# code, so we just tell compiler to be pedantic about everything
# but 'long long' type.
-my $gcc_devteam_warn = "-DDEBUG_UNUSED"
- . " -DPEDANTIC -pedantic -Wno-long-long"
- . " -Wall"
- . " -Wextra"
- . " -Wno-unused-parameter"
- . " -Wno-missing-field-initializers"
- . " -Wswitch"
- . " -Wsign-compare"
- . " -Wmissing-prototypes"
- . " -Wstrict-prototypes"
- . " -Wshadow"
- . " -Wformat"
- . " -Wtype-limits"
- . " -Wundef"
- . " -Werror"
- ;
+my %gcc_devteam_warn = ();
+{
+ my @common = qw( -DDEBUG_UNUSED
+ -DPEDANTIC -pedantic -Wno-long-long
+ -Wall
+ -Wextra
+ -Wno-unused-parameter
+ -Wno-missing-field-initializers
+ -Wswitch
+ -Wsign-compare
+ -Wshadow
+ -Wformat
+ -Wtype-limits
+ -Wundef
+ -Werror );
+ %gcc_devteam_warn = (
+ CFLAGS => [ @common, qw( -Wmissing-prototypes
+ -Wstrict-prototypes ) ],
+ CXXFLAGS => [ @common ]
+ );
+}
# These are used in addition to $gcc_devteam_warn when the compiler is clang.
# TODO(openssl-team): fix problems and investigate if (at least) the
# -Wlanguage-extension-token -- no, we use asm()
# -Wunused-macros -- no, too tricky for BN and _XOPEN_SOURCE etc
# -Wextended-offsetof -- no, needed in CMS ASN1 code
-my $clang_devteam_warn = ""
- . " -Wswitch-default"
- . " -Wno-parentheses-equality"
- . " -Wno-language-extension-token"
- . " -Wno-extended-offsetof"
- . " -Wconditional-uninitialized"
- . " -Wincompatible-pointer-types-discards-qualifiers"
- . " -Wmissing-variable-declarations"
- . " -Wno-unknown-warning-option"
- ;
+my %clang_devteam_warn = ();
+{
+ my @common = qw( -Wswitch-default
+ -Wno-parentheses-equality
+ -Wno-language-extension-token
+ -Wno-extended-offsetof
+ -Wconditional-uninitialized
+ -Wincompatible-pointer-types-discards-qualifiers
+ -Wno-unknown-warning-option );
+ %clang_devteam_warn = (
+ CFLAGS => [ @common, qw( -Wmissing-variable-declarations ) ],
+ CXXFLAGS => [ @common ]
+ );
+}
# This adds backtrace information to the memory leak info. Is only used
# when crypto-mdebug-backtrace is enabled.
"autoload-config",
"bf",
"blake2",
+ "buildtest-c++",
"camellia",
"capieng",
"cast",
"fuzz-afl",
"gost",
"heartbeats",
- "hw(-.+)?",
"idea",
"makedepend",
"md2",
"pinshared",
"ocb",
"ocsp",
+ "padlockeng",
"pic",
"poly1305",
"posix-io",
"tests",
"threads",
"tls",
+ "trace",
"ts",
"ubsan",
"ui-console",
my %deprecated_disablables = (
"ssl2" => undef,
"buf-freelists" => undef,
+ "hw" => "hw", # causes cascade, but no macro
+ "hw-padlock" => "padlockeng",
"ripemd" => "rmd160",
"ui" => "ui-console",
);
our %disabled = ( # "what" => "comment"
"asan" => "default",
+ "buildtest-c++" => "default",
"crypto-mdebug" => "default",
"crypto-mdebug-backtrace" => "default",
"devcryptoeng" => "default",
# Without position independent code, there can be no shared libraries or DSOs
"pic" => [ "shared" ],
"shared" => [ "dynamic-engine" ],
- "engine" => [ "afalgeng", "devcryptoeng" ],
+
+ "engine" => [ grep /eng$/, @disablables ],
+ "hw" => [ "padlockeng" ],
# no-autoalginit is only useful when building non-shared
"autoalginit" => [ "shared", "apps" ],
AS => undef,
ASFLAGS => [],
CC => env('CC'),
- CFLAGS => [],
+ CFLAGS => [ env('CFLAGS') || () ],
CXX => env('CXX'),
- CXXFLAGS => [],
+ CXXFLAGS => [ env('CXXFLAGS') || () ],
CPP => undef,
- CPPFLAGS => [], # -D, -I, -Wp,
+ CPPFLAGS => [ env('CPPFLAGS') || () ], # -D, -I, -Wp,
CPPDEFINES => [], # Alternative for -D
CPPINCLUDES => [], # Alternative for -I
CROSS_COMPILE => env('CROSS_COMPILE'),
HASHBANGPERL=> env('HASHBANGPERL') || env('PERL'),
LD => undef,
- LDFLAGS => [], # -L, -Wl,
- LDLIBS => [], # -l
+ LDFLAGS => [ env('LDFLAGS') || () ], # -L, -Wl,
+ LDLIBS => [ env('LDLIBS') || () ], # -l
MT => undef,
MTFLAGS => [],
PERL => env('PERL') || ($^O ne "VMS" ? $^X : "perl"),
if (/^(no|disable|enable)-(.+)$/)
{
my $word = $2;
- if (!exists $deprecated_disablables{$word}
- && !grep { $word =~ /^${_}$/ } @disablables)
+ if ($word !~ m|hw(?:-.+)| # special treatment for hw regexp opt
+ && !exists $deprecated_disablables{$word}
+ && !grep { $word eq $_ } @disablables)
{
$unsupported_options{$_} = 1;
next;
$disabled{$deprecated_disablables{$1}} = "option";
}
}
+ elsif ($1 =~ m|hw(?:-.+)|) # deprecate hw options in regexp form
+ {
+ $deprecated_options{$_} = 1;
+ }
else
{
$disabled{$1} = "option";
}
elsif (/^--strict-warnings$/)
{
- $strict_warnings = 1;
+ # Pretend that our strict flags is a C flag, and replace it
+ # with the proper flags later on
+ push @{$useradd{CFLAGS}}, '--ossl-strict-warnings';
+ push @{$useradd{CXXFLAGS}}, '--ossl-strict-warnings';
+ $strict_warnings=1;
}
elsif (/^--debug$/)
{
my %skipdir = ();
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.
+ next if $deprecated_disablables{$what};
+
$config{options} .= " no-$what";
- if (!grep { $what eq $_ } ( 'dso', 'threads', 'shared', 'pic',
- 'dynamic-engine', 'makedepend',
+ if (!grep { $what eq $_ } ( 'buildtest-c++', 'dso', 'threads', 'shared',
+ 'pic', 'dynamic-engine', 'makedepend',
'zlib-dynamic', 'zlib', 'sse2' )) {
(my $WHAT = uc $what) =~ s|-|_|g;
my $skipdir = $what;
push @{$config{lib_defines}}, "X25519_ASM";
}
if ($target{padlock_asm_src} ne $table{DEFAULTS}->{padlock_asm_src}) {
- push @{$config{lib_defines}}, "PADLOCK_ASM";
+ push @{$config{dso_defines}}, "PADLOCK_ASM";
}
if ($target{poly1305_asm_src} ne "") {
push @{$config{lib_defines}}, "POLY1305_ASM";
}
}
-my %predefined = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
+my %predefined_C = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
+my %predefined_CXX = $config{CXX}
+ ? compiler_predefined($config{CROSS_COMPILE}.$config{CXX})
+ : ();
# Check for makedepend capabilities.
if (!$disabled{makedepend}) {
# 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).
- } elsif (($predefined{__GNUC__} // -1) >= 3
- && !($predefined{__APPLE_CC__} && !$predefined{__clang__})) {
+ } 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)
}
}
-if (!$disabled{asm} && !$predefined{__MACH__} && $^O ne 'VMS') {
+if (!$disabled{asm} && !$predefined_C{__MACH__} && $^O ne 'VMS') {
# probe for -Wa,--noexecstack option...
- if ($predefined{__clang__}) {
+ if ($predefined_C{__clang__}) {
# clang has builtin assembler, which doesn't recognize --help,
# but it apparently recognizes the option in question on all
# supported platforms even when it's meaningless. In other words
"OPENSSL_MIN_API=".($apitable->{$config{api} // ""} // -1)
];
+my %strict_warnings_collection=( CFLAGS => [], CXXFLAGS => []);
if ($strict_warnings)
{
my $wopt;
- my $gccver = $predefined{__GNUC__} // -1;
+ my $gccver = $predefined_C{__GNUC__} // -1;
+ my $gxxver = $predefined_CXX{__GNUC__} // -1;
- die "ERROR --strict-warnings requires gcc[>=4] or gcc-alike"
+ warn "WARNING --strict-warnings requires gcc[>=4] or gcc-alike"
unless $gccver >= 4;
- foreach $wopt (split /\s+/, $gcc_devteam_warn)
+ warn "WARNING --strict-warnings requires g++[>=4] or g++-alike"
+ unless $gxxver >= 4;
+ foreach (qw(CFLAGS CXXFLAGS))
{
- push @{$config{cflags}}, $wopt
- unless grep { $_ eq $wopt } @{$config{cflags}};
- push @{$config{cxxflags}}, $wopt
- if ($config{CXX}
- && !grep { $_ eq $wopt } @{$config{cxxflags}});
- }
- if (defined($predefined{__clang__}))
- {
- foreach $wopt (split /\s+/, $clang_devteam_warn)
- {
- push @{$config{cflags}}, $wopt
- unless grep { $_ eq $wopt } @{$config{cflags}};
- push @{$config{cxxflags}}, $wopt
- if ($config{CXX}
- && !grep { $_ eq $wopt } @{$config{cxxflags}});
- }
+ push @{$strict_warnings_collection{$_}},
+ @{$gcc_devteam_warn{$_}};
}
+ push @{$strict_warnings_collection{CFLAGS}},
+ @{$clang_devteam_warn{CFLAGS}}
+ if (defined($predefined_C{__clang__}));
+ push @{$strict_warnings_collection{CXXFLAGS}},
+ @{$clang_devteam_warn{CXXFLAGS}}
+ if (defined($predefined_CXX{__clang__}));
}
+foreach my $idx (qw(CFLAGS CXXFLAGS))
+ {
+ $useradd{$idx} = [ map { $_ eq '--ossl-strict-warnings'
+ ? @{$strict_warnings_collection{$idx}}
+ : ( $_ ) }
+ @{$useradd{$idx}} ];
+ }
unless ($disabled{"crypto-mdebug-backtrace"})
{
my $f = 'build.info';
# The basic things we're trying to build
my @programs = ();
- my @programs_install = ();
my @libraries = ();
- my @libraries_install = ();
- my @engines = ();
- my @engines_install = ();
+ my @modules = ();
my @scripts = ();
- my @scripts_install = ();
- my @extra = ();
- my @overrides = ();
- my @intermediates = ();
- my @rawlines = ();
+ my %attributes = ();
my %sources = ();
my %shared_sources = ();
my %includes = ();
}
}
},
- qr/^\s*PROGRAMS(_NO_INST)?\s*=\s*(.*)\s*$/
+ qr/^\s*PROGRAMS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
=> sub {
if (!@skip || $skip[$#skip] > 0) {
- my $install = $1;
- my @x = tokenize($2);
- push @programs, @x;
- push @programs_install, @x unless $install;
+ my @a = tokenize($1, qr|\s*,\s*|);
+ my @p = tokenize($2);
+ push @programs, @p;
+ foreach my $a (@a) {
+ my $ak = $a;
+ my $av = 1;
+ if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
+ $ak = $1;
+ $av = $2;
+ }
+ foreach my $p (@p) {
+ $attributes{$p}->{$ak} = $av;
+ }
+ }
}
},
- qr/^\s*LIBS(_NO_INST)?\s*=\s*(.*)\s*$/
+ qr/^\s*LIBS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
=> sub {
if (!@skip || $skip[$#skip] > 0) {
- my $install = $1;
- my @x = tokenize($2);
- push @libraries, @x;
- push @libraries_install, @x unless $install;
+ my @a = tokenize($1, qr|\s*,\s*|);
+ my @l = tokenize($2);
+ push @libraries, @l;
+ foreach my $a (@a) {
+ my $ak = $a;
+ my $av = 1;
+ if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
+ $ak = $1;
+ $av = $2;
+ }
+ foreach my $l (@l) {
+ $attributes{$l}->{$ak} = $av;
+ }
+ }
}
},
- qr/^\s*ENGINES(_NO_INST)?\s*=\s*(.*)\s*$/
+ qr/^\s*MODULES(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
=> sub {
if (!@skip || $skip[$#skip] > 0) {
- my $install = $1;
- my @x = tokenize($2);
- push @engines, @x;
- push @engines_install, @x unless $install;
+ my @a = tokenize($1, qr|\s*,\s*|);
+ my @m = tokenize($2);
+ push @modules, @m;
+ foreach my $a (@a) {
+ my $ak = $a;
+ my $av = 1;
+ if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
+ $ak = $1;
+ $av = $2;
+ }
+ foreach my $m (@m) {
+ $attributes{$m}->{$ak} = $av;
+ }
+ }
}
},
- qr/^\s*SCRIPTS(_NO_INST)?\s*=\s*(.*)\s*$/
+ qr/^\s*SCRIPTS(?:{([\w=]+(?:\s*,\s*[\w=]+)*)})?\s*=\s*(.*)\s*$/
=> sub {
if (!@skip || $skip[$#skip] > 0) {
- my $install = $1;
- my @x = tokenize($2);
- push @scripts, @x;
- push @scripts_install, @x unless $install;
+ my @a = tokenize($1, qr|\s*,\s*|);
+ my @s = tokenize($2);
+ push @scripts, @s;
+ foreach my $a (@a) {
+ my $ak = $a;
+ my $av = 1;
+ if ($a =~ m|^(.*?)\s*=\s*(.*?)$|) {
+ $ak = $1;
+ $av = $2;
+ }
+ foreach my $s (@s) {
+ $attributes{$s}->{$ak} = $av;
+ }
+ }
}
},
- qr/^\s*EXTRA\s*=\s*(.*)\s*$/
- => sub { push @extra, tokenize($1)
- if !@skip || $skip[$#skip] > 0 },
- qr/^\s*OVERRIDES\s*=\s*(.*)\s*$/
- => sub { push @overrides, tokenize($1)
- if !@skip || $skip[$#skip] > 0 },
qr/^\s*ORDINALS\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/,
=> sub { push @{$ordinals{$1}}, tokenize($2)
qr/^\s*GENERATE\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
=> sub { push @{$generate{$1}}, $2
if !@skip || $skip[$#skip] > 0 },
- qr/^\s*RENAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { warn "RENAME is no longer supported\n" },
- qr/^\s*SHARED_NAME\[((?:\\.|[^\\\]])+)\]\s*=\s*(.*)\s*$/
- => sub { warn "SHARED_NAME is no longer supported\n" },
- qr/^\s*BEGINRAW\[((?:\\.|[^\\\]])+)\]\s*$/
- => sub {
- my $lineiterator = shift;
- my $target_kind = $1;
- while (defined $lineiterator->()) {
- s|\R$||;
- if (/^\s*ENDRAW\[((?:\\.|[^\\\]])+)\]\s*$/) {
- die "ENDRAW doesn't match BEGINRAW"
- if $1 ne $target_kind;
- last;
- }
- next if @skip && $skip[$#skip] <= 0;
- push @rawlines, $_
- if ($target_kind eq $target{build_file}
- || $target_kind eq $target{build_file}."(".$builder_platform.")");
- }
- },
qr/^\s*(?:#.*)?$/ => sub { },
"OTHERWISE" => sub { die "Something wrong with this line:\n$_\nat $sourced/$f" },
"BEFORE" => sub {
);
die "runaway IF?" if (@skip);
- foreach (@programs) {
- my $program = cleanfile($buildd, $_, $blddir);
- $unified_info{programs}->{$program} = 1;
- }
-
- foreach (@programs_install) {
- my $program = cleanfile($buildd, $_, $blddir);
- $unified_info{install}->{programs}->{$program} = 1;
- }
-
- foreach (@libraries) {
- my $library = cleanfile($buildd, $_, $blddir);
- $unified_info{libraries}->{$library} = 1;
- }
-
- foreach (@libraries_install) {
- my $library = cleanfile($buildd, $_, $blddir);
- $unified_info{install}->{libraries}->{$library} = 1;
- }
-
- die <<"EOF" if scalar @engines and !$config{dynamic_engines};
+ if (grep { defined $attributes{$_}->{engine} } keys %attributes
+ and !$config{dynamic_engines}) {
+ die <<"EOF"
ENGINES can only be used if configured with 'dynamic-engine'.
This is usually a fault in a build.info file.
EOF
- foreach (@engines) {
- my $library = cleanfile($buildd, $_, $blddir);
- $unified_info{engines}->{$library} = 1;
- }
-
- foreach (@engines_install) {
- my $library = cleanfile($buildd, $_, $blddir);
- $unified_info{install}->{engines}->{$library} = 1;
- }
-
- foreach (@scripts) {
- my $script = cleanfile($buildd, $_, $blddir);
- $unified_info{scripts}->{$script} = 1;
}
- foreach (@scripts_install) {
- my $script = cleanfile($buildd, $_, $blddir);
- $unified_info{install}->{scripts}->{$script} = 1;
- }
-
- foreach (@extra) {
- my $extra = cleanfile($buildd, $_, $blddir);
- $unified_info{extra}->{$extra} = 1;
+ foreach (keys %attributes) {
+ my $dest = $_;
+ my $ddest = cleanfile($buildd, $_, $blddir);
+ foreach (keys %{$attributes{$dest} // {}}) {
+ $unified_info{attributes}->{$ddest}->{$_} =
+ $attributes{$dest}->{$_};
+ }
}
- foreach (@overrides) {
- my $override = cleanfile($buildd, $_, $blddir);
- $unified_info{overrides}->{$override} = 1;
+ {
+ my %infos = ( programs => [ @programs ],
+ libraries => [ @libraries ],
+ modules => [ @modules ],
+ scripts => [ @scripts ] );
+ foreach my $k (keys %infos) {
+ foreach (@{$infos{$k}}) {
+ my $item = cleanfile($buildd, $_, $blddir);
+ $unified_info{$k}->{$item} = 1;
+ }
+ }
}
- push @{$unified_info{rawlines}}, @rawlines;
-
# Check that we haven't defined any library as both shared and
# explicitly static. That is forbidden.
my @doubles = ();
if defined($unified_info{$_});
delete $unified_info{$_};
}
- foreach my $prodtype (('programs', 'libraries', 'engines', 'scripts')) {
+ foreach my $prodtype (('programs', 'libraries', 'modules', 'scripts')) {
# $intent serves multi purposes:
# - give a prefix for the new object files names
# - in the case of libraries, rearrange the object files so static
src => [ 'sources',
'shared_sources' ],
dst => 'shared_sources' } },
- engines => { dso => { src => [ 'sources',
+ modules => { dso => { src => [ 'sources',
'shared_sources' ],
dst => 'shared_sources' } },
scripts => { script => { src => [ 'sources' ],
### Make unified_info a bit more efficient
# One level structures
- foreach (("programs", "libraries", "engines", "scripts", "extra", "overrides")) {
+ foreach (("programs", "libraries", "modules", "scripts")) {
$unified_info{$_} = [ sort keys %{$unified_info{$_}} ];
}
# Two level structures
- foreach my $l1 (("install", "sources", "shared_sources", "ldadd", "depends")) {
+ foreach my $l1 (("sources", "shared_sources", "ldadd", "depends")) {
foreach my $l2 (sort keys %{$unified_info{$l1}}) {
my @items =
sort
# they end up in where applicable. Then, add build rules for those
# directories
my %loopinfo = ( "lib" => [ @{$unified_info{libraries}} ],
- "dso" => [ @{$unified_info{engines}} ],
+ "dso" => [ @{$unified_info{modules}} ],
"bin" => [ @{$unified_info{programs}} ],
"script" => [ @{$unified_info{scripts}} ] );
foreach my $type (keys %loopinfo) {