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
19 if ($Is_VMS) { eval 'use VMS::Filespec;' }
22 my $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : '');
28 use ExtUtils::Packlist;
31 require './Porting/pod_lib.pl';
38 # override the ones in the rest of the script
40 File::Path::mkpath(@_) unless $opts{notify};
43 my $mainperldir = "/usr/bin";
44 my $exe_ext = $Config{exe_ext};
46 # Allow "make install PERLNAME=something_besides_perl":
47 my $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl';
49 # This is the base used for versioned names, like "perl5.6.0".
50 # It's separate because a common use of $PERLNAME is to install
51 # perl as "perl5", if that's used as base for versioned files you
53 my $perl_verbase = defined($ENV{PERLNAME_VERBASE})
54 ? $ENV{PERLNAME_VERBASE}
59 if ( defined $Config{usevmsdebug} ) {
60 if ( $Config{usevmsdebug} eq 'define' ) {
67 # This little hack simplifies making the code after the comment "Fetch some
68 # frequently-used items from %Config" warning free. With $opts{destdir} always
69 # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional.
72 # Consider refactoring this to use Getopt::Long once Getopt::Long's planned
73 # feature is implemented, to distinguish + and - options.
75 $opts{notify} = 1 if $ARGV[0] eq '-n';
76 $opts{dostrip} = 1 if $ARGV[0] eq '-s';
77 $versiononly = 1 if $ARGV[0] eq '-v';
78 $versiononly = 0 if $ARGV[0] eq '+v';
79 $opts{silent} = 1 if $ARGV[0] eq '-S';
80 $opts{'skip-otherperls'} = 1 if $ARGV[0] eq '-o';
81 $opts{force} = 1 if $ARGV[0] eq '-f';
82 $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n';
83 $opts{archname} = 1 if $ARGV[0] eq '-A';
84 $opts{netware} = 1 if $ARGV[0] eq '-netware';
85 $opts{nopods} = 1 if $ARGV[0] eq '-p';
86 $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/;
87 if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) {
90 -n Don't actually run any commands; just print them.
91 -s Run strip on installed binaries.
92 -v Only install perl as a binary with the version number in the name.
93 (Override whatever config.sh says)
94 +v Install perl as "perl" and as a binary with the version number in
95 the name. (Override whatever config.sh says)
97 -f Force installation (don't check if same version is there)
98 -o Skip checking for other copies of perl in your PATH.
100 -A Also install perl with the architecture's name in the perl binary's
102 -p Don't install the pod files. [This will break use diagnostics;]
103 -netware Install correctly on a Netware server.
104 -destdir Prefix installation directories by this string.
111 $versiononly = 1 if $Config{versiononly} && !defined $versiononly;
112 my (@scripts, @tolink);
113 open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!";
116 next if /a2p/; # a2p is binary, to be installed separately
118 if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) {
120 push @tolink, [$1, $2];
127 if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; }
129 # Specify here any .pm files that are actually architecture-dependent.
130 # (Those included with XS extensions under ext/ are automatically
132 # Now that the default privlib has the full perl version number included,
133 # we no longer have to play the trick of sticking version-specific .pm
134 # files under the archlib directory.
142 push(@scripts,'djgpp/fixpmain');
143 $archpms{config} = $archpms{filehand} = 1;
146 if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) {
147 push(@scripts, map("$_.exe", @scripts));
150 # Exclude nonxs extensions that are not architecture dependent
151 my @nonxs = grep(!/^Errno$/, split(' ', $Config{'nonxs_ext'}));
153 my @ext_dirs = qw(cpan dist ext);
154 foreach my $ext_dir (@ext_dirs) {
156 if (($File::Find::name =~ m{^$ext_dir\b(.*)/([^/]+)\.pm$}) &&
157 ! grep { (my $dir = $_) =~ s/\//-/g;
158 $File::Find::name =~ /^$ext_dir\/$dir\// } @nonxs)
160 my($path, $modname) = ($1,$2);
162 # Change hyphenated name like Filter-Util-Call to nested
163 # directory name Filter/Util/Call
166 # strip to optional "/lib", or remove trailing component
167 $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{};
169 # strip any leading /
172 # reconstitute canonical module name
173 $modname = "$path/$modname" if length $path;
176 $archpms{$modname} = 1;
181 # print "[$_]\n" for sort keys %archpms;
183 my $ver = $Config{version};
184 my $release = substr($],0,3); # Not used currently.
185 my $patchlevel = substr($],3,2);
186 die "Patchlevel of perl ($patchlevel)",
187 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
188 if $patchlevel != $Config{'PERL_VERSION'};
190 # Fetch some frequently-used items from %Config
191 my $installbin = "$opts{destdir}$Config{installbin}";
192 my $installscript = "$opts{destdir}$Config{installscript}";
193 my $installprivlib = "$opts{destdir}$Config{installprivlib}";
194 my $installarchlib = "$opts{destdir}$Config{installarchlib}";
195 my $installsitelib = "$opts{destdir}$Config{installsitelib}";
196 my $installsitearch = "$opts{destdir}$Config{installsitearch}";
197 my $installman1dir = "$opts{destdir}$Config{installman1dir}";
198 my $man1ext = $Config{man1ext};
199 my $libperl = $Config{libperl};
200 # Shared library and dynamic loading suffixes.
201 my $so = $Config{so};
202 my $dlext = $Config{dlext};
203 my $dlsrc = $Config{dlsrc};
204 if ($^O eq 'os390') {
207 my $archlibexp = $Config{archlibexp};
208 my $usedl = $Config{usedl};
209 if ($usedl eq 'define') {
210 `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`;
214 if ($opts{netware}) {
215 # This is required only if we are installing on a NetWare server
216 $installscript = $Config{installnwscripts};
217 $installprivlib = $Config{installnwlib};
218 $installarchlib = $Config{installnwlib};
219 $installsitelib = $Config{installnwlib};
222 my $binexp = $Config{binexp};
224 if ($Is_VMS) { # Hang in there until File::Spec hits the big time
225 foreach ( \$installbin, \$installscript, \$installprivlib,
226 \$installarchlib, \$installsitelib, \$installsitearch,
228 $$_ = unixify($$_); $$_ =~ s:/$::;
232 # Do some quick sanity checks.
234 $installbin || die "No installbin directory in config.sh\n";
235 -d $installbin || mkpath($installbin, $opts{verbose}, 0777);
236 -d $installbin || $opts{notify} || die "$installbin is not a directory\n";
237 -w $installbin || $opts{notify} || die "$installbin is not writable by you\n"
238 unless $installbin =~ m#^/afs/# || $opts{notify};
242 -x 'perl' . $exe_ext || die "perl isn't executable!\n";
245 -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n";
247 -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n";
251 -f 't/rantests' || $Is_W32
252 || warn "WARNING: You've never run 'make test' or",
253 " some tests failed! (Installing anyway.)\n";
256 # This will be used to store the packlist
257 $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist");
259 if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) {
265 $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext;
268 if ($dlsrc ne "dl_none.xs") {
269 -f $perldll || die "No perl DLL built\n";
273 safe_unlink("$installbin/$perldll");
274 copy("$perldll", "$installbin/$perldll");
275 chmod(0755, "$installbin/$perldll");
276 $packlist->{"$Config{installbin}/$perldll"} = { type => 'file' };
277 } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin)
279 # First we install the version-numbered executables.
282 safe_unlink("$installbin/perl_setup.com");
283 copy("perl_setup.com", "$installbin/perl_setup.com");
284 chmod(0755, "$installbin/perl_setup.com");
285 safe_unlink("$installbin/$dbg$perl$exe_ext");
286 copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext");
287 chmod(0755, "$installbin/$dbg$perl$exe_ext");
288 safe_unlink("$installbin/$dbg${perl}shr$exe_ext");
289 copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext");
290 chmod(0755, "$installbin/$dbg${perl}shr$exe_ext");
292 safe_unlink("$installbin/$ndbg$perl$exe_ext");
293 copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext");
294 chmod(0755, "$installbin/$ndbg$perl$exe_ext");
295 safe_unlink("$installbin/${dbg}a2p$exe_ext");
296 copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext");
297 chmod(0755, "$installbin/${dbg}a2p$exe_ext");
300 elsif ($^O ne 'dos') {
302 safe_unlink("$installbin/$perl_verbase$ver$exe_ext");
303 copy("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext");
304 strip("$installbin/$perl_verbase$ver$exe_ext");
305 chmod(0755, "$installbin/$perl_verbase$ver$exe_ext");
308 # If installing onto a NetWare server
309 if ($opts{netware}) {
310 # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm
311 mkpath($Config{installnwsystem}, $opts{verbose}, 0777);
312 copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem});
313 copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem});
314 copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem});
315 copy("x2p\\a2p.nlm", $Config{installnwsystem});
316 chmod(0755, "$Config{installnwsystem}\\perl.nlm");
317 mkpath($Config{installnwlcgi}, $opts{verbose}, 0777);
318 copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi});
323 safe_unlink("$installbin/$perl.exe");
324 copy("perl.exe", "$installbin/$perl.exe");
327 # Install library files.
329 my $do_installarchlib = !samepath($installarchlib, 'lib');
330 my $do_installprivlib = !samepath($installprivlib, 'lib');
331 my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver;
332 $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
334 mkpath($installprivlib, $opts{verbose}, 0777);
335 mkpath($installarchlib, $opts{verbose}, 0777);
336 mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib);
337 mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch);
340 find({no_chdir => 1, wanted => \&installlib}, 'lib')
341 if $do_installarchlib || $do_installprivlib;
344 warn "Can't install lib files - 'lib/' does not exist";
347 # Install header files and libraries.
348 mkpath("$installarchlib/CORE", $opts{verbose}, 0777);
350 if ($Is_VMS) { # We did core file selection during build
351 my $coredir = "lib/$Config{archname}/$ver/CORE";
353 map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>;
355 elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
356 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
357 my $coredll = "$installarchlib/CORE/$libperl";
358 my $instcoredll = "$Config{installarchlib}/CORE/$libperl";
359 safe_unlink($coredll);
360 ( $Config{'d_link'} eq 'define' &&
362 CORE::link("$installbin/$libperl", $coredll);
363 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
368 symlink("$installbin/$libperl", $coredll);
369 $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl",
372 ( copy("$installbin/$libperl", $coredll) &&
373 push(@corefiles, $instcoredll)
376 # [als] hard-coded 'libperl' name... not good!
377 @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>;
379 # AIX needs perl.exp installed as well.
380 push(@corefiles,'perl.exp') if $^O eq 'aix';
382 foreach my $file (@corefiles) {
383 # HP-UX (at least) needs to maintain execute permissions
384 # on dynamically-loadable libraries. So we do it for all.
385 if (copy_if_diff($file,"$installarchlib/CORE/$file")) {
386 if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) {
387 strip("-S", "$installarchlib/CORE/$file") if $^O eq 'darwin';
388 chmod(0555, "$installarchlib/CORE/$file");
390 chmod(0444, "$installarchlib/CORE/$file");
395 # Install main perl executables
396 # Make links to ordinary names if installbin directory isn't current directory.
398 if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) {
399 safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext");
401 # VOS doesn't support hard links, so use a symlink.
402 symlink("$installbin/$perl_verbase$ver$exe_ext",
403 "$installbin/$perl$exe_ext");
405 link("$installbin/$perl_verbase$ver$exe_ext",
406 "$installbin/$perl$exe_ext");
410 # For development purposes it can be very useful to have multiple perls
411 # build for different "architectures" (eg threading or not) simultaneously.
412 if ($opts{archname} && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) {
413 my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext";
414 safe_unlink("$installbin/$archperl");
416 # VOS doesn't support hard links, so use a symlink.
417 symlink("$installbin/$perl_verbase$ver$exe_ext",
418 "$installbin/$archperl");
420 link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl");
424 # Offer to install perl in a "standard" location
426 my $mainperl_is_instperl = 0;
428 if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' &&
429 !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR
430 && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
431 my($usrbinperl) = "$mainperldir/$perl$exe_ext";
432 my($instperl) = "$installbin/$perl$exe_ext";
433 my($expinstperl) = "$binexp/$perl$exe_ext";
435 # First make sure $usrbinperl is not already the same as the perl we
437 if (-x $usrbinperl) {
438 # Try to be clever about mainperl being a symbolic link
439 # to binexp/perl if binexp and installbin are different.
440 $mainperl_is_instperl =
441 samepath($usrbinperl, $instperl) ||
442 samepath($usrbinperl, $expinstperl) ||
443 (($binexp ne $installbin) &&
445 ((readlink $usrbinperl) eq $expinstperl));
447 if (! $mainperl_is_instperl) {
449 ( $Config{'d_link'} eq 'define' &&
450 eval { CORE::link $instperl, $usrbinperl } ) ||
451 eval { symlink $expinstperl, $usrbinperl } ||
452 copy($instperl, $usrbinperl);
454 $mainperl_is_instperl = 1;
458 # Make links to ordinary names if installbin directory isn't current directory.
459 if (!$Is_NetWare && $dbg eq '') {
460 if (! samepath($installbin, 'x2p')) {
462 $base .= $ver if $versiononly;
463 safe_unlink("$installbin/$base$exe_ext");
464 copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext");
465 strip("$installbin/$base$exe_ext");
466 chmod(0755, "$installbin/$base$exe_ext");
470 # cppstdin is just a script, but it is architecture-dependent, so
471 # it can't safely be shared. Place it in $installbin.
472 # Note that Configure doesn't build cppstin if it isn't needed, so
473 # we skip this if cppstdin doesn't exist.
474 if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
475 safe_unlink("$installbin/cppstdin");
476 copy("cppstdin", "$installbin/cppstdin");
477 chmod(0755, "$installbin/cppstdin");
481 my ($installscript, $orig, $alias, $scr_ext) = @_;
483 safe_unlink("$installscript/$alias$scr_ext");
484 if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') {
485 copy("$installscript/$orig$scr_ext",
486 "$installscript/$alias$scr_ext");
487 } elsif ($^O eq 'vos') {
488 symlink("$installscript/$orig$scr_ext",
489 "$installscript/$alias$scr_ext");
491 link("$installscript/$orig$scr_ext",
492 "$installscript/$alias$scr_ext");
497 mkpath($installscript, $opts{verbose}, 0777);
500 (my $base = $_) =~ s#.*/##;
502 copy($_, "$installscript/$base");
503 chmod(0755, "$installscript/$base");
507 my ($from, $to) = map { "$_$ver" } @$_;
508 (my $frbase = $from) =~ s#.*/##;
509 (my $tobase = $to) =~ s#.*/##;
510 script_alias($installscript, $frbase, $tobase, $scr_ext);
514 (my $base = $_) =~ s#.*/##;
515 copy($_, "$installscript/$base");
516 chmod(0755, "$installscript/$base");
520 my ($from, $to) = @$_;
521 (my $frbase = $from) =~ s#.*/##;
522 (my $tobase = $to) =~ s#.*/##;
523 script_alias($installscript, $frbase, $tobase, $scr_ext);
527 # Install pod pages. Where? I guess in $installprivlib/pod
528 # ($installprivlib/pods for cygwin).
529 if (!$opts{nopods} && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) {
530 my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod';
531 mkpath("${installprivlib}/$pod", $opts{verbose}, 0777);
533 for (map {$_->[1]} @{get_pod_metadata()->{master}}) {
534 # $_ is a name like pod/perl.pod
535 (my $base = $_) =~ s#.*/##;
536 copy_if_diff($_, "${installprivlib}/$pod/${base}");
537 chmod(0644, "${installprivlib}/$pod/${base}");
542 # Check to make sure there aren't other perls around in installer's
543 # path. This is probably UNIX-specific. Check all absolute directories
544 # in the path except for where public executables are supposed to live.
545 # Also skip $mainperl if the user opted to have it be a link to the
548 if (!$versiononly && !$opts{'skip-otherperls'}) {
550 my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ;
551 ($path = $ENV{"PATH"}) =~ s:\\:/:g ;
552 @path = split(/$dirsep/, $path);
555 while (exists $ENV{'DCL$PATH' . $i}) {
556 my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--;
564 # Use &samepath here because some systems have other dirs linked
565 # to $mainperldir (like SunOS)
567 next if samepath($_, $binexp);
568 next if samepath($_, cwd());
569 next if ($mainperl_is_instperl && samepath($_, $mainperldir));
570 my $otherperl = "$_/$perl$exe_ext";
571 next if $otherperls{$otherperl}++;
572 push(@otherperls, $otherperl)
573 if (-x $otherperl && ! -d $otherperl);
576 warn "\nWarning: $perl appears in your path in the following " .
577 "locations beyond where\nwe just installed it:\n";
586 $packlist->write() unless $opts{notify};
587 print " Installation complete\n" if $opts{verbose};
591 ###############################################################################
593 # If these are needed elsewhere, move them into install_lib.pl rather than
599 my($default) = $prompt =~ m/\[([yn])\]\s*$/i;
600 print STDERR $prompt;
601 chop($answer = <STDIN>);
602 $answer = $default if $answer =~ m/^\s*$/;
603 ($answer =~ m/^[yY]/);
607 return if $opts{notify} or $Is_VMS;
609 foreach my $name (@names) {
610 next unless -e $name;
611 chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare);
612 print " unlink $name\n" if $opts{verbose};
613 next if CORE::unlink($name);
614 warn "Couldn't unlink $name: $!\n";
616 print " mv $name $name.old\n" if $opts{verbose};
617 safe_rename($name, "$name.old")
618 or warn "Couldn't rename $name: $!\n";
625 if (-f $to and not unlink($to)) {
627 for ($i = 1; $i < 50; $i++) {
628 last if rename($to, "$to.$i");
630 warn("Cannot rename to '$to.$i': $!"), return 0
631 if $i >= 50; # Give up!
633 link($from,$to) || return 0;
641 $xto =~ s/^\Q$opts{destdir}\E//;
642 print $opts{verbose} ? " cp $from $xto\n" : " $xto\n"
643 unless $opts{silent};
644 print " creating new version of $xto\n"
645 if $Is_VMS and -e $to and !$opts{silent};
646 unless ($opts{notify} or File::Copy::copy($from, $to)) {
647 # Might have been that F::C::c can't overwrite the target
648 warn "Couldn't copy $from to $to: $!\n"
649 unless -f $to and (chmod(0666, $to), unlink $to)
650 and File::Copy::copy($from, $to);
652 $packlist->{$xto} = { type => 'file' };
656 my $dir = $File::Find::dir;
662 # This remains ugly, and in need of refactoring.
664 # $name always starts as the leafname
665 # $dir is the directory *within* lib
666 # $name later has $dir pre-pended, to give the relative path in lib/
667 # which is used to create the path in the target directory.
669 # $_ was always the filename to use on disk. Adding no_chdir doesn't change
670 # this, as $_ becomes a pathname, and so still works. However, it's not
671 # obvious that $_ is needed later, and hence $_ must not be modified.
673 # Also, many of the regex exclusion tests below are now superfluous, as the
674 # files in question are either no longer in blead, or now in ext/, dist/ or
675 # cpan/ and not copied into lib/
677 # Ignore version control directories.
678 if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) {
679 $File::Find::prune = 1;
683 # ignore patch backups, RCS files, emacs backup & temp files and the
684 # .exists files, .PL files, and test files.
685 return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util\.pl$|^filter-util\.pl$|^uupacktool\.pl$|^\.gitignore$} ||
686 $dir =~ m{/t(?:/|$)};
687 # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp
688 # scripts in lib/ExtUtils, the prove script in lib/Test/Harness,
689 # the corelist script from lib/Module/CoreList/bin and ptar* in
690 # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts
691 # and zipdetails in cpan/IO-Compress/bin
692 # (they're installed later with other utils)
693 return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|ptardiff|ptargrep|config_data|zipdetails)\z/;
694 # ignore the Makefiles
695 return if $name =~ /^makefile$/i;
696 # ignore the test extensions
697 return if $dir =~ m{\bXS/(?:APItest|Typemap)\b};
698 return if $name =~ m{\b(?:APItest|Typemap)\.pm$};
699 # ignore the build support code
700 return if $name =~ /\bbuildcustomize\.pl$/;
701 # ignore the demo files
702 return if $dir =~ /\b(?:demos?|eg)\b/;
703 # ignore unneeded unicore files
704 if ( $dir =~ /^unicore/ ) {
705 if ( $name =~ /\.txt\z/ ) {
706 # We can ignore most, but not all .txt files
707 return unless $name =~ /\A(?:Blocks|SpecialCasing|NamedSequences)\.txt\z/;
710 # TestProp only needed during testing
711 return if $name =~ /\ATestProp.pl\z/;
712 # we need version and *.pl files and can skip the rest
713 return unless $name =~ /\A(?:version|\w+\.p[lm])\z/;
717 # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs.
718 # Changes.e2x and README.e2x are needed by enc2xs.
719 return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x';
720 return if $name =~ m{^(?:MANIFEST|META\.yml)$};
721 return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i;
722 return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i;
723 return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files
724 return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files
726 # if using a shared perl library then ignore:
727 # - static library files [of statically linked extensions];
728 # - import library files and export library files (only present on Win32
729 # anyway?) and empty bootstrap files [of dynamically linked extensions].
730 return if $Config{useshrplib} eq 'true' and
731 ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name));
733 $name = "$dir/$name" if $dir ne '';
735 # ignore pods that are stand alone documentation from dual life modules.
736 return if /\.pod\z/ && is_duplicate_pod($_);
738 return if $name eq 'ExtUtils/XSSymSet.pm' and !$Is_VMS;
740 my $installlib = $installprivlib;
741 if ($dir =~ /^auto\// ||
742 ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) ||
743 ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) ||
744 $name=~/^Config_(heavy|git)\.pl\z/
746 $installlib = $installarchlib;
747 return unless $do_installarchlib;
749 return unless $do_installprivlib;
752 if ($Is_NetWare && !$opts{netware} && /\.(?:nlp|nlm|bs)$/) {
753 # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also
754 # if copied will give problems when building new extensions.
755 # Has to be copied if we are installing on a NetWare server and
756 # hence the check !$opts{netware}
761 my $xname = "$installlib/$name";
762 $xname =~ s/^\Q$opts{destdir}\E//;
763 $packlist->{$xname} = { type => 'file' };
764 if ($opts{force} || compare($_, "$installlib/$name") || $opts{notify}) {
765 unlink("$installlib/$name");
766 mkpath("$installlib/$dir", $opts{verbose}, 0777);
767 # HP-UX (at least) needs to maintain execute permissions
768 # on dynamically-loaded libraries.
769 if (copy_if_diff($_, "$installlib/$name")) {
770 strip("-S", "$installlib/$name")
771 if $^O eq 'darwin' and /\.(?:so|$dlext|a)$/;
772 chmod(/\.(so|$dlext)$/ ? 0555 : 0444, "$installlib/$name");
778 # Copy $from to $to, only if $from is different than $to.
779 # Also preserve modification times for .a libraries.
780 # On some systems, if you do
782 # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a
783 # and then try to link against the installed libperl.a, you might
784 # get an error message to the effect that the symbol table is older
786 # Return true if copying occurred.
790 return 1 if (($^O eq 'VMS') && (-d $from));
792 $xto =~ s/^\Q$opts{destdir}\E//;
793 my $perlpodbadsymlink;
794 if ($from =~ m!^pod/perl[\w-]+\.pod$! &&
797 # Some Linux implementations have problems traversing over
798 # multiple symlinks (when going over NFS?) and fail to read
799 # the symlink target. Combine this with the fact that some
800 # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS),
801 # and you end up with those pods not getting installed.
802 $perlpodbadsymlink = 1;
804 -f $from || $perlpodbadsymlink || warn "$0: $from not found";
805 $packlist->{$xto} = { type => 'file' };
806 if ($opts{force} || compare($from, $to) || $opts{notify}) {
807 safe_unlink($to); # In case we don't have write permissions.
808 if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) {
812 # Restore timestamps if it's a .a library or for OS/2.
813 if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) {
814 my ($atime, $mtime) = (stat $from)[8,9];
815 utime $atime, $mtime, $to;
825 return unless $opts{dostrip};
828 while (@args && $args[0] =~ /^(-\w+)$/) {
829 push @opts, shift @args;
832 foreach my $file (@args) {
834 if ($opts{verbose}) {
835 print " strip " . join(' ', @opts);
836 print " " if (@opts);
839 system("strip", @opts, $file);
841 print "# file '$file' skipped\n" if $opts{verbose};
847 # cperl-indent-level: 4
848 # indent-tabs-mode: nil
851 # ex: set ts=8 sts=4 sw=4 et: