diff --git a/Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch b/Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch new file mode 100644 index 0000000000000000000000000000000000000000..473d8c85093342094619d66b09caceeb46c4d962 --- /dev/null +++ b/Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch @@ -0,0 +1,145 @@ +From 6b096ea5670ed291abac632b296222b56d9fadb4 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 1 Mar 2018 14:44:40 +0100 +Subject: [PATCH] Do not need a compiler if c_source is an empty list +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +c_source used to be string, then it allowed a reference to an array. +But in case the array was empty, auto_require() still enabled +needs_compiler property and thus implied probing a compiler and +a failure if none was available. + +Minilla generates these Build.PLs for pure-Perl distributions. See +KAZUHO/Server-Starter-0.34. + +This patch makes Module::Build not require C compiler for +c_source = []. + +Petr Písař: Ported to 0.4224. + +Signed-off-by: Petr Písař +--- + lib/Module/Build/API.pod | 8 ++++---- + lib/Module/Build/Base.pm | 6 +++++- + t/properties/needs_compiler.t | 46 ++++++++++++++++++++++++++++++++++++++++--- + 3 files changed, 52 insertions(+), 8 deletions(-) + +diff --git a/lib/Module/Build/API.pod b/lib/Module/Build/API.pod +index cd2021a..c9be539 100644 +--- a/lib/Module/Build/API.pod ++++ b/lib/Module/Build/API.pod +@@ -209,10 +209,10 @@ created by Module::Build. + + [version 0.04] + +-An optional C argument specifies a directory which contains +-C source files that the rest of the build may depend on. Any C<.c> +-files in the directory will be compiled to object files. The +-directory will be added to the search path during the compilation and ++An optional C argument specifies a directory or a reference to array ++of directories which contain C source files that the rest of the build may ++depend on. Any C<.c> files in the directory will be compiled to object files. ++The directory will be added to the search path during the compilation and + linking phases of any C or XS files. + + [version 0.3604] +diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm +index 984810a..a29c664 100644 +--- a/lib/Module/Build/Base.pm ++++ b/lib/Module/Build/Base.pm +@@ -1520,7 +1520,11 @@ sub auto_require { + if ( $self->pureperl_only && $self->allow_pureperl ) { + $self->needs_compiler( 0 ); + } else { +- $self->needs_compiler( keys %$xs_files || defined $self->c_source ); ++ $self->needs_compiler( keys %$xs_files || ++ ( defined $self->c_source && ++ ( ref($self->c_source) ne 'ARRAY' || @{$self->c_source} ) ++ ) ++ ); + } + } + if ($self->needs_compiler) { +diff --git a/t/properties/needs_compiler.t b/t/properties/needs_compiler.t +index f616dfc..c76d38f 100644 +--- a/t/properties/needs_compiler.t ++++ b/t/properties/needs_compiler.t +@@ -5,7 +5,7 @@ use lib 't/lib'; + use MBTest; + use DistGen; + +-plan tests => 19; ++plan tests => 27; + + # Ensure any Module::Build modules are loaded from correct directory + blib_load('Module::Build'); +@@ -24,7 +24,7 @@ ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'}, + ); + + #--------------------------------------------------------------------------# +-# try with c_source ++# try with c_source as a string + #--------------------------------------------------------------------------# + $dist->change_build_pl({ + module_name => $dist->name, +@@ -34,7 +34,7 @@ $dist->change_build_pl({ + $dist->regen; + stderr_of(sub { + ok( $mb = $dist->new_from_context, +- "Build.PL with c_source" ++ "Build.PL with string c_source" + ); + }); + is( $mb->c_source, 'src', "c_source is set" ); +@@ -44,6 +44,46 @@ ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'}, + ); + + #--------------------------------------------------------------------------# ++# try with c_source as an array ++#--------------------------------------------------------------------------# ++$dist->change_build_pl({ ++ module_name => $dist->name, ++ license => 'perl', ++ c_source => ['src'], ++}); ++$dist->regen; ++stderr_of(sub { ++ ok( $mb = $dist->new_from_context, ++ "Build.PL with non-empty array c_source" ++ ); ++}); ++is_deeply( $mb->c_source, ['src'], "c_source is set" ); ++ok( $mb->needs_compiler, "needs_compiler is true" ); ++ok( exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'}, ++ "ExtUtils::CBuilder was added to build_requires" ++); ++ ++#--------------------------------------------------------------------------# ++# try with c_source as an empty array ++#--------------------------------------------------------------------------# ++$dist->change_build_pl({ ++ module_name => $dist->name, ++ license => 'perl', ++ c_source => [], ++}); ++$dist->regen; ++stderr_of(sub { ++ ok( $mb = $dist->new_from_context, ++ "Build.PL with empty array c_source" ++ ); ++}); ++is_deeply( $mb->c_source, [], "c_source is set" ); ++ok( ! $mb->needs_compiler, "needs_compiler is false" ); ++ok( ! exists $mb->{properties}{build_requires}{'ExtUtils::CBuilder'}, ++ "ExtUtils::CBuilder is not in build_requires" ++); ++ ++#--------------------------------------------------------------------------# + # try with xs files + #--------------------------------------------------------------------------# + $dist = DistGen->new(dir => 'MBTest', xs => 1); +-- +2.13.6 + diff --git a/Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch b/Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch new file mode 100644 index 0000000000000000000000000000000000000000..47d1dfcbe67c2704a84319721d768622b4f169a6 --- /dev/null +++ b/Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch @@ -0,0 +1,39 @@ +From 043add527dd6bc05d5ef5750839ab21c2fdab9e6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 28 Mar 2022 11:18:38 +0200 +Subject: [PATCH] Do not die on missing ExtUtils::CBuilder in have_c_compiler() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +In Fedora, ExtUtils::CBuilder is optional to allow installing perl +without gcc (bug #1547165). Module::Build::have_c_compiler() uses +ExtUtils::CBuilder to detect a presence of a C compiler. If +ExtUtils::CBuilder was not installed, have_c_compiler() died instead +of returning a false value. + +This error manifested in perl-Alien-Base-ModuleBuild tests. This patch +changes have_c_compiler() to return true if ExtUtils::CBuilder is not +available. + +Signed-off-by: Petr Písař +--- + lib/Module/Build/Base.pm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm +index 1352fcf..4e0f843 100644 +--- a/lib/Module/Build/Base.pm ++++ b/lib/Module/Build/Base.pm +@@ -5315,7 +5315,7 @@ sub have_c_compiler { + return $p->{_have_c_compiler} if defined $p->{_have_c_compiler}; + + $self->log_verbose("Checking if compiler tools configured... "); +- my $b = $self->cbuilder; ++ my $b = eval { $self->cbuilder }; + my $have = $b && eval { $b->have_compiler }; + $self->log_verbose($have ? "ok.\n" : "failed.\n"); + return $p->{_have_c_compiler} = $have; +-- +2.34.1 + diff --git a/perl-Module-Build.spec b/perl-Module-Build.spec index 524d1d83a2a479d9cda05e5ead26c6f1b76f3f82..2f06d63d45f0f6ad83a5a2755b422dfe4f8abd62 100644 --- a/perl-Module-Build.spec +++ b/perl-Module-Build.spec @@ -1,24 +1,25 @@ -%define anolis_release 1 +%define anolis_release 3 %global cpan_version_major 0.42 %global cpan_version_minor 32 %global cpan_version %{cpan_version_major}%{?cpan_version_minor} -%bcond_with perl_Module_Build_enables_optional_test - Name: perl-Module-Build Epoch: 2 Version: %{cpan_version_major}%{?cpan_version_minor:.%cpan_version_minor} Release: %{anolis_release}%{?dist} Summary: Build and install Perl modules -License: GPL+ or Artistic +License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/Module-Build Source0: https://cpan.metacpan.org/authors/id/L/LE/LEONT/Module-Build-%{cpan_version}.tar.gz - +# Do not require a compiler if c_source is an empty list, CPAN RT#124625, +Patch0: Module-Build-0.4224-Do-not-need-a-compiler-if-c_source-is-an-empty-list.patch +# Handle missing ExtUtils::CBuilder as a missing compiler +Patch1: Module-Build-0.4231-Do-not-die-on-missing-ExtUtils-CBuilder-in-have_c_co.patch BuildArch: noarch BuildRequires: coreutils -BuildRequires: perl-interpreter BuildRequires: perl-devel BuildRequires: perl-generators +BuildRequires: perl-interpreter BuildRequires: perl(Archive::Tar) BuildRequires: perl(AutoSplit) BuildRequires: perl(base) @@ -57,14 +58,6 @@ BuildRequires: perl(Parse::CPAN::Meta) >= 1.4401 BuildRequires: perl(Perl::OSType) >= 1 BuildRequires: perl(strict) # Optional tests: -%if !%{defined perl_bootstrap} -%if %{with perl_Module_Build_enables_optional_test} -BuildRequires: perl(Archive::Zip) -BuildRequires: perl(File::ShareDir) >= 1.00 -BuildRequires: perl(PAR::Dist) -BuildRequires: perl(Pod::Readme) -%endif -%endif BuildRequires: perl(TAP::Harness) BuildRequires: perl(TAP::Harness::Env) BuildRequires: perl(Test::Harness) >= 3.29 @@ -77,6 +70,10 @@ BuildRequires: perl(warnings) Requires: perl(CPAN::Meta) >= 2.142060 Requires: perl(CPAN::Meta::Converter) >= 2.141170 Requires: perl(CPAN::Meta::Merge) +# Do not hard-require ExtUtils::CBuilder to allow installing Module::Build +# without gcc, bug #1547165. Module::Build users have to require +# ExtUtils::CBuilder explicitly according to "XS Extensions" section in +# Module::Build::Authoring POD. Recommends: perl(ExtUtils::CBuilder) >= 0.27 Requires: perl(ExtUtils::Install) >= 0.3 Requires: perl(ExtUtils::Manifest) >= 1.54 @@ -84,15 +81,26 @@ Requires: perl(ExtUtils::Mkbootstrap) Requires: perl(ExtUtils::ParseXS) >= 2.21 Requires: perl(inc::latest) Requires: perl(Module::Metadata) >= 1.000002 +# Keep PAR support optional (PAR::Dist) Requires: perl(Perl::OSType) >= 1 Requires: perl(TAP::Harness::Env) Requires: perl(Test::Harness) %if !%{defined perl_bootstrap} +# Optional run-time needed for Software::License license identifier, +# bug #1152319 Requires: perl(Software::License) %endif +# Optional run-time needed for generating documentation from POD: Requires: perl(Pod::Html) Requires: perl(Pod::Man) >= 2.17 Requires: perl(Pod::Text) +# Run-time for generated Build scripts from Build.PLs: +# Those are already found by dependency generator. Just make sure they +# present. +# Cwd +# File::Basename +# File::Spec +# strict %{?perl_default_filter} # Remove under-specified dependencies @@ -112,8 +120,7 @@ works fine on perl 5.005 if you can install a few additional modules. %package doc Summary: Documentation files for %{name} -Requires: %{name} = %{epoch}:%{version}-%{release} -BuildArch: noarch +Requires: %{name} = %{EVR} %description doc The %{name}-doc package contains documentation files for %{name}. @@ -144,6 +151,12 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test %doc Changes contrib README %changelog +* Thu Mar 23 2023 Chunmei Xu - 2:0.42.32-3 +- Bump version to rebuild + +* Tue Feb 14 2023 Funda Wang - 2:0.42.32-2 +- Add patches to fix cbuilder + * Mon Feb 06 2023 mgb01105731 - 2:0.42.32-1 - remove versioned MODULE_COMPAT_ requires - update to version 0.42.32 @@ -153,4 +166,3 @@ LANG=C TEST_SIGNATURE=1 MB_TEST_EXPERIMENTAL=1 ./Build test * Wed Apr 20 2022 mgb01105731 - 2:0.42.31-1 - Init from upstream version 0.42.31 -