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);
18 # Not sure how easy it would be to refactor to remove the need for local $depth
23 if ($Is_VMS) { eval 'use VMS::Filespec;' }
26 my $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
32 use ExtUtils::Packlist;
40 # override the ones in the rest of the script
42 File::Path::mkpath(@_) unless $opts{notify};
45 my $mainperldir = "/usr/bin";
46 my $exe_ext = $Config{exe_ext};
48 # Allow "make install PERLNAME=something_besides_perl":
49 my $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
51 # This is the base used for versioned names, like "perl5.6.0".
52 # It's separate because a common use of $PERLNAME is to install
53 # perl as "perl5", if that's used as base for versioned files you
55 my $perl_verbase = defined($ENV{PERLNAME_VERBASE})
56 ? $ENV{PERLNAME_VERBASE}
61 if ( defined $Config{usevmsdebug} ) {
62 if ( $Config{usevmsdebug} eq 'define' ) {
70 # This little hack simplifies making the code after the comment "Fetch some
71 # frequently-used items from %Config" warning free. With $opts{destdir} always
72 # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional.
75 # Consider refactoring this to use Getopt::Long once Getopt::Long's planned
76 # feature is implemented, to distinguish + and - options.
78 $opts{notify} = 1 if $ARGV[0] eq '-n';
79 $dostrip = 1 if $ARGV[0] eq '-s';
80 $versiononly = 1 if $ARGV[0] eq '-v';
81 $versiononly = 0 if $ARGV[0] eq '+v';
82 $opts{silent} = 1 if $ARGV[0] eq '-S';
83 $otherperls = 0 if $ARGV[0] eq '-o';
84 $force = 1 if $ARGV[0] eq '-f';
85 $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
86 $archname = 1 if $ARGV[0] eq '-A';
87 $nwinstall = 1 if $ARGV[0] eq '-netware';
88 $nopods = 1 if $ARGV[0] eq '-p';
89 $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
90 if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
93 -n Don't actually run any commands; just print them.
94 -s Run strip on installed binaries.
95 -v Only install perl as a binary with the version number in the name.
96 (Override whatever config.sh says)
97 +v Install perl as "perl" and as a binary with the version number in
98 the name. (Override whatever config.sh says)
100 -f Force installation (don't check if same version is there)
101 -o Skip checking for other copies of perl in your PATH.
103 -A Also install perl with the architecture's name in the perl binary's
105 -p Don't install the pod files. [This will break use diagnostics;]
106 -netware Install correctly on a Netware server.
107 -destdir Prefix installation directories by this string.
114 $versiononly = 1 if $Config{versiononly} && !defined $versiononly;
115 my (@scripts, @tolink);
116 open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
119 next if /a2p/; # a2p is binary, to be installed separately
121 if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
123 push @tolink, [$1, $2];
130 if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
132 my @pods = $nopods ? () : (<pod/*.pod>, 'x2p/a2p.pod');
134 # Specify here any .pm files that are actually architecture-dependent.
135 # (Those included with XS extensions under ext/ are automatically
137 # Now that the default privlib has the full perl version number included,
138 # we no longer have to play the trick of sticking version-specific .pm
139 # files under the archlib directory.
147 push(@scripts,'djgpp/fixpmain');
148 $archpms{config} = $archpms{filehand} = 1;
151 if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
152 push(@scripts, map("$_.exe", @scripts));
155 # Exclude nonxs extensions that are not architecture dependent
156 my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
158 my @ext_dirs = qw(cpan dist ext);
159 foreach my $ext_dir (@ext_dirs) {
161 if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) &&
162 ! grep { (my $dir = $_) =~ s/\//-/g;
163 $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs)
165 my($path, $modname) = ($1,$2);
167 # Change hyphenated name like Filter-Util-Call to nested
168 # directory name Filter/Util/Call
171 # strip to optional "/lib", or remove trailing component
172 $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{};
174 # strip any leading /
177 # reconstitute canonical module name
178 $modname = "$path/$modname" if length $path;
181 $archpms{$modname} = 1;
186 # print "[$_]\n" for sort keys %archpms;
188 my $ver = $Config{version};
189 my $release = substr($],0,3); # Not used currently.
190 my $patchlevel = substr($],3,2);
191 die "Patchlevel of perl ($patchlevel)",
192 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
193 if $patchlevel != $Config{'PERL_VERSION'};
195 # Fetch some frequently-used items from %Config
196 my $installbin = "$opts{destdir}$Config{installbin}";
197 my $installscript = "$opts{destdir}$Config{installscript}";
198 my $installprivlib = "$opts{destdir}$Config{installprivlib}";
199 my $installarchlib = "$opts{destdir}$Config{installarchlib}";
200 my $installsitelib = "$opts{destdir}$Config{installsitelib}";
201 my $installsitearch = "$opts{destdir}$Config{installsitearch}";
202 my $installman1dir = "$opts{destdir}$Config{installman1dir}";
203 my $man1ext = $Config{man1ext};
204 my $libperl = $Config{libperl};
205 # Shared library and dynamic loading suffixes.
206 my $so = $Config{so};
207 my $dlext = $Config{dlext};
208 my $dlsrc = $Config{dlsrc};
209 if ($^O eq 'os390') {
212 my $archlibexp = $Config{archlibexp};
213 my $usedl = $Config{usedl};
214 if ($usedl eq 'define') {
215 `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
220 # This is required only if we are installing on a NetWare server
221 $installscript = $Config{installnwscripts};
222 $installprivlib = $Config{installnwlib};
223 $installarchlib = $Config{installnwlib};
224 $installsitelib = $Config{installnwlib};
227 my $binexp = $Config{binexp};
229 if ($Is_VMS) { # Hang in there until File::Spec hits the big time
230 foreach ( \$installbin, \$installscript, \$installprivlib,
231 \$installarchlib, \$installsitelib, \$installsitearch,
233 $$_ = unixify($$_); $$_ =~ s:/$::;
237 # Do some quick sanity checks.
239 $installbin || die "No installbin directory in config.sh\n";
240 -d $installbin || mkpath($installbin, $opts{verbose}, 0777);
241 -d $installbin || $opts{notify} || die "$installbin is not a directory\n";
242 -w $installbin || $opts{notify} || die "$installbin is not writable by you\n"
243 unless $installbin =~ m#^/afs/# || $opts{notify};
247 -x 'perl' . $exe_ext || die "perl isn't executable!\n";
250 -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n";
252 -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n";
256 -f 't/rantests' || $Is_W32
257 || warn "WARNING: You've never run 'make test' or",
258 " some tests failed! (Installing anyway.)\n";
261 # This will be used to store the packlist
262 $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
264 if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
270 $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
273 if ($dlsrc ne "dl_none.xs") {
274 -f $perldll || die "No perl DLL built\n";
278 safe_unlink("$installbin/$perldll");
279 copy("$perldll", "$installbin/$perldll");
280 chmod(0755, "$installbin/$perldll");
281 $packlist->{"$installbin/$perldll"} = { type => 'file' };
282 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
284 # First we install the version-numbered executables.
287 safe_unlink("$installbin/perl_setup.com");
288 copy("perl_setup.com", "$installbin/perl_setup.com");
289 chmod(0755, "$installbin/perl_setup.com");
290 safe_unlink("$installbin/$dbg$perl$exe_ext");
291 copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
292 chmod(0755, "$installbin/$dbg$perl$exe_ext");
293 safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
294 copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
295 chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
297 safe_unlink("$installbin/$ndbg$perl$exe_ext");
298 copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
299 chmod(0755, "$installbin/$ndbg$perl$exe_ext");
300 safe_unlink("$installbin/${dbg}a2p$exe_ext");
301 copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
302 chmod(0755, "$installbin/${dbg}a2p$exe_ext");
305 elsif ($^O eq 'mpeix') {
306 # MPE lacks hard links and requires that executables with special
307 # capabilities reside in the MPE namespace.
308 safe_unlink("$installbin/perl$ver$exe_ext", $Config{perlpath});
309 # Install the primary executable into the MPE namespace as perlpath.
310 copy("perl$exe_ext", $Config{perlpath});
311 chmod(0755, $Config{perlpath});
312 # Create a backup copy with the version number.
313 link($Config{perlpath}, "$installbin/perl$ver$exe_ext");
315 elsif ($^O ne 'dos') {
317 safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
318 copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
319 strip("$installbin/$perl_verbase$ver$exe_ext");
320 chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
323 # If installing onto a NetWare server
325 # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
326 mkpath($Config{installnwsystem}, $opts{verbose}, 0777);
327 copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
328 copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
329 copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
330 copy("x2p\\a2p.nlm", $Config{installnwsystem});
331 chmod(0755, "$Config{installnwsystem}\\perl.nlm");
332 mkpath($Config{installnwlcgi}, $opts{verbose}, 0777);
333 copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
338 safe_unlink("$installbin/$perl.exe");
339 copy("perl.exe", "$installbin/$perl.exe");
342 # Install library files.
344 my $do_installarchlib = !samepath($installarchlib, 'lib');
345 my $do_installprivlib = !samepath($installprivlib, 'lib');
346 my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
347 $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
349 mkpath($installprivlib, $opts{verbose}, 0777);
350 mkpath($installarchlib, $opts{verbose}, 0777);
351 mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
352 mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
355 if ($do_installarchlib || $do_installprivlib) {
356 find(\&installlib, '.');
358 chdir ".." || die "Can't cd back to source directory: $!\n";
361 warn "Can't cd to lib to install lib files: $!\n";
364 # Install header files and libraries.
365 mkpath("$installarchlib/CORE", $opts{verbose}, 0777);
367 if ($Is_VMS) { # We did core file selection during build
368 my $coredir = "lib/$Config{archname}/$ver/CORE";
370 map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
372 elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
373 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
374 my $coredll = "$installarchlib/CORE/$libperl";
375 safe_unlink($coredll);
376 ( $Config{'d_link'} eq 'define' &&
378 CORE::link("$installbin/$libperl", $coredll);
379 $packlist->{$coredll} = { from => "$installbin/$libperl",
384 symlink("$installbin/$libperl", $coredll);
385 $packlist->{$coredll} = { from => "$installbin/$libperl",
388 ( copy("$installbin/$libperl", $coredll) &&
389 push(@corefiles, $coredll)
392 # [als] hard-coded 'libperl' name... not good!
393 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
395 # AIX needs perl.exp installed as well.
396 push(@corefiles,'perl.exp') if $^O eq 'aix';
397 if ($^O eq 'mpeix') {
398 # MPE needs mpeixish.h installed as well.
399 mkpath("$installarchlib/CORE/mpeix", $opts{verbose}, 0777);
400 push(@corefiles,'mpeix/mpeixish.h');
403 foreach my $file (@corefiles) {
404 # HP-UX (at least) needs to maintain execute permissions
405 # on dynamically-loadable libraries. So we do it for all.
406 if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
407 if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
408 strip("-S", "$installarchlib/CORE/$file") if $^O =~ /^(rhapsody|darwin)$/;
409 chmod(0555, "$installarchlib/CORE/$file");
411 chmod(0444, "$installarchlib/CORE/$file");
416 # Install main perl executables
417 # Make links to ordinary names if installbin directory isn't current directory.
419 if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
420 safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
421 if ($^O eq 'mpeix') {
422 # MPE doesn't support hard links, so use a symlink.
423 # We don't want another cloned copy.
424 symlink($Config{perlpath}, "$installbin/perl$exe_ext");
425 } elsif ($^O eq 'vos') {
426 # VOS doesn't support hard links, so use a symlink.
427 symlink("$installbin/$perl_verbase$ver$exe_ext",
428 "$installbin/$perl$exe_ext");
430 link("$installbin/$perl_verbase$ver$exe_ext",
431 "$installbin/$perl$exe_ext");
435 # For development purposes it can be very useful to have multiple perls
436 # build for different "architectures" (eg threading or not) simultaneously.
437 if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
438 my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
439 safe_unlink("$installbin/$archperl");
440 if ($^O eq 'mpeix') {
441 # MPE doesn't support hard links, so use a symlink.
442 # We don't want another cloned copy.
443 symlink($Config{perlpath}, "$installbin/$archperl");
444 } elsif ($^O eq 'vos') {
445 # VOS doesn't support hard links, so use a symlink.
446 symlink("$installbin/$perl_verbase$ver$exe_ext",
447 "$installbin/$archperl");
449 link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
453 # Offer to install perl in a "standard" location
455 my $mainperl_is_instperl = 0;
457 if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
458 !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
459 && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
460 my($usrbinperl) = "$mainperldir/$perl$exe_ext";
461 my($instperl) = "$installbin/$perl$exe_ext";
462 my($expinstperl) = "$binexp/$perl$exe_ext";
464 # First make sure $usrbinperl is not already the same as the perl we
466 if (-x $usrbinperl) {
467 # Try to be clever about mainperl being a symbolic link
468 # to binexp/perl if binexp and installbin are different.
469 $mainperl_is_instperl =
470 samepath($usrbinperl, $instperl) ||
471 samepath($usrbinperl, $expinstperl) ||
472 (($binexp ne $installbin) &&
474 ((readlink $usrbinperl) eq $expinstperl));
476 if (! $mainperl_is_instperl) {
478 ( $Config{'d_link'} eq 'define' &&
479 eval { CORE::link $instperl, $usrbinperl } ) ||
480 eval { symlink $expinstperl, $usrbinperl } ||
481 copy($instperl, $usrbinperl);
483 $mainperl_is_instperl = 1;
487 # Make links to ordinary names if installbin directory isn't current directory.
488 if (!$Is_NetWare && $dbg eq '') {
489 if (! samepath($installbin, 'x2p')) {
491 $base .= $ver if $versiononly;
492 safe_unlink("$installbin/$base$exe_ext");
493 copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
494 strip("$installbin/$base$exe_ext");
495 chmod(0755, "$installbin/$base$exe_ext");
499 # cppstdin is just a script, but it is architecture-dependent, so
500 # it can't safely be shared. Place it in $installbin.
501 # Note that Configure doesn't build cppstin if it isn't needed, so
502 # we skip this if cppstdin doesn't exist.
503 if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
504 safe_unlink("$installbin/cppstdin");
505 copy("cppstdin", "$installbin/cppstdin");
506 chmod(0755, "$installbin/cppstdin");
510 my ($installscript, $orig, $alias, $scr_ext) = @_;
512 safe_unlink("$installscript/$alias$scr_ext");
513 if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
514 copy("$installscript/$orig$scr_ext",
515 "$installscript/$alias$scr_ext");
516 } elsif ($^O eq 'vos') {
517 symlink("$installscript/$orig$scr_ext",
518 "$installscript/$alias$scr_ext");
520 link("$installscript/$orig$scr_ext",
521 "$installscript/$alias$scr_ext");
526 mkpath($installscript, $opts{verbose}, 0777);
529 (my $base = $_) =~ s#.*/##;
531 copy($_, "$installscript/$base");
532 chmod(0755, "$installscript/$base");
536 my ($from, $to) = map { "$_$ver" } @$_;
537 (my $frbase = $from) =~ s#.*/##;
538 (my $tobase = $to) =~ s#.*/##;
539 script_alias($installscript, $frbase, $tobase, $scr_ext);
543 (my $base = $_) =~ s#.*/##;
544 copy($_, "$installscript/$base");
545 chmod(0755, "$installscript/$base");
549 my ($from, $to) = @$_;
550 (my $frbase = $from) =~ s#.*/##;
551 (my $tobase = $to) =~ s#.*/##;
552 script_alias($installscript, $frbase, $tobase, $scr_ext);
556 # Install pod pages. Where? I guess in $installprivlib/pod
557 # ($installprivlib/pods for cygwin).
559 my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod';
560 if ( !$versiononly || ($installprivlib =~ m/\Q$vershort/)) {
561 mkpath("${installprivlib}/$pod", $opts{verbose}, 0777);
564 # $_ is a name like pod/perl.pod
565 (my $base = $_) =~ s#.*/##;
566 copy_if_diff($_, "${installprivlib}/$pod/${base}");
571 # Check to make sure there aren't other perls around in installer's
572 # path. This is probably UNIX-specific. Check all absolute directories
573 # in the path except for where public executables are supposed to live.
574 # Also skip $mainperl if the user opted to have it be a link to the
577 if (!$versiononly && $otherperls) {
579 my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
580 ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
581 @path = split(/$dirsep/, $path);
584 while (exists $ENV{'DCL$PATH' . $i}) {
585 my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
593 # Use &samepath here because some systems have other dirs linked
594 # to $mainperldir (like SunOS)
596 next if samepath($_, $binexp);
597 next if samepath($_, cwd());
598 next if ($mainperl_is_instperl && samepath($_, $mainperldir));
599 my $otherperl = "$_/$perl$exe_ext";
600 next if $otherperls{$otherperl}++;
601 push(@otherperls, $otherperl)
602 if (-x $otherperl && ! -d $otherperl);
605 warn "\nWarning: $perl appears in your path in the following " .
606 "locations beyond where\nwe just installed it:\n";
615 $packlist->write() unless $opts{notify};
616 print " Installation complete\n" if $opts{verbose};
620 ###############################################################################
622 # If these are needed elsewhere, move them into install_lib.pl rather than
628 my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
629 print STDERR $prompt;
630 chop($answer = <STDIN>);
631 $answer = $default if $answer =~ m/^\s*$/;
632 ($answer =~ m/^[yY]/);
636 return if $opts{notify} or $Is_VMS;
638 foreach my $name (@names) {
639 next unless -e $name;
640 chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
641 print " unlink $name\n" if $opts{verbose};
642 next if CORE::unlink($name);
643 warn "Couldn't unlink $name: $!\n";
645 print " mv $name $name.old\n" if $opts{verbose};
646 safe_rename($name, "$name.old")
647 or warn "Couldn't rename $name: $!\n";
654 if (-f $to and not unlink($to)) {
656 for ($i = 1; $i < 50; $i++) {
657 last if rename($to, "$to.$i");
659 warn("Cannot rename to '$to.$i': $!"), return 0
660 if $i >= 50; # Give up!
662 link($from,$to) || return 0;
670 $xto =~ s/^\Q$opts{destdir}\E//;
671 print $opts{verbose} ? " cp $from $xto\n" : " $xto\n"
672 unless $opts{silent};
673 print " creating new version of $xto\n"
674 if $Is_VMS and -e $to and !$opts{silent};
675 unless ($opts{notify} or File::Copy::copy($from, $to)) {
676 # Might have been that F::C::c can't overwrite the target
677 warn "Couldn't copy $from to $to: $!\n"
678 unless -f $to and (chmod(0666, $to), unlink $to)
679 and File::Copy::copy($from, $to);
681 $packlist->{$xto} = { type => 'file' };
685 my $dir = $File::Find::dir;
686 $dir =~ s#^\.(?![^/])/?##;
687 local($depth) = $dir ? "lib/$dir/" : "lib/";
691 # Ignore version control directories.
692 if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) {
693 $File::Find::prune = 1;
697 # ignore patch backups, RCS files, emacs backup & temp files and the
698 # .exists files, .PL files, and test files.
699 return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} ||
700 $dir =~ m{/t(?:/|$)};
701 # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
702 # scripts in lib/ExtUtils, the prove script in lib/Test/Harness,
703 # the corelist script from lib/Module/CoreList/bin and ptar* in
704 # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts
705 # and zipdetails in cpan/IO-Compress/bin
706 # (they're installed later with other utils)
707 return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|cpan2dist|cpanp|cpanp-run-perl|ptardiff|ptargrep|config_data|zipdetails)\z/;
708 # ignore the Makefiles
709 return if $name =~ /^makefile$/i;
710 # ignore the test extensions
711 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
712 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
713 # ignore the build support code
714 return if $name =~ /\bbuildcustomize\.pl$/;
715 # ignore the demo files
716 return if $dir =~ /\b(?:demos?|eg)\b/;
717 # ignore unneeded unicore files
718 if ( $dir =~ /^unicore/ ) {
719 if ( $name =~ /\.txt\z/ ) {
720 # We can ignore most, but not all .txt files
721 return unless $name =~ /\A(?:Blocks|CaseFolding|SpecialCasing|NamedSequences)\.txt\z/;
724 # TestProp only needed during testing
725 return if $name =~ /\ATestProp.pl\z/;
726 # we need version and *.pl files and can skip the rest
727 return unless $name =~ /\A(?:version|\w+\.p[lm])\z/;
731 # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs.
732 # Changes.e2x and README.e2x are needed by enc2xs.
733 return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x';
734 return if $name =~ m{^(?:MANIFEST|META\.yml)$};
735 return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i;
736 return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i;
737 return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files
738 return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files
740 # if using a shared perl library then ignore:
741 # - static library files [of statically linked extensions];
742 # - import library files and export library files (only present on Win32
743 # anyway?) and empty bootstrap files [of dynamically linked extensions].
744 return if $Config{useshrplib} eq 'true' and
745 ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name));
747 $name = "$dir/$name" if $dir ne '';
749 return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
751 my $installlib = $installprivlib;
752 if ($dir =~ /^auto\// ||
753 ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
754 ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) ||
755 $name=~/^Config_(heavy|git)\.pl\z/
757 $installlib = $installarchlib;
758 return unless $do_installarchlib;
760 return unless $do_installprivlib;
763 if ($Is_NetWare && !$nwinstall && /\.(?:nlp|nlm|bs)$/) {
764 # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
765 # if copied will give problems when building new extensions.
766 # Has to be copied if we are installing on a NetWare server and
767 # hence the check !$nwinstall
772 if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$])) {
773 $installlib = $installprivlib;
774 #We're installing *.al and *.ix files into $installprivlib,
775 #but we have to delete old *.al and *.ix files from the 5.000
777 #This might not work because $archname might have changed.
778 unlink("$installarchlib/$name");
780 my $xname = "$installlib/$name";
781 $xname =~ s/^\Q$opts{destdir}\E//;
782 $packlist->{$xname} = { type => 'file' };
783 if ($force || compare($_, "$installlib/$name") || $opts{notify}) {
784 unlink("$installlib/$name");
785 mkpath("$installlib/$dir", $opts{verbose}, 0777);
786 # HP-UX (at least) needs to maintain execute permissions
787 # on dynamically-loaded libraries.
788 if (copy_if_diff($_, "$installlib/$name")) {
789 strip("-S", "$installlib/$name")
790 if $^O =~ /^(rhapsody|darwin)$/ and /\.(?:so|$dlext|a)$/;
791 chmod(/\.(so|$dlext)$/ ? 0555 : 0444, "$installlib/$name");
797 # Copy $from to $to, only if $from is different than $to.
798 # Also preserve modification times for .a libraries.
799 # On some systems, if you do
801 # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
802 # and then try to link against the installed libperl.a, you might
803 # get an error message to the effect that the symbol table is older
805 # Return true if copying occurred.
809 return 1 if (($^O eq 'VMS') && (-d $from));
811 $xto =~ s/^\Q$opts{destdir}\E//;
812 my $perlpodbadsymlink;
813 if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
816 # Some Linux implementations have problems traversing over
817 # multiple symlinks (when going over NFS?) and fail to read
818 # the symlink target. Combine this with the fact that some
819 # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
820 # and you end up with those pods not getting installed.
821 $perlpodbadsymlink = 1;
823 -f $from || $perlpodbadsymlink || warn "$0: $from not found";
824 $packlist->{$xto} = { type => 'file' };
825 if ($force || compare($from, $to) || $opts{notify}) {
826 safe_unlink($to); # In case we don't have write permissions.
828 $from = $depth . $from if $depth;
830 if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
834 # Restore timestamps if it's a .a library or for OS/2.
835 if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) {
836 my ($atime, $mtime) = (stat $from)[8,9];
837 utime $atime, $mtime, $to;
847 return unless $dostrip;
850 while (@args && $args[0] =~ /^(-\w+)$/) {
851 push @opts, shift @args;
854 foreach my $file (@args) {
856 if ($opts{verbose}) {
857 print " strip " . join(' ', @opts);
858 print " " if (@opts);
861 system("strip", @opts, $file);
863 print "# file '$file' skipped\n" if $opts{verbose};
869 # cperl-indent-level: 4
870 # indent-tabs-mode: nil
873 # ex: set ts=8 sts=4 sw=4 et: