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.
140 push(@scripts,'djgpp/fixpmain');
141 $archpms{config} = $archpms{filehand} = 1;
144 if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
145 push(@scripts, map("$_.exe", @scripts));
148 # Exclude nonxs extensions that are not architecture dependent
149 my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
151 my @ext_dirs = qw(cpan dist ext);
152 foreach my $ext_dir (@ext_dirs) {
154 if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) &&
155 ! grep { (my $dir = $_) =~ s/\//-/g;
156 $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs)
158 my($path, $modname) = ($1,$2);
160 # Change hyphenated name like Filter-Util-Call to nested
161 # directory name Filter/Util/Call
164 # strip to optional "/lib", or remove trailing component
165 $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{};
167 # strip any leading /
170 # reconstitute canonical module name
171 $modname = "$path/$modname" if length $path;
174 $archpms{$modname} = 1;
179 # print "[$_]\n" for sort keys %archpms;
181 my $ver = $Config{version};
182 my $release = substr($],0,3); # Not used currently.
183 my $patchlevel = substr($],3,2);
184 die "Patchlevel of perl ($patchlevel)",
185 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
186 if $patchlevel != $Config{'PERL_VERSION'};
188 # Fetch some frequently-used items from %Config
189 my $installbin = "$opts{destdir}$Config{installbin}";
190 my $installscript = "$opts{destdir}$Config{installscript}";
191 my $installprivlib = "$opts{destdir}$Config{installprivlib}";
192 my $installarchlib = "$opts{destdir}$Config{installarchlib}";
193 my $installsitelib = "$opts{destdir}$Config{installsitelib}";
194 my $installsitearch = "$opts{destdir}$Config{installsitearch}";
195 my $installman1dir = "$opts{destdir}$Config{installman1dir}";
196 my $man1ext = $Config{man1ext};
197 my $libperl = $Config{libperl};
198 # Shared library and dynamic loading suffixes.
199 my $so = $Config{so};
200 my $dlext = $Config{dlext};
201 my $dlsrc = $Config{dlsrc};
202 if ($^O eq 'os390') {
205 my $archlibexp = $Config{archlibexp};
206 my $usedl = $Config{usedl};
207 if ($usedl eq 'define') {
208 `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
212 if ($opts{netware}) {
213 # This is required only if we are installing on a NetWare server
214 $installscript = $Config{installnwscripts};
215 $installprivlib = $Config{installnwlib};
216 $installarchlib = $Config{installnwlib};
217 $installsitelib = $Config{installnwlib};
220 my $binexp = $Config{binexp};
222 if ($Is_VMS) { # Hang in there until File::Spec hits the big time
223 foreach ( \$installbin, \$installscript, \$installprivlib,
224 \$installarchlib, \$installsitelib, \$installsitearch,
226 $$_ = unixify($$_); $$_ =~ s:/$::;
230 # Do some quick sanity checks.
232 $installbin || die "No installbin directory in config.sh\n";
233 -d $installbin || mkpath($installbin);
234 -d $installbin || $opts{notify} || die "$installbin is not a directory\n";
235 -w $installbin || $opts{notify} || die "$installbin is not writable by you\n"
236 unless $installbin =~ m#^/afs/# || $opts{notify};
240 -x 'perl' . $exe_ext || die "perl isn't executable!\n";
243 -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n";
245 -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n";
249 -f 't/rantests' || $Is_W32
250 || warn "WARNING: You've never run 'make test' or",
251 " some tests failed! (Installing anyway.)\n";
254 # This will be used to store the packlist
255 $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
257 if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
263 $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
266 if ($dlsrc ne "dl_none.xs") {
267 -f $perldll || die "No perl DLL built\n";
271 safe_unlink("$installbin/$perldll");
272 copy("$perldll", "$installbin/$perldll");
273 chmod(0755, "$installbin/$perldll");
274 $packlist->{"$Config{installbin}/$perldll"} = { type => 'file' };
275 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
277 # First we install the version-numbered executables.
280 safe_unlink("$installbin/perl_setup.com");
281 copy("perl_setup.com", "$installbin/perl_setup.com");
282 chmod(0755, "$installbin/perl_setup.com");
283 safe_unlink("$installbin/$dbg$perl$exe_ext");
284 copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
285 chmod(0755, "$installbin/$dbg$perl$exe_ext");
286 safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
287 copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
288 chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
290 safe_unlink("$installbin/$ndbg$perl$exe_ext");
291 copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
292 chmod(0755, "$installbin/$ndbg$perl$exe_ext");
293 safe_unlink("$installbin/${dbg}a2p$exe_ext");
294 copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
295 chmod(0755, "$installbin/${dbg}a2p$exe_ext");
298 elsif ($^O ne 'dos') {
300 safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
301 copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
302 strip("$installbin/$perl_verbase$ver$exe_ext");
303 chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
306 # If installing onto a NetWare server
307 if ($opts{netware}) {
308 # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
309 mkpath($Config{installnwsystem});
310 copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
311 copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
312 copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
313 copy("x2p\\a2p.nlm", $Config{installnwsystem});
314 chmod(0755, "$Config{installnwsystem}\\perl.nlm");
315 mkpath($Config{installnwlcgi});
316 copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
321 safe_unlink("$installbin/$perl.exe");
322 copy("perl.exe", "$installbin/$perl.exe");
325 # Install library files.
327 my $do_installarchlib = !samepath($installarchlib, 'lib');
328 my $do_installprivlib = !samepath($installprivlib, 'lib');
329 my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
330 $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
332 mkpath($installprivlib);
333 mkpath($installarchlib);
334 mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
335 mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
338 find({no_chdir => 1, wanted => \&installlib}, 'lib')
339 if $do_installarchlib || $do_installprivlib;
342 warn "Can't install lib files - 'lib/' does not exist";
345 # Install header files and libraries.
346 mkpath("$installarchlib/CORE");
348 if ($Is_VMS) { # We did core file selection during build
349 my $coredir = "lib/$Config{archname}/$ver/CORE";
351 map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
353 elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
354 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
355 my $coredll = "$installarchlib/CORE/$libperl";
356 my $instcoredll = "$Config{installarchlib}/CORE/$libperl";
357 safe_unlink($coredll);
358 ( $Config{'d_link'} eq 'define' &&
360 CORE::link("$installbin/$libperl", $coredll);
361 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
366 symlink("$installbin/$libperl", $coredll);
367 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
370 ( copy("$installbin/$libperl", $coredll) &&
371 push(@corefiles, $instcoredll)
374 # [als] hard-coded 'libperl' name... not good!
375 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
377 # AIX needs perl.exp installed as well.
378 push(@corefiles,'perl.exp') if $^O eq 'aix';
380 foreach my $file (@corefiles) {
381 # HP-UX (at least) needs to maintain execute permissions
382 # on dynamically-loadable libraries. So we do it for all.
383 if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
384 if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
385 strip("-S", "$installarchlib/CORE/$file") if $^O eq 'darwin';
386 chmod(0555, "$installarchlib/CORE/$file");
388 chmod(0444, "$installarchlib/CORE/$file");
393 # Install main perl executables
394 # Make links to ordinary names if installbin directory isn't current directory.
396 if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
397 safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
399 # VOS doesn't support hard links, so use a symlink.
400 symlink("$installbin/$perl_verbase$ver$exe_ext",
401 "$installbin/$perl$exe_ext");
403 link("$installbin/$perl_verbase$ver$exe_ext",
404 "$installbin/$perl$exe_ext");
408 # For development purposes it can be very useful to have multiple perls
409 # build for different "architectures" (eg threading or not) simultaneously.
410 if ($opts{archname} && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
411 my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
412 safe_unlink("$installbin/$archperl");
414 # VOS doesn't support hard links, so use a symlink.
415 symlink("$installbin/$perl_verbase$ver$exe_ext",
416 "$installbin/$archperl");
418 link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
422 # Offer to install perl in a "standard" location
424 my $mainperl_is_instperl = 0;
426 if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
427 !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
428 && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
429 my($usrbinperl) = "$mainperldir/$perl$exe_ext";
430 my($instperl) = "$installbin/$perl$exe_ext";
431 my($expinstperl) = "$binexp/$perl$exe_ext";
433 # First make sure $usrbinperl is not already the same as the perl we
435 if (-x $usrbinperl) {
436 # Try to be clever about mainperl being a symbolic link
437 # to binexp/perl if binexp and installbin are different.
438 $mainperl_is_instperl =
439 samepath($usrbinperl, $instperl) ||
440 samepath($usrbinperl, $expinstperl) ||
441 (($binexp ne $installbin) &&
443 ((readlink $usrbinperl) eq $expinstperl));
445 if (! $mainperl_is_instperl) {
447 ( $Config{'d_link'} eq 'define' &&
448 eval { CORE::link $instperl, $usrbinperl } ) ||
449 eval { symlink $expinstperl, $usrbinperl } ||
450 copy($instperl, $usrbinperl);
452 $mainperl_is_instperl = 1;
456 # Make links to ordinary names if installbin directory isn't current directory.
457 if (!$Is_NetWare && $dbg eq '') {
458 if (! samepath($installbin, 'x2p')) {
460 $base .= $ver if $versiononly;
461 safe_unlink("$installbin/$base$exe_ext");
462 copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
463 strip("$installbin/$base$exe_ext");
464 chmod(0755, "$installbin/$base$exe_ext");
468 # cppstdin is just a script, but it is architecture-dependent, so
469 # it can't safely be shared. Place it in $installbin.
470 # Note that Configure doesn't build cppstin if it isn't needed, so
471 # we skip this if cppstdin doesn't exist.
472 if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
473 safe_unlink("$installbin/cppstdin");
474 copy("cppstdin", "$installbin/cppstdin");
475 chmod(0755, "$installbin/cppstdin");
479 my ($installscript, $orig, $alias, $scr_ext) = @_;
481 safe_unlink("$installscript/$alias$scr_ext");
482 if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
483 copy("$installscript/$orig$scr_ext",
484 "$installscript/$alias$scr_ext");
485 } elsif ($^O eq 'vos') {
486 symlink("$installscript/$orig$scr_ext",
487 "$installscript/$alias$scr_ext");
489 link("$installscript/$orig$scr_ext",
490 "$installscript/$alias$scr_ext");
495 mkpath($installscript);
498 (my $base = $_) =~ s#.*/##;
500 copy($_, "$installscript/$base");
501 chmod(0755, "$installscript/$base");
505 my ($from, $to) = map { "$_$ver" } @$_;
506 (my $frbase = $from) =~ s#.*/##;
507 (my $tobase = $to) =~ s#.*/##;
508 script_alias($installscript, $frbase, $tobase, $scr_ext);
512 (my $base = $_) =~ s#.*/##;
513 copy($_, "$installscript/$base");
514 chmod(0755, "$installscript/$base");
518 my ($from, $to) = @$_;
519 (my $frbase = $from) =~ s#.*/##;
520 (my $tobase = $to) =~ s#.*/##;
521 script_alias($installscript, $frbase, $tobase, $scr_ext);
525 # Install pod pages. Where? I guess in $installprivlib/pod
526 # ($installprivlib/pods for cygwin).
527 if (!$opts{nopods} && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) {
528 my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod';
529 mkpath("${installprivlib}/$pod");
531 for (map {$_->[1]} @{get_pod_metadata()->{master}}) {
532 # $_ is a name like pod/perl.pod
533 (my $base = $_) =~ s#.*/##;
534 copy_if_diff($_, "${installprivlib}/$pod/${base}");
535 chmod(0644, "${installprivlib}/$pod/${base}");
540 # Check to make sure there aren't other perls around in installer's
541 # path. This is probably UNIX-specific. Check all absolute directories
542 # in the path except for where public executables are supposed to live.
543 # Also skip $mainperl if the user opted to have it be a link to the
546 if (!$versiononly && !$opts{'skip-otherperls'}) {
548 my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
549 ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
550 @path = split(/$dirsep/, $path);
553 while (exists $ENV{'DCL$PATH' . $i}) {
554 my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
562 # Use &samepath here because some systems have other dirs linked
563 # to $mainperldir (like SunOS)
565 next if samepath($_, $binexp);
566 next if samepath($_, cwd());
567 next if ($mainperl_is_instperl && samepath($_, $mainperldir));
568 my $otherperl = "$_/$perl$exe_ext";
569 next if $otherperls{$otherperl}++;
570 push(@otherperls, $otherperl)
571 if (-x $otherperl && ! -d $otherperl);
574 warn "\nWarning: $perl appears in your path in the following " .
575 "locations beyond where\nwe just installed it:\n";
584 $packlist->write() unless $opts{notify};
585 print " Installation complete\n" if $opts{verbose};
589 ###############################################################################
591 # If these are needed elsewhere, move them into install_lib.pl rather than
597 my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
598 print STDERR $prompt;
599 chop($answer = <STDIN>);
600 $answer = $default if $answer =~ m/^\s*$/;
601 ($answer =~ m/^[yY]/);
605 return if $opts{notify} or $Is_VMS;
607 foreach my $name (@names) {
608 next unless -e $name;
609 chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
610 print " unlink $name\n" if $opts{verbose};
611 next if CORE::unlink($name);
612 warn "Couldn't unlink $name: $!\n";
614 print " mv $name $name.old\n" if $opts{verbose};
615 safe_rename($name, "$name.old")
616 or warn "Couldn't rename $name: $!\n";
625 $xto =~ s/^\Q$opts{destdir}\E//;
626 print $opts{verbose} ? " cp $from $xto\n" : " $xto\n"
627 unless $opts{silent};
628 print " creating new version of $xto\n"
629 if $Is_VMS and -e $to and !$opts{silent};
630 unless ($opts{notify} or File::Copy::copy($from, $to)) {
631 # Might have been that F::C::c can't overwrite the target
632 warn "Couldn't copy $from to $to: $!\n"
633 unless -f $to and (chmod(0666, $to), unlink $to)
634 and File::Copy::copy($from, $to);
636 $packlist->{$xto} = { type => 'file' };
640 my $dir = $File::Find::dir;
646 # This remains ugly, and in need of refactoring.
648 # $name always starts as the leafname
649 # $dir is the directory *within* lib
650 # $name later has $dir pre-pended, to give the relative path in lib/
651 # which is used to create the path in the target directory.
653 # $_ was always the filename to use on disk. Adding no_chdir doesn't change
654 # this, as $_ becomes a pathname, and so still works. However, it's not
655 # obvious that $_ is needed later, and hence $_ must not be modified.
657 # Also, many of the regex exclusion tests below are now superfluous, as the
658 # files in question are either no longer in blead, or now in ext/, dist/ or
659 # cpan/ and not copied into lib/
661 # Ignore version control directories.
662 if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) {
663 $File::Find::prune = 1;
667 # ignore patch backups, RCS files, emacs backup & temp files and the
668 # .exists files, .PL files, and test files.
669 return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} ||
670 $dir =~ m{/t(?:/|$)};
671 # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
672 # scripts in lib/ExtUtils, the prove script in lib/Test/Harness,
673 # the corelist script from lib/Module/CoreList/bin and ptar* in
674 # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts
675 # and zipdetails in cpan/IO-Compress/bin
676 # (they're installed later with other utils)
677 return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|ptardiff|ptargrep|config_data|zipdetails)\z/;
678 # ignore the Makefiles
679 return if $name =~ /^makefile$/i;
680 # ignore the test extensions
681 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
682 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
683 # ignore the build support code
684 return if $name =~ /\bbuildcustomize\.pl$/;
685 # ignore the demo files
686 return if $dir =~ /\b(?:demos?|eg)\b/;
687 # ignore unneeded unicore files
688 if ( $dir =~ /^unicore/ ) {
689 if ( $name =~ /\.txt\z/ ) {
690 # We can ignore most, but not all .txt files
691 return unless $name =~ /\A(?:Blocks|SpecialCasing|NamedSequences)\.txt\z/;
694 # TestProp only needed during testing
695 return if $name =~ /\ATestProp.pl\z/;
696 # we need version and *.pl files and can skip the rest
697 return unless $name =~ /\A(?:version|\w+\.p[lm])\z/;
701 # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs.
702 # Changes.e2x and README.e2x are needed by enc2xs.
703 return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x';
704 return if $name =~ m{^(?:MANIFEST|META\.yml)$};
705 return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i;
706 return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i;
707 return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files
708 return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files
710 # if using a shared perl library then ignore:
711 # - static library files [of statically linked extensions];
712 # - import library files and export library files (only present on Win32
713 # anyway?) and empty bootstrap files [of dynamically linked extensions].
714 return if $Config{useshrplib} eq 'true' and
715 ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name));
717 $name = "$dir/$name" if $dir ne '';
719 # ignore pods that are stand alone documentation from dual life modules.
720 return if /\.pod\z/ && is_duplicate_pod($_);
722 return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
724 my $installlib = $installprivlib;
725 if ($dir =~ /^auto\// ||
726 ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
727 ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) ||
728 $name=~/^Config_(heavy|git)\.pl\z/
730 $installlib = $installarchlib;
731 return unless $do_installarchlib;
733 return unless $do_installprivlib;
736 if ($Is_NetWare && !$opts{netware} && /\.(?:nlp|nlm|bs)$/) {
737 # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
738 # if copied will give problems when building new extensions.
739 # Has to be copied if we are installing on a NetWare server and
740 # hence the check !$opts{netware}
745 my $xname = "$installlib/$name";
746 $xname =~ s/^\Q$opts{destdir}\E//;
747 $packlist->{$xname} = { type => 'file' };
748 if ($opts{force} || compare($_, "$installlib/$name") || $opts{notify}) {
749 unlink("$installlib/$name");
750 mkpath("$installlib/$dir");
751 # HP-UX (at least) needs to maintain execute permissions
752 # on dynamically-loaded libraries.
753 if (copy_if_diff($_, "$installlib/$name")) {
754 strip("-S", "$installlib/$name")
755 if $^O eq 'darwin' and /\.(?:so|$dlext|a)$/;
756 chmod(/\.(so|$dlext)$/ ? 0555 : 0444, "$installlib/$name");
762 # Copy $from to $to, only if $from is different than $to.
763 # Also preserve modification times for .a libraries.
764 # On some systems, if you do
766 # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
767 # and then try to link against the installed libperl.a, you might
768 # get an error message to the effect that the symbol table is older
770 # Return true if copying occurred.
774 return 1 if (($^O eq 'VMS') && (-d $from));
776 $xto =~ s/^\Q$opts{destdir}\E//;
777 my $perlpodbadsymlink;
778 if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
781 # Some Linux implementations have problems traversing over
782 # multiple symlinks (when going over NFS?) and fail to read
783 # the symlink target. Combine this with the fact that some
784 # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
785 # and you end up with those pods not getting installed.
786 $perlpodbadsymlink = 1;
788 -f $from || $perlpodbadsymlink || warn "$0: $from not found";
789 $packlist->{$xto} = { type => 'file' };
790 if ($opts{force} || compare($from, $to) || $opts{notify}) {
791 safe_unlink($to); # In case we don't have write permissions.
792 if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
796 # Restore timestamps if it's a .a library or for OS/2.
797 if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) {
798 my ($atime, $mtime) = (stat $from)[8,9];
799 utime $atime, $mtime, $to;
809 return unless $opts{strip};
812 while (@args && $args[0] =~ /^(-\w+)$/) {
813 push @opts, shift @args;
816 foreach my $file (@args) {
818 if ($opts{verbose}) {
819 print " strip " . join(' ', @opts);
820 print " " if (@opts);
823 system("strip", @opts, $file);
825 print "# file '$file' skipped\n" if $opts{verbose};
831 # cperl-indent-level: 4
832 # indent-tabs-mode: nil
835 # ex: set ts=8 sts=4 sw=4 et: