| 1 |
#!/usr/bin/perl -w |
| 2 |
|
| 3 |
use Config; |
| 4 |
use Module::Build; |
| 5 |
|
| 6 |
my $build = Module::Build->current; |
| 7 |
|
| 8 |
my %config = (%Config, $build->notes); |
| 9 |
|
| 10 |
my $input_file = shift; |
| 11 |
my $output_file = shift; |
| 12 |
|
| 13 |
|
| 14 |
open my $input_fh, $input_file or die "Can't open $input_file: $!"; |
| 15 |
open my $output_fh, ">$output_file" or die "Can't open $output_file: $!"; |
| 16 |
print $output_fh <<"END"; |
| 17 |
/* |
| 18 |
* !!! DO NOT EDIT THIS FILE!!! |
| 19 |
* This file was generated from $input_file. |
| 20 |
* Edit that and rerun make to regenerate. |
| 21 |
*/ |
| 22 |
|
| 23 |
END |
| 24 |
|
| 25 |
while(<$input_fh>) { |
| 26 |
my $matched = s{%%(.*)%%}{defined $config{$1} ? $config{$1} : ''}eg; |
| 27 |
|
| 28 |
print $output_fh $_; |
| 29 |
} |