3 # This script uses the current values of Girocco::Config to
4 # convert apache.conf.in into apache.conf.
6 # It is run automatically by "make" or "make apache.conf" but
7 # may be run separately if desired.
13 trap "rm -f 'apache.conf.$$'" EXIT
17 __girocco_conf
="$GIROCCO_CONF"
18 [ -n "$__girocco_conf" ] || __girocco_conf
="Girocco::Config"
19 perl
-I.
-M"$__girocco_conf" -- - apache.conf.
in >apache.conf.$$
<<'EOT'
20 #line 21 "make-apache-conf.sh"
24 my $frombegin = '# ---- BEGIN LINES TO DUPLICATE ----';
25 my $fromend = '# ---- END LINES TO DUPLICATE ----';
26 my $tobegin = '# ---- BEGIN DUPLICATE LINES ----';
27 my $toend = '# ---- END DUPLICATE LINES ----';
29 open IN, '<', $ARGV[0] or die "could not open $ARGV[0] for reading: $!\n";
36 $input =~ s/^##.*(?:\n|$)//gm;
39 if (eval '$Girocco::Config::'.$_[1]) {
40 $_[0] ? "Girocco_Config_$_[1]_Disabled" : "!Girocco_Config_$_[1]_Disabled";
42 $_[0] ? "!Girocco_Config_$_[1]_Enabled" : "Girocco_Config_$_[1]_Enabled";
45 $input =~ s/^(\s*<IfDefine\s+)(!?)\@\@([a-zA-Z][a-zA-Z0-9_]*)\@\@>/
46 $1 . &$repl($2, $3) . '>'/gmexi;
49 $input =~ s/\@\@([a-zA-Z][a-zA-Z0-9_]*)\@\@/eval
50 "\$Girocco::Config::$1 ne ''?\$Girocco::Config::$1:'\@\@'.\"$1\".'\@\@'"/gsex;
52 if ($input =~ /(?:^|\n)$frombegin[^\n]*\n(.*)(?<=\n)$fromend/s) {
54 if ($input =~ /^((?:.+\n)?$tobegin[^\n]*\n).*((?<=\n)$toend.*)$/s) {
55 $input = $1 . $dupelines . $2;
60 mv -f apache.conf.$$ apache.conf