# # spec file for package perl-Makefile-DOM # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Makefile-DOM Name: perl-Makefile-DOM Version: 0.8.0 Release: 0 # 0.008 -> normalize -> 0.8.0 %define cpan_version 0.008 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Simple DOM parser for Makefiles URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/A/AG/AGENT/%{cpan_name}-%{cpan_version}.tar.gz Source100: README.md BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(Clone) >= 0.18 BuildRequires: perl(ExtUtils::MakeMaker) >= 6.59 BuildRequires: perl(List::MoreUtils) >= 0.21 BuildRequires: perl(Params::Util) >= 0.22 Requires: perl(Clone) >= 0.18 Requires: perl(List::MoreUtils) >= 0.21 Requires: perl(Params::Util) >= 0.22 Provides: perl(MDOM::Assignment) Provides: perl(MDOM::Command) Provides: perl(MDOM::Directive) Provides: perl(MDOM::Document) Provides: perl(MDOM::Document::Gmake) Provides: perl(MDOM::Dumper) = %{version} Provides: perl(MDOM::Element) = %{version} Provides: perl(MDOM::Node) = %{version} Provides: perl(MDOM::Rule) Provides: perl(MDOM::Rule::Simple) Provides: perl(MDOM::Rule::StaticPattern) Provides: perl(MDOM::Token) = %{version} Provides: perl(MDOM::Token::Bare) Provides: perl(MDOM::Token::Comment) = %{version} Provides: perl(MDOM::Token::Continuation) Provides: perl(MDOM::Token::Interpolation) Provides: perl(MDOM::Token::Modifier) Provides: perl(MDOM::Token::Separator) = %{version} Provides: perl(MDOM::Token::Whitespace) = %{version} Provides: perl(MDOM::Unknown) Provides: perl(MDOM::Util) Provides: perl(Makefile::DOM) = %{version} %undefine __perllib_provides %{perl_requires} %description This libary can serve as an advanced lexer for (GNU) makefiles. It parses makefiles as "documents" and the parsing is lossless. The results are data structures similar to DOM trees. The DOM trees hold every single bit of the information in the original input files, including white spaces, blank lines and makefile comments. That means it's possible to reproduce the original makefiles from the DOM trees. In addition, each node of the DOM trees is modifiable and so is the whole tree, just like the PPI module used for Perl source parsing and the HTML::TreeBuilder module used for parsing HTML source. If you're looking for a true GNU make parser that generates an AST, please see Makefile::Parser::GmakeDB instead. The interface of 'Makefile::DOM' mimics the API design of PPI. In fact, I've directly stolen the source code and POD documentation of PPI::Node, PPI::Element, and PPI::Dumper, with the full permission from the author of PPI, Adam Kennedy. 'Makefile::DOM' tries to be independent of specific makefile's syntax. The same set of DOM node types is supposed to get shared by different makefile DOM generators. For example, MDOM::Document::Gmake parses GNU makefiles and returns an instance of MDOM::Document, i.e., the root of the DOM tree while the NMAKE makefile lexer in the future, 'MDOM::Document::Nmake', also returns instances of the MDOM::Document class. Later, I'll also consider adding support for dmake and bsdmake. %prep %autosetup -n %{cpan_name}-%{cpan_version} find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build PERL_USE_UNSAFE_INC=1 perl Makefile.PL INSTALLDIRS=vendor %make_build %check make test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %doc Changes README TODO %changelog