In perl.git, the branch smoke-me/Makefile-norecurse has been updated <http://perl5.git.perl.org/perl.git/commitdiff/b0f2016588624b83f8ec7c7ff9d3a1cd0ec7bf8c?hp=79403e7734f5035577af0aa30b949ca081ec503c>
- Log ----------------------------------------------------------------- commit b0f2016588624b83f8ec7c7ff9d3a1cd0ec7bf8c Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 22:00:09 2012 +0200 Don't call CPAN to install and "extra" modules for the install-notify target. Previously the Makefile's install-notify target built extra.install just like the other 5 install targets. However, the other 5 actually install perl, whereas install-notify (a.k.a. no-install) runs installperl and installman with the --notify option (formerly -n), to cause them to print what they would do but take no action. Hence if -Dextras was used, make no-install would actually install the extra modules, but nothing else. This is inconsistent. M Makefile.SH commit 78557122d522a9ac26fb599c263e6cc2e5dbc136 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 20:04:08 2012 +0200 Inline the Makefile rule for extra.install into all 6 targets which use it. This eliminates 6 recursive calls from Makefile to itself. As five of these are generated from a loop in Makefile.SH, this isn't massive code duplication. It's not obvious how to merge the sixth without increasing the code complexity. Additionally, if the user has specified extra modules to download and build from CPAN using Configure's -Dextra, this avoids building perl, the non-XS modules and the CPAN modules twice on make install. M Makefile.SH commit 55f27663f38ceaed24d75b22790f9dea8a8308c8 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 18:28:39 2012 +0200 Refactor Makefile.SH to generate the install-* targets in a loop. This slightly reduces the line count, merges five-fold duplication into one, and works toward removing 5 recursive calls from Makefile to itself. M Makefile.SH commit b1358e9794a7e0d8b8f6fffb67bf42b40dcc8c5c Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 18:05:24 2012 +0200 In Makefile.SH, use the long names for options passed to install{perl,man} This makes it clearer what is going on, and enables a simplifying refactoring. M Makefile.SH commit 9404c14446d1311218a0090d951b42aef02a3354 Author: Nicholas Clark <[email protected]> Date: Tue Apr 24 18:41:47 2012 +0200 Refactor the Makefile so that the install target depends on install-all. Also, add targets install_notify and install-notify, as synonyms for no_install and no-install. Previously install, install-all and install_all were all generated by the same rule. These changes make future refactoring easier. M Makefile.SH commit e98046e2b32cff13753952cf8fa7c5832ad86683 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 15:48:33 2012 +0200 Add a no-op option --strip to installman. This intentionally does nothing. --strip for installperl instructs it to strip the installed binaries. Hence by permitting installman to accept --strip without error Makefile.SH can be simplified, as it's possible to pass identical flags to both install scripts. M installman commit 9ee62835b8e851eed707828eda5708531a62a1d8 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 15:21:54 2012 +0200 Refactor installman's option handling to use Getopt::Long's "multiple names". Previously installman specified synonyms for options as distinct options, and then used explicit code to merge them. Also add -h and -? as synonyms for --help. M installman commit 4a75d2b664d458878df44fbecc6e5c5295b986bc Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 14:38:00 2012 +0200 Convert installperl to use Getopt::Long. This requires some special handling for the +v option. Fortunately, we can cheat, because we know that no other non-options are acceptable. This does change the behaviour slightly from before: * single letter options now also have long names * invalid options are now rejected * command line arguments that are not options are now rejected However, the behaviour for all valid documented invocations is unchanged. Also, add a --help option to display the usage message. M installperl commit 23a50cf63dac6efc9478e8ba661845724b4fb4c9 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 16:57:22 2012 +0200 In installperl rename $opt{dostrip} to $opt{strip}. This will provide a more meaningful long option name once installperl is converted to Getopt::Long. M installperl commit b01d07d7fc786da516c84b80eb8fd2ed1b4f5f55 Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 13:17:41 2012 +0200 In installperl, record the state of options in %opts instead of lexicals. Replace all lexicals used to track the state of command line options with entries in the hash %opts. Make an exception for $versiononly, as it is controlled by 2 different command line options, and accessed in significantly more places than the state of any other command line option. M installperl commit cf4e5e3db9a5fd35b85b0f4c945d3539beacc65b Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 12:47:53 2012 +0200 In installperl, invert the sense of the variable used for the -o option. Previously it was $otherperls, and had to have its default of 1 explicitly set. Change it to $skip_otherperls, and the default default of undef is perfect. M installperl commit 5b755da6262c09f2727d34a15f4bb1f52db7875e Author: Nicholas Clark <[email protected]> Date: Wed Apr 25 12:06:26 2012 +0200 Remove dead code from installperl, related to a 5.000->5.001 change. 5.000 installed autosplit files into archlib. 5.001 and later install into privlib. archlib is earlier in @INC. It wasn't until 5.005 that perl put the version number into the paths used for privlib and archlib, hence without special treatment, the files installed by 5.001 would not be found, because those from 5.000 would be earlier in @INC. See commit a841533b5cf319b3 (Oct 2009) which removes similar special casing code dealing with perldiag.pod confusion between 5.003 and 5.004 All this code became redundant when 5.005 added the version number to library paths. (strictly, commit bfb7748a896459cc in Jul 1998) M installperl ----------------------------------------------------------------------- Summary of changes: Makefile.SH | 30 ++++++++++++++----------- installman | 9 ++++---- installperl | 75 +++++++++++++++++++++++++++++-------------------------------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/Makefile.SH b/Makefile.SH index 46c2620..ef30479 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -1006,27 +1006,31 @@ extras.install: $(PERL_EXE) .PHONY: install install-strip install-all install-verbose install-silent \ no-install install.perl install.man install.html -install_strip install-strip: - $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)" +# Set this to an empty string to avoid an attempt of rebuild before install +INSTALL_DEPENDENCE = all -install install_all install-all: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)" +no_install no-install: install-notify -install_verbose install-verbose: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)" +install: install-all +!NO!SUBS! -install_silent install-silent: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)" +for name in all notify silent strip verbose; do + flags="--$name"; + $spitshell >>$Makefile <<EOT -no_install no-install: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-n DESTDIR="$(DESTDIR)" +install_$name install-$name: \$(INSTALL_DEPENDENCE) installperl all installman + \$(RUN_PERL) installperl --destdir=\$(DESTDIR) ${flags%--all} \$(INSTALLFLAGS) \$(STRIPFLAGS) + \$(RUN_PERL) installman --destdir=\$(DESTDIR) ${flags%--all} +EOT -# Set this to an empty string to avoid an attempt of rebuild before install -INSTALL_DEPENDENCE = all + test $name = notify || echo ' -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '\''@ARGV&&install(@ARGV)'\'' `cat extras.lst`' >>$Makefile +done + +$spitshell >>$Makefile <<'!NO!SUBS!' install.perl: $(INSTALL_DEPENDENCE) installperl $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) - -@test ! -s extras.lst || $(MAKE) extras.install + -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` install.man: all installman $(RUN_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS) diff --git a/installman b/installman index cd8b094..4f9d469 100755 --- a/installman +++ b/installman @@ -36,9 +36,12 @@ my $usage = --verbose (or -V) report all progress. --silent (or -S) be silent. Only report errors.\n"; +# --strip intentionally does nothing. By permitting installman to accept it +# without error, the Makefile can pass the same options to installperl and +# installman, which permits more simplification there than this comment costs. GetOptions( \%opts, qw( man1dir=s man1ext=s man3dir=s man3ext=s - destdir:s notify n help silent S verbose V)) + destdir:s notify|n help|h|? silent|S verbose|V strip)) || die $usage; die $usage if $opts{help}; $opts{destdir} //= ''; @@ -47,9 +50,7 @@ foreach my $pre (qw(man1 man3)) { $opts{"${pre}dir"} //= $opts{destdir} . $Config{"install${pre}dir"}; $opts{"${pre}ext"} //= $Config{"${pre}ext"}; } -$opts{silent} ||= $opts{S}; -$opts{notify} ||= $opts{n}; -$opts{verbose} ||= $opts{V} || $opts{notify}; +$opts{verbose} ||= $opts{notify}; #Sanity checks diff --git a/installperl b/installperl index 60d392e..9cf7d7b 100755 --- a/installperl +++ b/installperl @@ -13,8 +13,7 @@ BEGIN { use strict; use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare %opts $packlist); -my ($dostrip, $versiononly, $force, - $otherperls, $archname, $nwinstall, $nopods); +my $versiononly; BEGIN { if ($Is_VMS) { eval 'use VMS::Filespec;' } @@ -28,6 +27,8 @@ use File::Copy (); use File::Path (); use ExtUtils::Packlist; use Cwd; +# nogetopt_compat to disable treating +v as meaning -v +use Getopt::Long qw(:config nogetopt_compat no_auto_abbrev noignorecase); require './Porting/pod_lib.pl'; @@ -65,29 +66,31 @@ if ( $Is_VMS ) { } } -$otherperls = 1; # This little hack simplifies making the code after the comment "Fetch some # frequently-used items from %Config" warning free. With $opts{destdir} always # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional. $opts{destdir} = ''; -# Consider refactoring this to use Getopt::Long once Getopt::Long's planned -# feature is implemented, to distinguish + and - options. -while (@ARGV) { - $opts{notify} = 1 if $ARGV[0] eq '-n'; - $dostrip = 1 if $ARGV[0] eq '-s'; - $versiononly = 1 if $ARGV[0] eq '-v'; - $versiononly = 0 if $ARGV[0] eq '+v'; - $opts{silent} = 1 if $ARGV[0] eq '-S'; - $otherperls = 0 if $ARGV[0] eq '-o'; - $force = 1 if $ARGV[0] eq '-f'; - $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n'; - $archname = 1 if $ARGV[0] eq '-A'; - $nwinstall = 1 if $ARGV[0] eq '-netware'; - $nopods = 1 if $ARGV[0] eq '-p'; - $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/; - if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) { - print <<"EOT"; +{ + my $usage = 0; + if (!GetOptions(\%opts, 'notify|n', 'strip|s', 'silent|S', + 'skip-otherperls|o', 'force|f', 'verbose|V', 'archname|A', + 'netware', 'nopods|p', 'destdir:s', 'help|h|?', + 'versiononly|v' => \$versiononly, '<>' => sub { + if ($_[0] eq '+v') { + $versiononly = 0; + } else { + # Any other unknown argument is going to be an error + $usage = 1; + } + }, + )) { + $usage = 1; + } + $opts{verbose} ||= $opts{notify}; + + if ($usage || $opts{help}) { + print <<"EOT"; Usage $0: [switches] -n Don't actually run any commands; just print them. -s Run strip on installed binaries. @@ -104,10 +107,10 @@ Usage $0: [switches] -p Don't install the pod files. [This will break use diagnostics;] -netware Install correctly on a Netware server. -destdir Prefix installation directories by this string. + -h Display this help message. EOT - exit; + exit $usage; } - shift; } $versiononly = 1 if $Config{versiononly} && !defined $versiononly; @@ -213,7 +216,7 @@ if ($^O eq 'os390') { } } -if ($nwinstall) { +if ($opts{netware}) { # This is required only if we are installing on a NetWare server $installscript = $Config{installnwscripts}; $installprivlib = $Config{installnwlib}; @@ -308,7 +311,7 @@ elsif ($^O ne 'dos') { } else { # If installing onto a NetWare server - if ($nwinstall) { + if ($opts{netware}) { # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm mkpath($Config{installnwsystem}, $opts{verbose}, 0777); copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem}); @@ -411,7 +414,7 @@ if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VM # For development purposes it can be very useful to have multiple perls # build for different "architectures" (eg threading or not) simultaneously. -if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { +if ($opts{archname} && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext"; safe_unlink("$installbin/$archperl"); if ($^O eq 'vos') { @@ -528,7 +531,7 @@ if ($versiononly) { # Install pod pages. Where? I guess in $installprivlib/pod # ($installprivlib/pods for cygwin). -if (!$nopods && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) { +if (!$opts{nopods} && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) { my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod'; mkpath("${installprivlib}/$pod", $opts{verbose}, 0777); @@ -547,7 +550,7 @@ if (!$nopods && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) { # Also skip $mainperl if the user opted to have it be a link to the # installed perl. -if (!$versiononly && $otherperls) { +if (!$versiononly && !$opts{'skip-otherperls'}) { my ($path, @path); my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ; ($path = $ENV{"PATH"}) =~ s:\\:/:g ; @@ -751,27 +754,19 @@ sub installlib { return unless $do_installprivlib; } - if ($Is_NetWare && !$nwinstall && /\.(?:nlp|nlm|bs)$/) { + if ($Is_NetWare && !$opts{netware} && /\.(?:nlp|nlm|bs)$/) { # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also # if copied will give problems when building new extensions. # Has to be copied if we are installing on a NetWare server and - # hence the check !$nwinstall + # hence the check !$opts{netware} return; } if (-f $_) { - if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$])) { - $installlib = $installprivlib; - #We're installing *.al and *.ix files into $installprivlib, - #but we have to delete old *.al and *.ix files from the 5.000 - #distribution: - #This might not work because $archname might have changed. - unlink("$installarchlib/$name"); - } my $xname = "$installlib/$name"; $xname =~ s/^\Q$opts{destdir}\E//; $packlist->{$xname} = { type => 'file' }; - if ($force || compare($_, "$installlib/$name") || $opts{notify}) { + if ($opts{force} || compare($_, "$installlib/$name") || $opts{notify}) { unlink("$installlib/$name"); mkpath("$installlib/$dir", $opts{verbose}, 0777); # HP-UX (at least) needs to maintain execute permissions @@ -813,7 +808,7 @@ sub copy_if_diff { } -f $from || $perlpodbadsymlink || warn "$0: $from not found"; $packlist->{$xto} = { type => 'file' }; - if ($force || compare($from, $to) || $opts{notify}) { + if ($opts{force} || compare($from, $to) || $opts{notify}) { safe_unlink($to); # In case we don't have write permissions. if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) { $from = "README.$1"; @@ -832,7 +827,7 @@ sub strip { my(@args) = @_; - return unless $dostrip; + return unless $opts{strip}; my @opts; while (@args && $args[0] =~ /^(-\w+)$/) { -- Perl5 Master Repository
