From 7f73eafe2f5014ce1f915702c19ee7274e6b8c2d Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Sat, 3 Nov 2018 15:03:59 +0100 Subject: [PATCH] Build: make it possibly to specify subdirs in build.info This adds a keyword SUBDIRS for build.info, to be used like this: SUBDIRS=foo bar This tells Configure that it should look for 'build.info' in the relative subdirectories 'foo' and 'bar' as well. Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/7558) --- CHANGES | 5 +++++ Configurations/README | 8 +++++++- Configure | 37 +++++++++++++++---------------------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index de10744357..163dd9889c 100644 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,11 @@ Changes between 1.1.1 and 1.1.2 [xx XXX xxxx] + *) Instead of having the source directories listed in Configure, add + a 'build.info' keyword SUBDIRS to indicate what sub-directories to + look into. + [Richard Levitte] + *) Add GMAC to EVP_MAC. [Paul Dale] diff --git a/Configurations/README b/Configurations/README index 1c67f75a7b..10463aadee 100644 --- a/Configurations/README +++ b/Configurations/README @@ -400,7 +400,13 @@ $sourcedir and $builddir, which are the locations of the source directory for the current build.info file and the corresponding build directory, all relative to the top of the build tree. -To begin with, things to be built are declared by setting specific +'Configure' only knows inherently about the top build.info file. For +any other directory that has one, further directories to look into +must be indicated like this: + + SUBDIRS=something someelse + +On to things to be built; they are declared by setting specific variables: PROGRAMS=foo bar diff --git a/Configure b/Configure index 094898cc56..65a3e2b3af 100755 --- a/Configure +++ b/Configure @@ -15,7 +15,7 @@ use Config; use FindBin; use lib "$FindBin::Bin/util/perl"; use File::Basename; -use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; +use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs splitdir/; use File::Path qw/mkpath/; use OpenSSL::Glob; @@ -1677,34 +1677,19 @@ if ($builder eq "unified") { cleanfile($srcdir, catfile("Configurations", "common.tmpl"), $blddir) ]; - my @build_infos = ( [ ".", "build.info" ] ); - foreach (@{$config{dirs}}) { - push @build_infos, [ $_, "build.info" ] - if (-f catfile($srcdir, $_, "build.info")); - } - foreach (@{$config{sdirs}}) { - push @build_infos, [ catdir("crypto", $_), "build.info" ] - if (-f catfile($srcdir, "crypto", $_, "build.info")); - } - foreach (@{$config{engdirs}}) { - push @build_infos, [ catdir("engines", $_), "build.info" ] - if (-f catfile($srcdir, "engines", $_, "build.info")); - } - foreach (@{$config{tdirs}}) { - push @build_infos, [ catdir("test", $_), "build.info" ] - if (-f catfile($srcdir, "test", $_, "build.info")); - } + my @build_dirs = ( [ ] ); # current directory $config{build_infos} = [ ]; my %ordinals = (); - foreach (@build_infos) { - my $sourced = catdir($srcdir, $_->[0]); - my $buildd = catdir($blddir, $_->[0]); + while (@build_dirs) { + my @curd = @{shift @build_dirs}; + my $sourced = catdir($srcdir, @curd); + my $buildd = catdir($blddir, @curd); mkpath($buildd); - my $f = $_->[1]; + my $f = 'build.info'; # The basic things we're trying to build my @programs = (); my @programs_install = (); @@ -1783,6 +1768,14 @@ if ($builder eq "unified") { qr/^\s*ENDIF\s*$/ => sub { die "ENDIF out of scope" if ! @skip; pop @skip; }, + qr/^\s*SUBDIRS\s*=\s*(.*)\s*$/ + => sub { + if (!@skip || $skip[$#skip] > 0) { + foreach (tokenize($1)) { + push @build_dirs, [ @curd, splitdir($_, 1) ]; + } + } + }, qr/^\s*PROGRAMS(_NO_INST)?\s*=\s*(.*)\s*$/ => sub { if (!@skip || $skip[$#skip] > 0) { -- 2.25.1