5 chdir '..' if !-d 'lib' and -d '../lib';
7 $ENV{PERL5LIB} = 'lib';
9 # This needs to be at BEGIN time, before any use of Config
10 require './install_lib.pl';
14 use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare
16 my ($dostrip, $versiononly, $force,
17 $otherperls, $archname, $nwinstall, $nopods);
20 if ($Is_VMS) { eval 'use VMS::Filespec;' }
23 my $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
29 use ExtUtils::Packlist;
32 require './Porting/pod_lib.pl';
39 # override the ones in the rest of the script
41 File::Path::mkpath(@_) unless $opts{notify};
44 my $mainperldir = "/usr/bin";
45 my $exe_ext = $Config{exe_ext};
47 # Allow "make install PERLNAME=something_besides_perl":
48 my $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
50 # This is the base used for versioned names, like "perl5.6.0".
51 # It's separate because a common use of $PERLNAME is to install
52 # perl as "perl5", if that's used as base for versioned files you
54 my $perl_verbase = defined($ENV{PERLNAME_VERBASE})
55 ? $ENV{PERLNAME_VERBASE}
60 if ( defined $Config{usevmsdebug} ) {
61 if ( $Config{usevmsdebug} eq 'define' ) {
69 # This little hack simplifies making the code after the comment "Fetch some
70 # frequently-used items from %Config" warning free. With $opts{destdir} always
71 # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional.
74 # Consider refactoring this to use Getopt::Long once Getopt::Long's planned
75 # feature is implemented, to distinguish + and - options.
77 $opts{notify} = 1 if $ARGV[0] eq '-n';
78 $dostrip = 1 if $ARGV[0] eq '-s';
79 $versiononly = 1 if $ARGV[0] eq '-v';
80 $versiononly = 0 if $ARGV[0] eq '+v';
81 $opts{silent} = 1 if $ARGV[0] eq '-S';
82 $otherperls = 0 if $ARGV[0] eq '-o';
83 $force = 1 if $ARGV[0] eq '-f';
84 $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
85 $archname = 1 if $ARGV[0] eq '-A';
86 $nwinstall = 1 if $ARGV[0] eq '-netware';
87 $nopods = 1 if $ARGV[0] eq '-p';
88 $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
89 if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
92 -n Don't actually run any commands; just print them.
93 -s Run strip on installed binaries.
94 -v Only install perl as a binary with the version number in the name.
95 (Override whatever config.sh says)
96 +v Install perl as "perl" and as a binary with the version number in
97 the name. (Override whatever config.sh says)
99 -f Force installation (don't check if same version is there)
100 -o Skip checking for other copies of perl in your PATH.
102 -A Also install perl with the architecture's name in the perl binary's
104 -p Don't install the pod files. [This will break use diagnostics;]
105 -netware Install correctly on a Netware server.
106 -destdir Prefix installation directories by this string.
113 $versiononly = 1 if $Config{versiononly} && !defined $versiononly;
114 my (@scripts, @tolink);
115 open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
118 next if /a2p/; # a2p is binary, to be installed separately
120 if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
122 push @tolink, [$1, $2];
129 if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
131 # Specify here any .pm files that are actually architecture-dependent.
132 # (Those included with XS extensions under ext/ are automatically
134 # Now that the default privlib has the full perl version number included,
135 # we no longer have to play the trick of sticking version-specific .pm
136 # files under the archlib directory.
144 push(@scripts,'djgpp/fixpmain');
145 $archpms{config} = $archpms{filehand} = 1;
148 if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
149 push(@scripts, map("$_.exe", @scripts));
152 # Exclude nonxs extensions that are not architecture dependent
153 my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
155 my @ext_dirs = qw(cpan dist ext);
156 foreach my $ext_dir (@ext_dirs) {
158 if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) &&
159 ! grep { (my $dir = $_) =~ s/\//-/g;
160 $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs)
162 my($path, $modname) = ($1,$2);
164 # Change hyphenated name like Filter-Util-Call to nested
165 # directory name Filter/Util/Call
168 # strip to optional "/lib", or remove trailing component
169 $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{};
171 # strip any leading /
174 # reconstitute canonical module name
175 $modname = "$path/$modname" if length $path;
178 $archpms{$modname} = 1;
183 # print "[$_]\n" for sort keys %archpms;
185 my $ver = $Config{version};
186 my $release = substr($],0,3); # Not used currently.
187 my $patchlevel = substr($],3,2);
188 die "Patchlevel of perl ($patchlevel)",
189 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
190 if $patchlevel != $Config{'PERL_VERSION'};
192 # Fetch some frequently-used items from %Config
193 my $installbin = "$opts{destdir}$Config{installbin}";
194 my $installscript = "$opts{destdir}$Config{installscript}";
195 my $installprivlib = "$opts{destdir}$Config{installprivlib}";
196 my $installarchlib = "$opts{destdir}$Config{installarchlib}";
197 my $installsitelib = "$opts{destdir}$Config{installsitelib}";
198 my $installsitearch = "$opts{destdir}$Config{installsitearch}";
199 my $installman1dir = "$opts{destdir}$Config{installman1dir}";
200 my $man1ext = $Config{man1ext};
201 my $libperl = $Config{libperl};
202 # Shared library and dynamic loading suffixes.
203 my $so = $Config{so};
204 my $dlext = $Config{dlext};
205 my $dlsrc = $Config{dlsrc};
206 if ($^O eq 'os390') {
209 my $archlibexp = $Config{archlibexp};
210 my $usedl = $Config{usedl};
211 if ($usedl eq 'define') {
212 `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
217 # This is required only if we are installing on a NetWare server
218 $installscript = $Config{installnwscripts};
219 $installprivlib = $Config{installnwlib};
220 $installarchlib = $Config{installnwlib};
221 $installsitelib = $Config{installnwlib};
224 my $binexp = $Config{binexp};
226 if ($Is_VMS) { # Hang in there until File::Spec hits the big time
227 foreach ( \$installbin, \$installscript, \$installprivlib,
228 \$installarchlib, \$installsitelib, \$installsitearch,
230 $$_ = unixify($$_); $$_ =~ s:/$::;
234 # Do some quick sanity checks.
236 $installbin || die "No installbin directory in config.sh\n";
237 -d $installbin || mkpath($installbin, $opts{verbose}, 0777);
238 -d $installbin || $opts{notify} || die "$installbin is not a directory\n";
239 -w $installbin || $opts{notify} || die "$installbin is not writable by you\n"
240 unless $installbin =~ m#^/afs/# || $opts{notify};
244 -x 'perl' . $exe_ext || die "perl isn't executable!\n";
247 -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n";
249 -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n";
253 -f 't/rantests' || $Is_W32
254 || warn "WARNING: You've never run 'make test' or",
255 " some tests failed! (Installing anyway.)\n";
258 # This will be used to store the packlist
259 $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
261 if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
267 $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
270 if ($dlsrc ne "dl_none.xs") {
271 -f $perldll || die "No perl DLL built\n";
275 safe_unlink("$installbin/$perldll");
276 copy("$perldll", "$installbin/$perldll");
277 chmod(0755, "$installbin/$perldll");
278 $packlist->{"$Config{installbin}/$perldll"} = { type => 'file' };
279 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
281 # First we install the version-numbered executables.
284 safe_unlink("$installbin/perl_setup.com");
285 copy("perl_setup.com", "$installbin/perl_setup.com");
286 chmod(0755, "$installbin/perl_setup.com");
287 safe_unlink("$installbin/$dbg$perl$exe_ext");
288 copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
289 chmod(0755, "$installbin/$dbg$perl$exe_ext");
290 safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
291 copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
292 chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
294 safe_unlink("$installbin/$ndbg$perl$exe_ext");
295 copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
296 chmod(0755, "$installbin/$ndbg$perl$exe_ext");
297 safe_unlink("$installbin/${dbg}a2p$exe_ext");
298 copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
299 chmod(0755, "$installbin/${dbg}a2p$exe_ext");
302 elsif ($^O ne 'dos') {
304 safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
305 copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
306 strip("$installbin/$perl_verbase$ver$exe_ext");
307 chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
310 # If installing onto a NetWare server
312 # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
313 mkpath($Config{installnwsystem}, $opts{verbose}, 0777);
314 copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
315 copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
316 copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
317 copy("x2p\\a2p.nlm", $Config{installnwsystem});
318 chmod(0755, "$Config{installnwsystem}\\perl.nlm");
319 mkpath($Config{installnwlcgi}, $opts{verbose}, 0777);
320 copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
325 safe_unlink("$installbin/$perl.exe");
326 copy("perl.exe", "$installbin/$perl.exe");
329 # Install library files.
331 my $do_installarchlib = !samepath($installarchlib, 'lib');
332 my $do_installprivlib = !samepath($installprivlib, 'lib');
333 my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
334 $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
336 mkpath($installprivlib, $opts{verbose}, 0777);
337 mkpath($installarchlib, $opts{verbose}, 0777);
338 mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
339 mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
342 find({no_chdir => 1, wanted => \&installlib}, 'lib')
343 if $do_installarchlib || $do_installprivlib;
346 warn "Can't install lib files - 'lib/' does not exist";
349 # Install header files and libraries.
350 mkpath("$installarchlib/CORE", $opts{verbose}, 0777);
352 if ($Is_VMS) { # We did core file selection during build
353 my $coredir = "lib/$Config{archname}/$ver/CORE";
355 map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
357 elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
358 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
359 my $coredll = "$installarchlib/CORE/$libperl";
360 my $instcoredll = "$Config{installarchlib}/CORE/$libperl";
361 safe_unlink($coredll);
362 ( $Config{'d_link'} eq 'define' &&
364 CORE::link("$installbin/$libperl", $coredll);
365 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
370 symlink("$installbin/$libperl", $coredll);
371 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
374 ( copy("$installbin/$libperl", $coredll) &&
375 push(@corefiles, $instcoredll)
378 # [als] hard-coded 'libperl' name... not good!
379 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
381 # AIX needs perl.exp installed as well.
382 push(@corefiles,'perl.exp') if $^O eq 'aix';
384 foreach my $file (@corefiles) {
385 # HP-UX (at least) needs to maintain execute permissions
386 # on dynamically-loadable libraries. So we do it for all.
387 if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
388 if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
389 strip("-S", "$installarchlib/CORE/$file") if $^O eq 'darwin';
390 chmod(0555, "$installarchlib/CORE/$file");
392 chmod(0444, "$installarchlib/CORE/$file");
397 # Install main perl executables
398 # Make links to ordinary names if installbin directory isn't current directory.
400 if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
401 safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
403 # VOS doesn't support hard links, so use a symlink.
404 symlink("$installbin/$perl_verbase$ver$exe_ext",
405 "$installbin/$perl$exe_ext");
407 link("$installbin/$perl_verbase$ver$exe_ext",
408 "$installbin/$perl$exe_ext");
412 # For development purposes it can be very useful to have multiple perls
413 # build for different "architectures" (eg threading or not) simultaneously.
414 if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
415 my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
416 safe_unlink("$installbin/$archperl");
418 # VOS doesn't support hard links, so use a symlink.
419 symlink("$installbin/$perl_verbase$ver$exe_ext",
420 "$installbin/$archperl");
422 link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
426 # Offer to install perl in a "standard" location
428 my $mainperl_is_instperl = 0;
430 if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
431 !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
432 && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
433 my($usrbinperl) = "$mainperldir/$perl$exe_ext";
434 my($instperl) = "$installbin/$perl$exe_ext";
435 my($expinstperl) = "$binexp/$perl$exe_ext";
437 # First make sure $usrbinperl is not already the same as the perl we
439 if (-x $usrbinperl) {
440 # Try to be clever about mainperl being a symbolic link
441 # to binexp/perl if binexp and installbin are different.
442 $mainperl_is_instperl =
443 samepath($usrbinperl, $instperl) ||
444 samepath($usrbinperl, $expinstperl) ||
445 (($binexp ne $installbin) &&
447 ((readlink $usrbinperl) eq $expinstperl));
449 if (! $mainperl_is_instperl) {
451 ( $Config{'d_link'} eq 'define' &&
452 eval { CORE::link $instperl, $usrbinperl } ) ||
453 eval { symlink $expinstperl, $usrbinperl } ||
454 copy($instperl, $usrbinperl);
456 $mainperl_is_instperl = 1;
460 # Make links to ordinary names if installbin directory isn't current directory.
461 if (!$Is_NetWare && $dbg eq '') {
462 if (! samepath($installbin, 'x2p')) {
464 $base .= $ver if $versiononly;
465 safe_unlink("$installbin/$base$exe_ext");
466 copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
467 strip("$installbin/$base$exe_ext");
468 chmod(0755, "$installbin/$base$exe_ext");
472 # cppstdin is just a script, but it is architecture-dependent, so
473 # it can't safely be shared. Place it in $installbin.
474 # Note that Configure doesn't build cppstin if it isn't needed, so
475 # we skip this if cppstdin doesn't exist.
476 if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
477 safe_unlink("$installbin/cppstdin");
478 copy("cppstdin", "$installbin/cppstdin");
479 chmod(0755, "$installbin/cppstdin");
483 my ($installscript, $orig, $alias, $scr_ext) = @_;
485 safe_unlink("$installscript/$alias$scr_ext");
486 if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
487 copy("$installscript/$orig$scr_ext",
488 "$installscript/$alias$scr_ext");
489 } elsif ($^O eq 'vos') {
490 symlink("$installscript/$orig$scr_ext",
491 "$installscript/$alias$scr_ext");
493 link("$installscript/$orig$scr_ext",
494 "$installscript/$alias$scr_ext");
499 mkpath($installscript, $opts{verbose}, 0777);
502 (my $base = $_) =~ s#.*/##;
504 copy($_, "$installscript/$base");
505 chmod(0755, "$installscript/$base");
509 my ($from, $to) = map { "$_$ver" } @$_;
510 (my $frbase = $from) =~ s#.*/##;
511 (my $tobase = $to) =~ s#.*/##;
512 script_alias($installscript, $frbase, $tobase, $scr_ext);
516 (my $base = $_) =~ s#.*/##;
517 copy($_, "$installscript/$base");
518 chmod(0755, "$installscript/$base");
522 my ($from, $to) = @$_;
523 (my $frbase = $from) =~ s#.*/##;
524 (my $tobase = $to) =~ s#.*/##;
525 script_alias($installscript, $frbase, $tobase, $scr_ext);
529 # Install pod pages. Where? I guess in $installprivlib/pod
530 # ($installprivlib/pods for cygwin).
531 if (!$nopods && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) {
532 my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod';
533 mkpath("${installprivlib}/$pod", $opts{verbose}, 0777);
535 for (map {$_->[1]} @{get_pod_metadata()->{master}}) {
536 # $_ is a name like pod/perl.pod
537 (my $base = $_) =~ s#.*/##;
538 copy_if_diff($_, "${installprivlib}/$pod/${base}");
539 chmod(0644, "${installprivlib}/$pod/${base}");
544 # Check to make sure there aren't other perls around in installer's
545 # path. This is probably UNIX-specific. Check all absolute directories
546 # in the path except for where public executables are supposed to live.
547 # Also skip $mainperl if the user opted to have it be a link to the
550 if (!$versiononly && $otherperls) {
552 my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
553 ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
554 @path = split(/$dirsep/, $path);
557 while (exists $ENV{'DCL$PATH' . $i}) {
558 my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
566 # Use &samepath here because some systems have other dirs linked
567 # to $mainperldir (like SunOS)
569 next if samepath($_, $binexp);
570 next if samepath($_, cwd());
571 next if ($mainperl_is_instperl && samepath($_, $mainperldir));
572 my $otherperl = "$_/$perl$exe_ext";
573 next if $otherperls{$otherperl}++;
574 push(@otherperls, $otherperl)
575 if (-x $otherperl && ! -d $otherperl);
578 warn "\nWarning: $perl appears in your path in the following " .
579 "locations beyond where\nwe just installed it:\n";
588 $packlist->write() unless $opts{notify};
589 print " Installation complete\n" if $opts{verbose};
593 ###############################################################################
595 # If these are needed elsewhere, move them into install_lib.pl rather than
601 my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
602 print STDERR $prompt;
603 chop($answer = <STDIN>);
604 $answer = $default if $answer =~ m/^\s*$/;
605 ($answer =~ m/^[yY]/);
609 return if $opts{notify} or $Is_VMS;
611 foreach my $name (@names) {
612 next unless -e $name;
613 chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
614 print " unlink $name\n" if $opts{verbose};
615 next if CORE::unlink($name);
616 warn "Couldn't unlink $name: $!\n";
618 print " mv $name $name.old\n" if $opts{verbose};
619 safe_rename($name, "$name.old")
620 or warn "Couldn't rename $name: $!\n";
627 if (-f $to and not unlink($to)) {
629 for ($i = 1; $i < 50; $i++) {
630 last if rename($to, "$to.$i");
632 warn("Cannot rename to '$to.$i': $!"), return 0
633 if $i >= 50; # Give up!
635 link($from,$to) || return 0;
643 $xto =~ s/^\Q$opts{destdir}\E//;
644 print $opts{verbose} ? " cp $from $xto\n" : " $xto\n"
645 unless $opts{silent};
646 print " creating new version of $xto\n"
647 if $Is_VMS and -e $to and !$opts{silent};
648 unless ($opts{notify} or File::Copy::copy($from, $to)) {
649 # Might have been that F::C::c can't overwrite the target
650 warn "Couldn't copy $from to $to: $!\n"
651 unless -f $to and (chmod(0666, $to), unlink $to)
652 and File::Copy::copy($from, $to);
654 $packlist->{$xto} = { type => 'file' };
658 my $dir = $File::Find::dir;
664 # This remains ugly, and in need of refactoring.
666 # $name always starts as the leafname
667 # $dir is the directory *within* lib
668 # $name later has $dir pre-pended, to give the relative path in lib/
669 # which is used to create the path in the target directory.
671 # $_ was always the filename to use on disk. Adding no_chdir doesn't change
672 # this, as $_ becomes a pathname, and so still works. However, it's not
673 # obvious that $_ is needed later, and hence $_ must not be modified.
675 # Also, many of the regex exclusion tests below are now superfluous, as the
676 # files in question are either no longer in blead, or now in ext/, dist/ or
677 # cpan/ and not copied into lib/
679 # Ignore version control directories.
680 if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) {
681 $File::Find::prune = 1;
685 # ignore patch backups, RCS files, emacs backup & temp files and the
686 # .exists files, .PL files, and test files.
687 return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} ||
688 $dir =~ m{/t(?:/|$)};
689 # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
690 # scripts in lib/ExtUtils, the prove script in lib/Test/Harness,
691 # the corelist script from lib/Module/CoreList/bin and ptar* in
692 # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts
693 # and zipdetails in cpan/IO-Compress/bin
694 # (they're installed later with other utils)
695 return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|ptardiff|ptargrep|config_data|zipdetails)\z/;
696 # ignore the Makefiles
697 return if $name =~ /^makefile$/i;
698 # ignore the test extensions
699 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
700 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
701 # ignore the build support code
702 return if $name =~ /\bbuildcustomize\.pl$/;
703 # ignore the demo files
704 return if $dir =~ /\b(?:demos?|eg)\b/;
705 # ignore unneeded unicore files
706 if ( $dir =~ /^unicore/ ) {
707 if ( $name =~ /\.txt\z/ ) {
708 # We can ignore most, but not all .txt files
709 return unless $name =~ /\A(?:Blocks|SpecialCasing|NamedSequences)\.txt\z/;
712 # TestProp only needed during testing
713 return if $name =~ /\ATestProp.pl\z/;
714 # we need version and *.pl files and can skip the rest
715 return unless $name =~ /\A(?:version|\w+\.p[lm])\z/;
719 # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs.
720 # Changes.e2x and README.e2x are needed by enc2xs.
721 return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x';
722 return if $name =~ m{^(?:MANIFEST|META\.yml)$};
723 return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i;
724 return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i;
725 return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files
726 return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files
728 # if using a shared perl library then ignore:
729 # - static library files [of statically linked extensions];
730 # - import library files and export library files (only present on Win32
731 # anyway?) and empty bootstrap files [of dynamically linked extensions].
732 return if $Config{useshrplib} eq 'true' and
733 ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name));
735 $name = "$dir/$name" if $dir ne '';
737 # ignore pods that are stand alone documentation from dual life modules.
738 return if /\.pod\z/ && is_duplicate_pod($_);
740 return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
742 my $installlib = $installprivlib;
743 if ($dir =~ /^auto\// ||
744 ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
745 ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) ||
746 $name=~/^Config_(heavy|git)\.pl\z/
748 $installlib = $installarchlib;
749 return unless $do_installarchlib;
751 return unless $do_installprivlib;
754 if ($Is_NetWare && !$nwinstall && /\.(?:nlp|nlm|bs)$/) {
755 # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
756 # if copied will give problems when building new extensions.
757 # Has to be copied if we are installing on a NetWare server and
758 # hence the check !$nwinstall
763 my $xname = "$installlib/$name";
764 $xname =~ s/^\Q$opts{destdir}\E//;
765 $packlist->{$xname} = { type => 'file' };
766 if ($force || compare($_, "$installlib/$name") || $opts{notify}) {
767 unlink("$installlib/$name");
768 mkpath("$installlib/$dir", $opts{verbose}, 0777);
769 # HP-UX (at least) needs to maintain execute permissions
770 # on dynamically-loaded libraries.
771 if (copy_if_diff($_, "$installlib/$name")) {
772 strip("-S", "$installlib/$name")
773 if $^O eq 'darwin' and /\.(?:so|$dlext|a)$/;
774 chmod(/\.(so|$dlext)$/ ? 0555 : 0444, "$installlib/$name");
780 # Copy $from to $to, only if $from is different than $to.
781 # Also preserve modification times for .a libraries.
782 # On some systems, if you do
784 # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
785 # and then try to link against the installed libperl.a, you might
786 # get an error message to the effect that the symbol table is older
788 # Return true if copying occurred.
792 return 1 if (($^O eq 'VMS') && (-d $from));
794 $xto =~ s/^\Q$opts{destdir}\E//;
795 my $perlpodbadsymlink;
796 if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
799 # Some Linux implementations have problems traversing over
800 # multiple symlinks (when going over NFS?) and fail to read
801 # the symlink target. Combine this with the fact that some
802 # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
803 # and you end up with those pods not getting installed.
804 $perlpodbadsymlink = 1;
806 -f $from || $perlpodbadsymlink || warn "$0: $from not found";
807 $packlist->{$xto} = { type => 'file' };
808 if ($force || compare($from, $to) || $opts{notify}) {
809 safe_unlink($to); # In case we don't have write permissions.
810 if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
814 # Restore timestamps if it's a .a library or for OS/2.
815 if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) {
816 my ($atime, $mtime) = (stat $from)[8,9];
817 utime $atime, $mtime, $to;
827 return unless $dostrip;
830 while (@args && $args[0] =~ /^(-\w+)$/) {
831 push @opts, shift @args;
834 foreach my $file (@args) {
836 if ($opts{verbose}) {
837 print " strip " . join(' ', @opts);
838 print " " if (@opts);
841 system("strip", @opts, $file);
843 print "# file '$file' skipped\n" if $opts{verbose};
849 # cperl-indent-level: 4
850 # indent-tabs-mode: nil
853 # ex: set ts=8 sts=4 sw=4 et: