[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat Jan 23 21:43:31 UTC 2016


The branch master has been updated
       via  642a613809ef68432eefbbd957ec542c70a8d7b4 (commit)
      from  df71f0b8247beb49338c38327079661233e46b97 (commit)


- Log -----------------------------------------------------------------
commit 642a613809ef68432eefbbd957ec542c70a8d7b4
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Dec 27 02:27:30 2015 +0100

    Refactor file writing - make configdata.pm the info center for "reconf"
    
    Now that configdata.pm is the centre of information, use that instead
    of Makefile to figure out reconfiguration parameters.  This will help
    future development with different Makefile file names.
    
    The code to read necessary configuration data from Makefile is retained
    for an easy transition to configdata.pm based information gathering.  It
    will be removed later on.
    
    This change includes moving the variable $cross_compile_prefix to %config.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Viktor Dukhovni <viktor at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configure | 71 ++++++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 26 deletions(-)

diff --git a/Configure b/Configure
index 4f32e4e..5e973c6 100755
--- a/Configure
+++ b/Configure
@@ -181,7 +181,7 @@ $config{processor}="";
 my $libdir="";
 my $exe_ext="";
 my $install_prefix= "$ENV{'INSTALL_PREFIX'}";
-my $cross_compile_prefix="";
+$config{cross_compile_prefix}="";
 my $fipslibdir="/usr/local/ssl/fips-2.0/lib/";
 my $nofipscanistercheck=0;
 my $baseaddr="0xFB00000";
@@ -406,36 +406,54 @@ my $build_prefix = "release_";
 my @argvcopy=@ARGV;
 
 if (grep /^reconf(igure)?$/, @argvcopy) {
-    if (open IN, "<$Makefile") {
-	while (<IN>) {
-	    chomp;
-	    if (/^CONFIGURE_ARGS=\s*(.*)\s*/) {
-		my $line = $1;
-		if ($line =~ /^\s*\(/) {
-		    # New form perl expression saved in Makefile, eval it
-		    @argvcopy = eval $line;
-		} else {
-		    # Older form, we split the string and hope for the best
-		    @argvcopy = split /\s+/, $line;
-		}
-		die "Incorrect data to reconfigure, please do a normal configuration\n"
-		    if (grep(/^reconf/, at argvcopy));
-	    } elsif (/^CROSS_COMPILE=\s*(.*)/) {
-		$ENV{CROSS_COMPILE}=$1;
-	    } elsif (/^CC=\s*(?:\$\(CROSS_COMPILE\))?(.*?)$/) {
-		$ENV{CC}=$1;
-	    }
+    if (-f "./configdata.pm") {
+	my $file = "./configdata.pm";
+	unless (my $return = do $file) {
+	    die "couldn't parse $file: $@" if $@;
+            die "couldn't do $file: $!"    unless defined $return;
+            die "couldn't run $file"       unless $return;
 	}
+
+	@argvcopy = defined($configdata::config{perlargv}) ?
+	    @{$configdata::config{perlargv}} : ();
+	die "Incorrect data to reconfigure, please do a normal configuration\n"
+	    if (grep(/^reconf/, at argvcopy));
+	$ENV{CROSS_COMPILE} = $configdata::config{cross_compile_prefix}
+	    if defined($configdata::config{cross_compile_prefix});
+	$ENV{CROSS_COMPILE} = $configdata::config{cc}
+	    if defined($configdata::config{cc});
+
 	print "Reconfiguring with: ", join(" ", at argvcopy), "\n";
 	print "    CROSS_COMPILE = ",$ENV{CROSS_COMPILE},"\n"
 	    if $ENV{CROSS_COMPILE};
 	print "    CC = ",$ENV{CC},"\n" if $ENV{CC};
-	close IN;
+    } elsif (open IN, "<Makefile") {
+        #
+        # THIS SECTION IS TEMPORARY, it helps transitioning from Makefile
+        # centered information gathering the reading configdata.pm
+        #
+        while (<IN>) {
+            chomp;
+            if (/^CONFIGURE_ARGS=\s*(.*)\s*/) {
+                # Older form, we split the string and hope for the best
+                @argvcopy = split /\s+/, $_;
+                die "Incorrect data to reconfigure, please do a normal configuration\n"
+                    if (grep(/^reconf/, at argvcopy));
+            } elsif (/^CROSS_COMPILE=\s*(.*)/) {
+                $ENV{CROSS_COMPILE}=$1;
+            } elsif (/^CC=\s*(?:\$\(CROSS_COMPILE\))?(.*?)$/) {
+                $ENV{CC}=$1;
+            }
+        }
+        #
+        # END OF TEMPORARY SECTION
+        #
     } else {
 	die "Insufficient data to reconfigure, please do a normal configuration\n";
     }
 }
 
+$config{perlargv} = [ @argvcopy ];
 
 my %unsupported_options = ();
 foreach (@argvcopy)
@@ -579,7 +597,7 @@ foreach (@argvcopy)
 			}
 		elsif (/^--cross-compile-prefix=(.*)$/)
 			{
-			$cross_compile_prefix=$1;
+			$config{cross_compile_prefix}=$1;
 			}
 		elsif (/^--config=(.*)$/)
 			{
@@ -768,7 +786,8 @@ $default_ranlib	= which("ranlib") || "true";
 $config{perl}	= $ENV{'PERL'} || which("perl5") || which("perl") || "perl";
 my $make	= $ENV{'MAKE'} || "make";
 
-$cross_compile_prefix=$ENV{'CROSS_COMPILE'} if $cross_compile_prefix eq "";
+$config{cross_compile_prefix} = $ENV{'CROSS_COMPILE'}
+    if $config{cross_compile_prefix} eq "";
 
 $config{prefix} = "/usr/local" if !$config{prefix};
 $config{openssldir} = "ssl" if !$config{openssldir};
@@ -1007,7 +1026,7 @@ if ($target =~ /^BSD\-/)
 if ($target{sys_id} ne "")
 	{
 	#$cflags="-DOPENSSL_SYS_$target{sys_id} $cflags";
-	push @{$config{openssl_sys_defines}}="OPENSSL_SYS_$target{sys_id}";
+	push @{$config{openssl_sys_defines}}, "OPENSSL_SYS_$target{sys_id}";
 	}
 
 if ($target{ranlib} eq "")
@@ -1292,9 +1311,9 @@ while (<IN>)
 	s/^OPTIONS=.*$/OPTIONS=$config{options}/;
 	my $argvstring = "(".join(", ", map { quotify("perl", $_) } @argvcopy).")";
 	s/^CONFIGURE_ARGS=.*$/CONFIGURE_ARGS=$argvstring/;
-	if ($cross_compile_prefix)
+	if ($config{cross_compile_prefix})
 		{
-		s/^CC=.*$/CROSS_COMPILE= $cross_compile_prefix\nCC= \$\(CROSS_COMPILE\)$target{cc}/;
+		s/^CC=.*$/CROSS_COMPILE= $config{cross_compile_prefix}\nCC= \$\(CROSS_COMPILE\)$target{cc}/;
 		s/^AR=\s*/AR= \$\(CROSS_COMPILE\)/;
 		s/^NM=\s*/NM= \$\(CROSS_COMPILE\)/;
 		s/^RANLIB=\s*/RANLIB= \$\(CROSS_COMPILE\)/;


More information about the openssl-commits mailing list