#! /usr/bin/env perl
# -*- mode: perl; -*-
-# Copyright 2016-2023 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2024 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
# Generic OpenSSL-style methods relating to this support
# are always compiled but return NULL if the hardware
# support isn't compiled.
+#
+# enable-demos Enable the building of the example code in the demos directory
+# enable-h3demo Enable the http3 demo, which currently only links to the
+# external nghttp3 library on unix platforms
# no-hw do not compile support for any crypto hardware.
# [no-]threads [don't] try to create a library that is suitable for
# multithreaded applications (default is "threads" if we
}
}
+# Fail if no configuration is apparent
+if (!%table) {
+ print "Failed to find any os/compiler configurations. Please make sure the Configurations directory is included.\n";
+ &usage;
+}
+
# Save away perl command information
$config{perl_cmd} = $^X;
$config{perl_version} = $Config{version};
"asan",
"asm",
"async",
+ "atexit",
"autoalginit",
"autoerrinit",
"autoload-config",
"crypto-mdebug",
"ct",
"default-thread-pool",
+ "demos",
+ "h3demo",
"deprecated",
"des",
"devcryptoeng",
"ocsp",
"padlockeng",
"pic",
+ "pie",
"pinshared",
"poly1305",
"posix-io",
"psk",
"quic",
+ "unstable-qlog",
"rc2",
"rc4",
"rc5",
"thread-pool",
"threads",
"tls",
+ "integrity-only-ciphers",
"trace",
"ts",
"ubsan",
"buildtest-c++" => "default",
"crypto-mdebug" => "default",
"crypto-mdebug-backtrace" => "default",
+ "demos" => "default",
+ "h3demo" => "default",
"devcryptoeng" => "default",
"ec_nistp_64_gcc_128" => "default",
"egd" => "default",
"external-tests" => "default",
"fuzz-afl" => "default",
"fuzz-libfuzzer" => "default",
+ "pie" => "default",
"ktls" => "default",
"md2" => "default",
"msan" => "default",
my @disable_cascades = (
# "what" => [ "cascade", ... ]
"bulk" => [ "shared", "dso",
- "aria", "async", "autoload-config",
+ "aria", "async", "atexit", "autoload-config",
"blake2", "bf", "camellia", "cast", "chacha",
"cmac", "cms", "cmp", "comp", "ct",
"des", "dgram", "dh", "dsa",
sub { 0 == scalar grep { !$disabled{$_} } @tls }
=> [ "tls" ],
"tls1_3" => [ "quic" ],
+ "quic" => [ "unstable-qlog" ],
"crypto-mdebug" => [ "crypto-mdebug-backtrace" ],
{
delete $disabled{"brotli"};
}
+ elsif ($1 eq "pie")
+ {
+ delete $disabled{"pie"};
+ }
elsif ($1 eq "zstd-dynamic")
{
delete $disabled{"zstd"};
if (/^--prefix=(.*)$/)
{
$config{prefix}=$1;
- die "Directory given with --prefix MUST be absolute\n"
- unless file_name_is_absolute($config{prefix});
}
elsif (/^--api=(.*)$/)
{
# At this point, we can forget everything about %user and %useradd,
# because it's now all been merged into the corresponding $config entry
+if ($config{prefix} && !$config{CROSS_COMPILE}) {
+ die "Directory given with --prefix MUST be absolute\n"
+ unless file_name_is_absolute($config{prefix});
+}
+
if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) {
disable('static', 'pic', 'threads');
}
push @{$config{openssl_feature_defines}}, "OPENSSL_THREADS";
}
+if ($disabled{"unstable-qlog"}) {
+ $disabled{"qlog"} = 1;
+}
+
my $no_shared_warn=0;
if (($target{shared_target} // '') eq "")
{
my $base = shift;
my $dir = shift;
my $relativeto = shift || ".";
+ my $no_mkpath = shift // 0;
$dir = catdir($base,$dir) unless isabsolute($dir);
# Make sure the directories we're building in exists
- mkpath($dir);
+ mkpath($dir) unless $no_mkpath;
my $res = abs2rel(absolutedir($dir), rel2abs($relativeto));
#print STDERR "DEBUG[cleandir]: $dir , $base => $res\n";
my $base = shift;
my $file = shift;
my $relativeto = shift || ".";
+ my $no_mkpath = shift // 0;
$file = catfile($base,$file) unless isabsolute($file);
my $f = basename($file);
# Make sure the directories we're building in exists
- mkpath($d);
+ mkpath($d) unless $no_mkpath;
my $res = abs2rel(catfile(absolutedir($d), $f), rel2abs($relativeto));
#print STDERR "DEBUG[cleanfile]: $d , $f => $res\n";
}
# Then, look in our standard directory
push @build_file_templates,
- ( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir) }
+ ( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir, 1) }
@build_file_template_names );
my $build_file_template;
}
$config{build_file_templates}
= [ cleanfile($srcdir, catfile("Configurations", "common0.tmpl"),
- $blddir),
+ $blddir, 1),
$build_file_template ];
my @build_dirs = ( [ ] ); # current directory
# We want to detect configdata.pm in the source tree, so we
# don't use it if the build tree is different.
- my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir);
+ my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir, 1);
# Any source file that we recognise is placed in this hash table, with
# the list of its intended destinations as value. When everything has
my $dest = $_;
my $ddest = cleanfile($buildd, $_, $blddir);
foreach (@{$sources{$dest}}) {
- my $s = cleanfile($sourced, $_, $blddir);
+ my $s = cleanfile($sourced, $_, $blddir, 1);
# If it's generated or we simply don't find it in the source
# tree, we assume it's in the build tree.
my $dest = $_;
my $ddest = cleanfile($buildd, $_, $blddir);
foreach (@{$shared_sources{$dest}}) {
- my $s = cleanfile($sourced, $_, $blddir);
+ my $s = cleanfile($sourced, $_, $blddir, 1);
# If it's generated or we simply don't find it in the source
# tree, we assume it's in the build tree.
if scalar @{$generate{$_}} > 1;
my @generator = split /\s+/, $generate{$dest}->[0];
my $gen = $generator[0];
- $generator[0] = cleanfile($sourced, $gen, $blddir);
+ $generator[0] = cleanfile($sourced, $gen, $blddir, 1);
# If the generator is itself generated, it's in the build tree
if ($generate{$gen} || ! -f $generator[0]) {
} elsif ($dest eq '') {
$ddest = '';
} else {
- $ddest = cleanfile($sourced, $dest, $blddir);
+ $ddest = cleanfile($sourced, $dest, $blddir, 1);
# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
&& $f =~ m/^(.*?)\|(.*)$/) {
$i = $1;
$m = $2;
- $i = cleanfile($sourced, $i, $blddir);
- $i2 = cleanfile($buildd, $i, $blddir);
- $d = cleanfile($sourced, "$i/$m", $blddir);
+ # We must be very careful to modify $i last
+ $d = cleanfile($sourced, "$i/$m", $blddir, 1);
$d2 = cleanfile($buildd, "$i/$m", $blddir);
+ $i2 = cleandir($buildd, $i, $blddir);
+ $i = cleandir($sourced, $i, $blddir, 1);
} else {
- $d = cleanfile($sourced, $f, $blddir);
+ $d = cleanfile($sourced, $f, $blddir, 1);
$d2 = cleanfile($buildd, $f, $blddir);
}
foreach (keys %includes) {
my $dest = $_;
- my $ddest = cleanfile($sourced, $_, $blddir);
+ my $ddest = cleanfile($sourced, $_, $blddir, 1);
# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
$ddest = cleanfile($buildd, $_, $blddir);
}
foreach (@{$includes{$dest}}) {
- my $is = cleandir($sourced, $_, $blddir);
+ my $is = cleandir($sourced, $_, $blddir, 1);
my $ib = cleandir($buildd, $_, $blddir);
push @{$unified_info{includes}->{$ddest}->{source}}, $is
unless grep { $_ eq $is } @{$unified_info{includes}->{$ddest}->{source}};
my $ddest;
if ($dest ne "") {
- $ddest = cleanfile($sourced, $dest, $blddir);
+ $ddest = cleanfile($sourced, $dest, $blddir, 1);
# If the destination doesn't exist in source, it can only
# be a generated file in the build tree.
my $configdata_outname = 'configdata.pm';
open CONFIGDATA, ">$configdata_outname.new"
or die "Trying to create $configdata_outname.new: $!";
-my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir);
+my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir, 1);
my $configdata_tmpl =
OpenSSL::Template->new(TYPE => 'FILE', SOURCE => $configdata_tmplname);
$configdata_tmpl->fill_in(