#! /usr/bin/env perl
# -*- mode: perl; -*-
-# Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
use File::Basename;
use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs splitdir/;
use File::Path qw/mkpath/;
+use File::Compare qw(compare_text);
use OpenSSL::fallback "$FindBin::Bin/external/perl/MODULES.txt";
use OpenSSL::Glob;
use OpenSSL::Template;
my $usage="Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]\n";
+my $banner = <<"EOF";
+
+**********************************************************************
+*** ***
+*** OpenSSL has been successfully configured ***
+*** ***
+*** If you encounter a problem while building, please open an ***
+*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
+*** and include the output from the following command: ***
+*** ***
+*** perl configdata.pm --dump ***
+*** ***
+*** (If you are new to OpenSSL, you might want to consult the ***
+*** 'Troubleshooting' section in the INSTALL.md file first) ***
+*** ***
+**********************************************************************
+EOF
+
# Options:
#
# --config add the given configuration file, which will be read after
# given with --prefix.
# This becomes the value of OPENSSLDIR in Makefile and in C.
# (Default: PREFIX/ssl)
+# --banner=".." Output specified text instead of default completion banner
+#
+# -w Don't wait after showing a Configure warning
#
# --cross-compile-prefix Add specified prefix to binutils components.
#
# get past these. Note that we only use these with C compilers, not with
# C++ compilers.
-# DEBUG_UNUSED enables __owur (warn unused result) checks.
# -DPEDANTIC complements -pedantic and is meant to mask code that
# is not strictly standard-compliant and/or implementation-specific,
# e.g. inline assembly, disregards to alignment requirements, such
# but 'long long' type.
my @gcc_devteam_warn = qw(
- -DDEBUG_UNUSED
- -DPEDANTIC -pedantic -Wno-long-long
+ -DPEDANTIC -pedantic -Wno-long-long -DUNUSEDRESULT_DEBUG
-Wall
+ -Wmissing-declarations
-Wextra
-Wno-unused-parameter
-Wno-missing-field-initializers
# For developers: keep it sorted alphabetically
my @disablables = (
- "acvp_tests",
+ "acvp-tests",
"afalgeng",
"aria",
"asan",
"dynamic-engine",
"ec",
"ec2m",
+ "ec_nistp_64_gcc_128",
"ecdh",
"ecdsa",
- "ec_nistp_64_gcc_128",
"egd",
"engine",
"err",
"filenames",
"fips",
"fips-securitychecks",
- "fuzz-libfuzzer",
"fuzz-afl",
+ "fuzz-libfuzzer",
"gost",
"idea",
"ktls",
"legacy",
+ "loadereng",
"makedepend",
"md2",
"md4",
"msan",
"multiblock",
"nextprotoneg",
- "pinshared",
"ocb",
"ocsp",
"padlockeng",
"pic",
+ "pinshared",
"poly1305",
"posix-io",
"psk",
"static-engine",
"stdio",
"tests",
+ "tfo",
"threads",
"tls",
"trace",
"ui-console",
"unit-test",
"uplink",
- "whirlpool",
"weak-ssl-ciphers",
+ "whirlpool",
"zlib",
"zlib-dynamic",
);
# All of the following are disabled by default:
our %disabled = ( # "what" => "comment"
+ "fips" => "default",
"asan" => "default",
"buildtest-c++" => "default",
"crypto-mdebug" => "default",
"ec_nistp_64_gcc_128" => "default",
"egd" => "default",
"external-tests" => "default",
- "fuzz-libfuzzer" => "default",
"fuzz-afl" => "default",
+ "fuzz-libfuzzer" => "default",
+ "ktls" => "default",
"md2" => "default",
"msan" => "default",
"rc5" => "default",
"sctp" => "default",
- "ssl-trace" => "default",
"ssl3" => "default",
"ssl3-method" => "default",
+ "tfo" => "default",
"trace" => "default",
"ubsan" => "default",
"unit-test" => "default",
"weak-ssl-ciphers" => "default",
"zlib" => "default",
"zlib-dynamic" => "default",
- "ktls" => "default",
);
# Note: => pair form used for aesthetics, not to truly make a hash table
"rc2", "rc4", "rmd160",
"seed", "siphash", "siv",
"sm3", "sm4", "srp",
- "srtp", "ssl3-method",
+ "srtp", "ssl3-method", "ssl-trace",
+ "tfo",
"ts", "ui-console", "whirlpool",
"fips-securitychecks" ],
sub { $config{processor} eq "386" }
"des" => [ "mdc2" ],
"ec" => [ "ec2m", "ecdsa", "ecdh", "sm2", "gost" ],
"dgram" => [ "dtls", "sctp" ],
- "sock" => [ "dgram" ],
+ "sock" => [ "dgram", "tfo" ],
"dtls" => [ @dtls ],
sub { 0 == scalar grep { !$disabled{$_} } @dtls }
=> [ "dtls" ],
# Without shared libraries, dynamic engines aren't possible.
# This is due to them having to link with libcrypto and register features
# using the ENGINE functionality, and since that relies on global tables,
- # those *have* to be exacty the same as the ones accessed from the app,
+ # those *have* to be exactly the same as the ones accessed from the app,
# which cannot be guaranteed if shared libraries aren't present.
# (note that even with shared libraries, both the app and dynamic engines
# must be linked with the same library)
"module" => [ "fips", "dso" ],
"engine" => [ "dynamic-engine", grep(/eng$/, @disablables) ],
+ "dynamic-engine" => [ "loadereng" ],
"hw" => [ "padlockeng" ],
# no-autoalginit is only useful when building non-shared
- "autoalginit" => [ "shared", "apps" ],
+ "autoalginit" => [ "shared", "apps", "fips" ],
"stdio" => [ "apps", "capieng", "egd" ],
"apps" => [ "tests" ],
"cmp" => [ "crmf" ],
+ "fips" => [ "fips-securitychecks", "acvp-tests" ],
+
"deprecated-3.0" => [ "engine", "srp" ]
);
s /^threads$/enable-threads/;
s /^zlib$/enable-zlib/;
s /^zlib-dynamic$/enable-zlib-dynamic/;
+ s /^fips$/enable-fips/;
if (/^(no|disable|enable)-(.+)$/)
{
{
$guess_opts{verbose} = 1;
}
- elsif (/^-w$/) # From older 'config'
+ elsif (/^-w$/)
{
$guess_opts{nowait} = 1;
}
}
elsif (/^386$/)
{ $config{processor}=386; }
- elsif (/^fips$/)
- {
- die "FIPS mode not supported\n";
- }
elsif (/^rsaref$/)
{
# No RSAref support any more since it's not needed.
# The check for the option is there so scripts aren't
# broken
}
- elsif (/^nofipscanistercheck$/)
- {
- die "FIPS mode not supported\n";
- }
elsif (m|^[-+/]|)
{
if (/^--prefix=(.*)$/)
die "FIPS key too long (64 bytes max)\n"
if length $1 > 64;
}
+ elsif (/^--banner=(.*)$/)
+ {
+ $banner = $1 . "\n";
+ }
elsif (/^--cross-compile-prefix=(.*)$/)
{
$user{CROSS_COMPILE}=$1;
# At this point, we can forget everything about %user and %useradd,
# because it's now all been merged into the corresponding $config entry
+if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) {
+ disable('static', 'pic', 'threads');
+}
+
# Allow overriding the build file name
$config{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
unless ($disabled{asm}) {
# big endian systems can use ELFv2 ABI
- if ($target eq "linux-ppc64") {
+ if ($target eq "linux-ppc64" || $target eq "BSD-ppc64") {
$target{perlasm_scheme} = "linux64v2" if ($predefined_C{_CALL_ELF} == 2);
}
}
# Check for makedepend capabilities.
if (!$disabled{makedepend}) {
- if ($config{target} =~ /^(VC|vms)-/) {
- # For VC- and vms- targets, there's nothing more to do here. The
- # functionality is hard coded in the corresponding build files for
- # cl (Windows) and CC/DECC (VMS).
+ # If the attribute makedep_scheme is defined, then we assume that the
+ # config target and its associated build file are programmed to deal
+ # with it.
+ # If makedep_scheme is undefined, we go looking for GCC compatible
+ # dependency making, and if that's not available, we try to fall back
+ # on 'makedepend'.
+ if ($target{makedep_scheme}) {
+ $config{makedep_scheme} = $target{makedep_scheme};
+ # If the makedepcmd attribute is defined, copy it. If not, the
+ # build files will have to fend for themselves.
+ $config{makedepcmd} = $target{makedepcmd} if $target{makedepcmd};
} elsif (($predefined_C{__GNUC__} // -1) >= 3
&& !($predefined_C{__APPLE_CC__} && !$predefined_C{__clang__})) {
# We know that GNU C version 3 and up as well as all clang
# versions support dependency generation, but Xcode did not
# handle $cc -M before clang support (but claims __GNUC__ = 3)
- $config{makedepprog} = "\$(CROSS_COMPILE)$config{CC}";
+ $config{makedep_scheme} = 'gcc';
} else {
- # In all other cases, we look for 'makedepend', and disable the
- # capability if not found.
- $config{makedepprog} = which('makedepend');
- disable('unavailable', 'makedepend') unless $config{makedepprog};
+ # In all other cases, we look for 'makedepend', and set the
+ # makedep_scheme value if we found it.
+ $config{makedepcmd} = which('makedepend');
+ $config{makedep_scheme} = 'makedepend' if $config{makedepcmd};
}
+
+ # If no depend scheme is set, we disable makedepend
+ disable('unavailable', 'makedepend') unless $config{makedep_scheme};
}
if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS') {
}
}
-if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) {
- disable('static', 'pic', 'threads');
-}
-
$config{CFLAGS} = [ map { $_ eq '--ossl-strict-warnings'
? @strict_warnings_collection
: ( $_ ) }
unless ($disabled{afalgeng}) {
$config{afalgeng}="";
if (grep { $_ eq 'afalgeng' } @{$target{enable}}) {
- my $minver = 4*10000 + 1*100 + 0;
- if ($config{CROSS_COMPILE} eq "") {
- my $verstr = `uname -r`;
- my ($ma, $mi1, $mi2) = split("\\.", $verstr);
- ($mi2) = $mi2 =~ /(\d+)/;
- my $ver = $ma*10000 + $mi1*100 + $mi2;
- if ($ver < $minver) {
- disable('too-old-kernel', 'afalgeng');
- } else {
- push @{$config{engdirs}}, "afalg";
- }
- } else {
- disable('cross-compiling', 'afalgeng');
- }
+ push @{$config{engdirs}}, "afalg";
} else {
disable('not-linux', 'afalgeng');
}
my %disabled_info = (); # For configdata.pm
foreach my $what (sort keys %disabled) {
# There are deprecated disablables that translate to themselves.
- # They cause disabling cascades, but should otherwise not regiter.
+ # They cause disabling cascades, but should otherwise not register.
next if $deprecated_disablables{$what};
# The generated $disabled{"deprecated-x.y"} entries are special
# and treated properly elsewhere
$config{build_file_templates}
= [ cleanfile($srcdir, catfile("Configurations", "common0.tmpl"),
$blddir),
- $build_file_template,
- cleanfile($srcdir, catfile("Configurations", "common.tmpl"),
- $blddir) ];
+ $build_file_template ];
my @build_dirs = ( [ ] ); # current directory
my %defines = ();
my %depends = ();
my %generate = ();
+ my %imagedocs = ();
my %htmldocs = ();
my %mandocs = ();
my $index_re = qr/\[\s*(?P<INDEX>(?:\\.|.)*?)\s*\]/;
my $cond_re = qr/\[\s*(?P<COND>(?:\\.|.)*?)\s*\]/;
my $attribs_re = qr/(?:\{\s*(?P<ATTRIBS>(?:\\.|.)*?)\s*\})?/;
- my $value_re = qr/\s*(?P<VALUE>.*?)\s*/;
+ my $value_re = qr/(?P<VALUE>.*?)/;
collect_information(
collect_from_array([ @text ],
qr/\\$/ => sub { my $l1 = shift; my $l2 = shift;
qr/^\s* ENDIF \s*$/x
=> sub { die "ENDIF out of scope" if ! @skip;
pop @skip; },
- qr/^\s* ${variable_re} \s* = ${value_re} $/x
+ qr/^\s* ${variable_re} \s* = \s* ${value_re} \s* $/x
=> sub {
if (!@skip || $skip[$#skip] > 0) {
$variables{$+{VARIABLE}} = $expand_variables->($+{VALUE});
}
},
- qr/^\s* SUBDIRS \s* = ${value_re} $/x
+ qr/^\s* SUBDIRS \s* = \s* ${value_re} \s* $/x
=> sub {
if (!@skip || $skip[$#skip] > 0) {
foreach (tokenize($expand_variables->($+{VALUE}))) {
}
}
},
- qr/^\s* PROGRAMS ${attribs_re} \s* = ${value_re} $/x
+ qr/^\s* PROGRAMS ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\@programs, undef,
\$attributes{programs}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* LIBS ${attribs_re} \s* = ${value_re} $/x
+ qr/^\s* LIBS ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\@libraries, undef,
\$attributes{libraries}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* MODULES ${attribs_re} \s* = ${value_re} $/x
+ qr/^\s* MODULES ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\@modules, undef,
\$attributes{modules}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* SCRIPTS ${attribs_re} \s* = ${value_re} $/x
+ qr/^\s* SCRIPTS ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\@scripts, undef,
\$attributes{scripts}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* HTMLDOCS ${index_re} = ${value_re} $/x
+ qr/^\s* IMAGEDOCS ${index_re} \s* = \s* ${value_re} \s* $/x
+ => sub { $push_to->(\%imagedocs, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* HTMLDOCS ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%htmldocs, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* MANDOCS ${index_re} = ${value_re} $/x
+ qr/^\s* MANDOCS ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%mandocs, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* SOURCE ${index_re} = ${value_re} $/x
+ qr/^\s* SOURCE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%sources, $expand_variables->($+{INDEX}),
- undef, undef,
+ \$attributes{sources}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* SHARED_SOURCE ${index_re} = ${value_re} $/x
+ qr/^\s* SHARED_SOURCE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%shared_sources, $expand_variables->($+{INDEX}),
- undef, undef,
+ \$attributes{sources}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* INCLUDE ${index_re} = ${value_re} $/x
+ qr/^\s* INCLUDE ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%includes, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* DEFINE ${index_re} = ${value_re} $/x
+ qr/^\s* DEFINE ${index_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%defines, $expand_variables->($+{INDEX}),
undef, undef,
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* DEPEND ${index_re} ${attribs_re} = ${value_re} $/x
+ qr/^\s* DEPEND ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%depends, $expand_variables->($+{INDEX}),
\$attributes{depends}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
- qr/^\s* GENERATE ${index_re} = ${value_re} $/x
+ qr/^\s* GENERATE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%generate, $expand_variables->($+{INDEX}),
- undef, undef, $+{VALUE})
+ \$attributes{generate}, $+{ATTRIBS},
+ $expand_variables->($+{VALUE}))
if !@skip || $skip[$#skip] > 0; },
qr/^\s* (?:\#.*)? $/x => sub { },
"OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },
if ($s eq $src_configdata || $generate{$_} || ! -f $s) {
$s = cleanfile($buildd, $_, $blddir);
}
+ my $o = $_;
# We recognise C++, C and asm files
if ($s =~ /\.(cc|cpp|c|s|S)$/) {
push @{$check_exist{$s}}, $ddest;
- my $o = $_;
$o =~ s/\.[csS]$/.o/; # C and assembler
$o =~ s/\.(cc|cpp)$/_cc.o/; # C++
$o = cleanfile($buildd, $o, $blddir);
} elsif ($s =~ /\.rc$/) {
# We also recognise resource files
push @{$check_exist{$s}}, $ddest;
- my $o = $_;
$o =~ s/\.rc$/.res/; # Resource configuration
$o = cleanfile($buildd, $o, $blddir);
$unified_info{sources}->{$ddest}->{$o} = -1;
push @{$check_exist{$s}}, $ddest;
$unified_info{sources}->{$ddest}->{$s} = 1;
}
+ # Fix up associated attributes
+ if ($o ne $_) {
+ $unified_info{attributes}->{sources}->{$ddest}->{$o} =
+ $unified_info{attributes}->{sources}->{$o}->{$s} =
+ $attributes{sources}->{$dest}->{$_}
+ if defined $attributes{sources}->{$dest}->{$_};
+ } else {
+ $unified_info{attributes}->{sources}->{$ddest}->{$s} =
+ $attributes{sources}->{$dest}->{$_}
+ if defined $attributes{sources}->{$dest}->{$_};
+ }
}
}
$s = cleanfile($buildd, $_, $blddir);
}
+ my $o = $_;
if ($s =~ /\.(cc|cpp|c|s|S)$/) {
# We recognise C++, C and asm files
push @{$check_exist{$s}}, $ddest;
- my $o = $_;
$o =~ s/\.[csS]$/.o/; # C and assembler
$o =~ s/\.(cc|cpp)$/_cc.o/; # C++
$o = cleanfile($buildd, $o, $blddir);
} elsif ($s =~ /\.rc$/) {
# We also recognise resource files
push @{$check_exist{$s}}, $ddest;
- my $o = $_;
$o =~ s/\.rc$/.res/; # Resource configuration
$o = cleanfile($buildd, $o, $blddir);
$unified_info{shared_sources}->{$ddest}->{$o} = -1;
# We also recognise linker scripts (or corresponding)
# We know they are generated files
push @{$check_exist{$s}}, $ddest;
- my $ld = cleanfile($buildd, $_, $blddir);
- $unified_info{shared_sources}->{$ddest}->{$ld} = 1;
+ $o = cleanfile($buildd, $_, $blddir);
+ $unified_info{shared_sources}->{$ddest}->{$o} = 1;
} else {
die "unrecognised source file type for shared library: $s\n";
}
+ # Fix up associated attributes
+ if ($o ne $_) {
+ $unified_info{attributes}->{shared_sources}->{$ddest}->{$o} =
+ $unified_info{attributes}->{sources}->{$o}->{$s} =
+ $attributes{sources}->{$dest}->{$_}
+ if defined $attributes{sources}->{$dest}->{$_};
+ } else {
+ $unified_info{attributes}->{shared_sources}->{$ddest}->{$o} =
+ $attributes{sources}->{$dest}->{$_}
+ if defined $attributes{sources}->{$dest}->{$_};
+ }
}
}
$generator[0] = cleanfile($sourced, $gen, $blddir);
# If the generator is itself generated, it's in the build tree
- if ($generate{$gen}) {
+ if ($generate{$gen} || ! -f $generator[0]) {
$generator[0] = cleanfile($buildd, $gen, $blddir);
}
$check_generate{$ddest}->{$generator[0]}++;
$unified_info{generate}->{$ddest} = [ @generator ];
+ # Fix up associated attributes
+ $unified_info{attributes}->{generate}->{$ddest} =
+ $attributes{generate}->{$dest}->{$gen}
+ if defined $attributes{generate}->{$dest}->{$gen};
}
foreach (keys %depends) {
my $dest = $_;
- my $ddest = $dest eq "" ? "" : cleanfile($sourced, $_, $blddir);
+ my $ddest = $dest;
+
+ if ($dest =~ /^\|(.*)\|$/) {
+ # Collect the raw target
+ $unified_info{targets}->{$1} = 1;
+ $ddest = $1;
+ } elsif ($dest eq '') {
+ $ddest = '';
+ } else {
+ $ddest = cleanfile($sourced, $_, $blddir);
- # If the destination doesn't exist in source, it can only be
- # a generated file in the build tree.
- if ($ddest ne "" && ($ddest eq $src_configdata || ! -f $ddest)) {
- $ddest = cleanfile($buildd, $_, $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);
+ }
}
foreach (@{$depends{$dest}}) {
my $d = cleanfile($sourced, $_, $blddir);
+ my $d2 = cleanfile($buildd, $_, $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
# in the build tree rather than the source tree.
if ($d eq $src_configdata
- || (grep { $d eq $_ }
- map { cleanfile($srcdir, $_, $blddir) }
- grep { /\.h$/ } keys %{$unified_info{generate}})
+ || (grep { $d2 eq $_ }
+ keys %{$unified_info{generate}})
|| ! -f $d) {
- $d = cleanfile($buildd, $_, $blddir);
+ $d = $d2;
}
$unified_info{depends}->{$ddest}->{$d} = 1;
}
}
+ foreach my $section (keys %imagedocs) {
+ foreach (@{$imagedocs{$section}}) {
+ my $imagedocs = cleanfile($buildd, $_, $blddir);
+ $unified_info{imagedocs}->{$section}->{$imagedocs} = 1;
+ }
+ }
+
foreach my $section (keys %htmldocs) {
foreach (@{$htmldocs{$section}}) {
my $htmldocs = cleanfile($buildd, $_, $blddir);
$unified_info{$dst}->{$prod}->{$newobj} = 1;
foreach my $src (@{$prod_sources{$_}}) {
$unified_info{sources}->{$newobj}->{$src} = 1;
+ # Adjust source attributes
+ my $attrs = $unified_info{attributes}->{sources};
+ if (defined $attrs->{$prod}
+ && defined $attrs->{$prod}->{$_}) {
+ $attrs->{$prod}->{$newobj} =
+ $attrs->{$prod}->{$_};
+ delete $attrs->{$prod}->{$_};
+ }
+ foreach my $objsrc (keys %{$attrs->{$_} // {}}) {
+ $attrs->{$newobj}->{$objsrc} =
+ $attrs->{$_}->{$objsrc};
+ delete $attrs->{$_}->{$objsrc};
+ }
}
# Adjust dependencies
foreach my $deps (keys %{$unified_info{depends}->{$_}}) {
### Make unified_info a bit more efficient
# One level structures
- foreach (("programs", "libraries", "modules", "scripts")) {
+ foreach (("programs", "libraries", "modules", "scripts", "targets")) {
$unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
}
# Two level structures
foreach my $l1 (("sources", "shared_sources", "ldadd", "depends",
- "htmldocs", "mandocs")) {
+ "imagedocs", "htmldocs", "mandocs")) {
foreach my $l2 (sort keys %{$unified_info{$l1}}) {
my @items =
sort
"dso" => [ @{$unified_info{modules}} ],
"bin" => [ @{$unified_info{programs}} ],
"script" => [ @{$unified_info{scripts}} ],
- "docs" => [ (map { @{$unified_info{htmldocs}->{$_} // []} }
+ "docs" => [ (map { @{$unified_info{imagedocs}->{$_} // []} }
+ keys %{$unified_info{imagedocs} // {}}),
+ (map { @{$unified_info{htmldocs}->{$_} // []} }
keys %{$unified_info{htmldocs} // {}}),
(map { @{$unified_info{mandocs}->{$_} // []} }
keys %{$unified_info{mandocs} // {}}) ] );
- foreach my $type (keys %loopinfo) {
+ foreach my $type (sort keys %loopinfo) {
foreach my $product (@{$loopinfo{$type}}) {
my %dirs = ();
my $pd = dirname($product);
push @{$unified_info{dirinfo}->{$d}->{deps}}, $_
if $d ne $pd;
}
- foreach (keys %dirs) {
+ foreach (sort keys %dirs) {
push @{$unified_info{dirinfo}->{$_}->{products}->{$type}},
$product;
}
user_crossable => \@user_crossable,
);
my $configdata_outname = 'configdata.pm';
-print "Creating $configdata_outname\n";
open CONFIGDATA, ">$configdata_outname.new"
- or die "Trying to create $configdata_outname.new: $!";
+ or die "Trying to create $configdata_outname.new: $!";
my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir);
my $configdata_tmpl =
OpenSSL::Template->new(TYPE => 'FILE', SOURCE => $configdata_tmplname);
] }
) or die $Text::Template::ERROR;
close CONFIGDATA;
-rename "$configdata_outname.new", $configdata_outname;
-if ($builder_platform eq 'unix') {
- my $mode = (0755 & ~umask);
- chmod $mode, 'configdata.pm'
- or warn sprintf("WARNING: Couldn't change mode for 'configdata.pm' to 0%03o: %s\n",$mode,$!);
+
+# When using stat() on Windows, we can get it to perform better by avoid some
+# data. This doesn't affect the mtime field, so we're not losing anything...
+${^WIN32_SLOPPY_STAT} = 1;
+
+my $update_configdata = 0;
+my $run_configdata = 0;
+if (-f $configdata_outname) {
+ my $Configure_mtime = (stat($0))[9];
+ my $configdata_mtime = (stat($configdata_outname))[9];
+
+ # If this script was updated after the last configdata.pm, or if
+ # configdata.pm.new differs from configdata.pm, we update configdata.pm
+ if ($configdata_mtime < $Configure_mtime
+ || compare_text("$configdata_outname.new", $configdata_outname) != 0) {
+ $update_configdata = 1;
+ } else {
+ # If nothing has changed, let's just drop the new one and pretend
+ # like nothing happened
+ unlink "$configdata_outname.new";
+
+ # We still run configdata.pm if one of the build file (Makefile) or
+ # the configuration header file are missing
+ $run_configdata =
+ !( -f $target{build_file} )
+ || !( -f catfile('include', 'openssl', 'configuration.h') );
+ }
+} else {
+ $update_configdata = 1;
+}
+
+if ($update_configdata) {
+ # If something did change, or there was no previous configdata.pm, we
+ # rename the new one, set permissions as needed, and run it.
+ rename "$configdata_outname.new", $configdata_outname;
+ if ($builder_platform eq 'unix') {
+ my $mode = (0755 & ~umask);
+ chmod $mode, 'configdata.pm'
+ or warn sprintf("WARNING: Couldn't change mode for 'configdata.pm' to 0%03o: %s\n",$mode,$!);
+ }
+ $run_configdata = 1;
+ print "Created $configdata_outname\n";
}
-print "Running $configdata_outname\n";
-my $perlcmd = (quotify("maybeshell", $config{PERL}))[0];
-my $cmd = "$perlcmd $configdata_outname";
-#print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n";
-system($cmd);
-exit 1 if $? != 0;
+if ($run_configdata) {
+ print "Running $configdata_outname\n";
+ my $perlcmd = (quotify("maybeshell", $config{PERL}))[0];
+ my $cmd = "$perlcmd $configdata_outname";
+ #print STDERR "DEBUG[run_dofile]: \$cmd = $cmd\n";
+ system($cmd);
+ exit 1 if $? != 0;
+} else {
+ print "No changes in $configdata_outname, no need to run it\n";
+}
$SIG{__DIE__} = $orig_death_handler;
you have tried with a current version of OpenSSL).
EOF
-print <<"EOF";
-
-**********************************************************************
-*** ***
-*** OpenSSL has been successfully configured ***
-*** ***
-*** If you encounter a problem while building, please open an ***
-*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
-*** and include the output from the following command: ***
-*** ***
-*** perl configdata.pm --dump ***
-*** ***
-*** (If you are new to OpenSSL, you might want to consult the ***
-*** 'Troubleshooting' section in the INSTALL.md file first) ***
-*** ***
-**********************************************************************
-EOF
+print $banner;
exit(0);
}
}
- foreach (sort keys %all_keys) {
- my $previous = $combined_inheritance{$_};
+ foreach my $key (sort keys %all_keys) {
+ my $previous = $combined_inheritance{$key};
# Current target doesn't have a value for the current key?
# Assign it the default combiner, the rest of this loop body
# will handle it just like any other coderef.
- if (!exists $table{$target}->{$_}) {
- $table{$target}->{$_} = $default_combiner;
+ if (!exists $table{$target}->{$key}) {
+ $table{$target}->{$key} = $default_combiner;
}
- $table{$target}->{$_} = process_values($table{$target}->{$_},
- $combined_inheritance{$_},
- $target, $_);
- unless(defined($table{$target}->{$_})) {
- delete $table{$target}->{$_};
+ $table{$target}->{$key} = process_values($table{$target}->{$key},
+ $combined_inheritance{$key},
+ $target, $key);
+ unless(defined($table{$target}->{$key})) {
+ delete $table{$target}->{$key};
}
# if ($extra_checks &&
-# $previous && !($add_called || $previous ~~ $table{$target}->{$_})) {
-# warn "$_ got replaced in $target\n";
+# $previous && !($add_called || $previous ~~ $table{$target}->{$key})) {
+# warn "$key got replaced in $target\n";
# }
}