Commit | Line | Data |
dca8fd5c |
1 | #!./perl -w |
68dc0745 |
2 | |
3 | BEGIN { |
c90c0ff4 |
4 | require 5.004; |
922ef74c |
5 | chdir '..' if !-d 'lib' and -d '../lib'; |
68dc0745 |
6 | @INC = 'lib'; |
7 | $ENV{PERL5LIB} = 'lib'; |
a29d2910 |
8 | |
dca8fd5c |
9 | # This needs to be at BEGIN time, before any use of Config |
9e6fc21f |
10 | require './install_lib.pl'; |
1d230ada |
11 | } |
12 | |
a29d2910 |
13 | use strict; |
9e6fc21f |
14 | use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare |
15 | %opts $packlist); |
16 | my ($dostrip, $versiononly, $force, |
17 | $otherperls, $archname, $nwinstall, $nopods); |
dca8fd5c |
18 | # Not sure how easy it would be to refactor to remove the need for local $depth |
19 | # below |
5f675712 |
20 | use vars qw /$depth/; |
a29d2910 |
21 | |
22 | BEGIN { |
17f28c40 |
23 | if ($Is_VMS) { eval 'use VMS::Filespec;' } |
68dc0745 |
24 | } |
25 | |
c2cd2081 |
26 | my $scr_ext = ($Is_VMS ? '.Com' : $Is_W32 ? '.bat' : ''); |
4a71ed0c |
27 | |
a0d0e21e |
28 | use File::Find; |
5f05dabc |
29 | use File::Compare; |
68dc0745 |
30 | use File::Copy (); |
0ecb046b |
31 | use File::Path (); |
354f3b56 |
32 | use ExtUtils::Packlist; |
ebef0ab4 |
33 | use Cwd; |
791b4ad3 |
34 | |
2986a63f |
35 | if ($Is_NetWare) { |
2e2b85db |
36 | $Is_W32 = 0; |
37 | $scr_ext = '.pl'; |
2986a63f |
38 | } |
39 | |
0ecb046b |
40 | # override the ones in the rest of the script |
68dc0745 |
41 | sub mkpath { |
68006eea |
42 | File::Path::mkpath(@_) unless $opts{notify}; |
0ecb046b |
43 | } |
44 | |
c2cd2081 |
45 | my $mainperldir = "/usr/bin"; |
46 | my $exe_ext = $Config{exe_ext}; |
bee1dbe2 |
47 | |
dca8fd5c |
48 | # Allow "make install PERLNAME=something_besides_perl": |
c2cd2081 |
49 | my $perl = defined($ENV{PERLNAME}) ? $ENV{PERLNAME} : 'perl'; |
6ee623d5 |
50 | |
146174a9 |
51 | # This is the base used for versioned names, like "perl5.6.0". |
beb13193 |
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 |
146174a9 |
54 | # get "perl55.6.0". |
beb13193 |
55 | my $perl_verbase = defined($ENV{PERLNAME_VERBASE}) |
56 | ? $ENV{PERLNAME_VERBASE} |
57 | : $perl; |
5d25492c |
58 | my $dbg = ''; |
59 | my $ndbg = ''; |
60 | if ( $Is_VMS ) { |
61 | if ( defined $Config{usevmsdebug} ) { |
62 | if ( $Config{usevmsdebug} eq 'define' ) { |
63 | $dbg = 'dbg'; |
64 | $ndbg = 'ndbg'; |
65 | } |
66 | } |
67 | } |
beb13193 |
68 | |
5f675712 |
69 | $otherperls = 1; |
dca8fd5c |
70 | # Consider refactoring this to use Getopt::Long once Getopt::Long's planned |
71 | # feature is implemented, to distinguish + and - options. |
c623bd54 |
72 | while (@ARGV) { |
68006eea |
73 | $opts{notify} = 1 if $ARGV[0] eq '-n'; |
f556e5b9 |
74 | $dostrip = 1 if $ARGV[0] eq '-s'; |
c623bd54 |
75 | $versiononly = 1 if $ARGV[0] eq '-v'; |
f4a342c3 |
76 | $versiononly = 0 if $ARGV[0] eq '+v'; |
68006eea |
77 | $opts{silent} = 1 if $ARGV[0] eq '-S'; |
5f675712 |
78 | $otherperls = 0 if $ARGV[0] eq '-o'; |
2e2b85db |
79 | $force = 1 if $ARGV[0] eq '-f'; |
68006eea |
80 | $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n'; |
f4a342c3 |
81 | $archname = 1 if $ARGV[0] eq '-A'; |
2e2b85db |
82 | $nwinstall = 1 if $ARGV[0] eq '-netware'; |
4f048c5d |
83 | $nopods = 1 if $ARGV[0] eq '-p'; |
2227e2d5 |
84 | $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/; |
33bd2d8f |
85 | if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) { |
2e2b85db |
86 | print <<"EOT"; |
33bd2d8f |
87 | Usage $0: [switches] |
88 | -n Don't actually run any commands; just print them. |
89 | -s Run strip on installed binaries. |
90 | -v Only install perl as a binary with the version number in the name. |
91 | (Override whatever config.sh says) |
92 | +v Install perl as "perl" and as a binary with the version number in |
93 | the name. (Override whatever config.sh says) |
94 | -S Silent mode. |
2e2b85db |
95 | -f Force installation (don't check if same version is there) |
33bd2d8f |
96 | -o Skip checking for other copies of perl in your PATH. |
97 | -V Verbose mode. |
98 | -A Also install perl with the architecture's name in the perl binary's |
99 | name. |
4f048c5d |
100 | -p Don't install the pod files. [This will break use diagnostics;] |
33bd2d8f |
101 | -netware Install correctly on a Netware server. |
70eaf669 |
102 | -destdir Prefix installation directories by this string. |
33bd2d8f |
103 | EOT |
2e2b85db |
104 | exit; |
33bd2d8f |
105 | } |
c623bd54 |
106 | shift; |
107 | } |
108 | |
f4a342c3 |
109 | $versiononly = 1 if $Config{versiononly} && !defined $versiononly; |
21dae8a0 |
110 | my (@scripts, @tolink); |
111 | open SCRIPTS, "utils.lst" or die "Can't open utils.lst: $!"; |
112 | while (<SCRIPTS>) { |
113 | next if /^#/; |
71c9e11c |
114 | s/\s*#\s*pod\s*=.*//; # install script regardless of pod location |
115 | next if /a2p/; # a2p is binary, to be installed separately |
21dae8a0 |
116 | chomp; |
117 | if (/(\S*)\s*#\s*link\s*=\s*(\S*)/) { |
2e2b85db |
118 | push @scripts, $1; |
119 | push @tolink, [$1, $2]; |
21dae8a0 |
120 | } else { |
2e2b85db |
121 | push @scripts, $_; |
21dae8a0 |
122 | } |
123 | } |
124 | close SCRIPTS; |
16d20bd9 |
125 | |
4a71ed0c |
126 | if ($scr_ext) { @scripts = map { "$_$scr_ext" } @scripts; } |
17f28c40 |
127 | |
ffb5d6c5 |
128 | my @pods = $nopods ? () : (<pod/*.pod>, 'x2p/a2p.pod'); |
c623bd54 |
129 | |
e8ea6127 |
130 | # Specify here any .pm files that are actually architecture-dependent. |
131 | # (Those included with XS extensions under ext/ are automatically |
132 | # added later.) |
133 | # Now that the default privlib has the full perl version number included, |
0b3bfb33 |
134 | # we no longer have to play the trick of sticking version-specific .pm |
e8ea6127 |
135 | # files under the archlib directory. |
c2cd2081 |
136 | my %archpms = ( |
0b3bfb33 |
137 | Config => 1, |
138 | lib => 1, |
139 | Cwd => 1, |
38b8243a |
140 | ); |
39e571d4 |
141 | |
142 | if ($^O eq 'dos') { |
143 | push(@scripts,'djgpp/fixpmain'); |
144 | $archpms{config} = $archpms{filehand} = 1; |
145 | } |
146 | |
2e2b85db |
147 | if ((-e "testcompile") && (defined($ENV{'COMPILE'}))) { |
148 | push(@scripts, map("$_.exe", @scripts)); |
6ee623d5 |
149 | } |
150 | |
1dd15ed4 |
151 | find(sub { |
2e2b85db |
152 | if ("$File::Find::dir/$_" =~ m{^ext\b(.*)/([^/]+)\.pm$}) { |
153 | my($path, $modname) = ($1,$2); |
68c887af |
154 | |
1a959400 |
155 | # strip to optional "/lib", or remove trailing component |
156 | $path =~ s{.*/lib\b}{} or $path =~ s{/[^/]*$}{}; |
68c887af |
157 | |
2e2b85db |
158 | # strip any leading / |
159 | $path =~ s{^/}{}; |
68c887af |
160 | |
2e2b85db |
161 | # reconstitute canonical module name |
162 | $modname = "$path/$modname" if length $path; |
68c887af |
163 | |
2e2b85db |
164 | # remember it |
165 | $archpms{$modname} = 1; |
166 | } |
167 | }, 'ext'); |
1dd15ed4 |
168 | |
68c887af |
169 | # print "[$_]\n" for sort keys %archpms; |
170 | |
146174a9 |
171 | my $ver = $Config{version}; |
f2766b05 |
172 | my $release = substr($],0,3); # Not used currently. |
03284eb6 |
173 | my $patchlevel = substr($],3,2); |
748a9306 |
174 | die "Patchlevel of perl ($patchlevel)", |
cceca5ed |
175 | "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n" |
176 | if $patchlevel != $Config{'PERL_VERSION'}; |
4633a7c4 |
177 | |
178 | # Fetch some frequently-used items from %Config |
2227e2d5 |
179 | my $installbin = "$opts{destdir}$Config{installbin}"; |
180 | my $installscript = "$opts{destdir}$Config{installscript}"; |
181 | my $installprivlib = "$opts{destdir}$Config{installprivlib}"; |
182 | my $installarchlib = "$opts{destdir}$Config{installarchlib}"; |
183 | my $installsitelib = "$opts{destdir}$Config{installsitelib}"; |
184 | my $installsitearch = "$opts{destdir}$Config{installsitearch}"; |
185 | my $installman1dir = "$opts{destdir}$Config{installman1dir}"; |
c2cd2081 |
186 | my $man1ext = $Config{man1ext}; |
187 | my $libperl = $Config{libperl}; |
4633a7c4 |
188 | # Shared library and dynamic loading suffixes. |
c2cd2081 |
189 | my $so = $Config{so}; |
190 | my $dlext = $Config{dlext}; |
146174a9 |
191 | my $dlsrc = $Config{dlsrc}; |
f2766b05 |
192 | if ($^O eq 'os390') { |
193 | my $pwd; |
194 | chomp($pwd=`pwd`); |
195 | my $archlibexp = $Config{archlibexp}; |
196 | my $usedl = $Config{usedl}; |
197 | if ($usedl eq 'define') { |
2e2b85db |
198 | `./$^X -pibak -e 's{$pwd\/libperl.x}{$archlibexp/CORE/libperl.x}' lib/Config.pm`; |
f2766b05 |
199 | } |
200 | } |
4633a7c4 |
201 | |
2986a63f |
202 | if ($nwinstall) { |
2e2b85db |
203 | # This is required only if we are installing on a NetWare server |
204 | $installscript = $Config{installnwscripts}; |
205 | $installprivlib = $Config{installnwlib}; |
206 | $installarchlib = $Config{installnwlib}; |
207 | $installsitelib = $Config{installnwlib}; |
2986a63f |
208 | } |
209 | |
c2cd2081 |
210 | my $d_dosuid = $Config{d_dosuid}; |
211 | my $binexp = $Config{binexp}; |
c623bd54 |
212 | |
17f28c40 |
213 | if ($Is_VMS) { # Hang in there until File::Spec hits the big time |
214 | foreach ( \$installbin, \$installscript, \$installprivlib, |
2e2b85db |
215 | \$installarchlib, \$installsitelib, \$installsitearch, |
216 | \$installman1dir ) { |
217 | $$_ = unixify($$_); $$_ =~ s:/$::; |
17f28c40 |
218 | } |
219 | } |
220 | |
c623bd54 |
221 | # Do some quick sanity checks. |
222 | |
68006eea |
223 | if (!$opts{notify} && $d_dosuid && $>) { die "You must run as root to install suidperl\n"; } |
c623bd54 |
224 | |
fe14fcc3 |
225 | $installbin || die "No installbin directory in config.sh\n"; |
68006eea |
226 | -d $installbin || mkpath($installbin, $opts{verbose}, 0777); |
227 | -d $installbin || $opts{notify} || die "$installbin is not a directory\n"; |
228 | -w $installbin || $opts{notify} || die "$installbin is not writable by you\n" |
229 | unless $installbin =~ m#^/afs/# || $opts{notify}; |
c623bd54 |
230 | |
2986a63f |
231 | if (!$Is_NetWare) { |
5d25492c |
232 | if (!$Is_VMS) { |
39add537 |
233 | -x 'perl' . $exe_ext || die "perl isn't executable!\n"; |
5d25492c |
234 | } |
235 | else { |
236 | -x $ndbg . 'perl' . $exe_ext || die "${ndbg}perl$exe_ext isn't executable!\n"; |
237 | if ($dbg) { |
238 | -x $dbg . 'perl' . $exe_ext || die "${dbg}perl$exe_ext isn't executable!\n"; |
239 | } |
240 | } |
39add537 |
241 | -x 'suidperl' . $exe_ext|| die "suidperl isn't executable!\n" if $d_dosuid; |
c623bd54 |
242 | |
9fba8746 |
243 | -f 't/rantests' || $Is_W32 |
2e2b85db |
244 | || warn "WARNING: You've never run 'make test' or", |
245 | " some tests failed! (Installing anyway.)\n"; |
2986a63f |
246 | } #if (!$Is_NetWare) |
c623bd54 |
247 | |
25207203 |
248 | # This will be used to store the packlist |
9e6fc21f |
249 | $packlist = ExtUtils::Packlist->new("$installarchlib/.packlist"); |
25207203 |
250 | |
2e2b85db |
251 | if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) { |
252 | my $perldll; |
253 | |
254 | if ($Is_Cygwin) { |
255 | $perldll = $libperl; |
2e2b85db |
256 | } else { |
5f9145a3 |
257 | $perldll = 'perl5'.$Config{patchlevel}.'.'.$dlext; |
2e2b85db |
258 | } |
5f675712 |
259 | |
2e2b85db |
260 | if ($dlsrc ne "dl_none.xs") { |
261 | -f $perldll || die "No perl DLL built\n"; |
262 | } |
0b3bfb33 |
263 | |
2e2b85db |
264 | # Install the DLL |
265 | safe_unlink("$installbin/$perldll"); |
266 | copy("$perldll", "$installbin/$perldll"); |
267 | chmod(0755, "$installbin/$perldll"); |
25207203 |
268 | $packlist->{"$installbin/$perldll"} = { type => 'file' }; |
2986a63f |
269 | } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) |
eef1cf2a |
270 | |
c623bd54 |
271 | # First we install the version-numbered executables. |
272 | |
17f28c40 |
273 | if ($Is_VMS) { |
9edbfc61 |
274 | safe_unlink("$installbin/perl_setup.com"); |
275 | copy("perl_setup.com", "$installbin/perl_setup.com"); |
276 | chmod(0755, "$installbin/perl_setup.com"); |
5d25492c |
277 | safe_unlink("$installbin/$dbg$perl$exe_ext"); |
278 | copy("$dbg$perl$exe_ext", "$installbin/$dbg$perl$exe_ext"); |
279 | chmod(0755, "$installbin/$dbg$perl$exe_ext"); |
280 | safe_unlink("$installbin/$dbg${perl}shr$exe_ext"); |
281 | copy("$dbg${perl}shr$exe_ext", "$installbin/$dbg${perl}shr$exe_ext"); |
282 | chmod(0755, "$installbin/$dbg${perl}shr$exe_ext"); |
283 | if ($ndbg) { |
9edbfc61 |
284 | safe_unlink("$installbin/$ndbg$perl$exe_ext"); |
285 | copy("$ndbg$perl$exe_ext", "$installbin/$ndbg$perl$exe_ext"); |
286 | chmod(0755, "$installbin/$ndbg$perl$exe_ext"); |
287 | safe_unlink("$installbin/${dbg}a2p$exe_ext"); |
288 | copy("x2p/${dbg}a2p$exe_ext", "$installbin/${dbg}a2p$exe_ext"); |
289 | chmod(0755, "$installbin/${dbg}a2p$exe_ext"); |
5d25492c |
290 | } |
17f28c40 |
291 | } |
1d84e8df |
292 | elsif ($^O eq 'mpeix') { |
293 | # MPE lacks hard links and requires that executables with special |
294 | # capabilities reside in the MPE namespace. |
295 | safe_unlink("$installbin/perl$ver$exe_ext", $Config{perlpath}); |
296 | # Install the primary executable into the MPE namespace as perlpath. |
297 | copy("perl$exe_ext", $Config{perlpath}); |
298 | chmod(0755, $Config{perlpath}); |
299 | # Create a backup copy with the version number. |
300 | link($Config{perlpath}, "$installbin/perl$ver$exe_ext"); |
301 | } |
3f5ee302 |
302 | elsif ($^O ne 'dos') { |
2e2b85db |
303 | if (!$Is_NetWare) { |
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"); |
308 | } |
309 | else { |
310 | # If installing onto a NetWare server |
311 | if ($nwinstall) { |
312 | # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm |
313 | mkpath($Config{installnwsystem}, 1, 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}, 1, 0777); |
320 | copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi}); |
2986a63f |
321 | } |
2e2b85db |
322 | } #if (!$Is_NetWare) |
3f5ee302 |
323 | } |
1d84e8df |
324 | else { |
6ee623d5 |
325 | safe_unlink("$installbin/$perl.exe"); |
326 | copy("perl.exe", "$installbin/$perl.exe"); |
39e571d4 |
327 | } |
c623bd54 |
328 | |
beb13193 |
329 | safe_unlink("$installbin/s$perl_verbase$ver$exe_ext"); |
c623bd54 |
330 | if ($d_dosuid) { |
beb13193 |
331 | copy("suidperl$exe_ext", "$installbin/s$perl_verbase$ver$exe_ext"); |
332 | chmod(04711, "$installbin/s$perl_verbase$ver$exe_ext"); |
c623bd54 |
333 | } |
334 | |
45d8adaa |
335 | # Install library files. |
336 | |
c2cd2081 |
337 | my ($do_installarchlib, $do_installprivlib) = (0, 0); |
5f9145a3 |
338 | my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver; |
0b3bfb33 |
339 | |
68006eea |
340 | mkpath($installprivlib, $opts{verbose}, 0777); |
341 | mkpath($installarchlib, $opts{verbose}, 0777); |
342 | mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib); |
343 | mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch); |
4633a7c4 |
344 | |
45d8adaa |
345 | if (chdir "lib") { |
68dc0745 |
346 | $do_installarchlib = ! samepath($installarchlib, '.'); |
347 | $do_installprivlib = ! samepath($installprivlib, '.'); |
7e73a980 |
348 | $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/); |
45d8adaa |
349 | |
a0d0e21e |
350 | if ($do_installarchlib || $do_installprivlib) { |
351 | find(\&installlib, '.'); |
45d8adaa |
352 | } |
353 | chdir ".." || die "Can't cd back to source directory: $!\n"; |
354 | } |
355 | else { |
356 | warn "Can't cd to lib to install lib files: $!\n"; |
357 | } |
358 | |
1aef975c |
359 | # Install header files and libraries. |
68006eea |
360 | mkpath("$installarchlib/CORE", $opts{verbose}, 0777); |
c2cd2081 |
361 | my @corefiles; |
17f28c40 |
362 | if ($Is_VMS) { # We did core file selection during build |
0185066f |
363 | my $coredir = "lib/$Config{archname}/$ver/CORE"; |
17f28c40 |
364 | $coredir =~ tr/./_/; |
0185066f |
365 | map { s|^$coredir/||i; } @corefiles = <$coredir/*.*>; |
17f28c40 |
366 | } |
367 | else { |
8736538c |
368 | # [als] hard-coded 'libperl' name... not good! |
1933e12c |
369 | @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>; |
8736538c |
370 | |
17f28c40 |
371 | # AIX needs perl.exp installed as well. |
372 | push(@corefiles,'perl.exp') if $^O eq 'aix'; |
9d7f10f2 |
373 | if ($^O eq 'mpeix') { |
2e2b85db |
374 | # MPE needs mpeixish.h installed as well. |
68006eea |
375 | mkpath("$installarchlib/CORE/mpeix", $opts{verbose}, 0777); |
2e2b85db |
376 | push(@corefiles,'mpeix/mpeixish.h'); |
9d7f10f2 |
377 | } |
17f28c40 |
378 | # If they have built sperl.o... |
379 | push(@corefiles,'sperl.o') if -f 'sperl.o'; |
380 | } |
c2cd2081 |
381 | foreach my $file (@corefiles) { |
aa3cf465 |
382 | # HP-UX (at least) needs to maintain execute permissions |
efc5ad56 |
383 | # on dynamically-loadable libraries. So we do it for all. |
8f1f23e8 |
384 | if (copy_if_diff($file,"$installarchlib/CORE/$file")) { |
f556e5b9 |
385 | if ($file =~ /\.(\Q$so\E|\Q$dlext\E)$/) { |
f556e5b9 |
386 | strip("-S", "$installarchlib/CORE/$file") if $^O =~ /^(rhapsody|darwin)$/; |
2e2b85db |
387 | chmod(0555, "$installarchlib/CORE/$file"); |
8f1f23e8 |
388 | } else { |
389 | chmod(0444, "$installarchlib/CORE/$file"); |
390 | } |
391 | } |
340f689c |
392 | } |
3edbfbe5 |
393 | |
156620fa |
394 | # Install main perl executables |
395 | # Make links to ordinary names if installbin directory isn't current directory. |
396 | |
2986a63f |
397 | if (! $versiononly && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS && ! $Is_NetWare) { |
6ee623d5 |
398 | safe_unlink("$installbin/$perl$exe_ext", "$installbin/suid$perl$exe_ext"); |
1d84e8df |
399 | if ($^O eq 'mpeix') { |
400 | # MPE doesn't support hard links, so use a symlink. |
401 | # We don't want another cloned copy. |
2e2b85db |
402 | symlink($Config{perlpath}, "$installbin/perl$exe_ext"); |
7e6b8b1f |
403 | } elsif ($^O eq 'vos') { |
404 | # VOS doesn't support hard links, so use a symlink. |
2e2b85db |
405 | symlink("$installbin/$perl_verbase$ver$exe_ext", |
406 | "$installbin/$perl$exe_ext"); |
1d84e8df |
407 | } else { |
beb13193 |
408 | link("$installbin/$perl_verbase$ver$exe_ext", |
409 | "$installbin/$perl$exe_ext"); |
1d84e8df |
410 | } |
86207487 |
411 | link("$installbin/$perl_verbase$ver$exe_ext", |
0b3bfb33 |
412 | "$installbin/suid$perl$exe_ext") |
156620fa |
413 | if $d_dosuid; |
414 | } |
415 | |
f4a342c3 |
416 | # For development purposes it can be very useful to have multiple perls |
417 | # build for different "architectures" (eg threading or not) simultaneously. |
418 | if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { |
419 | my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext"; |
420 | safe_unlink("$installbin/$archperl"); |
eb96f679 |
421 | if ($^O eq 'mpeix') { |
422 | # MPE doesn't support hard links, so use a symlink. |
f4a342c3 |
423 | # We don't want another cloned copy. |
2e2b85db |
424 | symlink($Config{perlpath}, "$installbin/$archperl"); |
eb96f679 |
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/$archperl"); |
f4a342c3 |
429 | } else { |
2e2b85db |
430 | link("$installbin/$perl_verbase$ver$exe_ext", "$installbin/$archperl"); |
f4a342c3 |
431 | } |
432 | } |
433 | |
a0d0e21e |
434 | # Offer to install perl in a "standard" location |
435 | |
c2cd2081 |
436 | my $mainperl_is_instperl = 0; |
a0d0e21e |
437 | |
a3ed4895 |
438 | if ($Config{installusrbinperl} && $Config{installusrbinperl} eq 'define' && |
68006eea |
439 | !$versiononly && !$opts{notify} && !$Is_W32 && !$Is_NetWare && !$Is_VMS && -t STDIN && -t STDERR |
68dc0745 |
440 | && -w $mainperldir && ! samepath($mainperldir, $installbin)) { |
c2cd2081 |
441 | my($usrbinperl) = "$mainperldir/$perl$exe_ext"; |
442 | my($instperl) = "$installbin/$perl$exe_ext"; |
443 | my($expinstperl) = "$binexp/$perl$exe_ext"; |
55497cff |
444 | |
445 | # First make sure $usrbinperl is not already the same as the perl we |
446 | # just installed. |
447 | if (-x $usrbinperl) { |
a0d0e21e |
448 | # Try to be clever about mainperl being a symbolic link |
449 | # to binexp/perl if binexp and installbin are different. |
450 | $mainperl_is_instperl = |
68dc0745 |
451 | samepath($usrbinperl, $instperl) || |
452 | samepath($usrbinperl, $expinstperl) || |
a0d0e21e |
453 | (($binexp ne $installbin) && |
55497cff |
454 | (-l $usrbinperl) && |
455 | ((readlink $usrbinperl) eq $expinstperl)); |
a0d0e21e |
456 | } |
835f8a63 |
457 | if (! $mainperl_is_instperl) { |
55497cff |
458 | unlink($usrbinperl); |
1d84e8df |
459 | ( $Config{'d_link'} eq 'define' && |
460 | eval { CORE::link $instperl, $usrbinperl } ) || |
461 | eval { symlink $expinstperl, $usrbinperl } || |
462 | copy($instperl, $usrbinperl); |
463 | |
a0d0e21e |
464 | $mainperl_is_instperl = 1; |
465 | } |
466 | } |
467 | |
b971f6e4 |
468 | # Make links to ordinary names if installbin directory isn't current directory. |
9edbfc61 |
469 | if (!$Is_NetWare && $dbg eq '') { |
bbd0f0ff |
470 | if (! samepath($installbin, 'x2p')) { |
471 | my $base = 'a2p'; |
472 | $base .= $ver if $versiononly; |
473 | safe_unlink("$installbin/$base$exe_ext"); |
474 | copy("x2p/a2p$exe_ext", "$installbin/$base$exe_ext"); |
475 | strip("$installbin/$base$exe_ext"); |
476 | chmod(0755, "$installbin/$base$exe_ext"); |
477 | } |
b971f6e4 |
478 | } |
479 | |
480 | # cppstdin is just a script, but it is architecture-dependent, so |
481 | # it can't safely be shared. Place it in $installbin. |
482 | # Note that Configure doesn't build cppstin if it isn't needed, so |
483 | # we skip this if cppstdin doesn't exist. |
68dc0745 |
484 | if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) { |
485 | safe_unlink("$installbin/cppstdin"); |
486 | copy("cppstdin", "$installbin/cppstdin"); |
487 | chmod(0755, "$installbin/cppstdin"); |
b971f6e4 |
488 | } |
489 | |
1a09d0c8 |
490 | sub script_alias { |
491 | my ($installscript, $orig, $alias, $scr_ext) = @_; |
492 | |
eea3e086 |
493 | safe_unlink("$installscript/$alias$scr_ext"); |
1a09d0c8 |
494 | if ($^O eq 'dos' or $Is_VMS or $^O eq 'transit') { |
495 | copy("$installscript/$orig$scr_ext", |
0b3bfb33 |
496 | "$installscript/$alias$scr_ext"); |
7e6b8b1f |
497 | } elsif ($^O eq 'vos') { |
498 | symlink("$installscript/$orig$scr_ext", |
2e2b85db |
499 | "$installscript/$alias$scr_ext"); |
1a09d0c8 |
500 | } else { |
501 | link("$installscript/$orig$scr_ext", |
502 | "$installscript/$alias$scr_ext"); |
503 | } |
504 | } |
505 | |
c8f392da |
506 | # Install scripts. |
68006eea |
507 | mkpath($installscript, $opts{verbose}, 0777); |
c8f392da |
508 | if ($versiononly) { |
509 | for (@scripts) { |
510 | (my $base = $_) =~ s#.*/##; |
511 | $base .= $ver; |
512 | copy($_, "$installscript/$base"); |
513 | chmod(0755, "$installscript/$base"); |
514 | } |
b971f6e4 |
515 | |
0b3bfb33 |
516 | for (@tolink) { |
2e2b85db |
517 | my ($from, $to) = map { "$_$ver" } @$_; |
518 | (my $frbase = $from) =~ s#.*/##; |
519 | (my $tobase = $to) =~ s#.*/##; |
520 | script_alias($installscript, $frbase, $tobase, $scr_ext); |
c8f392da |
521 | } |
522 | } else { |
22e77942 |
523 | for (@scripts) { |
524 | (my $base = $_) =~ s#.*/##; |
525 | copy($_, "$installscript/$base"); |
526 | chmod(0755, "$installscript/$base"); |
b971f6e4 |
527 | } |
22e77942 |
528 | |
0b3bfb33 |
529 | for (@tolink) { |
2e2b85db |
530 | my ($from, $to) = @$_; |
531 | (my $frbase = $from) =~ s#.*/##; |
532 | (my $tobase = $to) =~ s#.*/##; |
533 | script_alias($installscript, $frbase, $tobase, $scr_ext); |
21dae8a0 |
534 | } |
b971f6e4 |
535 | } |
536 | |
146174a9 |
537 | # Install pod pages. Where? I guess in $installprivlib/pod |
538 | # ($installprivlib/pods for cygwin). |
b971f6e4 |
539 | |
e65df1b6 |
540 | my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod'; |
7e73a980 |
541 | if ( !$versiononly || ($installprivlib =~ m/\Q$vershort/)) { |
68006eea |
542 | mkpath("${installprivlib}/$pod", $opts{verbose}, 0777); |
91a06757 |
543 | |
544 | # If Perl 5.003's perldiag.pod is there, rename it. |
146174a9 |
545 | if (open POD, "${installprivlib}/$pod/perldiag.pod") { |
91a06757 |
546 | read POD, $_, 4000; |
547 | close POD; |
548 | # Some of Perl 5.003's diagnostic messages ended with periods. |
549 | if (/^=.*\.$/m) { |
146174a9 |
550 | my ($from, $to) = ("${installprivlib}/$pod/perldiag.pod", |
551 | "${installprivlib}/$pod/perldiag-5.003.pod"); |
f311e742 |
552 | print " rename $from $to"; |
91a06757 |
553 | rename($from, $to) |
554 | or warn "Couldn't rename $from to $to: $!\n" |
68006eea |
555 | unless $opts{notify}; |
91a06757 |
556 | } |
557 | } |
558 | |
146174a9 |
559 | for (@pods) { |
560 | # $_ is a name like pod/perl.pod |
2e2b85db |
561 | (my $base = $_) =~ s#.*/##; |
146174a9 |
562 | copy_if_diff($_, "${installprivlib}/$pod/${base}"); |
b971f6e4 |
563 | } |
91a06757 |
564 | |
b971f6e4 |
565 | } |
566 | |
a0d0e21e |
567 | # Check to make sure there aren't other perls around in installer's |
568 | # path. This is probably UNIX-specific. Check all absolute directories |
569 | # in the path except for where public executables are supposed to live. |
570 | # Also skip $mainperl if the user opted to have it be a link to the |
571 | # installed perl. |
572 | |
5f675712 |
573 | if (!$versiononly && $otherperls) { |
146174a9 |
574 | my ($path, @path); |
2986a63f |
575 | my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ; |
b971f6e4 |
576 | ($path = $ENV{"PATH"}) =~ s:\\:/:g ; |
577 | @path = split(/$dirsep/, $path); |
17f28c40 |
578 | if ($Is_VMS) { |
2e2b85db |
579 | my $i = 0; |
580 | while (exists $ENV{'DCL$PATH' . $i}) { |
581 | my $dir = unixpath($ENV{'DCL$PATH' . $i}); $dir =~ s-/$--; |
582 | push(@path,$dir); |
583 | } |
17f28c40 |
584 | } |
c2cd2081 |
585 | my @otherperls; |
160a7e37 |
586 | my %otherperls; |
b971f6e4 |
587 | for (@path) { |
588 | next unless m,^/,; |
589 | # Use &samepath here because some systems have other dirs linked |
590 | # to $mainperldir (like SunOS) |
68dc0745 |
591 | next if samepath($_, $binexp); |
ebef0ab4 |
592 | next if samepath($_, cwd()); |
68dc0745 |
593 | next if ($mainperl_is_instperl && samepath($_, $mainperldir)); |
2e2b85db |
594 | my $otherperl = "$_/$perl$exe_ext"; |
160a7e37 |
595 | next if $otherperls{$otherperl}++; |
596 | push(@otherperls, $otherperl) |
597 | if (-x $otherperl && ! -d $otherperl); |
b971f6e4 |
598 | } |
599 | if (@otherperls) { |
5f675712 |
600 | warn "\nWarning: $perl appears in your path in the following " . |
b971f6e4 |
601 | "locations beyond where\nwe just installed it:\n"; |
602 | for (@otherperls) { |
5f675712 |
603 | warn " ", $_, "\n"; |
b971f6e4 |
604 | } |
5f675712 |
605 | warn "\n"; |
a0d0e21e |
606 | } |
b971f6e4 |
607 | |
a0d0e21e |
608 | } |
609 | |
68006eea |
610 | $packlist->write() unless $opts{notify}; |
611 | print " Installation complete\n" if $opts{verbose}; |
c623bd54 |
612 | |
613 | exit 0; |
614 | |
615 | ############################################################################### |
616 | |
9e6fc21f |
617 | # If these are needed elsewhere, move them into install_lib.pl rather than |
618 | # copying them. |
619 | |
a0d0e21e |
620 | sub yn { |
c2cd2081 |
621 | my($prompt) = @_; |
622 | my($answer); |
623 | my($default) = $prompt =~ m/\[([yn])\]\s*$/i; |
802cdca0 |
624 | print STDERR $prompt; |
a0d0e21e |
625 | chop($answer = <STDIN>); |
626 | $answer = $default if $answer =~ m/^\s*$/; |
627 | ($answer =~ m/^[yY]/); |
628 | } |
629 | |
e50aee73 |
630 | sub safe_unlink { |
68006eea |
631 | return if $opts{notify} or $Is_VMS; |
c2cd2081 |
632 | my @names = @_; |
633 | foreach my $name (@names) { |
e50aee73 |
634 | next unless -e $name; |
2986a63f |
635 | chmod 0777, $name if ($Is_OS2 || $Is_W32 || $Is_NetWare); |
68006eea |
636 | print " unlink $name\n" if $opts{verbose}; |
39add537 |
637 | next if CORE::unlink($name); |
e50aee73 |
638 | warn "Couldn't unlink $name: $!\n"; |
639 | if ($! =~ /busy/i) { |
68006eea |
640 | print " mv $name $name.old\n" if $opts{verbose}; |
68dc0745 |
641 | safe_rename($name, "$name.old") |
642 | or warn "Couldn't rename $name: $!\n"; |
e50aee73 |
643 | } |
644 | } |
645 | } |
646 | |
68dc0745 |
647 | sub safe_rename { |
c2cd2081 |
648 | my($from,$to) = @_; |
55a105fd |
649 | if (-f $to and not unlink($to)) { |
e50aee73 |
650 | my($i); |
651 | for ($i = 1; $i < 50; $i++) { |
91a06757 |
652 | last if rename($to, "$to.$i"); |
e50aee73 |
653 | } |
0b3bfb33 |
654 | warn("Cannot rename to `$to.$i': $!"), return 0 |
39add537 |
655 | if $i >= 50; # Give up! |
e50aee73 |
656 | } |
657 | link($from,$to) || return 0; |
55a105fd |
658 | unlink($from); |
e50aee73 |
659 | } |
660 | |
68dc0745 |
661 | sub copy { |
662 | my($from,$to) = @_; |
663 | |
5a9231b0 |
664 | my $xto = $to; |
2227e2d5 |
665 | $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; |
68006eea |
666 | print $opts{verbose} ? " cp $from $xto\n" : " $xto\n" |
667 | unless $opts{silent}; |
668 | print " creating new version of $xto\n" |
669 | if $Is_VMS and -e $to and !$opts{silent}; |
670 | unless ($opts{notify} or File::Copy::copy($from, $to)) { |
6c9f5ae6 |
671 | # Might have been that F::C::c can't overwrite the target |
672 | warn "Couldn't copy $from to $to: $!\n" |
673 | unless -f $to and (chmod(0666, $to), unlink $to) |
674 | and File::Copy::copy($from, $to); |
675 | } |
5a9231b0 |
676 | $packlist->{$xto} = { type => 'file' }; |
c623bd54 |
677 | } |
678 | |
a0d0e21e |
679 | sub installlib { |
680 | my $dir = $File::Find::dir; |
681 | $dir =~ s#^\.(?![^/])/?##; |
0ecb046b |
682 | local($depth) = $dir ? "lib/$dir" : "lib"; |
a0d0e21e |
683 | |
684 | my $name = $_; |
efc5ad56 |
685 | |
ce28de53 |
686 | # Ignore version control directories. |
559940b2 |
687 | if ($name =~ /^(?:CVS|RCS|SCCS|\.svn)\z/ and -d $name) { |
efc5ad56 |
688 | $File::Find::prune = 1; |
689 | return; |
690 | } |
0b3bfb33 |
691 | |
146174a9 |
692 | # ignore patch backups, RCS files, emacs backup & temp files and the |
056a8fbe |
693 | # .exists files, .PL files, and test files. |
f7388fd6 |
694 | return if $name =~ m{\.orig$|\.rej$|~$|^#.+#$|,v$|^\.exists|\.PL$|\.plc$|\.t$|^test\.pl$|^dbm_filter_util.pl$} || |
2e2b85db |
695 | $dir =~ m{/t(?:/|$)}; |
e4fc8a1e |
696 | # ignore the cpan script in lib/CPAN/bin, the instmodsh and xsubpp |
04f9cde5 |
697 | # scripts in lib/ExtUtils, the prove script in lib/Test/Harness, |
ca32a3cb |
698 | # the corelist script from lib/Module/CoreList/bin and ptar* in |
bb4e9162 |
699 | # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts |
e4fc8a1e |
700 | # (they're installed later with other utils) |
6aaee015 |
701 | return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|cpan2dist|cpanp|cpanp-run-perl|ptardiff|config_data)\z/; |
922ef74c |
702 | # ignore the Makefiles |
703 | return if $name =~ /^makefile$/i; |
f9aa124c |
704 | # ignore the test extensions |
f631d084 |
705 | return if $dir =~ m{\bXS/(?:APItest|Typemap)\b}; |
706 | return if $name =~ m{\b(?:APItest|Typemap)\.pm$}; |
a6c3b020 |
707 | # ignore the demo files |
021db424 |
708 | return if $dir =~ /\b(?:demos?|eg)\b/; |
b695f709 |
709 | |
0ae089ad |
710 | # ignore READMEs, MANIFESTs, INSTALL docs, META.ymls and change logs. |
711 | # Changes.e2x and README.e2x are needed by enc2xs. |
ae5e75fd |
712 | return if $name =~ m{^(?:README(?:\.\w+)?)$} && $name ne 'README.e2x'; |
021db424 |
713 | return if $name =~ m{^(?:MANIFEST|META\.yml)$}; |
714 | return if $name =~ m{^(?:INSTALL|TODO|BUGS|CREDITS)$}i; |
0ae089ad |
715 | return if $name =~ m{^change(?:s|log)(?:\.libnet)?$}i; |
021db424 |
716 | return if $name =~ m{^(?:SIGNATURE|PAUSE200\d\.pub)$}; # CPAN files |
717 | return if $name =~ m{^(?:NOTES|PATCHING)$}; # ExtUtils files |
0ae089ad |
718 | |
54f1e9b4 |
719 | # if using a shared perl library then ignore: |
720 | # - static library files [of statically linked extensions]; |
721 | # - import library files and export library files (only present on Win32 |
722 | # anyway?) and empty bootstrap files [of dynamically linked extensions]. |
723 | return if $Config{useshrplib} eq 'true' and |
724 | ($name =~ /$Config{_a}$/ or $name =~ /\.exp$/ or ($name =~ /\.bs$/ and -z $name)); |
725 | |
a0d0e21e |
726 | $name = "$dir/$name" if $dir ne ''; |
727 | |
728 | my $installlib = $installprivlib; |
1dd15ed4 |
729 | if ($dir =~ /^auto/ || |
eef1cf2a |
730 | ($name =~ /^(.*)\.(?:pm|pod)$/ && $archpms{$1}) || |
b809f04e |
731 | ($name =~ /^(.*)\.(?:h|lib)$/i && ($Is_W32 || $Is_NetWare)) || |
732 | $name eq 'Config_heavy.pl' |
eef1cf2a |
733 | ) { |
2e2b85db |
734 | $installlib = $installarchlib; |
a0d0e21e |
735 | return unless $do_installarchlib; |
736 | } else { |
737 | return unless $do_installprivlib; |
738 | } |
739 | |
a0d0e21e |
740 | if (-f $_) { |
1a959400 |
741 | if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$])) { |
3edbfbe5 |
742 | $installlib = $installprivlib; |
743 | #We're installing *.al and *.ix files into $installprivlib, |
744 | #but we have to delete old *.al and *.ix files from the 5.000 |
745 | #distribution: |
75f92628 |
746 | #This might not work because $archname might have changed. |
55a105fd |
747 | unlink("$installarchlib/$name"); |
3edbfbe5 |
748 | } |
5a9231b0 |
749 | my $xname = "$installlib/$name"; |
2227e2d5 |
750 | $xname =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; |
5a9231b0 |
751 | $packlist->{$xname} = { type => 'file' }; |
68006eea |
752 | if ($force || compare($_, "$installlib/$name") || $opts{notify}) { |
55a105fd |
753 | unlink("$installlib/$name"); |
68006eea |
754 | mkpath("$installlib/$dir", $opts{verbose}, 0777); |
75f92628 |
755 | # HP-UX (at least) needs to maintain execute permissions |
756 | # on dynamically-loaded libraries. |
2e2b85db |
757 | if ($Is_NetWare && !$nwinstall) { |
758 | # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also |
759 | # if copied will give problems when building new extensions. |
760 | # Has to be copied if we are installing on a NetWare server and hence |
761 | # the check !$nwinstall |
762 | if (!(/\.(?:nlp|nlm|bs)$/)) { |
763 | copy_if_diff($_, "$installlib/$name") |
2986a63f |
764 | and chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444, |
2e2b85db |
765 | "$installlib/$name"); |
766 | } |
767 | } else { |
768 | if (copy_if_diff($_, "$installlib/$name")) { |
769 | if ($name =~ /\.(so|$dlext)$/o) { |
770 | strip("-S", "$installlib/$name") if $^O =~ /^(rhapsody|darwin)$/; |
771 | chmod(0555, "$installlib/$name"); |
772 | } else { |
773 | strip("-S", "$installlib/$name") |
774 | if ($name =~ /\.a$/o and $^O =~ /^(rhapsody|darwin)$/); |
775 | chmod(0444, "$installlib/$name"); |
776 | } |
777 | } |
778 | } #if ($Is_NetWare) |
a0d0e21e |
779 | } |
a0d0e21e |
780 | } |
781 | } |
3edbfbe5 |
782 | |
16d20bd9 |
783 | # Copy $from to $to, only if $from is different than $to. |
784 | # Also preserve modification times for .a libraries. |
785 | # On some systems, if you do |
786 | # ranlib libperl.a |
787 | # cp libperl.a /usr/local/lib/perl5/archlib/CORE/libperl.a |
788 | # and then try to link against the installed libperl.a, you might |
789 | # get an error message to the effect that the symbol table is older |
790 | # than the library. |
aa3cf465 |
791 | # Return true if copying occurred. |
68dc0745 |
792 | |
793 | sub copy_if_diff { |
3edbfbe5 |
794 | my($from,$to)=@_; |
8530e788 |
795 | return 1 if (($^O eq 'VMS') && (-d $from)); |
5a9231b0 |
796 | my $xto = $to; |
2227e2d5 |
797 | $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; |
5f239f73 |
798 | my $perlpodbadsymlink; |
799 | if ($from =~ m!^pod/perl[\w-]+\.pod$! && |
800 | -l $from && |
801 | ! -e $from) { |
802 | # Some Linux implementations have problems traversing over |
803 | # multiple symlinks (when going over NFS?) and fail to read |
804 | # the symlink target. Combine this with the fact that some |
805 | # of the pod files (the perl$OS.pod) are symlinks (to ../README.$OS), |
806 | # and you end up with those pods not getting installed. |
807 | $perlpodbadsymlink = 1; |
808 | } |
809 | -f $from || $perlpodbadsymlink || warn "$0: $from not found"; |
5a9231b0 |
810 | $packlist->{$xto} = { type => 'file' }; |
68006eea |
811 | if ($force || compare($from, $to) || $opts{notify}) { |
68dc0745 |
812 | safe_unlink($to); # In case we don't have write permissions. |
68006eea |
813 | if ($opts{notify}) { |
2e2b85db |
814 | $from = $depth . "/" . $from if $depth; |
815 | } |
5f239f73 |
816 | if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) { |
817 | $from = "README.$1"; |
818 | } |
68dc0745 |
819 | copy($from, $to); |
820 | # Restore timestamps if it's a .a library or for OS/2. |
68006eea |
821 | if (!$opts{notify} && ($Is_OS2 || $to =~ /\.a$/)) { |
68dc0745 |
822 | my ($atime, $mtime) = (stat $from)[8,9]; |
16d20bd9 |
823 | utime $atime, $mtime, $to; |
824 | } |
aa3cf465 |
825 | 1; |
3edbfbe5 |
826 | } |
827 | } |
8f1f23e8 |
828 | |
829 | sub strip |
830 | { |
831 | my(@args) = @_; |
832 | |
f556e5b9 |
833 | return unless $dostrip; |
834 | |
8f1f23e8 |
835 | my @opts; |
836 | while (@args && $args[0] =~ /^(-\w+)$/) { |
2e2b85db |
837 | push @opts, shift @args; |
8f1f23e8 |
838 | } |
839 | |
840 | foreach my $file (@args) { |
2e2b85db |
841 | if (-f $file) { |
68006eea |
842 | if ($opts{verbose}) { |
2e2b85db |
843 | print " strip " . join(' ', @opts); |
844 | print " " if (@opts); |
845 | print "$file\n"; |
846 | } |
847 | system("strip", @opts, $file); |
848 | } else { |
68006eea |
849 | print "# file '$file' skipped\n" if $opts{verbose}; |
2e2b85db |
850 | } |
8f1f23e8 |
851 | } |
852 | } |