mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-05-20 13:29:41 +00:00
Various small build improvements on mkdef.pl, progs.pl
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4994) (cherry picked from commit ab307dc645502d025c2760160062d5032da56bf7)
This commit is contained in:
parent
48c9c139f4
commit
63175ecff6
@ -26,7 +26,7 @@ my @openssl_source =
|
|||||||
@{$unified_info{sources}->{$apps_openssl}};
|
@{$unified_info{sources}->{$apps_openssl}};
|
||||||
|
|
||||||
foreach my $filename (@openssl_source) {
|
foreach my $filename (@openssl_source) {
|
||||||
open F, $filename or die "Coudn't open $_: $!\n";
|
open F, $filename or die "Couldn't open $filename: $!\n";
|
||||||
foreach (grep /$cmdre/, <F>) {
|
foreach (grep /$cmdre/, <F>) {
|
||||||
my @foo = /$cmdre/;
|
my @foo = /$cmdre/;
|
||||||
$commands{$1} = 1;
|
$commands{$1} = 1;
|
||||||
|
@ -106,6 +106,8 @@ use OpenSSL::Glob;
|
|||||||
(my $SO_VARIANT = qq{\U$target{"shlib_variant"}}) =~ s/\W/_/g;
|
(my $SO_VARIANT = qq{\U$target{"shlib_variant"}}) =~ s/\W/_/g;
|
||||||
|
|
||||||
my $debug=0;
|
my $debug=0;
|
||||||
|
my $trace=0;
|
||||||
|
my $verbose=0;
|
||||||
|
|
||||||
my $crypto_num= catfile($config{sourcedir},"util","libcrypto.num");
|
my $crypto_num= catfile($config{sourcedir},"util","libcrypto.num");
|
||||||
my $ssl_num= catfile($config{sourcedir},"util","libssl.num");
|
my $ssl_num= catfile($config{sourcedir},"util","libssl.num");
|
||||||
@ -202,6 +204,8 @@ my $zlib;
|
|||||||
foreach (@ARGV, split(/ /, $config{options}))
|
foreach (@ARGV, split(/ /, $config{options}))
|
||||||
{
|
{
|
||||||
$debug=1 if $_ eq "debug";
|
$debug=1 if $_ eq "debug";
|
||||||
|
$trace=1 if $_ eq "trace";
|
||||||
|
$verbose=1 if $_ eq "verbose";
|
||||||
$W32=1 if $_ eq "32";
|
$W32=1 if $_ eq "32";
|
||||||
die "win16 not supported" if $_ eq "16";
|
die "win16 not supported" if $_ eq "16";
|
||||||
if($_ eq "NT") {
|
if($_ eq "NT") {
|
||||||
@ -444,7 +448,7 @@ sub do_defs
|
|||||||
foreach $file (split(/\s+/,$symhacksfile." ".$files))
|
foreach $file (split(/\s+/,$symhacksfile." ".$files))
|
||||||
{
|
{
|
||||||
my $fn = catfile($config{sourcedir},$file);
|
my $fn = catfile($config{sourcedir},$file);
|
||||||
print STDERR "DEBUG: starting on $fn:\n" if $debug;
|
print STDERR "TRACE: start reading $fn\n" if $trace;
|
||||||
open(IN,"<$fn") || die "unable to open $fn:$!\n";
|
open(IN,"<$fn") || die "unable to open $fn:$!\n";
|
||||||
my $line = "", my $def= "";
|
my $line = "", my $def= "";
|
||||||
my %tag = (
|
my %tag = (
|
||||||
@ -569,19 +573,19 @@ sub do_defs
|
|||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=-1;
|
$tag{$1}=-1;
|
||||||
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
||||||
} elsif (/^\#\s*if\s+!defined\(([^\)]+)\)/) {
|
} elsif (/^\#\s*if\s+!defined\s*\(([^\)]+)\)/) {
|
||||||
push(@tag,"-");
|
push(@tag,"-");
|
||||||
if (/^\#\s*if\s+(!defined\(([^\)]+)\)(\s+\&\&\s+!defined\(([^\)]+)\))*)$/) {
|
if (/^\#\s*if\s+(!defined\s*\(([^\)]+)\)(\s+\&\&\s+!defined\s*\(([^\)]+)\))*)$/) {
|
||||||
my $tmp_1 = $1;
|
my $tmp_1 = $1;
|
||||||
my $tmp_;
|
my $tmp_;
|
||||||
foreach $tmp_ (split '\&\&',$tmp_1) {
|
foreach $tmp_ (split '\&\&',$tmp_1) {
|
||||||
$tmp_ =~ /!defined\(([^\)]+)\)/;
|
$tmp_ =~ /!defined\s*\(([^\)]+)\)/;
|
||||||
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=-1;
|
$tag{$1}=-1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print STDERR "Warning: $file: complicated expression: $_" if $debug; # because it is O...
|
print STDERR "Warning: $file: taking only '!defined($1)' of complicated expression: $_" if $verbose; # because it is O...
|
||||||
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = -1\n" if $debug;
|
||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=-1;
|
$tag{$1}=-1;
|
||||||
@ -591,19 +595,19 @@ sub do_defs
|
|||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=1;
|
$tag{$1}=1;
|
||||||
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
||||||
} elsif (/^\#\s*if\s+defined\(([^\)]+)\)/) {
|
} elsif (/^\#\s*if\s+defined\s*\(([^\)]+)\)/) {
|
||||||
push(@tag,"-");
|
push(@tag,"-");
|
||||||
if (/^\#\s*if\s+(defined\(([^\)]+)\)(\s+\|\|\s+defined\(([^\)]+)\))*)$/) {
|
if (/^\#\s*if\s+(defined\s*\(([^\)]+)\)(\s+\|\|\s+defined\s*\(([^\)]+)\))*)$/) {
|
||||||
my $tmp_1 = $1;
|
my $tmp_1 = $1;
|
||||||
my $tmp_;
|
my $tmp_;
|
||||||
foreach $tmp_ (split '\|\|',$tmp_1) {
|
foreach $tmp_ (split '\|\|',$tmp_1) {
|
||||||
$tmp_ =~ /defined\(([^\)]+)\)/;
|
$tmp_ =~ /defined\s*\(([^\)]+)\)/;
|
||||||
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=1;
|
$tag{$1}=1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print STDERR "Warning: $file: complicated expression: $_\n" if $debug; # because it is O...
|
print STDERR "Warning: $file: taking only 'defined($1)' of complicated expression: $_\n" if $verbose; # because it is O...
|
||||||
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
print STDERR "DEBUG: $file: found tag $1 = 1\n" if $debug;
|
||||||
push(@tag,$1);
|
push(@tag,$1);
|
||||||
$tag{$1}=1;
|
$tag{$1}=1;
|
||||||
@ -668,6 +672,7 @@ sub do_defs
|
|||||||
} elsif (/^\#\s*if\s+/) {
|
} elsif (/^\#\s*if\s+/) {
|
||||||
#Some other unrecognized "if" style
|
#Some other unrecognized "if" style
|
||||||
push(@tag,"-");
|
push(@tag,"-");
|
||||||
|
print STDERR "Warning: $file: ignoring unrecognized expression: $_\n" if $verbose; # because it is O...
|
||||||
} elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
|
} elsif (/^\#\s*define\s+(\w+)\s+(\w+)/
|
||||||
&& $symhacking && $tag{'TRUE'} != -1) {
|
&& $symhacking && $tag{'TRUE'} != -1) {
|
||||||
# This is for aliasing. When we find an alias,
|
# This is for aliasing. When we find an alias,
|
||||||
@ -958,11 +963,13 @@ sub do_defs
|
|||||||
next if(/typedef\W/);
|
next if(/typedef\W/);
|
||||||
next if(/\#define/);
|
next if(/\#define/);
|
||||||
|
|
||||||
|
print STDERR "TRACE: processing $_\n" if $trace && !/^\#INFO:/;
|
||||||
# Reduce argument lists to empty ()
|
# Reduce argument lists to empty ()
|
||||||
# fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {}
|
# fold round brackets recursively: (t(*v)(t),t) -> (t{}{},t) -> {}
|
||||||
while(/\(.*\)/s) {
|
my $nsubst = 1; # prevent infinite loop, e.g., on int fn()
|
||||||
s/\([^\(\)]+\)/\{\}/gs;
|
while($nsubst && /\(.*\)/s) {
|
||||||
s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f
|
$nsubst = s/\([^\(\)]+\)/\{\}/gs;
|
||||||
|
$nsubst+= s/\(\s*\*\s*(\w+)\s*\{\}\s*\)/$1/gs; #(*f{}) -> f
|
||||||
}
|
}
|
||||||
# pretend as we didn't use curly braces: {} -> ()
|
# pretend as we didn't use curly braces: {} -> ()
|
||||||
s/\{\}/\(\)/gs;
|
s/\{\}/\(\)/gs;
|
||||||
@ -1439,9 +1446,9 @@ sub load_numbers
|
|||||||
$prev=$a[0];
|
$prev=$a[0];
|
||||||
}
|
}
|
||||||
if ($num_noinfo) {
|
if ($num_noinfo) {
|
||||||
print STDERR "Warning: $num_noinfo symbols were without info.";
|
print STDERR "Warning: $num_noinfo symbols were without info." if $verbose || !$do_rewrite;
|
||||||
if ($do_rewrite) {
|
if ($do_rewrite) {
|
||||||
printf STDERR " The rewrite will fix this.\n";
|
printf STDERR " The rewrite will fix this.\n" if $verbose;
|
||||||
} else {
|
} else {
|
||||||
printf STDERR " You should do a rewrite to fix this.\n";
|
printf STDERR " You should do a rewrite to fix this.\n";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user