diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2008-09-29 17:19:07 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2008-09-29 17:19:07 +0000 |
commit | bfa863c83bfd01d72a748decaaf2676b800c60ff (patch) | |
tree | 02491e683928ba1c318d3ebc1200feb7c8bb78b4 /gnu/usr.bin/perl/utils/config_data.PL | |
parent | 37a0443eb842cf3d2c9de0e5647b0094a0dcf0bd (diff) |
import perl 5.10.0 from CPAN
Diffstat (limited to 'gnu/usr.bin/perl/utils/config_data.PL')
-rw-r--r-- | gnu/usr.bin/perl/utils/config_data.PL | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/utils/config_data.PL b/gnu/usr.bin/perl/utils/config_data.PL new file mode 100644 index 00000000000..e1de813b526 --- /dev/null +++ b/gnu/usr.bin/perl/utils/config_data.PL @@ -0,0 +1,51 @@ +#!/usr/local/bin/perl + +use Config; +use File::Basename qw(&basename &dirname); +use Cwd; + +# List explicitly here the variables you want Configure to +# generate. Metaconfig only looks for shell variables, so you +# have to mention them as if they were shell variables, not +# %Config entries. Thus you write +# $startperl +# to ensure Configure will look for $Config{startperl}. + +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +my $origdir = cwd; +chdir dirname($0); +my $file = basename($0, '.PL'); +$file .= '.com' if $^O eq 'VMS'; + +open OUT,">$file" or die "Can't create $file: $!"; + +print "Extracting $file (with variable substitutions)\n"; + +# In this section, perl variables will be expanded during extraction. +# You can use $Config{...} to use Configure variables. + +print OUT <<"!GROK!THIS!"; +$Config{startperl} + eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' + if \$running_under_some_shell; +!GROK!THIS! + +use File::Spec; + +my $script = File::Spec->catfile( + File::Spec->catdir( + File::Spec->updir, qw[lib Module Build scripts] + ), "config_data"); + +if (open(IN, $script)) { + print OUT <IN>; + close IN; +} else { + die "$0: cannot find '$script'\n"; +} + +close OUT or die "Can't close $file: $!"; +chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; +exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir; |