Commit | Line | Data |
---|---|---|
d658129c FR |
1 | #!/usr/local/bin/perl |
2 | ||
3 | use Config; | |
4 | use File::Basename qw(&basename &dirname); | |
5 | use Cwd; | |
6 | ||
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}. | |
13 | ||
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 | my $origdir = cwd; | |
17 | chdir dirname($0); | |
18 | my $file = basename($0, '.PL'); | |
19 | $file .= '.com' if $^O eq 'VMS'; | |
20 | ||
21 | open OUT,">$file" or die "Can't create $file: $!"; | |
22 | ||
23 | print "Extracting $file (with variable substitutions)\n"; | |
24 | ||
25 | # In this section, perl variables will be expanded during extraction. | |
26 | # You can use $Config{...} to use Configure variables. | |
27 | ||
28 | print OUT <<"!GROK!THIS!"; | |
29 | $Config{startperl} | |
30 | eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' | |
31 | if \$running_under_some_shell; | |
32 | !GROK!THIS! | |
33 | ||
34 | use File::Spec; | |
35 | ||
36 | my $script = File::Spec->catfile( | |
37 | File::Spec->catdir( | |
38 | File::Spec->updir, qw(ext Pod-Html bin), | |
39 | ), | |
40 | 'pod2html', | |
41 | ); | |
42 | ||
43 | if (open(IN, $script)) { | |
44 | print OUT <IN>; | |
45 | close IN; | |
46 | } else { | |
47 | die "$0: cannot find '$script'\n"; | |
48 | } | |
49 | ||
50 | close OUT or die "Can't close $file: $!"; | |
51 | chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; | |
52 | exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; | |
53 | chdir $origdir; |