diff options
author | Richard Levitte <levitte@openssl.org> | 2019-10-03 23:30:58 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-10-10 14:12:15 +0200 |
commit | 285daccdc0e20fa70ddda9ddcd1f22191425de8a (patch) | |
tree | 9835380bae24c2463342fc9cfca8ee1ddaaad589 /Configurations/common.tmpl | |
parent | 12a765a5235f181c2f4992b615eb5f892c368e88 (diff) |
Configure: rework build.info grammar and attributes
The build.info grammar's regular expressions were a horrible read.
By assigning certain sub-expressions to variables, we hope to make
it a little more readable.
Also, the handling of build.info attributes is reworked to use a
common function instead of having copies of the same code.
Finally, the attributes are reorganized to specify if they belong with
programs, libraries, modules or scripts. This will enable more
intricate attribute assignment in changes to come.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10088)
Diffstat (limited to 'Configurations/common.tmpl')
-rw-r--r-- | Configurations/common.tmpl | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl index 62b1102c79..d28df743fe 100644 --- a/Configurations/common.tmpl +++ b/Configurations/common.tmpl @@ -118,7 +118,7 @@ unless ($disabled{shared} || $lib =~ /\.a$/) { my $obj2shlib = defined &obj2shlib ? \&obj2shlib : \&libobj2shlib; $OUT .= $obj2shlib->(lib => $lib, - attrs => $unified_info{attributes}->{$lib}, + attrs => $unified_info{attributes}->{libraries}->{$lib}, objs => $unified_info{shared_sources}->{$lib}, deps => [ reducedepends(resolvedepends($lib)) ]); foreach ((@{$unified_info{shared_sources}->{$lib}}, @@ -127,18 +127,18 @@ # Otherwise, it might simply be generated if (defined $unified_info{sources}->{$_}) { doobj($_, $lib, intent => "shlib", - attrs => $unified_info{attributes}->{$lib}); + attrs => $unified_info{attributes}->{libraries}->{$lib}); } else { dogenerate($_, undef, undef, intent => "lib"); } } } $OUT .= obj2lib(lib => $lib, - attrs => $unified_info{attributes}->{$lib}, + attrs => $unified_info{attributes}->{libraries}->{$lib}, objs => [ @{$unified_info{sources}->{$lib}} ]); foreach (@{$unified_info{sources}->{$lib}}) { doobj($_, $lib, intent => "lib", - attrs => $unified_info{attributes}->{$lib}); + attrs => $unified_info{attributes}->{libraries}->{$lib}); } $cache{$lib} = 1; } @@ -147,23 +147,23 @@ # obj2dso, and also makes sure all object files for the library # are built. sub domodule { - my $lib = shift; - return "" if $cache{$lib}; - $OUT .= obj2dso(lib => $lib, - attrs => $unified_info{attributes}->{$lib}, - objs => $unified_info{sources}->{$lib}, - deps => [ resolvedepends($lib) ]); - foreach (@{$unified_info{sources}->{$lib}}) { + my $module = shift; + return "" if $cache{$module}; + $OUT .= obj2dso(module => $module, + attrs => $unified_info{attributes}->{modules}->{$module}, + objs => $unified_info{sources}->{$module}, + deps => [ resolvedepends($module) ]); + foreach (@{$unified_info{sources}->{$module}}) { # If this is somehow a compiled object, take care of it that way # Otherwise, it might simply be generated if (defined $unified_info{sources}->{$_}) { - doobj($_, $lib, intent => "dso", - attrs => $unified_info{attributes}->{$lib}); + doobj($_, $module, intent => "dso", + attrs => $unified_info{attributes}->{modules}->{$module}); } else { - dogenerate($_, undef, $lib, intent => "dso"); + dogenerate($_, undef, $module, intent => "dso"); } } - $cache{$lib} = 1; + $cache{$module} = 1; } # dobin is responsible for building programs. It will call obj2bin, @@ -173,7 +173,7 @@ return "" if $cache{$bin}; my $deps = [ reducedepends(resolvedepends($bin)) ]; $OUT .= obj2bin(bin => $bin, - attrs => $unified_info{attributes}->{$bin}, + attrs => $unified_info{attributes}->{programs}->{$bin}, objs => [ @{$unified_info{sources}->{$bin}} ], deps => $deps); foreach (@{$unified_info{sources}->{$bin}}) { |