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 diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index 89f9b81e72..f852acf513 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -1641,12 +1641,44 @@ 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; - $deps = join(' ', $deps, compute_platform_depends(@perlmodules)); - @perlmodules = map { "-M".basename($_, '.pm') } @perlmodules; - my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @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; + } + + # Because of the special treatment of dependencies, we need to + # recompute $deps completely + my $deps + = join(" ", compute_platform_depends(@{$args{generator_deps}}, + sort keys %perlmoduledeps)); + my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules); + return <<"EOF"; $args{src}: $gen0 $deps \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@ diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index 9250b989ca..c05d03f369 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -790,12 +790,44 @@ 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; - $deps = join(' ', $deps, compute_platform_depends(@perlmodules)); - @perlmodules = map { "-M".basename($_, '.pm') } @perlmodules; - my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @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; + } + + # Because of the special treatment of dependencies, we need to + # recompute $deps completely + my $deps + = join(" ", compute_platform_depends(@{$args{generator_deps}}, + sort keys %perlmoduledeps)); + my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules); + return <<"EOF"; $args{src}: "$gen0" $deps "\$(PERL)"$perlmodules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@ diff --git a/Configure b/Configure index e62fbc99a8..ae16aafcea 100755 --- a/Configure +++ b/Configure @@ -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'; diff --git a/build.info b/build.info index a8bd48e540..d9e3c904b2 100644 --- a/build.info +++ b/build.info @@ -75,6 +75,9 @@ GENERATE[include/openssl/x509_vfy.h]=include/openssl/x509_vfy.h.in GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in +DEPEND[crypto/params_idx.c \ + include/internal/param_names.h \ + include/openssl/core_names.h]=util/perl|OpenSSL/paramnames.pm GENERATE[crypto/params_idx.c]=crypto/params_idx.c.in GENERATE[include/internal/param_names.h]=include/internal/param_names.h.in GENERATE[include/openssl/core_names.h]=include/openssl/core_names.h.in diff --git a/doc/internal/man7/build.info.pod b/doc/internal/man7/build.info.pod index 080c9e444e..0f1f8be006 100644 --- a/doc/internal/man7/build.info.pod +++ b/doc/internal/man7/build.info.pod @@ -461,18 +461,15 @@ C is strong, while the dependency between C and C and C is weak. See the description of B in L for more information. +B is a bit more involving when used with Is that are +generated with B. This is described more in depth below. + =item BIB<]> B<=> I I ... This specifies that the I is generated using the I with the Is as arguments, plus the name of the output file as last argument. -For Is where this is applicable, any B statement -for the same I will be given to the I as its -inclusion directories. Likewise, any B statement for the same -I will be given to the I as an extra file or module -to load, where this is applicable. - The build file generators must be able to recognise the I. Currently, they at least recognise files ending in C<.pl>, and will execute them to generate the I, and files ending in C<.in>, @@ -480,6 +477,42 @@ which will be used as input for L to generate I (in other words, we use the exact same style of L mechanism that is used to read F files). +For Is where this is applicable, any B statement +for the same I will be given to the I as its +inclusion directories. + +Likewise, For Is where this is applicable, any B +statement for the same I will be given to the I as an +extra file or module to load, where this is applicable. + +=over 4 + +=item The B statement may be problematic: + +Depending on what generator is used, a B statement also acts +as an B statement for the directory where the I is +located. In some cases, that's not quite feasible, because a module +isn't meant to be loaded by filename only and may require a nondefault +separation between the implied inclusion directory and the intended module +name. + +=item ... but there is a solution: + +To enable that sort of separation, B can use a slightly +different I syntax, that looks like this: + +BIB<]> B<=> I|I + +The I must be specified in a way that makes sense for the generator. +For example, when the generator implies perl (ends with C<.in>) and depends +on the module F - a.k.a. F - which lives in +F, it feasible to have something like this: + + GENERATE[something.c]=something.c.in + DEPEND[something.c]=util/perl|OpenSSL/foo.pm + +=back + =item BIB<]> B<=> I ... Collects filenames that will be used as source files for I.