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 | |
parent | Explicitly test against NULL; do not use !p or similar (diff) | |
download | openssl-285daccdc0e20fa70ddda9ddcd1f22191425de8a.tar.xz openssl-285daccdc0e20fa70ddda9ddcd1f22191425de8a.zip |
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')
-rw-r--r-- | Configurations/common.tmpl | 32 | ||||
-rw-r--r-- | Configurations/descrip.mms.tmpl | 24 | ||||
-rw-r--r-- | Configurations/unix-Makefile.tmpl | 26 | ||||
-rw-r--r-- | Configurations/windows-makefile.tmpl | 30 |
4 files changed, 56 insertions, 56 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}}) { diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl index 892102dd91..e177f2202e 100644 --- a/Configurations/descrip.mms.tmpl +++ b/Configurations/descrip.mms.tmpl @@ -48,26 +48,26 @@ @{$unified_info{libraries}}; our @install_libs = map { platform->staticname($_) } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}; our @install_shlibs = map { platform->sharedname($_) // () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}; our @install_engines = - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{engine} } + grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} + && $unified_info{attributes}->{modules}->{$_}->{engine} } @{$unified_info{modules}}; our @install_programs = - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } @{$unified_info{programs}}; our @install_bin_scripts = - grep { !$unified_info{attributes}->{$_}->{noinst} - && !$unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && !$unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}; our @install_misc_scripts = - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && $unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}; # This is a horrible hack, but is needed because recursive inclusion of files @@ -704,7 +704,7 @@ reconfigure reconf : # On Unix platforms, we depend on {shlibname}.so return map { { lib => platform->sharedlib($_) // platform->staticlib($_), - attrs => $unified_info{attributes}->{$_} } + attrs => $unified_info{attributes}->{libraries}->{$_} } } @_; } @@ -1014,8 +1014,8 @@ EOF } sub obj2dso { my %args = @_; - my $dsoname = platform->dsoname($args{lib}); - my $dso = platform->dso($args{lib}); + my $dsoname = platform->dsoname($args{module}); + my $dso = platform->dso($args{module}); my @objs = map { platform->convertext($_) } grep { platform->isobj($_) } @{$args{objs}}; diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 74b9079219..6de2acc9e7 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -54,44 +54,44 @@ GENERATED={- # common0.tmpl provides @generated INSTALL_LIBS={- join(" ", map { platform->staticlib($_) // () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_SHLIBS={- join(" ", map { platform->sharedlib($_) // () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_); my $y = platform->sharedlib_simple($_); $x ? "\"$x;$y\"" : () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_ENGINES={- join(" ", map { platform->dso($_) } - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{engine} } + grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} + && $unified_info{attributes}->{modules}->{$_}->{engine} } @{$unified_info{modules}}) -} INSTALL_PROGRAMS={- join(" ", map { platform->bin($_) } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } @{$unified_info{programs}}) -} BIN_SCRIPTS={- - join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname}; + join(" ", map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; $x ? "$_:$x" : $_ } - grep { !$unified_info{attributes}->{$_}->{noinst} - && !$unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && !$unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}) -} MISC_SCRIPTS={- - join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname}; + join(" ", map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; $x ? "$_:$x" : $_ } - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && $unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}) -} @@ -1156,7 +1156,7 @@ EOF } sub obj2dso { my %args = @_; - my $dso = platform->dso($args{lib}); + my $dso = platform->dso($args{module}); my @linkdirs = (); foreach (@{args{deps}}) { my $d = dirname($_); diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index bfe88f6cc9..4a83d0cee6 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -62,53 +62,53 @@ GENERATED={- # common0.tmpl provides @generated INSTALL_LIBS={- join(" ", map { quotify1(platform->sharedlib_import($_) // platform->staticlib($_)) } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_SHLIBS={- join(" ", map { my $x = platform->sharedlib($_); $x ? quotify_l($x) : () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_SHLIBPDBS={- join(" ", map { my $x = platform->sharedlibpdb($_); $x ? quotify_l($x) : () } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } @{$unified_info{libraries}}) -} INSTALL_ENGINES={- join(" ", map { quotify1(platform->dso($_)) } - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{engine} } + grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} + && $unified_info{attributes}->{modules}->{$_}->{engine} } @{$unified_info{modules}}) -} INSTALL_ENGINEPDBS={- join(" ", map { quotify1(platform->dsopdb($_)) } - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{engine} } + grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} + && $unified_info{attributes}->{modules}->{$_}->{engine} } @{$unified_info{modules}}) -} INSTALL_PROGRAMS={- join(" ", map { quotify1(platform->bin($_)) } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } @{$unified_info{programs}}) -} INSTALL_PROGRAMPDBS={- join(" ", map { quotify1(platform->binpdb($_)) } - grep { !$unified_info{attributes}->{$_}->{noinst} } + grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } @{$unified_info{programs}}) -} BIN_SCRIPTS={- join(" ", map { quotify1($_) } - grep { !$unified_info{attributes}->{$_}->{noinst} - && !$unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && !$unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}) -} MISC_SCRIPTS={- join(" ", map { quotify1($_) } - grep { !$unified_info{attributes}->{$_}->{noinst} - && $unified_info{attributes}->{$_}->{misc} } + grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} + && $unified_info{attributes}->{scripts}->{$_}->{misc} } @{$unified_info{scripts}}) -} @@ -714,8 +714,8 @@ EOF } sub obj2dso { my %args = @_; - my $dso = platform->dso($args{lib}); - my $dso_n = platform->dsoname($args{lib}); + my $dso = platform->dso($args{module}); + my $dso_n = platform->dsoname($args{module}); my @objs = map { platform->convertext($_) } grep { platform->isobj($_) || platform->isres($_) } @{$args{objs}}; |