From: Richard Levitte Date: Wed, 23 Feb 2022 08:05:10 +0000 (+0100) Subject: VMS: copy prologue/epilogue headers when header files are generated X-Git-Tag: openssl-3.2.0-alpha1~2910 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98b7b74122e66f63c4ec67a74e345c64a55c68db;p=thirdparty%2Fopenssl.git VMS: copy prologue/epilogue headers when header files are generated This is crucial when the build tree isn't the source tree, as they only take effect in directories where included header files reside. The issue only comes up when linking with the static libraries, since the shared libraries have upper case aliases of all symbols. Reviewed-by: Tim Hudson Reviewed-by: Paul Dale Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/17755) --- diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl index c8197337650..0c660152da5 100644 --- a/Configurations/descrip.mms.tmpl +++ b/Configurations/descrip.mms.tmpl @@ -871,6 +871,59 @@ EOF return ($filename, $scripture); } + # On VMS, (some) header file directories include the files + # __DECC_INCLUDE_EPILOGUE.H and __DECC_INCLUDE_PROLOGUE.H. + # When header files are generated, and the build directory + # isn't the same as the source directory, these files must + # be copied alongside the generated header file, or their + # effect will be lost. + # We use the same include file cache as make_includefile + # to check if the scripture to copy these files has already + # been generated. + sub make_decc_include_files { + my $outd = shift; + my $ind = shift; + + # If the build directory and the source directory are the + # same, there's no need to copy the prologue and epilogue + # files. + return ('') if $outd eq $ind; + + my $outprologue = catfile($outd, '__DECC_INCLUDE_PROLOGUE.H'); + my $outepilogue = catfile($outd, '__DECC_INCLUDE_EPILOGUE.H'); + my $inprologue = catfile($ind, '__DECC_INCLUDE_PROLOGUE.H'); + my $inepilogue = catfile($ind, '__DECC_INCLUDE_EPILOGUE.H'); + my @filenames = (); + my $scripture = ''; + + if ($includefile_cache{$outprologue}) { + push @filenames, $outprologue; + } elsif (-f $inprologue) { + my $local_scripture .= <<"EOF"; +$outprologue : $inprologue + COPY $inprologue $outprologue +EOF + $includefile_cache{$outprologue} = $local_scripture; + + push @filenames, $outprologue; + $scripture .= $local_scripture; + } + if ($includefile_cache{$outepilogue}) { + push @filenames, $outepilogue; + } elsif (-f $inepilogue) { + my $local_scripture .= <<"EOF"; +$outepilogue : $inepilogue + COPY $inepilogue $outepilogue +EOF + $includefile_cache{$outepilogue} = $local_scripture; + + push @filenames, $outepilogue; + $scripture .= $local_scripture; + } + + return (@filenames, $scripture); + } + sub generatetarget { my %args = @_; my $deps = join(" ", compute_platform_depends(@{$args{deps}})); @@ -984,12 +1037,18 @@ EOF my @perlmodules = ( 'configdata.pm', grep { $_ =~ m|\.pm$| } @{$args{deps}} ); my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules; - $deps = join(' ', $deps, compute_platform_depends(@perlmodules)); + 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); + return <<"EOF"; $args{src} : $gen0 $deps \$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@ +$decc_include_scripture EOF } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { #