OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall Root: /v/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-src Date: 31-Oct-2005 16:33:36 Branch: HEAD Handle: 2005103115333600 Modified files: openpkg-src/perl-openpkg perl-openpkg.pl perl-openpkg.spec Log: add initial support for Module::Build based Build.PL scripts Summary: Revision Changes Path 1.14 +73 -38 openpkg-src/perl-openpkg/perl-openpkg.pl 1.26 +1 -1 openpkg-src/perl-openpkg/perl-openpkg.spec ____________________________________________________________________________ patch -p0 <<'@@ .' Index: openpkg-src/perl-openpkg/perl-openpkg.pl ============================================================================ $ cvs diff -u -r1.13 -r1.14 perl-openpkg.pl --- openpkg-src/perl-openpkg/perl-openpkg.pl 15 May 2005 08:52:44 -0000 1.13 +++ openpkg-src/perl-openpkg/perl-openpkg.pl 31 Oct 2005 15:33:36 -0000 1.14 @@ -155,7 +155,7 @@ " -P, --perl <file-path> filesystem path to Perl program\n" . "\n" . " -s, --schema <schema> Perl INSTALLDIRS schema\n" . - " -A, --args <arguments> Perl Makefile.PL passed through arguments\n" . + " -A, --args <arguments> Perl Build.PL/Makefile.PL passed through arguments\n" . " -I, --stdin <file-path> filesystem path to connect to stdin\n" . " -F, --files <file-path> filesystem path to write RPM \%files list to\n" . " -U, --unquoted output RPM \%files list in unquoted format\n" . @@ -328,19 +328,37 @@ if (grep { $_ eq "configure" } @steps_run) { &verbose("step 2: configure"); - # sanity check - if (not -f "Makefile.PL") { - die "file \"Makefile.PL\" not found in working directory"; - } - # determine Makefile.PL arguments - my $perl_args = " PERL=$perlwrap FULLPERL=$perlwrap"; - $perl_args .= " INSTALLDIRS=$CF->{perl_schema}"; - $perl_args .= " INSTALLMAN3DIR=none INSTALLSITEMAN3DIR=none INSTALLVENDORMAN3DIR=none"; - $perl_args .= " DESTDIR=$CF->{path_buildroot} PREFIX=$CF->{path_prefix}"; - if ($CF->{path_libdir} ne '') { - $perl_args .= " LIB=$CF->{path_libdir}"; + my $perl_args = ''; + if (-f "Build.PL") { + # new-style Module::Build "Build.PL" + $perl_args .= " installdirs=$CF->{perl_schema}"; + $perl_args .= " --install_path libdoc=remove-me-later"; + $perl_args .= " destdir=$CF->{path_buildroot}"; + if ($CF->{path_prefix} ne '' and $CF->{path_prefix} ne '@l_prefix@') { + $perl_args .= " install_base=$CF->{path_prefix}"; + } + if ($CF->{path_libdir} ne '') { + $perl_args .= " --install_path lib=$CF->{path_libdir}"; + } } + elsif (-f "Makefile.PL") { + # old-style ExtUtils::MakeMaker "Makefile.PL" + $perl_args .= " PERL=$perlwrap FULLPERL=$perlwrap"; + $perl_args .= " INSTALLDIRS=$CF->{perl_schema}"; + $perl_args .= " INSTALLMAN3DIR=none INSTALLSITEMAN3DIR=none INSTALLVENDORMAN3DIR=none"; + $perl_args .= " DESTDIR=$CF->{path_buildroot}"; + if ($CF->{path_prefix} ne '') { + $perl_args .= " PREFIX=$CF->{path_prefix}"; + } + if ($CF->{path_libdir} ne '') { + $perl_args .= " LIB=$CF->{path_libdir}"; + } + } + else { + die "neither Module::Build \"Build.PL\" nor ExtUtils::MakeMaker \"Makefile.PL\" file found"; + } + if ([EMAIL PROTECTED]>{perl_args}}} >= 0) { my $user_args = join(" ", @{$CF->{perl_args}}); if ($user_args =~ m|#|) { @@ -353,9 +371,16 @@ } # fixate Makefile.PL - &runcmd("chmod u+rw Makefile.PL"); - &runcmd("cp Makefile.PL Makefile.PL.orig"); - &runcmd("sed -e \"s:\\\$^X:'$perlwrap':g\" <Makefile.PL.orig >Makefile.PL"); + if (-f "Build.PL") { + &runcmd("chmod u+rw Build.PL"); + &runcmd("cp Build.PL Build.PL.orig"); + &runcmd("sed -e \"s:\\\$^X:'$perlwrap':g\" <Build.PL.orig >Build.PL"); + } + elsif (-f "Makefile.PL") { + &runcmd("chmod u+rw Makefile.PL"); + &runcmd("cp Makefile.PL Makefile.PL.orig"); + &runcmd("sed -e \"s:\\\$^X:'$perlwrap':g\" <Makefile.PL.orig >Makefile.PL"); + } # determine stdin if ($CF->{perl_stdin} ne "-") { @@ -363,43 +388,53 @@ } # execute Makefile.PL - &runcmd("$perlwrap Makefile.PL $perl_args"); + if (-f "Build.PL") { + &runcmd("$perlwrap ./Build.PL $perl_args"); + } + elsif (-f "Makefile.PL") { + &runcmd("$perlwrap ./Makefile.PL $perl_args"); + } } # ==== STEP: 3. build ==== if (grep { $_ eq "build" } @steps_run) { &verbose("step 3: build"); - # sanity check - if (not -f "Makefile") { - die "file \"Makefile\" not found in working directory"; + if (-f "Build.PL" and -f "Build") { + # execute Build script + &runcmd("$perlwrap Build build"); + } + elsif (-f "Makefile.PL" and -f "Makefile") { + # execute Makefile procedure + my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; + $make =~ s|\n+$||s; + my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; + &runcmd("$make $make_args pure_all"); + } + else { + die "neither \"Build\" nor \"Makefile\" found in working directory"; } - - # determine make(1) command and flags - my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; - $make =~ s|\n+$||s; - my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; - - # execute make(1) - &runcmd("$make $make_args pure_all"); } # ==== STEP: 4. install ==== if (grep { $_ eq "install" } @steps_run) { &verbose("step 4: install"); - # sanity check - if (not -f "Makefile") { - die "file \"Makefile\" not found in working directory"; + if (-f "Build.PL") { + # execute Build script + &runcmd("$perlwrap Build install"); + &runcmd("rm -rf $CF->{path_buildroot}$CF->{path_prefix}/remove-me-later"); + } + elsif (-f "Makefile.PL") { + # execute Makefile procedure + my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; + $make =~ s|\n+$||s; + my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; + &runcmd("$make $make_args pure_install"); + } + else { + die "neither \"Build\" nor \"Makefile\" found in working directory"; } - - # determine make(1) command and flags - my $make = `$CF->{prog_rpm} --eval '\%{l_make} \%{l_mflags}'`; - $make =~ s|\n+$||s; - my $make_args = "PERL=$perlwrap FULLPERL=$perlwrap"; - - # execute make(1) - &runcmd("$make $make_args pure_install"); } # ==== STEP: 5. fixate ==== @@ . patch -p0 <<'@@ .' Index: openpkg-src/perl-openpkg/perl-openpkg.spec ============================================================================ $ cvs diff -u -r1.25 -r1.26 perl-openpkg.spec --- openpkg-src/perl-openpkg/perl-openpkg.spec 3 Jun 2005 07:05:08 -0000 1.25 +++ openpkg-src/perl-openpkg/perl-openpkg.spec 31 Oct 2005 15:33:36 -0000 1.26 @@ -36,7 +36,7 @@ Group: Language License: PD Version: %{V_perl} -Release: 20050603 +Release: 20051031 # list of sources Source0: perl-openpkg.pl @@ . ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List openpkg-cvs@openpkg.org