Make 'make ordinals' work again

'make ordinals' assumed that all headers reside in the source tree,
which is no longer true, now that we generate a number of them.  This
needed some refactoring.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12781)
This commit is contained in:
Richard Levitte 2020-09-04 08:51:37 +02:00 committed by Matt Caswell
parent 83ecb26f2b
commit 962963395c

View File

@ -1062,7 +1062,7 @@ errors:
{- use File::Basename;
our @sslheaders =
my @sslheaders_tmpl =
qw( include/openssl/ssl.h
include/openssl/ssl2.h
include/openssl/ssl3.h
@ -1070,7 +1070,7 @@ errors:
include/openssl/tls1.h
include/openssl/dtls1.h
include/openssl/srtp.h );
our @cryptoheaders =
my @cryptoheaders_tmpl =
qw( include/internal/dso.h
include/internal/o_dir.h
include/internal/err.h
@ -1078,15 +1078,39 @@ errors:
include/internal/pem.h
include/internal/asn1.h
include/internal/sslconf.h );
our @cryptoskipheaders = ( @sslheaders,
my @cryptoskipheaders = ( @sslheaders_tmpl,
qw( include/openssl/conf_api.h
include/openssl/ebcdic.h
include/openssl/opensslconf.h
include/openssl/symhacks.h ) );
foreach my $f ( glob(catfile($config{sourcedir},
'include','openssl','*.h')) ) {
my $fn = "include/openssl/" . basename($f);
push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
our @cryptoheaders = ();
our @sslheaders = ();
foreach my $d ( qw( include/openssl include/internal ) ) {
my @header_patterns =
map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
foreach my $f ( map { glob($_) } @header_patterns ) {
my $base = basename($f);
my $base_in = basename($f, '.in');
my $dir = catfile($config{sourcedir}, $d);
if ($base ne $base_in) {
# We have a .h.in file, which means the header file is in the
# build tree.
$base = $base_in;
$dir = catfile($config{builddir}, $d);
}
my $new_f = catfile($dir, $base);
my $fn = "$d/$base";
# The logic to add files to @cryptoheaders is a bit complex. The
# file to be added must be either in the public header directory
# or one of the pre-declared internal headers, and must under no
# circumstances be one of those that must be skipped.
push @cryptoheaders, $new_f
if (($d eq 'include/openssl'
|| ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
&& !( grep { $_ eq $fn } @cryptoskipheaders ));
# The logic to add files to @sslheaders is much simpler...
push @sslheaders, $new_f if grep { $_ eq $fn } @sslheaders_tmpl;
}
}
"";
-}
@ -1094,17 +1118,15 @@ CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
SSLHEADERS={- join(" \\\n" . ' ' x 11,
fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
ordinals:
( cd $(SRCDIR); \
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
--ordinals util/libcrypto.num \
--symhacks include/openssl/symhacks.h \
$(CRYPTOHEADERS) )
( cd $(SRCDIR); \
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
--ordinals util/libssl.num \
--symhacks include/openssl/symhacks.h \
$(SSLHEADERS))
ordinals: build_generated
$(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
--ordinals $(SRCDIR)/util/libcrypto.num \
--symhacks $(SRCDIR)/include/openssl/symhacks.h \
$(CRYPTOHEADERS)
$(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
--ordinals $(SRCDIR)/util/libssl.num \
--symhacks $(SRCDIR)/include/openssl/symhacks.h \
$(SSLHEADERS)
test_ordinals:
( cd test; \