Commit | Line | Data |
82835e01 |
1 | # This will put installed perl files into some other location |
2 | # Note that we cannot put hashbang to be extproc to make Configure work. |
3 | |
4 | use Config; |
5 | |
6 | $dir = shift; |
7 | $dir =~ s|/|\\|g ; |
8 | $nowarn = 1, $dir = shift if $dir eq '-n'; |
9 | |
10 | die <<EOU unless defined $dir and -d $dir; |
11 | usage: $^X $0 [-n] directory-to-install |
12 | -n do not check whether the directory is not on path |
13 | EOU |
14 | |
15 | @path = split /;/, $ENV{PATH}; |
16 | $idir = $Config{installbin}; |
17 | $indir =~ s|\\|/|g ; |
18 | |
59ad941d |
19 | my %seen; |
20 | |
760ac839 |
21 | foreach $file (<$idir/*>) { |
59ad941d |
22 | next if $file =~ /\.(exe|bak)/i; |
82835e01 |
23 | $base = $file; |
24 | $base =~ s/\.$//; # just in case... |
25 | $base =~ s|.*/||; |
59ad941d |
26 | $base =~ s|\.pl$||; |
27 | #$file =~ s|/|\\|g ; |
28 | warn "Clashing output name for $file, skipping" if $seen{$base}++; |
82835e01 |
29 | print "Processing $file => $dir\\$base.cmd\n"; |
59ad941d |
30 | open IN, '<', $file or warn, next; |
31 | open OUT, '>', "$dir/$base.cmd" or warn, next; |
32 | my $firstline = <IN>; |
33 | my $flags = ''; |
34 | $flags = $2 if $firstline =~ /^#!\s*(\S+)\s+-([^#]+?)\s*(#|$)/; |
35 | print OUT "extproc perl -S$flags\n$firstline"; |
36 | print OUT $_ while <IN>; |
37 | close IN or warn, next; |
38 | close OUT or warn, next; |
82835e01 |
39 | } |
40 | |