aboutsummaryrefslogtreecommitdiffstats
path: root/configure.pl
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-07-01 21:59:19 +0000
committerlloyd <[email protected]>2009-07-01 21:59:19 +0000
commit21308960d04c28e90ee63485b4d95636f4fe9240 (patch)
tree10fff059d3ad0127f20f61001dce1c6be808ada1 /configure.pl
parent461602d1d2662cdad9f898bc350d9074b267cc6a (diff)
Change the makefile template language somewhat. Previously variables
had been denoted with @{var:NAME}, this has changed to %{NAME}. This is pretty much a wash for configure.pl but it makes it much easier to process the templates using Python's string.Template. The logic being the 'var:' prefix had been to support conditional statements in the templates (using an 'if:' prefix), but this functionality was not being used and support for it is removed from configure.pl in this revision. For a similiar reason, rename a number of template variables with hyphens in their name to use underscores instead. This is slightly more consistent anyway (since many variable names had already used _ instead of -) but more importantly makes them much easier to deal with using aforementioned Python template code. This should not result in any user-visible change (unless I messed up).
Diffstat (limited to 'configure.pl')
-rwxr-xr-xconfigure.pl59
1 files changed, 25 insertions, 34 deletions
diff --git a/configure.pl b/configure.pl
index d94b376e2..f290f002d 100755
--- a/configure.pl
+++ b/configure.pl
@@ -65,12 +65,12 @@ sub main {
$$config{'base-dir'} = $base_dir;
$$config{'src-dir'} = File::Spec->catdir($base_dir, 'src');
$$config{'checks-dir'} = File::Spec->catdir($base_dir, 'checks');
- $$config{'doc-dir'} = File::Spec->catdir($base_dir, 'doc');
+ $$config{'doc_src_dir'} = File::Spec->catdir($base_dir, 'doc');
$$config{'config-dir'} =
File::Spec->catdir($$config{'src-dir'}, 'build-data');
- $$config{'command-line'} = $0 . ' ' . join(' ', @ARGV);
+ $$config{'command_line'} = $0 . ' ' . join(' ', @ARGV);
$$config{'timestamp'} = gmtime;
$$config{'user'} = getlogin || getpwuid($<) || '';
$$config{'hostname'} = hostname;
@@ -103,12 +103,12 @@ sub main {
# Goes into build-specific dirs (maybe)
- $$config{'build-dir'} = 'build';
- $$config{'botan-config'} = File::Spec->catfile(
- $$config{'build-dir'}, 'botan-config');
+ $$config{'build_dir'} = 'build';
+ $$config{'botan_config'} = File::Spec->catfile(
+ $$config{'build_dir'}, 'botan-config');
- $$config{'botan-pkgconfig'} = File::Spec->catfile(
- $$config{'build-dir'},
+ $$config{'botan_pkgconfig'} = File::Spec->catfile(
+ $$config{'build_dir'},
'botan-' . $MAJOR_VERSION . '.' . $MINOR_VERSION . '.pc');
$$config{'makefile'} = 'Makefile';
@@ -116,9 +116,9 @@ sub main {
$$config{'lib_prefix'} = '';
if(defined($$config{'with_build_dir'})) {
- for my $var ('build-dir',
- 'botan-config',
- 'botan-pkgconfig',
+ for my $var ('build_dir',
+ 'botan_config',
+ 'botan_pkgconfig',
'makefile',
'check_prefix',
'lib_prefix')
@@ -147,12 +147,12 @@ sub main {
add_to($config, {
'includedir' => os_info_for($os, 'header_dir'),
- 'build_lib' => File::Spec->catdir($$config{'build-dir'}, 'lib'),
- 'build_check' => File::Spec->catdir($$config{'build-dir'}, 'checks'),
+ 'build_lib' => File::Spec->catdir($$config{'build_dir'}, 'lib'),
+ 'build_check' => File::Spec->catdir($$config{'build_dir'}, 'checks'),
'build_include' =>
- File::Spec->catdir($$config{'build-dir'}, 'include'),
+ File::Spec->catdir($$config{'build_dir'}, 'include'),
'build_include_botan' =>
- File::Spec->catdir($$config{'build-dir'}, 'include', 'botan'),
+ File::Spec->catdir($$config{'build_dir'}, 'include', 'botan'),
'mp_bits' => find_mp_bits(sort keys %{$$config{'modules'}}),
'mod_libs' =>
@@ -170,7 +170,7 @@ sub main {
load_modules($config);
- my @dirs = mkdirs($$config{'build-dir'},
+ my @dirs = mkdirs($$config{'build_dir'},
$$config{'build_include'},
$$config{'build_include_botan'},
$$config{'build_lib'},
@@ -183,15 +183,15 @@ sub main {
determine_config($config);
process_template(File::Spec->catfile($$config{'config-dir'}, 'buildh.in'),
- File::Spec->catfile($$config{'build-dir'}, 'build.h'),
+ File::Spec->catfile($$config{'build_dir'}, 'build.h'),
$config);
process_template(File::Spec->catfile(
$$config{'config-dir'}, 'botan.doxy.in'),
- File::Spec->catfile($$config{'doc-dir'}, 'botan.doxy'),
+ File::Spec->catfile($$config{'doc_src_dir'}, 'botan.doxy'),
$config);
- $$config{'includes'}{'build.h'} = $$config{'build-dir'};
+ $$config{'includes'}{'build.h'} = $$config{'build_dir'};
generate_makefile($config);
@@ -1246,7 +1246,7 @@ sub load_modules {
push @mod_names, $mod;
}
- $$config{'mod-list'} = join("\n", @mod_names);
+ $$config{'mod_list'} = join("\n", @mod_names);
my $unaligned_ok = 0;
@@ -1468,19 +1468,10 @@ sub process_template {
next;
}
- $contents =~ s/@\{var:$name\}/$val/g;
-
- unless($val eq 'no' or $val eq 'false') {
- $contents =~ s/\@\{if:$name (.*)\}/$1/g;
- $contents =~ s/\@\{if:$name (.*) (.*)\}/$1/g;
- } else {
- $contents =~ s/\@\{if:$name (.*)\}//g;
- $contents =~ s/\@\{if:$name (.*) (.*)\}/$2/g;
- }
+ $contents =~ s/\%\{$name\}/$val/g;
}
- if($contents =~ /@\{var:([a-z_]*)\}/ or
- $contents =~ /@\{if:(.*) /) {
+ if($contents =~ /\%\{([a-z_]*)\}/) {
sub summarize {
my ($n, $s) = @_;
@@ -1823,7 +1814,7 @@ sub write_pkg_config {
$$config{'link_to'} = libs('-l', '', 'm', @{$$config{'mod_libs'}});
- my $botan_config = $$config{'botan-config'};
+ my $botan_config = $$config{'botan_config'};
process_template(
File::Spec->catfile($$config{'config-dir'}, 'botan-config.in'),
@@ -1832,7 +1823,7 @@ sub write_pkg_config {
process_template(
File::Spec->catfile($$config{'config-dir'}, 'botan.pc.in'),
- $$config{'botan-pkgconfig'}, $config);
+ $$config{'botan_pkgconfig'}, $config);
delete $$config{'link_to'};
}
@@ -2029,10 +2020,10 @@ sub generate_makefile {
my ($config) = @_;
my $is_in_doc_dir =
- sub { -e File::Spec->catfile($$config{'doc-dir'}, $_[0]) };
+ sub { -e File::Spec->catfile($$config{'doc_src_dir'}, $_[0]) };
my $docs = file_list(undef, undef, undef,
- map_to($$config{'doc-dir'},
+ map_to($$config{'doc_src_dir'},
grep { &$is_in_doc_dir($_); } @DOCS));
$docs .= File::Spec->catfile($$config{'base-dir'}, 'readme.txt');