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; {- use File::Basename;
our @sslheaders = my @sslheaders_tmpl =
qw( include/openssl/ssl.h qw( include/openssl/ssl.h
include/openssl/ssl2.h include/openssl/ssl2.h
include/openssl/ssl3.h include/openssl/ssl3.h
@ -1070,7 +1070,7 @@ errors:
include/openssl/tls1.h include/openssl/tls1.h
include/openssl/dtls1.h include/openssl/dtls1.h
include/openssl/srtp.h ); include/openssl/srtp.h );
our @cryptoheaders = my @cryptoheaders_tmpl =
qw( include/internal/dso.h qw( include/internal/dso.h
include/internal/o_dir.h include/internal/o_dir.h
include/internal/err.h include/internal/err.h
@ -1078,15 +1078,39 @@ errors:
include/internal/pem.h include/internal/pem.h
include/internal/asn1.h include/internal/asn1.h
include/internal/sslconf.h ); include/internal/sslconf.h );
our @cryptoskipheaders = ( @sslheaders, my @cryptoskipheaders = ( @sslheaders_tmpl,
qw( include/openssl/conf_api.h qw( include/openssl/conf_api.h
include/openssl/ebcdic.h include/openssl/ebcdic.h
include/openssl/opensslconf.h include/openssl/opensslconf.h
include/openssl/symhacks.h ) ); include/openssl/symhacks.h ) );
foreach my $f ( glob(catfile($config{sourcedir}, our @cryptoheaders = ();
'include','openssl','*.h')) ) { our @sslheaders = ();
my $fn = "include/openssl/" . basename($f); foreach my $d ( qw( include/openssl include/internal ) ) {
push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders; 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)) -} fill_lines(" ", $COLUMNS - 14, sort @cryptoheaders)) -}
SSLHEADERS={- join(" \\\n" . ' ' x 11, SSLHEADERS={- join(" \\\n" . ' ' x 11,
fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -} fill_lines(" ", $COLUMNS - 11, sort @sslheaders)) -}
ordinals: ordinals: build_generated
( cd $(SRCDIR); \ $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ --ordinals $(SRCDIR)/util/libcrypto.num \
--ordinals util/libcrypto.num \ --symhacks $(SRCDIR)/include/openssl/symhacks.h \
--symhacks include/openssl/symhacks.h \ $(CRYPTOHEADERS)
$(CRYPTOHEADERS) ) $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
( cd $(SRCDIR); \ --ordinals $(SRCDIR)/util/libssl.num \
$(PERL) util/mknum.pl --version $(VERSION) --no-warnings \ --symhacks $(SRCDIR)/include/openssl/symhacks.h \
--ordinals util/libssl.num \ $(SSLHEADERS)
--symhacks include/openssl/symhacks.h \
$(SSLHEADERS))
test_ordinals: test_ordinals:
( cd test; \ ( cd test; \