mirror of
https://github.com/openssl/openssl.git
synced 2025-03-19 19:50:42 +08:00
Configure: Add read_eval_file, a general purpose perl file reader/evaluator
It will return the last expression from the input file. We also use this in read_config, which slightly changes what's expected of Configurations/*.conf. They do not have to assign %targets specifically. On the other hand, the table of configs MUST be the last expression in each of those files. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4840)
This commit is contained in:
parent
cbade36108
commit
3b6c4b0736
@ -1,5 +1,5 @@
|
||||
# -*- Mode: perl -*-
|
||||
%targets=(
|
||||
my %targets=(
|
||||
DEFAULTS => {
|
||||
template => 1,
|
||||
|
||||
|
@ -144,7 +144,7 @@ sub vms_info {
|
||||
return $vms_info;
|
||||
}
|
||||
|
||||
%targets = (
|
||||
my %targets = (
|
||||
|
||||
#### Basic configs that should work on any 32-bit box
|
||||
"gcc" => {
|
||||
|
@ -2,7 +2,7 @@
|
||||
# and rely entirely on the OpenSSL community to help is fine
|
||||
# tune and test.
|
||||
|
||||
%targets = (
|
||||
my %targets = (
|
||||
"DJGPP" => {
|
||||
inherit_from => [ asm("x86_asm") ],
|
||||
cc => "gcc",
|
||||
|
@ -1,4 +1,4 @@
|
||||
%targets = (
|
||||
my %targets = (
|
||||
"haiku-common" => {
|
||||
template => 1,
|
||||
cc => "cc",
|
||||
|
@ -7,7 +7,7 @@
|
||||
# proven to be daunting task. This is experimental target, for
|
||||
# production builds stick with [up-to-date version of] nasm.
|
||||
|
||||
%targets = (
|
||||
my %targets = (
|
||||
"VC-WIN64A-masm" => {
|
||||
inherit_from => [ "VC-WIN64-common", asm("x86_64_asm"),
|
||||
sub { $disabled{shared} ? () : "x86_64_uplink" } ],
|
||||
|
@ -1,7 +1,7 @@
|
||||
## -*- mode: perl; -*-
|
||||
## Build configuration targets for openssl-team members
|
||||
|
||||
%targets = (
|
||||
my %targets = (
|
||||
"purify" => {
|
||||
cc => "purify gcc",
|
||||
cflags => "-g -Wall",
|
||||
|
35
Configure
35
Configure
@ -2292,25 +2292,38 @@ sub add {
|
||||
sub { _add($separator, @_, @x) };
|
||||
}
|
||||
|
||||
sub read_eval_file {
|
||||
my $fname = shift;
|
||||
my $content;
|
||||
my @result;
|
||||
|
||||
open F, "< $fname" or die "Can't open '$fname': $!\n";
|
||||
{
|
||||
undef local $/;
|
||||
$content = <F>;
|
||||
}
|
||||
close F;
|
||||
{
|
||||
local $@;
|
||||
|
||||
@result = ( eval $content );
|
||||
warn $@ if $@;
|
||||
}
|
||||
return wantarray ? @result : $result[0];
|
||||
}
|
||||
|
||||
# configuration reader, evaluates the input file as a perl script and expects
|
||||
# it to fill %targets with target configurations. Those are then added to
|
||||
# %table.
|
||||
sub read_config {
|
||||
my $fname = shift;
|
||||
open(CONFFILE, "< $fname")
|
||||
or die "Can't open configuration file '$fname'!\n";
|
||||
my $x = $/;
|
||||
undef $/;
|
||||
my $content = <CONFFILE>;
|
||||
$/ = $x;
|
||||
close(CONFFILE);
|
||||
my %targets = ();
|
||||
my %targets;
|
||||
|
||||
{
|
||||
# Protect certain tables from tampering
|
||||
local %table = %::table;
|
||||
local %table = ();
|
||||
|
||||
eval $content;
|
||||
warn $@ if $@;
|
||||
%targets = read_eval_file($fname);
|
||||
}
|
||||
|
||||
# For each target, check that it's configured with a hash table.
|
||||
|
Loading…
x
Reference in New Issue
Block a user