diff options
author | Richard Levitte <levitte@openssl.org> | 2023-06-02 14:32:07 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2023-06-08 07:53:10 +0200 |
commit | b684ee2ce4bbf2c877d2cdc39e095d52ea3fe2a3 (patch) | |
tree | ffac760438fbbe091d921e0637029b43b78d8715 /Configure | |
parent | Modify ENGINE_pkey_asn1_find_str() to use a read lock instead of a write (diff) | |
download | openssl-b684ee2ce4bbf2c877d2cdc39e095d52ea3fe2a3.tar.xz openssl-b684ee2ce4bbf2c877d2cdc39e095d52ea3fe2a3.zip |
build.info: Introduce special syntax for dependencies on script modules
The DEPEND statement, when applied on files generated with GENERATE, may
be used to specify script modules that the template to be generated from
depends on. In short, this sort of depend:
DEPEND[generated]=util/perl/OpenSSL/something.pm
... would generate a perl run that has the inclusion directory
'util/perl/OpenSSL' and 'something' as the module to be loaded. However,
the package name for this module is 'OpenSSL::something', so to load it the
way it's expected, the inclusion directory should be 'util/perl', and the
module to be loaded should be specified as 'OpenSSL/something' (to be
massaged into a proper module name by the build file template).
To allow this, we introduce a file syntax, where a single '|' is used as a
directory separator, to delineate what part should be used as the inclustion
directory, and which part the module name to be loaded should be derived
from:
DEPEND[generated]=util/perl|OpenSSL/something.pm
Fixes #21112
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21117)
Diffstat (limited to 'Configure')
-rwxr-xr-x | Configure | 47 |
1 files changed, 39 insertions, 8 deletions
@@ -2442,17 +2442,39 @@ EOF } elsif ($dest eq '') { $ddest = ''; } else { - $ddest = cleanfile($sourced, $_, $blddir); + $ddest = cleanfile($sourced, $dest, $blddir); # If the destination doesn't exist in source, it can only be # a generated file in the build tree. if ($ddest eq $src_configdata || ! -f $ddest) { - $ddest = cleanfile($buildd, $_, $blddir); + $ddest = cleanfile($buildd, $dest, $blddir); } } - foreach (@{$depends{$dest}}) { - my $d = cleanfile($sourced, $_, $blddir); - my $d2 = cleanfile($buildd, $_, $blddir); + foreach my $f (@{$depends{$dest}}) { + # If the dependency destination is generated, dependencies + # may have an extra syntax to separate the intended inclusion + # directory from the module to be loaded: a | instead of a + # / as directory separator. + # Do note that this has to be handled in the build file + # template as well. + # $i = inclusion path in source directory + # $i2 = inclusion path in build directory + # $m = module path (within the inclusion path) + # $i = full module path in source directory + # $i2 = full module path in build directory + my $i; my $i2; my $m; my $d; my $d2; + if ($unified_info{generate}->{$ddest} + && $f =~ m/^(.*?)\|(.*)$/) { + $i = $1; + $m = $2; + $i = cleanfile($sourced, $i, $blddir); + $i2 = cleanfile($buildd, $i, $blddir); + $d = cleanfile($sourced, "$i/$m", $blddir); + $d2 = cleanfile($buildd, "$i/$m", $blddir); + } else { + $d = cleanfile($sourced, $f, $blddir); + $d2 = cleanfile($buildd, $f, $blddir); + } # If we know it's generated, or assume it is because we can't # find it in the source tree, we set file we depend on to be @@ -2462,13 +2484,20 @@ EOF keys %{$unified_info{generate}}) || ! -f $d) { $d = $d2; + $i = $i2; + } + if ($i) { + # Put together the computed inclusion dir with the + # original module name. Do note that we conserve the + # Unixly path syntax for the module path. + $d = "$i|$m"; } $unified_info{depends}->{$ddest}->{$d} = 1; # Fix up associated attributes $unified_info{attributes}->{depends}->{$ddest}->{$d} = - $attributes{depends}->{$dest}->{$_} - if defined $attributes{depends}->{$dest}->{$_}; + $attributes{depends}->{$dest}->{$f} + if defined $attributes{depends}->{$dest}->{$f}; } } @@ -2638,7 +2667,9 @@ EOF next if $dest eq ""; foreach my $d (keys %{$unified_info{depends}->{$dest}}) { next unless $d =~ /\.(h|pm)$/; - my $i = dirname($d); + # Take into account when a dependency uses the inclusion|module + # syntax + my $i = $d =~ m/\|/ ? $` : dirname($d); my $spot = $d eq "configdata.pm" || defined($unified_info{generate}->{$d}) ? 'build' : 'source'; |