X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/dca8fd5cbbabc88a58ed21681e67afeed1ba9633..20980f0122d374b4a9d072436ef0415126f941de:/installperl diff --git a/installperl b/installperl index 623034e..73448df 100755 --- a/installperl +++ b/installperl @@ -67,6 +67,11 @@ 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) { @@ -148,23 +153,36 @@ if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) { push(@scripts, map("$_.exe", @scripts)); } -find(sub { - if ("$File::Find::dir/$_" =~ m{^ext\b(.*)/([^/]+)\.pm$}) { - my($path, $modname) = ($1,$2); +# Exclude nonxs extensions that are not architecture dependent +my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'})); - # strip to optional "/lib", or remove trailing component - $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{}; +my @ext_dirs = qw(cpan dist ext); +foreach my $ext_dir (@ext_dirs) { + find(sub { + if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) && + ! grep { (my $dir = $_) =~ s/\//-/g; + $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs) + { + my($path, $modname) = ($1,$2); - # strip any leading / - $path =~ s{^/}{}; + # Change hyphenated name like Filter-Util-Call to nested + # directory name Filter/Util/Call + $path =~ s{-}{/}g; - # reconstitute canonical module name - $modname = "$path/$modname" if length $path; + # strip to optional "/lib", or remove trailing component + $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{}; - # remember it - $archpms{$modname} = 1; - } -}, 'ext'); + # strip any leading / + $path =~ s{^/}{}; + + # reconstitute canonical module name + $modname = "$path/$modname" if length $path; + + # remember it + $archpms{$modname} = 1; + } + }, $ext_dir); +} # print "[$_]\n" for sort keys %archpms; @@ -207,7 +225,6 @@ if ($nwinstall) { $installsitelib = $Config{installnwlib}; } -my $d_dosuid = $Config{d_dosuid}; my $binexp = $Config{binexp}; if ($Is_VMS) { # Hang in there until File::Spec hits the big time @@ -220,8 +237,6 @@ if ($Is_VMS) { # Hang in there until File::Spec hits the big time # Do some quick sanity checks. -if (!$opts{notify} && $d_dosuid && $>) { die "You must run as root to install suidperl\n"; } - $installbin || die "No installbin directory in config.sh\n"; -d $installbin || mkpath($installbin, $opts{verbose}, 0777); -d $installbin || $opts{notify} || die "$installbin is not a directory\n"; @@ -238,7 +253,6 @@ else { -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n"; } } --x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid; -f 't/rantests' || $Is_W32 || warn "WARNING: You've never run 'make test' or", @@ -253,11 +267,8 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { if ($Is_Cygwin) { $perldll = $libperl; - my $v_e_r_s = substr($ver,0,-2); $v_e_r_s =~ tr/./_/; - $perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/; - $perldll =~ s/^lib/cyg/; } else { - $perldll = 'perl511.' . $dlext; + $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext; } if ($dlsrc ne "dl_none.xs") { @@ -329,16 +340,10 @@ else { copy("perl.exe", "$installbin/$perl.exe"); } -safe_unlink("$installbin/s$perl_verbase$ver$exe_ext"); -if ($d_dosuid) { - copy("suidperl$exe_ext", "$installbin/s$perl_verbase$ver$exe_ext"); - chmod(04711, "$installbin/s$perl_verbase$ver$exe_ext"); -} - # Install library files. my ($do_installarchlib, $do_installprivlib) = (0, 0); -my $vershort = $Is_Cygwin ? substr($ver,0,-2) : $ver; +my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver; mkpath($installprivlib, $opts{verbose}, 0777); mkpath($installarchlib, $opts{verbose}, 0777); @@ -367,7 +372,26 @@ if ($Is_VMS) { # We did core file selection during build $coredir =~ tr/./_/; map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>; } -else { +elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy + @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>; + my $coredll = "$installarchlib/CORE/$libperl"; + safe_unlink($coredll); + ( $Config{'d_link'} eq 'define' && + eval { + CORE::link("$installbin/$libperl", $coredll); + $packlist->{$coredll} = { from => "$installbin/$libperl", + type => 'link' }; + } + ) || + eval { + symlink("$installbin/$libperl", $coredll); + $packlist->{$coredll} = { from => "$installbin/$libperl", + type => 'link' }; + } || + ( copy("$installbin/$libperl", $coredll) && + push(@corefiles, $coredll) + ) +} else { # [als] hard-coded 'libperl' name... not good! @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>; @@ -411,9 +435,6 @@ if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VM link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$perl$exe_ext"); } - link("$installbin/$perl_verbase$ver$exe_ext", - "$installbin/suid$perl$exe_ext") - if $d_dosuid; } # For development purposes it can be very useful to have multiple perls @@ -544,21 +565,6 @@ my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod'; if ( !$versiononly || ($installprivlib =~ m/\Q$vershort/)) { mkpath("${installprivlib}/$pod", $opts{verbose}, 0777); - # If Perl 5.003's perldiag.pod is there, rename it. - if (open POD, "${installprivlib}/$pod/perldiag.pod") { - read POD, $_, 4000; - close POD; - # Some of Perl 5.003's diagnostic messages ended with periods. - if (/^=.*\.$/m) { - my ($from, $to) = ("${installprivlib}/$pod/perldiag.pod", - "${installprivlib}/$pod/perldiag-5.003.pod"); - print " rename $from $to"; - rename($from, $to) - or warn "Couldn't rename $from to $to: $!\n" - unless $opts{notify}; - } - } - for (@pods) { # $_ is a name like pod/perl.pod (my $base = $_) =~ s#.*/##; @@ -591,6 +597,7 @@ if (!$versiononly && $otherperls) { next unless m,^/,; # Use &samepath here because some systems have other dirs linked # to $mainperldir (like SunOS) + next unless -d; next if samepath($_, $binexp); next if samepath($_, cwd()); next if ($mainperl_is_instperl && samepath($_, $mainperldir)); @@ -665,7 +672,7 @@ sub copy { my($from,$to) = @_; my $xto = $to; - $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; + $xto =~ s/^\Q$opts{destdir}\E//; print $opts{verbose} ? " cp $from $xto\n" : " $xto\n" unless $opts{silent}; print " creating new version of $xto\n" @@ -694,21 +701,36 @@ sub installlib { # ignore patch backups, RCS files, emacs backup & temp files and the # .exists files, .PL files, and test files. - return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util.pl$} || + return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} || $dir =~ m{/t(?:/|$)}; # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp # scripts in lib/ExtUtils, the prove script in lib/Test/Harness, # the corelist script from lib/Module/CoreList/bin and ptar* in # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts # (they're installed later with other utils) - return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|cpan2dist|cpanp|cpanp-run-perl|ptardiff|config_data)\z/; + return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|cpan2dist|cpanp|cpanp-run-perl|ptardiff|ptargrep|config_data)\z/; # ignore the Makefiles return if $name =~ /^makefile$/i; # ignore the test extensions return if $dir =~ m{\bXS/(?:APItest|Typemap)\b}; return if $name =~ m{\b(?:APItest|Typemap)\.pm$}; + # ignore the build support code + return if $name =~ /\bbuildcustomize\.pl$/; # ignore the demo files return if $dir =~ /\b(?:demos?|eg)\b/; + # ignore unneeded unicore files + if ( $dir =~ /^unicore/ ) { + if ( $name =~ /\.txt\z/ ) { + # We can ignore most, but not all .txt files + return unless $name =~ /\A(?:Blocks|CaseFolding|SpecialCasing|NamedSequences)\.txt\z/; + } + else { + # TestProp only needed during testing + return if $name =~ /\ATestProp.pl\z/; + # we need version and *.pl files and can skip the rest + return unless $name =~ /\A(?:version|\w+\.pl)\z/; + } + } # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs. # Changes.e2x and README.e2x are needed by enc2xs. @@ -728,11 +750,13 @@ sub installlib { $name = "$dir/$name" if $dir ne ''; + return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS; + my $installlib = $installprivlib; - if ($dir =~ /^auto/ || + if ($dir =~ /^auto\// || ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) || ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) || - $name eq 'Config_heavy.pl' + $name=~/^Config_(heavy|git)\.pl\z/ ) { $installlib = $installarchlib; return unless $do_installarchlib; @@ -750,7 +774,7 @@ sub installlib { unlink("$installarchlib/$name"); } my $xname = "$installlib/$name"; - $xname =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; + $xname =~ s/^\Q$opts{destdir}\E//; $packlist->{$xname} = { type => 'file' }; if ($force || compare($_, "$installlib/$name") || $opts{notify}) { unlink("$installlib/$name"); @@ -797,7 +821,7 @@ sub copy_if_diff { my($from,$to)=@_; return 1 if (($^O eq 'VMS') && (-d $from)); my $xto = $to; - $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; + $xto =~ s/^\Q$opts{destdir}\E//; my $perlpodbadsymlink; if ($from =~ m!^pod/perl[\w-]+\.pod$! && -l $from &&