Commit | Line | Data |
cb1a09d0 |
1 | #!/usr/local/bin/perl |
2 | |
c07a80fd |
3 | use Config; |
4 | use File::Basename qw(&basename &dirname); |
3b5ca523 |
5 | use Cwd; |
cb1a09d0 |
6 | |
c07a80fd |
7 | # List explicitly here the variables you want Configure to |
8 | # generate. Metaconfig only looks for shell variables, so you |
9 | # have to mention them as if they were shell variables, not |
10 | # %Config entries. Thus you write |
11 | # $startperl |
12 | # to ensure Configure will look for $Config{startperl}. |
cb1a09d0 |
13 | |
3b5ca523 |
14 | # This forces PL files to create target in same directory as PL file. |
15 | # This is so that make depend always knows where to find PL derivatives. |
16 | $origdir = cwd; |
17 | chdir dirname($0); |
44a8e56a |
18 | $file = basename($0, '.PL'); |
774d564b |
19 | $file .= '.com' if $^O eq 'VMS'; |
cb1a09d0 |
20 | |
c07a80fd |
21 | open OUT,">$file" or die "Can't create $file: $!"; |
cb1a09d0 |
22 | |
c07a80fd |
23 | print "Extracting $file (with variable substitutions)\n"; |
cb1a09d0 |
24 | |
c07a80fd |
25 | # In this section, perl variables will be expanded during extraction. |
26 | # You can use $Config{...} to use Configure variables. |
cb1a09d0 |
27 | |
c07a80fd |
28 | print OUT <<"!GROK!THIS!"; |
5f05dabc |
29 | $Config{startperl} |
30 | eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' |
31 | if \$running_under_some_shell; |
c07a80fd |
32 | !GROK!THIS! |
cb1a09d0 |
33 | |
c07a80fd |
34 | # In the following, perl variables are not expanded during extraction. |
cb1a09d0 |
35 | |
c07a80fd |
36 | print OUT <<'!NO!SUBS!'; |
cb1a09d0 |
37 | |
c07a80fd |
38 | use Pod::Text; |
cb1a09d0 |
39 | |
c07a80fd |
40 | if(@ARGV) { |
41 | pod2text($ARGV[0]); |
42 | } else { |
43 | pod2text("<&STDIN"); |
cb1a09d0 |
44 | } |
45 | |
c07a80fd |
46 | !NO!SUBS! |
cb1a09d0 |
47 | |
c07a80fd |
48 | close OUT or die "Can't close $file: $!"; |
49 | chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; |
50 | exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; |
3b5ca523 |
51 | chdir $origdir; |