4 chdir '..' if !-d 'lib' and -d '../lib';
6 $ENV{PERL5LIB} = 'lib';
8 # This needs to be at BEGIN time, before any use of Config
9 # install_lib itself loads and imports Config into main::
10 require './install_lib.pl';
14 use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare
19 if ($Is_VMS) { eval 'use VMS::Filespec;' }
22 my $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
27 use ExtUtils::Packlist;
29 # nogetopt_compat to disable treating +v as meaning -v
30 use Getopt::Long qw(:config nogetopt_compat no_auto_abbrev noignorecase);
32 require './Porting/pod_lib.pl';
39 my $mainperldir = "/usr/bin";
40 my $exe_ext = $Config{exe_ext};
42 # Allow "make install PERLNAME=something_besides_perl":
43 my $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
45 # This is the base used for versioned names, like "perl5.6.0".
46 # It's separate because a common use of $PERLNAME is to install
47 # perl as "perl5", if that's used as base for versioned files you
49 my $perl_verbase = defined($ENV{PERLNAME_VERBASE})
50 ? $ENV{PERLNAME_VERBASE}
55 if ( defined $Config{usevmsdebug} ) {
56 if ( $Config{usevmsdebug} eq 'define' ) {
63 # This little hack simplifies making the code after the comment "Fetch some
64 # frequently-used items from %Config" warning free. With $opts{destdir} always
65 # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional.
70 if (!GetOptions(\%opts, 'notify|n', 'strip|s', 'silent|S',
71 'skip-otherperls|o', 'force|f', 'verbose|V', 'archname|A',
72 'netware', 'nopods|p', 'destdir:s', 'help|h|?',
73 'versiononly|v' => \$versiononly, '<>' => sub {
77 # Any other unknown argument is going to be an error
84 $opts{verbose} ||= $opts{notify};
86 if ($usage || $opts{help}) {
89 -n Don't actually run any commands; just print them.
90 -s Run strip on installed binaries.
91 -v Only install perl as a binary with the version number in the name.
92 (Override whatever config.sh says)
93 +v Install perl as "perl" and as a binary with the version number in
94 the name. (Override whatever config.sh says)
96 -f Force installation (don't check if same version is there)
97 -o Skip checking for other copies of perl in your PATH.
99 -A Also install perl with the architecture's name in the perl binary's
101 -p Don't install the pod files. [This will break use diagnostics;]
102 -netware Install correctly on a Netware server.
103 -destdir Prefix installation directories by this string.
104 -h Display this help message.
110 $versiononly = 1 if $Config{versiononly} && !defined $versiononly;
111 my (@scripts, @tolink);
112 open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
115 next if /a2p/; # a2p is binary, to be installed separately
117 if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
119 push @tolink, [$1, $2];
126 if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
128 # Specify here any .pm files that are actually architecture-dependent.
129 # (Those included with XS extensions under ext/ are automatically
131 # Now that the default privlib has the full perl version number included,
132 # we no longer have to play the trick of sticking version-specific .pm
133 # files under the archlib directory.
141 push(@scripts,'djgpp/fixpmain');
142 $archpms{config} = $archpms{filehand} = 1;
145 if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
146 push(@scripts, map("$_.exe", @scripts));
149 # Exclude nonxs extensions that are not architecture dependent
150 my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
152 my @ext_dirs = qw(cpan dist ext);
153 foreach my $ext_dir (@ext_dirs) {
155 if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) &&
156 ! grep { (my $dir = $_) =~ s/\//-/g;
157 $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs)
159 my($path, $modname) = ($1,$2);
161 # Change hyphenated name like Filter-Util-Call to nested
162 # directory name Filter/Util/Call
165 # strip to optional "/lib", or remove trailing component
166 $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{};
168 # strip any leading /
171 # reconstitute canonical module name
172 $modname = "$path/$modname" if length $path;
175 $archpms{$modname} = 1;
180 # print "[$_]\n" for sort keys %archpms;
182 my $ver = $Config{version};
183 my $release = substr($],0,3); # Not used currently.
184 my $patchlevel = substr($],3,2);
185 die "Patchlevel of perl ($patchlevel)",
186 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
187 if $patchlevel != $Config{'PERL_VERSION'};
189 # Fetch some frequently-used items from %Config
190 my $installbin = "$opts{destdir}$Config{installbin}";
191 my $installscript = "$opts{destdir}$Config{installscript}";
192 my $installprivlib = "$opts{destdir}$Config{installprivlib}";
193 my $installarchlib = "$opts{destdir}$Config{installarchlib}";
194 my $installsitelib = "$opts{destdir}$Config{installsitelib}";
195 my $installsitearch = "$opts{destdir}$Config{installsitearch}";
196 my $installman1dir = "$opts{destdir}$Config{installman1dir}";
197 my $man1ext = $Config{man1ext};
198 my $libperl = $Config{libperl};
199 # Shared library and dynamic loading suffixes.
200 my $so = $Config{so};
201 my $dlext = $Config{dlext};
202 my $dlsrc = $Config{dlsrc};
203 if ($^O eq 'os390') {
206 my $archlibexp = $Config{archlibexp};
207 my $usedl = $Config{usedl};
208 if ($usedl eq 'define') {
209 `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
213 if ($opts{netware}) {
214 # This is required only if we are installing on a NetWare server
215 $installscript = $Config{installnwscripts};
216 $installprivlib = $Config{installnwlib};
217 $installarchlib = $Config{installnwlib};
218 $installsitelib = $Config{installnwlib};
221 my $binexp = $Config{binexp};
223 if ($Is_VMS) { # Hang in there until File::Spec hits the big time
224 foreach ( \$installbin, \$installscript, \$installprivlib,
225 \$installarchlib, \$installsitelib, \$installsitearch,
227 $$_ = unixify($$_); $$_ =~ s:/$::;
231 # Do some quick sanity checks.
233 $installbin || die "No installbin directory in config.sh\n";
234 -d $installbin || mkpath($installbin);
235 -d $installbin || $opts{notify} || die "$installbin is not a directory\n";
236 -w $installbin || $opts{notify} || die "$installbin is not writable by you\n"
237 unless $installbin =~ m#^/afs/# || $opts{notify};
241 -x 'perl' . $exe_ext || die "perl isn't executable!\n";
244 -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n";
246 -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n";
250 -f 't/rantests' || $Is_W32
251 || warn "WARNING: You've never run 'make test' or",
252 " some tests failed! (Installing anyway.)\n";
255 # This will be used to store the packlist
256 $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
258 if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
264 $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
267 if ($dlsrc ne "dl_none.xs") {
268 -f $perldll || die "No perl DLL built\n";
272 safe_unlink("$installbin/$perldll");
273 copy("$perldll", "$installbin/$perldll");
274 chmod(0755, "$installbin/$perldll");
275 $packlist->{"$Config{installbin}/$perldll"} = { type => 'file' };
276 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
278 # First we install the version-numbered executables.
281 safe_unlink("$installbin/perl_setup.com");
282 copy("perl_setup.com", "$installbin/perl_setup.com");
283 chmod(0755, "$installbin/perl_setup.com");
284 safe_unlink("$installbin/$dbg$perl$exe_ext");
285 copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
286 chmod(0755, "$installbin/$dbg$perl$exe_ext");
287 safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
288 copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
289 chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
291 safe_unlink("$installbin/$ndbg$perl$exe_ext");
292 copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
293 chmod(0755, "$installbin/$ndbg$perl$exe_ext");
294 safe_unlink("$installbin/${dbg}a2p$exe_ext");
295 copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
296 chmod(0755, "$installbin/${dbg}a2p$exe_ext");
299 elsif ($^O ne 'dos') {
301 safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
302 copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
303 strip("$installbin/$perl_verbase$ver$exe_ext");
304 chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
307 # If installing onto a NetWare server
308 if ($opts{netware}) {
309 # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
310 mkpath($Config{installnwsystem});
311 copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
312 copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
313 copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
314 copy("x2p\\a2p.nlm", $Config{installnwsystem});
315 chmod(0755, "$Config{installnwsystem}\\perl.nlm");
316 mkpath($Config{installnwlcgi});
317 copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
322 safe_unlink("$installbin/$perl.exe");
323 copy("perl.exe", "$installbin/$perl.exe");
326 # Install library files.
328 my $do_installarchlib = !samepath($installarchlib, 'lib');
329 my $do_installprivlib = !samepath($installprivlib, 'lib');
330 my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
331 $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
333 mkpath($installprivlib);
334 mkpath($installarchlib);
335 mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
336 mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
339 find({no_chdir => 1, wanted => \&installlib}, 'lib')
340 if $do_installarchlib || $do_installprivlib;
343 warn "Can't install lib files - 'lib/' does not exist";
346 # Install header files and libraries.
347 mkpath("$installarchlib/CORE");
349 if ($Is_VMS) { # We did core file selection during build
350 my $coredir = "lib/$Config{archname}/$ver/CORE";
352 map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
354 elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
355 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
356 my $coredll = "$installarchlib/CORE/$libperl";
357 my $instcoredll = "$Config{installarchlib}/CORE/$libperl";
358 safe_unlink($coredll);
359 ( $Config{'d_link'} eq 'define' &&
361 CORE::link("$installbin/$libperl", $coredll);
362 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
367 symlink("$installbin/$libperl", $coredll);
368 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
371 ( copy("$installbin/$libperl", $coredll) &&
372 push(@corefiles, $instcoredll)
375 # [als] hard-coded 'libperl' name... not good!
376 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
378 # AIX needs perl.exp installed as well.
379 push(@corefiles,'perl.exp') if $^O eq 'aix';
381 foreach my $file (@corefiles) {
382 # HP-UX (at least) needs to maintain execute permissions
383 # on dynamically-loadable libraries. So we do it for all.
384 if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
385 if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
386 strip("-S", "$installarchlib/CORE/$file") if $^O eq 'darwin';
387 chmod(0555, "$installarchlib/CORE/$file");
389 chmod(0444, "$installarchlib/CORE/$file");
394 # Install main perl executables
395 # Make links to ordinary names if installbin directory isn't current directory.
397 if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
398 safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
400 # VOS doesn't support hard links, so use a symlink.
401 symlink("$installbin/$perl_verbase$ver$exe_ext",
402 "$installbin/$perl$exe_ext");
404 link("$installbin/$perl_verbase$ver$exe_ext",
405 "$installbin/$perl$exe_ext");
409 # For development purposes it can be very useful to have multiple perls
410 # build for different "architectures" (eg threading or not) simultaneously.
411 if ($opts{archname} && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
412 my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
413 safe_unlink("$installbin/$archperl");
415 # VOS doesn't support hard links, so use a symlink.
416 symlink("$installbin/$perl_verbase$ver$exe_ext",
417 "$installbin/$archperl");
419 link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
423 # Offer to install perl in a "standard" location
425 my $mainperl_is_instperl = 0;
427 if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
428 !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
429 && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
430 my($usrbinperl) = "$mainperldir/$perl$exe_ext";
431 my($instperl) = "$installbin/$perl$exe_ext";
432 my($expinstperl) = "$binexp/$perl$exe_ext";
434 # First make sure $usrbinperl is not already the same as the perl we
436 if (-x $usrbinperl) {
437 # Try to be clever about mainperl being a symbolic link
438 # to binexp/perl if binexp and installbin are different.
439 $mainperl_is_instperl =
440 samepath($usrbinperl, $instperl) ||
441 samepath($usrbinperl, $expinstperl) ||
442 (($binexp ne $installbin) &&
444 ((readlink $usrbinperl) eq $expinstperl));
446 if (! $mainperl_is_instperl) {
448 ( $Config{'d_link'} eq 'define' &&
449 eval { CORE::link $instperl, $usrbinperl } ) ||
450 eval { symlink $expinstperl, $usrbinperl } ||
451 copy($instperl, $usrbinperl);
453 $mainperl_is_instperl = 1;
457 # Make links to ordinary names if installbin directory isn't current directory.
458 if (!$Is_NetWare && $dbg eq '') {
459 if (! samepath($installbin, 'x2p')) {
461 $base .= $ver if $versiononly;
462 safe_unlink("$installbin/$base$exe_ext");
463 copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
464 strip("$installbin/$base$exe_ext");
465 chmod(0755, "$installbin/$base$exe_ext");
469 # cppstdin is just a script, but it is architecture-dependent, so
470 # it can't safely be shared. Place it in $installbin.
471 # Note that Configure doesn't build cppstin if it isn't needed, so
472 # we skip this if cppstdin doesn't exist.
473 if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
474 safe_unlink("$installbin/cppstdin");
475 copy("cppstdin", "$installbin/cppstdin");
476 chmod(0755, "$installbin/cppstdin");
480 my ($installscript, $orig, $alias, $scr_ext) = @_;
482 safe_unlink("$installscript/$alias$scr_ext");
483 if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
484 copy("$installscript/$orig$scr_ext",
485 "$installscript/$alias$scr_ext");
486 } elsif ($^O eq 'vos') {
487 symlink("$installscript/$orig$scr_ext",
488 "$installscript/$alias$scr_ext");
490 link("$installscript/$orig$scr_ext",
491 "$installscript/$alias$scr_ext");
496 mkpath($installscript);
499 (my $base = $_) =~ s#.*/##;
501 copy($_, "$installscript/$base");
502 chmod(0755, "$installscript/$base");
506 my ($from, $to) = map { "$_$ver" } @$_;
507 (my $frbase = $from) =~ s#.*/##;
508 (my $tobase = $to) =~ s#.*/##;
509 script_alias($installscript, $frbase, $tobase, $scr_ext);
513 (my $base = $_) =~ s#.*/##;
514 copy($_, "$installscript/$base");
515 chmod(0755, "$installscript/$base");
519 my ($from, $to) = @$_;
520 (my $frbase = $from) =~ s#.*/##;
521 (my $tobase = $to) =~ s#.*/##;
522 script_alias($installscript, $frbase, $tobase, $scr_ext);
526 # Install pod pages. Where? I guess in $installprivlib/pod
527 # ($installprivlib/pods for cygwin).
528 if (!$opts{nopods} && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) {
529 my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod';
530 mkpath("${installprivlib}/$pod");
532 for (map {$_->[1]} @{get_pod_metadata()->{master}}) {
533 # $_ is a name like pod/perl.pod
534 (my $base = $_) =~ s#.*/##;
535 copy_if_diff($_, "${installprivlib}/$pod/${base}");
536 chmod(0644, "${installprivlib}/$pod/${base}");
541 # Check to make sure there aren't other perls around in installer's
542 # path. This is probably UNIX-specific. Check all absolute directories
543 # in the path except for where public executables are supposed to live.
544 # Also skip $mainperl if the user opted to have it be a link to the
547 if (!$versiononly && !$opts{'skip-otherperls'}) {
549 my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
550 ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
551 @path = split(/$dirsep/, $path);
554 while (exists $ENV{'DCL$PATH' . $i}) {
555 my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
563 # Use &samepath here because some systems have other dirs linked
564 # to $mainperldir (like SunOS)
566 next if samepath($_, $binexp);
567 next if samepath($_, cwd());
568 next if ($mainperl_is_instperl && samepath($_, $mainperldir));
569 my $otherperl = "$_/$perl$exe_ext";
570 next if $otherperls{$otherperl}++;
571 push(@otherperls, $otherperl)
572 if (-x $otherperl && ! -d $otherperl);
575 warn "\nWarning: $perl appears in your path in the following " .
576 "locations beyond where\nwe just installed it:\n";
585 $packlist->write() unless $opts{notify};
586 print " Installation complete\n" if $opts{verbose};
590 ###############################################################################
592 # If these are needed elsewhere, move them into install_lib.pl rather than
598 my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
599 print STDERR $prompt;
600 chop($answer = <STDIN>);
601 $answer = $default if $answer =~ m/^\s*$/;
602 ($answer =~ m/^[yY]/);
606 return if $opts{notify} or $Is_VMS;
608 foreach my $name (@names) {
609 next unless -e $name;
610 chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
611 print " unlink $name\n" if $opts{verbose};
612 next if CORE::unlink($name);
613 warn "Couldn't unlink $name: $!\n";
615 print " mv $name $name.old\n" if $opts{verbose};
616 safe_rename($name, "$name.old")
617 or warn "Couldn't rename $name: $!\n";
626 $xto =~ s/^\Q$opts{destdir}\E//;
627 print $opts{verbose} ? " cp $from $xto\n" : " $xto\n"
628 unless $opts{silent};
629 print " creating new version of $xto\n"
630 if $Is_VMS and -e $to and !$opts{silent};
631 unless ($opts{notify} or File::Copy::copy($from, $to)) {
632 # Might have been that F::C::c can't overwrite the target
633 warn "Couldn't copy $from to $to: $!\n"
634 unless -f $to and (chmod(0666, $to), unlink $to)
635 and File::Copy::copy($from, $to);
637 $packlist->{$xto} = { type => 'file' };
641 my $dir = $File::Find::dir;
647 # This remains ugly, and in need of refactoring.
649 # $name always starts as the leafname
650 # $dir is the directory *within* lib
651 # $name later has $dir pre-pended, to give the relative path in lib/
652 # which is used to create the path in the target directory.
654 # $_ was always the filename to use on disk. Adding no_chdir doesn't change
655 # this, as $_ becomes a pathname, and so still works. However, it's not
656 # obvious that $_ is needed later, and hence $_ must not be modified.
658 # Also, many of the regex exclusion tests below are now superfluous, as the
659 # files in question are either no longer in blead, or now in ext/, dist/ or
660 # cpan/ and not copied into lib/
662 # Ignore version control directories.
663 if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) {
664 $File::Find::prune = 1;
668 # ignore patch backups, RCS files, emacs backup & temp files and the
669 # .exists files, .PL files, and test files.
670 return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} ||
671 $dir =~ m{/t(?:/|$)};
672 # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
673 # scripts in lib/ExtUtils, the prove script in lib/Test/Harness,
674 # the corelist script from lib/Module/CoreList/bin and ptar* in
675 # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts
676 # and zipdetails in cpan/IO-Compress/bin
677 # (they're installed later with other utils)
678 return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|ptardiff|ptargrep|config_data|zipdetails)\z/;
679 # ignore the Makefiles
680 return if $name =~ /^makefile$/i;
681 # ignore the test extensions
682 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
683 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
684 # ignore the build support code
685 return if $name =~ /\bbuildcustomize\.pl$/;
686 # ignore the demo files
687 return if $dir =~ /\b(?:demos?|eg)\b/;
688 # ignore unneeded unicore files
689 if ( $dir =~ /^unicore/ ) {
690 if ( $name =~ /\.txt\z/ ) {
691 # We can ignore most, but not all .txt files
692 return unless $name =~ /\A(?:Blocks|SpecialCasing|NamedSequences)\.txt\z/;
695 # TestProp only needed during testing
696 return if $name =~ /\ATestProp.pl\z/;
697 # we need version and *.pl files and can skip the rest
698 return unless $name =~ /\A(?:version|\w+\.p[lm])\z/;
702 # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs.
703 # Changes.e2x and README.e2x are needed by enc2xs.
704 return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x';
705 return if $name =~ m{^(?:MANIFEST|META\.yml)$};
706 return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i;
707 return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i;
708 return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files
709 return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files
711 # if using a shared perl library then ignore:
712 # - static library files [of statically linked extensions];
713 # - import library files and export library files (only present on Win32
714 # anyway?) and empty bootstrap files [of dynamically linked extensions].
715 return if $Config{useshrplib} eq 'true' and
716 ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name));
718 $name = "$dir/$name" if $dir ne '';
720 # ignore pods that are stand alone documentation from dual life modules.
721 return if /\.pod\z/ && is_duplicate_pod($_);
723 return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
725 my $installlib = $installprivlib;
726 if ($dir =~ /^auto\// ||
727 ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
728 ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) ||
729 $name=~/^Config_(heavy|git)\.pl\z/
731 $installlib = $installarchlib;
732 return unless $do_installarchlib;
734 return unless $do_installprivlib;
737 if ($Is_NetWare && !$opts{netware} && /\.(?:nlp|nlm|bs)$/) {
738 # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
739 # if copied will give problems when building new extensions.
740 # Has to be copied if we are installing on a NetWare server and
741 # hence the check !$opts{netware}
746 my $xname = "$installlib/$name";
747 $xname =~ s/^\Q$opts{destdir}\E//;
748 $packlist->{$xname} = { type => 'file' };
749 if ($opts{force} || compare($_, "$installlib/$name") || $opts{notify}) {
750 unlink("$installlib/$name");
751 mkpath("$installlib/$dir");
752 # HP-UX (at least) needs to maintain execute permissions
753 # on dynamically-loaded libraries.
754 if (copy_if_diff($_, "$installlib/$name")) {
755 strip("-S", "$installlib/$name")
756 if $^O eq 'darwin' and /\.(?:so|$dlext|a)$/;
757 chmod(/\.(so|$dlext)$/ ? 0555 : 0444, "$installlib/$name");
763 # Copy $from to $to, only if $from is different than $to.
764 # Also preserve modification times for .a libraries.
765 # On some systems, if you do
767 # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
768 # and then try to link against the installed libperl.a, you might
769 # get an error message to the effect that the symbol table is older
771 # Return true if copying occurred.
775 return 1 if (($^O eq 'VMS') && (-d $from));
777 $xto =~ s/^\Q$opts{destdir}\E//;
778 my $perlpodbadsymlink;
779 if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
782 # Some Linux implementations have problems traversing over
783 # multiple symlinks (when going over NFS?) and fail to read
784 # the symlink target. Combine this with the fact that some
785 # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
786 # and you end up with those pods not getting installed.
787 $perlpodbadsymlink = 1;
789 -f $from || $perlpodbadsymlink || warn "$0: $from not found";
790 $packlist->{$xto} = { type => 'file' };
791 if ($opts{force} || compare($from, $to) || $opts{notify}) {
792 safe_unlink($to); # In case we don't have write permissions.
793 if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
797 # Restore timestamps if it's a .a library or for OS/2.
798 if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) {
799 my ($atime, $mtime) = (stat $from)[8,9];
800 utime $atime, $mtime, $to;
810 return unless $opts{strip};
813 while (@args && $args[0] =~ /^(-\w+)$/) {
814 push @opts, shift @args;
817 foreach my $file (@args) {
819 if ($opts{verbose}) {
820 print " strip " . join(' ', @opts);
821 print " " if (@opts);
824 system("strip", @opts, $file);
826 print "# file '$file' skipped\n" if $opts{verbose};
832 # cperl-indent-level: 4
833 # indent-tabs-mode: nil
836 # ex: set ts=8 sts=4 sw=4 et: