From 17f1661724480b720f718d455b997b5fa52be424 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 29 Nov 2017 17:41:10 +0100 Subject: [PATCH] Have all relevant config targets use the env() function rather than $ENV This way, any of the relevant environment variables for the platform being configured are preserved and don't have to be recalled manually when reconfiguring. Reviewed-by: Andy Polyakov (Merged from https://github.com/openssl/openssl/pull/4818) --- Configurations/10-main.conf | 38 ++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index f8f4bd194c..28cfd30021 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -53,14 +53,14 @@ my $vc_wince_info = {}; sub vc_wince_info { unless (%$vc_wince_info) { # sanity check - $die->('%OSVERSION% is not defined') if (!defined($ENV{'OSVERSION'})); - $die->('%PLATFORM% is not defined') if (!defined($ENV{'PLATFORM'})); - $die->('%TARGETCPU% is not defined') if (!defined($ENV{'TARGETCPU'})); + $die->('%OSVERSION% is not defined') if (!defined(env('OSVERSION'))); + $die->('%PLATFORM% is not defined') if (!defined(env('PLATFORM'))); + $die->('%TARGETCPU% is not defined') if (!defined(env('TARGETCPU'))); # # Idea behind this is to mimic flags set by eVC++ IDE... # - my $wcevers = $ENV{'OSVERSION'}; # WCENNN + my $wcevers = env('OSVERSION'); # WCENNN my $wcevernum; my $wceverdotnum; if ($wcevers =~ /^WCE([1-9])([0-9]{2})$/) { @@ -74,12 +74,12 @@ sub vc_wince_info { my $wcecdefs = "-D_WIN32_WCE=$wcevernum -DUNDER_CE=$wcevernum"; # -D_WIN32_WCE=NNN my $wcelflag = "/subsystem:windowsce,$wceverdotnum"; # ...,N.NN - my $wceplatf = $ENV{'PLATFORM'}; + my $wceplatf = env('PLATFORM'); $wceplatf =~ tr/a-z0-9 /A-Z0-9_/; $wcecdefs .= " -DWCE_PLATFORM_$wceplatf"; - my $wcetgt = $ENV{'TARGETCPU'}; # just shorter name... + my $wcetgt = env('TARGETCPU'); # just shorter name... SWITCH: for($wcetgt) { /^X86/ && do { $wcecdefs.=" -Dx86 -D_X86_ -D_i386_ -Di_386_"; $wcelflag.=" /machine:X86"; last; }; @@ -1407,9 +1407,9 @@ sub vms_info { picker(default => combine('/W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYS_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT', sub { vc_wince_info()->{cflags}; }, - sub { defined($ENV{'WCECOMPAT'}) + sub { defined(env('WCECOMPAT')) ? '-I$(WCECOMPAT)/include' : (); }, - sub { defined($ENV{'PORTSDK_LIBPATH'}) + sub { defined(env('PORTSDK_LIBPATH')) ? '-I$(PORTSDK_LIBPATH)/../../include' : (); }, sub { `cl 2>&1` =~ /Version ([0-9]+)\./ && $1>=14 ? ($disabled{shared} ? " /MT" : " /MD") @@ -1418,7 +1418,7 @@ sub vms_info { release => "/O1i"), lflags => combine("/nologo /opt:ref", sub { vc_wince_info()->{lflags}; }, - sub { defined($ENV{PORTSDK_LIBPATH}) + sub { defined(env('PORTSDK_LIBPATH')) ? "/entry:mainCRTstartup" : (); }), sys_id => "WINCE", bn_ops => "BN_LLONG EXPORT_VAR_AS_FN", @@ -1426,9 +1426,9 @@ sub vms_info { my @ex_libs = (); push @ex_libs, 'ws2.lib' unless $disabled{sock}; push @ex_libs, 'crypt32.lib'; - if (defined($ENV{WCECOMPAT})) { + if (defined(env('WCECOMPAT'))) { my $x = '$(WCECOMPAT)/lib'; - if (-f "$x/$ENV{TARGETCPU}/wcecompatex.lib") { + if (-f "$x/env('TARGETCPU')/wcecompatex.lib") { $x .= '/$(TARGETCPU)/wcecompatex.lib'; } else { $x .= '/wcecompatex.lib'; @@ -1436,9 +1436,9 @@ sub vms_info { push @ex_libs, $x; } push @ex_libs, '$(PORTSDK_LIBPATH)/portlib.lib' - if (defined($ENV{'PORTSDK_LIBPATH'})); + if (defined(env('PORTSDK_LIBPATH'))); push @ex_libs, ' /nodefaultlib coredll.lib corelibc.lib' - if ($ENV{'TARGETCPU'} eq "X86"); + if (env('TARGETCPU') eq "X86"); return @ex_libs; }), build_scheme => add("VC-WCE", { separator => undef }), @@ -1738,35 +1738,35 @@ sub vms_info { #### uClinux "uClinux-dist" => { inherit_from => [ "BASE_unix" ], - cc => "$ENV{'CC'}", + cc => sub { env('CC') }, cflags => combine("\$(CFLAGS)", threads("-D_REENTRANT")), plib_lflags => "\$(LDFLAGS)", ex_libs => add("\$(LDLIBS)"), bn_ops => "BN_LLONG", thread_scheme => "pthreads", - dso_scheme => "$ENV{'LIBSSL_dlfcn'}", + dso_scheme => sub { env('LIBSSL_dlfcn') }, shared_target => "linux-shared", shared_cflag => "-fPIC", shared_ldflag => "-shared", shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", - ranlib => "$ENV{'RANLIB'}", + ranlib => sub { env('RANLIB') }, }, "uClinux-dist64" => { inherit_from => [ "BASE_unix" ], - cc => "$ENV{'CC'}", + cc => sub { env('CC') }, cflags => combine("\$(CFLAGS)", threads("-D_REENTRANT")), plib_lflags => "\$(LDFLAGS)", ex_libs => add("\$(LDLIBS)"), bn_ops => "SIXTY_FOUR_BIT_LONG", thread_scheme => "pthreads", - dso_scheme => "$ENV{'LIBSSL_dlfcn'}", + dso_scheme => sub { env('LIBSSL_dlfcn') }, shared_target => "linux-shared", shared_cflag => "-fPIC", shared_ldflag => "-shared", shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)", - ranlib => "$ENV{'RANLIB'}", + ranlib => sub { env('RANLIB') }, }, ##### VMS -- 2.25.1