mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
CryptoPkg/Library/OpensslLib: Update process_files.pl INF generation
Update process_files.pl to generate all OpensslLib INF files. * OpensslLib.inf * OpensslLibAccel.inf * OpensslLibCrypto.inf * OpensslLibFull.inf * OpensslLibFullAccel.inf Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Christopher Zurcher <christopher.zurcher@microsoft.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Yi Li <yi1.li@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
3b46a1e243
commit
d79295b5c5
@ -15,6 +15,15 @@
|
|||||||
# ./process_files.pl
|
# ./process_files.pl
|
||||||
# ./process_files.pl X64
|
# ./process_files.pl X64
|
||||||
# ./process_files.pl [Arch]
|
# ./process_files.pl [Arch]
|
||||||
|
#
|
||||||
|
# Follow the command below to update the INF file:
|
||||||
|
# 1. OpensslLib.inf ,OpensslLibCrypto.inf and OpensslLibFull.inf
|
||||||
|
# ./process_files.pl
|
||||||
|
# 2. OpensslLibAccel.inf and OpensslLibFullAccel.inf
|
||||||
|
# ./process_files.pl X64
|
||||||
|
# ./process_files.pl X64Gcc
|
||||||
|
# ./process_files.pl IA32
|
||||||
|
# ./process_files.pl IA32Gcc
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Cwd;
|
use Cwd;
|
||||||
@ -79,6 +88,7 @@ my $inf_file;
|
|||||||
my $OPENSSL_PATH;
|
my $OPENSSL_PATH;
|
||||||
my $uefi_config;
|
my $uefi_config;
|
||||||
my $extension;
|
my $extension;
|
||||||
|
my $compile;
|
||||||
my $arch;
|
my $arch;
|
||||||
my @inf;
|
my @inf;
|
||||||
|
|
||||||
@ -90,31 +100,32 @@ BEGIN {
|
|||||||
if (defined $arch) {
|
if (defined $arch) {
|
||||||
if (uc ($arch) eq "X64") {
|
if (uc ($arch) eq "X64") {
|
||||||
$arch = "X64";
|
$arch = "X64";
|
||||||
$inf_file = "OpensslLibX64.inf";
|
|
||||||
$uefi_config = "UEFI-x86_64";
|
$uefi_config = "UEFI-x86_64";
|
||||||
$extension = "nasm";
|
$extension = "nasm";
|
||||||
|
$compile = "MSFT";
|
||||||
$comment_character = ";";
|
$comment_character = ";";
|
||||||
} elsif (uc ($arch) eq "X64GCC") {
|
} elsif (uc ($arch) eq "X64GCC") {
|
||||||
$arch = "X64Gcc";
|
$arch = "X64Gcc";
|
||||||
$inf_file = "OpensslLibX64Gcc.inf";
|
|
||||||
$uefi_config = "UEFI-x86_64-GCC";
|
$uefi_config = "UEFI-x86_64-GCC";
|
||||||
$extension = "S";
|
$extension = "S";
|
||||||
|
$compile = "GCC";
|
||||||
$comment_character = "#";
|
$comment_character = "#";
|
||||||
} elsif (uc ($arch) eq "IA32") {
|
} elsif (uc ($arch) eq "IA32") {
|
||||||
$arch = "IA32";
|
$arch = "IA32";
|
||||||
$inf_file = "OpensslLibIa32.inf";
|
|
||||||
$uefi_config = "UEFI-x86";
|
$uefi_config = "UEFI-x86";
|
||||||
$extension = "nasm";
|
$extension = "nasm";
|
||||||
|
$compile = "MSFT";
|
||||||
$comment_character = ";";
|
$comment_character = ";";
|
||||||
} elsif (uc ($arch) eq "IA32GCC") {
|
} elsif (uc ($arch) eq "IA32GCC") {
|
||||||
$arch = "IA32Gcc";
|
$arch = "IA32Gcc";
|
||||||
$inf_file = "OpensslLibIa32Gcc.inf";
|
|
||||||
$uefi_config = "UEFI-x86-GCC";
|
$uefi_config = "UEFI-x86-GCC";
|
||||||
$extension = "S";
|
$extension = "S";
|
||||||
|
$compile = "GCC";
|
||||||
$comment_character = "#";
|
$comment_character = "#";
|
||||||
} else {
|
} else {
|
||||||
die "Unsupported architecture \"" . $arch . "\"!";
|
die "Unsupported architecture \"" . $arch . "\"!";
|
||||||
}
|
}
|
||||||
|
$inf_file = "OpensslLibAccel.inf";
|
||||||
if ($extension eq "nasm") {
|
if ($extension eq "nasm") {
|
||||||
if (`nasm -v 2>&1`) {
|
if (`nasm -v 2>&1`) {
|
||||||
#Presence of nasm executable will trigger inclusion of AVX instructions
|
#Presence of nasm executable will trigger inclusion of AVX instructions
|
||||||
@ -256,6 +267,7 @@ foreach my $f (@{$config{lib_defines}}) {
|
|||||||
|
|
||||||
my @cryptofilelist = ();
|
my @cryptofilelist = ();
|
||||||
my @sslfilelist = ();
|
my @sslfilelist = ();
|
||||||
|
my @ecfilelist = ();
|
||||||
my @asmfilelist = ();
|
my @asmfilelist = ();
|
||||||
my @asmbuild = ();
|
my @asmbuild = ();
|
||||||
foreach my $product ((@{$unified_info{libraries}},
|
foreach my $product ((@{$unified_info{libraries}},
|
||||||
@ -286,10 +298,14 @@ foreach my $product ((@{$unified_info{libraries}},
|
|||||||
$buildstring .= " ./$arch/$path$s.$extension";
|
$buildstring .= " ./$arch/$path$s.$extension";
|
||||||
make_path ("./$arch/$path");
|
make_path ("./$arch/$path");
|
||||||
push @asmbuild, "$buildstring\n";
|
push @asmbuild, "$buildstring\n";
|
||||||
push @asmfilelist, " $arch/$path$s.$extension\r\n";
|
push @asmfilelist, " $arch/$path$s.$extension |$compile\r\n";
|
||||||
}
|
}
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if ($s =~ "/ec/" || $s =~ "/sm2/") {
|
||||||
|
push @ecfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
if ($product =~ "libssl") {
|
if ($product =~ "libssl") {
|
||||||
push @sslfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";
|
push @sslfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";
|
||||||
next;
|
next;
|
||||||
@ -323,6 +339,10 @@ foreach (@headers){
|
|||||||
push @sslfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
|
push @sslfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if ($_ =~ "/ec/" || $_ =~ "/sm2/") {
|
||||||
|
push @ecfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
push @cryptofilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
|
push @cryptofilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,10 +371,18 @@ foreach (@inf) {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if ( $_ =~ "# Autogenerated files list starts here" ) {
|
if ( $_ =~ "# Autogenerated files list starts here" ) {
|
||||||
push @new_inf, $_, @asmfilelist, @cryptofilelist, @sslfilelist;
|
push @new_inf, $_, @cryptofilelist, @sslfilelist;
|
||||||
$subbing = 1;
|
$subbing = 1;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
if (defined $arch) {
|
||||||
|
my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";
|
||||||
|
if ($_ =~ $arch_asmfile_flag) {
|
||||||
|
push @new_inf, $_, @asmfilelist;
|
||||||
|
$subbing = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( $_ =~ "# Autogenerated files list ends here" ) {
|
if ( $_ =~ "# Autogenerated files list ends here" ) {
|
||||||
push @new_inf, $_;
|
push @new_inf, $_;
|
||||||
$subbing = 0;
|
$subbing = 0;
|
||||||
@ -421,6 +449,59 @@ if (!defined $arch) {
|
|||||||
print "Done!";
|
print "Done!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Update OpensslLibFull.inf with autogenerated file list
|
||||||
|
#
|
||||||
|
if (!defined $arch) {
|
||||||
|
$inf_file = "OpensslLibFull.inf";
|
||||||
|
} else {
|
||||||
|
$inf_file = "OpensslLibFullAccel.inf";
|
||||||
|
}
|
||||||
|
# Read the contents of the inf file
|
||||||
|
@inf = ();
|
||||||
|
@new_inf = ();
|
||||||
|
open( FD, "<" . $inf_file ) ||
|
||||||
|
die "Cannot open \"" . $inf_file . "\"!";
|
||||||
|
@inf = (<FD>);
|
||||||
|
close(FD) ||
|
||||||
|
die "Cannot close \"" . $inf_file . "\"!";
|
||||||
|
$subbing = 0;
|
||||||
|
print "\n--> Updating $inf_file ... ";
|
||||||
|
foreach (@inf) {
|
||||||
|
if ( $_ =~ "# Autogenerated files list starts here" ) {
|
||||||
|
push @new_inf, $_, @cryptofilelist, @sslfilelist, @ecfilelist;
|
||||||
|
$subbing = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if (defined $arch) {
|
||||||
|
my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";
|
||||||
|
if ($_ =~ $arch_asmfile_flag) {
|
||||||
|
push @new_inf, $_, @asmfilelist;
|
||||||
|
$subbing = 1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( $_ =~ "# Autogenerated files list ends here" ) {
|
||||||
|
push @new_inf, $_;
|
||||||
|
$subbing = 0;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
push @new_inf, $_
|
||||||
|
unless ($subbing);
|
||||||
|
}
|
||||||
|
|
||||||
|
$new_inf_file = $inf_file . ".new";
|
||||||
|
open( FD, ">" . $new_inf_file ) ||
|
||||||
|
die $new_inf_file;
|
||||||
|
print( FD @new_inf ) ||
|
||||||
|
die $new_inf_file;
|
||||||
|
close(FD) ||
|
||||||
|
die $new_inf_file;
|
||||||
|
rename( $new_inf_file, $inf_file ) ||
|
||||||
|
die "rename $inf_file";
|
||||||
|
print "Done!";
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration
|
# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user