summaryrefslogtreecommitdiffstats
path: root/Configurations/descrip.mms.tmpl
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2023-06-02 14:32:07 +0200
committerRichard Levitte <levitte@openssl.org>2023-06-08 07:53:10 +0200
commitb684ee2ce4bbf2c877d2cdc39e095d52ea3fe2a3 (patch)
treeffac760438fbbe091d921e0637029b43b78d8715 /Configurations/descrip.mms.tmpl
parentb8fa5be5506e43b405c9a3ecc3d65c77044777be (diff)
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 'Configurations/descrip.mms.tmpl')
-rw-r--r--Configurations/descrip.mms.tmpl46
1 files changed, 39 insertions, 7 deletions
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index ce74b3703f..b6e6eb4d60 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -1056,16 +1056,48 @@ EOF
my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
"util", "dofile.pl")),
rel2abs($config{builddir}));
- my @perlmodules = ( 'configdata.pm',
- grep { $_ =~ m|\.pm$| } @{$args{deps}} );
- my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
+ my @perlmodules = ();
+ my %perlmoduleincs = ();
+ my %perlmoduledeps = ();
+ foreach my $x (('configdata.pm', @{$args{deps}})) {
+ # Compute (i)nclusion directory, (m)odule name and (d)ependency
+ my $i, $m, $d;
+ if ($x =~ /\|/) {
+ $i = $`;
+ $d = $';
+
+ # Massage the module part to become a real perl module spec
+ $m = $d;
+ $m =~ s|\.pm$||;
+ # Directory specs are :: in perl package names
+ $m =~ s|/|::|g;
+
+ # Full file name of the dependency
+ $d = catfile($i, $d) if $i;
+ } elsif ($x =~ /\.pm$/) {
+ $i = dirname($x);
+ $m = basename($x, '.pm');
+ $d = $x;
+ } else {
+ # All other dependencies are simply collected
+ $d = $x;
+ }
+ push @perlmodules, '"-M'.$m.'"' if $m;
+ $perlmoduledeps{$d} = 1;
+ $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
+ }
+
my @decc_include_data
= make_decc_include_files(dirname($args{src}), dirname($gen0));
my $decc_include_scripture = pop @decc_include_data;
- $deps = join(' ', $deps, @decc_include_data,
- compute_platform_depends(@perlmodules));
- @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules;
- my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
+ # Because of the special treatment of dependencies, we need to
+ # recompute $deps completely
+ my $deps
+ = join(" ", @decc_include_data,
+ compute_platform_depends(@{$args{generator_deps}},
+ sort keys %perlmoduledeps));
+ my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
+
return <<"EOF";
$args{src} : $gen0 $deps