diff options
author | Richard Levitte <levitte@openssl.org> | 2018-11-07 10:44:05 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-01-22 12:35:39 +0100 |
commit | c91f24d4cca5862f11876457e0ffb6dd54814814 (patch) | |
tree | fd7f06766263fd5e3f021e20a5826901f3ec6bef | |
parent | Configure: teach the tokenizer to handle other separators than spaces (diff) | |
download | openssl-c91f24d4cca5862f11876457e0ffb6dd54814814.tar.xz openssl-c91f24d4cca5862f11876457e0ffb6dd54814814.zip |
Configure: add attributes to end product build.info variables
Among others, this avoids having special variables like
PROGRAMS_NO_INST. Instead, we can have something like this:
PROGRAMS{noinst}=foo bar
Configure itself is entirely agnostic to these attributes, they are
simply passed to the build file templates, to be used as they see fit.
Attributes can also have values, for example:
SCRIPTS{linkname=foo}=foo.pl
This could help indicate to build file templates that care that the
perl script 'foo.pl' should also exist with the name 'foo', preferably
as a symbolic link.
Fixes #7568
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7581)
Diffstat (limited to '')
-rwxr-xr-x | Configure | 156 |
1 files changed, 86 insertions, 70 deletions
@@ -1710,18 +1710,15 @@ if ($builder eq "unified") { my $f = 'build.info'; # The basic things we're trying to build my @programs = (); - my @programs_install = (); my @libraries = (); - my @libraries_install = (); my @engines = (); - my @engines_install = (); my @scripts = (); - my @scripts_install = (); my @extra = (); my @overrides = (); my @intermediates = (); my @rawlines = (); + my %attributes = (); my %sources = (); my %shared_sources = (); my %includes = (); @@ -1792,40 +1789,84 @@ if ($builder eq "unified") { } } }, - qr/^\s*PROGRAMS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*PROGRAMS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @programs, @x; - push @programs_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @p = tokenize($2); + push @programs, @p; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $p (@p) { + $attributes{$p}->{$ak} = $av; + } + } + push @programs, @p; } }, - qr/^\s*LIBS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*LIBS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @libraries, @x; - push @libraries_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @l = tokenize($2); + push @libraries, @l; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $l (@l) { + $attributes{$l}->{$ak} = $av; + } + } + push @libraries, @l; } }, - qr/^\s*ENGINES(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*ENGINES(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @engines, @x; - push @engines_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @e = tokenize($2); + push @engines, @e; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $e (@e) { + $attributes{$e}->{$ak} = $av; + } + } + push @engines, @e; } }, - qr/^\s*SCRIPTS(_NO_INST)?\s*=\s*(.*)\s*$/ + qr/^\s*SCRIPTS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { - my $install = $1; - my @x = tokenize($2); - push @scripts, @x; - push @scripts_install, @x unless $install; + my @a = tokenize($1, qr|\s*,\s*|); + my @s = tokenize($2); + push @scripts, @s; + foreach my $a (@a) { + my $ak = $a; + my $av = 1; + if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) { + $ak = $1; + $av = $2; + } + foreach my $s (@s) { + $attributes{$s}->{$ak} = $av; + } + } + push @scripts, @s; } }, qr/^\s*EXTRA\s*=\s*(.*)\s*$/ @@ -1893,58 +1934,33 @@ if ($builder eq "unified") { ); die "runaway IF?" if (@skip); - foreach (@programs) { - my $program = cleanfile($buildd, $_, $blddir); - $unified_info{programs}->{$program} = 1; - } - - foreach (@programs_install) { - my $program = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{programs}->{$program} = 1; - } - - foreach (@libraries) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{libraries}->{$library} = 1; - } - - foreach (@libraries_install) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{libraries}->{$library} = 1; - } - die <<"EOF" if scalar @engines and !$config{dynamic_engines}; ENGINES can only be used if configured with 'dynamic-engine'. This is usually a fault in a build.info file. EOF - foreach (@engines) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{engines}->{$library} = 1; - } - - foreach (@engines_install) { - my $library = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{engines}->{$library} = 1; - } - - foreach (@scripts) { - my $script = cleanfile($buildd, $_, $blddir); - $unified_info{scripts}->{$script} = 1; - } - - foreach (@scripts_install) { - my $script = cleanfile($buildd, $_, $blddir); - $unified_info{install}->{scripts}->{$script} = 1; - } - foreach (@extra) { - my $extra = cleanfile($buildd, $_, $blddir); - $unified_info{extra}->{$extra} = 1; + foreach (keys %attributes) { + my $dest = $_; + my $ddest = cleanfile($buildd, $_, $blddir); + foreach (keys %{$attributes{$dest} // {}}) { + $unified_info{attributes}->{$ddest}->{$_} = + $attributes{$dest}->{$_}; + } } - foreach (@overrides) { - my $override = cleanfile($buildd, $_, $blddir); - $unified_info{overrides}->{$override} = 1; + { + my %infos = ( programs => [ @programs ], + libraries => [ @libraries ], + engines => [ @engines ], + scripts => [ @scripts ], + extra => [ @extra ], + overrides => [ @overrides ] ); + foreach my $k (keys %infos) { + foreach (@{$infos{$k}}) { + my $item = cleanfile($buildd, $_, $blddir); + $unified_info{$k}->{$item} = 1; + } + } } push @{$unified_info{rawlines}}, @rawlines; @@ -2247,7 +2263,7 @@ EOF $unified_info{$_} = [ sort keys %{$unified_info{$_}} ]; } # Two level structures - foreach my $l1 (("install", "sources", "shared_sources", "ldadd", "depends")) { + foreach my $l1 (("sources", "shared_sources", "ldadd", "depends")) { foreach my $l2 (sort keys %{$unified_info{$l1}}) { my @items = sort |