Subject: Various debian-specific ExtUtils changes * Respect umask during installation, and set as appropriate for each of perl, vendor and site (policy requires group writable site dirs). * Don't install .packlist or perllocal.pod for perl or vendor. * Fiddle with *PREFIX and variables written to the makefile so that install directories may be changed when make is run by passing PREFIX= to the "make install" command (used when packaging modules). * Set location of libperl.a to /usr/lib. * Note that libperl-dev package is required for embedded linking. * Change install target dependencies to facilitate parallel makes. --- lib/ExtUtils/Embed.pm | 3 ++ lib/ExtUtils/Install.pm | 18 ++++++++-------- lib/ExtUtils/MM_Any.pm | 12 +++++----- lib/ExtUtils/MM_Unix.pm | 44 +++++++++-------------------------------- lib/ExtUtils/t/INST.t | 4 +-- lib/ExtUtils/t/INST_PREFIX.t | 10 ++++---- 6 files changed, 34 insertions(+), 57 deletions(-) diff --git a/lib/ExtUtils/Embed.pm b/lib/ExtUtils/Embed.pm index 24ae909..12d421d 100644 --- a/lib/ExtUtils/Embed.pm +++ b/lib/ExtUtils/Embed.pm @@ -305,6 +305,9 @@ and extensions in your C/C++ applications. Typically, an application B will invoke ExtUtils::Embed functions while building your application. +Note that on Debian systems the B package is required for +compiling applications which embed an interpreter. + =head1 @EXPORT ExtUtils::Embed exports the following functions: diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index c886c69..7a0c24e 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -457,7 +457,7 @@ sub _can_write_dir { =pod -=item _mkpath($dir,$show,$mode,$verbose,$dry_run) +=item _mkpath($dir,$show,$verbose,$dry_run) Wrapper around File::Path::mkpath() to handle errors. @@ -474,13 +474,13 @@ writable. =cut sub _mkpath { - my ($dir,$show,$mode,$verbose,$dry_run)=@_; + my ($dir,$show,$verbose,$dry_run)=@_; if ( $verbose && $verbose > 1 && ! -d $dir) { $show= 1; - printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode; + printf "mkpath(%s,%d)\n", $dir, $show; } if (!$dry_run) { - if ( ! eval { File::Path::mkpath($dir,$show,$mode); 1 } ) { + if ( ! eval { File::Path::mkpath($dir,$show); 1 } ) { _choke("Can't create '$dir'","$@"); } @@ -787,7 +787,7 @@ sub install { #XXX OS-SPECIFIC _chdir($cwd); } foreach my $targetdir (sort keys %check_dirs) { - _mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); + _mkpath( $targetdir, 0, $verbose, $dry_run ); } foreach my $found (@found_files) { my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime, @@ -801,7 +801,7 @@ sub install { #XXX OS-SPECIFIC $targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' ) unless $dry_run; } elsif ( ! -d $targetdir ) { - _mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); + _mkpath( $targetdir, 0, $verbose, $dry_run ); } print "Installing $targetfile\n"; @@ -841,7 +841,7 @@ sub install { #XXX OS-SPECIFIC if ($pack{'write'}) { $dir = install_rooted_dir(dirname($pack{'write'})); - _mkpath( $dir, 0, 0755, $verbose, $dry_run ); + _mkpath( $dir, 0, $verbose, $dry_run ); print "Writing $pack{'write'}\n" if $verbose; $packlist->write(install_rooted_file($pack{'write'})) unless $dry_run; } @@ -1181,7 +1181,7 @@ be prepended as a directory to each installed file (and directory). sub pm_to_blib { my($fromto,$autodir,$pm_filter) = @_; - _mkpath($autodir,0,0755); + _mkpath($autodir,0); while(my($from, $to) = each %$fromto) { if( -f $to && -s $from == -s $to && -M $to < -M $from ) { print "Skip $to (unchanged)\n"; @@ -1204,7 +1204,7 @@ sub pm_to_blib { # we wont try hard here. its too likely to mess things up. forceunlink($to); } else { - _mkpath(dirname($to),0,0755); + _mkpath(dirname($to),0); } if ($need_filtering) { run_filter($pm_filter, $from, $to); diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index a7afe20..402e0c0 100644 --- a/lib/ExtUtils/MM_Any.pm +++ b/lib/ExtUtils/MM_Any.pm @@ -701,8 +701,6 @@ all POD files in MAN1PODS and MAN3PODS. sub manifypods_target { my($self) = shift; - my $man1pods = ''; - my $man3pods = ''; my $dependencies = ''; # populate manXpods & dependencies: @@ -718,7 +716,7 @@ END foreach my $section (qw(1 3)) { my $pods = $self->{"MAN${section}PODS"}; push @man_cmds, $self->split_command(<{SITEPREFIX} ||= $sprefix; $self->{VENDORPREFIX} ||= $vprefix; - # Lots of MM extension authors like to use $(PREFIX) so we - # put something sensible in there no matter what. - $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)'; + my $p = $self->{PREFIX} = $self->{PERLPREFIX}; + for my $t (qw/PERL SITE VENDOR/) + { + $self->{"${t}PREFIX"} =~ s!^\Q$p\E(?=/|$)!\$(PREFIX)!; + } } my $arch = $Config{archname}; diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index ad28b22..c3504b6 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -2046,9 +2046,7 @@ doc__install : doc_site_install $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site pure_perl_install :: all - $(NOECHO) $(MOD_INSTALL) \ - read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ - write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \ + $(NOECHO) umask 022; $(MOD_INSTALL) \ $(INST_LIB) $(DESTINSTALLPRIVLIB) \ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \ $(INST_BIN) $(DESTINSTALLBIN) \ @@ -2060,7 +2058,7 @@ pure_perl_install :: all pure_site_install :: all - $(NOECHO) $(MOD_INSTALL) \ + $(NOECHO) umask 02; $(MOD_INSTALL) \ read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \ write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \ $(INST_LIB) $(DESTINSTALLSITELIB) \ @@ -2073,9 +2071,7 @@ pure_site_install :: all }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{ pure_vendor_install :: all - $(NOECHO) $(MOD_INSTALL) \ - read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \ - write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \ + $(NOECHO) umask 022; $(MOD_INSTALL) \ $(INST_LIB) $(DESTINSTALLVENDORLIB) \ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \ $(INST_BIN) $(DESTINSTALLVENDORBIN) \ @@ -2084,37 +2080,19 @@ pure_vendor_install :: all $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR) doc_perl_install :: all - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLPRIVLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ doc_site_install :: all - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ + $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLSITEARCH)/perllocal.pod + -$(NOECHO) umask 02; $(MKPATH) $(DESTINSTALLSITEARCH) + -$(NOECHO) umask 02; $(DOC_INSTALL) \ "Module" "$(NAME)" \ "installed into" "$(INSTALLSITELIB)" \ LINKTYPE "$(LINKTYPE)" \ VERSION "$(VERSION)" \ EXE_FILES "$(EXE_FILES)" \ - >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ + >> }.$self->catfile('$(DESTINSTALLSITEARCH)','perllocal.pod').q{ doc_vendor_install :: all - $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod - -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB) - -$(NOECHO) $(DOC_INSTALL) \ - "Module" "$(NAME)" \ - "installed into" "$(INSTALLVENDORLIB)" \ - LINKTYPE "$(LINKTYPE)" \ - VERSION "$(VERSION)" \ - EXE_FILES "$(EXE_FILES)" \ - >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{ }; @@ -2123,13 +2101,12 @@ uninstall :: uninstall_from_$(INSTALLDIRS)dirs $(NOECHO) $(NOOP) uninstall_from_perldirs :: - $(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ uninstall_from_sitedirs :: $(NOECHO) $(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ uninstall_from_vendordirs :: - $(NOECHO) $(UNINSTALL) }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ + }; join("",@m); @@ -2402,7 +2379,7 @@ MAP_PRELIBS = $Config{perllibs} $Config{cryptlib} ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/; } unless ($libperl && -f $lperl) { # Ilya's code... - my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE"; + my $dir = $self->{PERL_SRC} || "/usr/lib"; $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL}; $libperl ||= "libperl$self->{LIB_EXT}"; $libperl = "$dir/$libperl"; @@ -2986,8 +2963,7 @@ sub prefixify { print STDERR " prefixify $var => $path\n" if $Verbose >= 2; print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2; - if( $self->{ARGS}{PREFIX} && - $path !~ s{^\Q$sprefix\E\b}{$rprefix}s ) + if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} ) { print STDERR " cannot prefix, using default.\n" if $Verbose >= 2; diff --git a/lib/ExtUtils/t/INST.t b/lib/ExtUtils/t/INST.t index 49938cb..562e3de 100755 --- a/lib/ExtUtils/t/INST.t +++ b/lib/ExtUtils/t/INST.t @@ -65,9 +65,7 @@ isa_ok( $mm, 'ExtUtils::MakeMaker' ); is( $mm->{NAME}, 'Big::Dummy', 'NAME' ); is( $mm->{VERSION}, 0.01, 'VERSION' ); -my $config_prefix = $Config{installprefixexp} || $Config{installprefix} || - $Config{prefixexp} || $Config{prefix}; -is( $mm->{PERLPREFIX}, $config_prefix, 'PERLPREFIX' ); +is( $mm->{PERLPREFIX}, '$(PREFIX)', 'PERLPREFIX' ); is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' ); diff --git a/lib/ExtUtils/t/INST_PREFIX.t b/lib/ExtUtils/t/INST_PREFIX.t index 57e7eb2..337c3b8 100755 --- a/lib/ExtUtils/t/INST_PREFIX.t +++ b/lib/ExtUtils/t/INST_PREFIX.t @@ -16,7 +16,7 @@ BEGIN { } use strict; -use Test::More tests => 52; +use Test::More tests => 47; use MakeMaker::Test::Utils; use MakeMaker::Test::Setup::BFD; use ExtUtils::MakeMaker; @@ -62,16 +62,16 @@ like( $stdout->read, qr{ Writing\ $Makefile\ for\ Big::Dummy\n }x ); -is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' ); +#is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' ); isa_ok( $mm, 'ExtUtils::MakeMaker' ); is( $mm->{NAME}, 'Big::Dummy', 'NAME' ); is( $mm->{VERSION}, 0.01, 'VERSION' ); -foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) { - unlike( $mm->{$prefix}, qr/\$\(PREFIX\)/ ); -} +#foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) { +# unlike( $mm->{$prefix}, qr/\$\(PREFIX\)/ ); +#} my $PREFIX = File::Spec->catdir('foo', 'bar'); -- tg: (daf8b46..) debian/extutils_hacks (depends on: upstream)