Commit | Line | Data |
137443ea |
1 | my %opt; |
2 | while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/) |
3 | { |
4 | $opt{$1}=$2; |
5 | shift(@ARGV); |
6 | } |
7bac28a0 |
7 | |
acbc2db6 |
8 | $opt{'archname'} = 'MSWin32'; |
9 | if (defined $ENV{'PROCESSOR_ARCHITECTURE'}) |
10 | { |
11 | $opt{'archname'} .= '-'.$ENV{'PROCESSOR_ARCHITECTURE'}; |
12 | } |
13 | |
14 | if ($opt{'ccflags'} =~ /USE_THREADS/) |
15 | { |
16 | $opt{'archname'} .= '-thread'; |
17 | } |
18 | |
c90c0ff4 |
19 | if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true |
20 | $opt{PATCHLEVEL} = int($1 || 0); |
21 | $opt{SUBVERSION} = $2 || '00'; |
22 | } |
23 | |
d484a829 |
24 | $opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'}; |
25 | $opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0] |
26 | unless $opt{'cf_email'}; |
27 | |
137443ea |
28 | while (<>) |
29 | { |
30 | s/~([\w_]+)~/$opt{$1}/g; |
dc050285 |
31 | if (/^([\w_]+)=(.*)$/) { |
32 | # this depends on cf_time being empty in the template (or we'll get a loop) |
33 | if ($1 eq 'cf_time') { |
34 | $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/; |
35 | } |
36 | elsif (exists $opt{$1}) { |
37 | $_ = "$1='$opt{$1}'\n"; |
38 | } |
39 | } |
137443ea |
40 | print; |
41 | } |
42 | |