# ./process_files.pl\r
# ./process_files.pl X64\r
# ./process_files.pl [Arch]\r
+#\r
+# Follow the command below to update the INF file:\r
+# 1. OpensslLib.inf ,OpensslLibCrypto.inf and OpensslLibFull.inf\r
+# ./process_files.pl\r
+# 2. OpensslLibAccel.inf and OpensslLibFullAccel.inf\r
+# ./process_files.pl X64\r
+# ./process_files.pl X64Gcc\r
+# ./process_files.pl IA32\r
+# ./process_files.pl IA32Gcc\r
\r
use strict;\r
use Cwd;\r
my $OPENSSL_PATH;\r
my $uefi_config;\r
my $extension;\r
+my $compile;\r
my $arch;\r
my @inf;\r
\r
if (defined $arch) {\r
if (uc ($arch) eq "X64") {\r
$arch = "X64";\r
- $inf_file = "OpensslLibX64.inf";\r
$uefi_config = "UEFI-x86_64";\r
$extension = "nasm";\r
+ $compile = "MSFT";\r
$comment_character = ";";\r
} elsif (uc ($arch) eq "X64GCC") {\r
$arch = "X64Gcc";\r
- $inf_file = "OpensslLibX64Gcc.inf";\r
$uefi_config = "UEFI-x86_64-GCC";\r
$extension = "S";\r
+ $compile = "GCC";\r
$comment_character = "#";\r
} elsif (uc ($arch) eq "IA32") {\r
$arch = "IA32";\r
- $inf_file = "OpensslLibIa32.inf";\r
$uefi_config = "UEFI-x86";\r
$extension = "nasm";\r
+ $compile = "MSFT";\r
$comment_character = ";";\r
} elsif (uc ($arch) eq "IA32GCC") {\r
$arch = "IA32Gcc";\r
- $inf_file = "OpensslLibIa32Gcc.inf";\r
$uefi_config = "UEFI-x86-GCC";\r
$extension = "S";\r
+ $compile = "GCC";\r
$comment_character = "#";\r
} else {\r
die "Unsupported architecture \"" . $arch . "\"!";\r
}\r
+ $inf_file = "OpensslLibAccel.inf";\r
if ($extension eq "nasm") {\r
if (`nasm -v 2>&1`) {\r
#Presence of nasm executable will trigger inclusion of AVX instructions\r
\r
my @cryptofilelist = ();\r
my @sslfilelist = ();\r
+my @ecfilelist = ();\r
my @asmfilelist = ();\r
my @asmbuild = ();\r
foreach my $product ((@{$unified_info{libraries}},\r
$buildstring .= " ./$arch/$path$s.$extension";\r
make_path ("./$arch/$path");\r
push @asmbuild, "$buildstring\n";\r
- push @asmfilelist, " $arch/$path$s.$extension\r\n";\r
+ push @asmfilelist, " $arch/$path$s.$extension |$compile\r\n";\r
}\r
next;\r
}\r
+ if ($s =~ "/ec/" || $s =~ "/sm2/") {\r
+ push @ecfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";\r
+ next;\r
+ }\r
if ($product =~ "libssl") {\r
push @sslfilelist, ' $(OPENSSL_PATH)/' . $s . "\r\n";\r
next;\r
push @sslfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";\r
next;\r
}\r
+ if ($_ =~ "/ec/" || $_ =~ "/sm2/") {\r
+ push @ecfilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";\r
+ next;\r
+ }\r
push @cryptofilelist, ' $(OPENSSL_PATH)/' . $_ . "\r\n";\r
}\r
\r
next;\r
}\r
if ( $_ =~ "# Autogenerated files list starts here" ) {\r
- push @new_inf, $_, @asmfilelist, @cryptofilelist, @sslfilelist;\r
+ push @new_inf, $_, @cryptofilelist, @sslfilelist;\r
$subbing = 1;\r
next;\r
}\r
+ if (defined $arch) {\r
+ my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";\r
+ if ($_ =~ $arch_asmfile_flag) {\r
+ push @new_inf, $_, @asmfilelist;\r
+ $subbing = 1;\r
+ next;\r
+ }\r
+ }\r
if ( $_ =~ "# Autogenerated files list ends here" ) {\r
push @new_inf, $_;\r
$subbing = 0;\r
print "Done!";\r
}\r
\r
+#\r
+# Update OpensslLibFull.inf with autogenerated file list\r
+#\r
+if (!defined $arch) {\r
+ $inf_file = "OpensslLibFull.inf";\r
+} else {\r
+ $inf_file = "OpensslLibFullAccel.inf";\r
+}\r
+# Read the contents of the inf file\r
+@inf = ();\r
+@new_inf = ();\r
+open( FD, "<" . $inf_file ) ||\r
+ die "Cannot open \"" . $inf_file . "\"!";\r
+@inf = (<FD>);\r
+close(FD) ||\r
+ die "Cannot close \"" . $inf_file . "\"!";\r
+$subbing = 0;\r
+print "\n--> Updating $inf_file ... ";\r
+foreach (@inf) {\r
+ if ( $_ =~ "# Autogenerated files list starts here" ) {\r
+ push @new_inf, $_, @cryptofilelist, @sslfilelist, @ecfilelist;\r
+ $subbing = 1;\r
+ next;\r
+ }\r
+ if (defined $arch) {\r
+ my $arch_asmfile_flag = "# Autogenerated " . $arch . " files list starts here";\r
+ if ($_ =~ $arch_asmfile_flag) {\r
+ push @new_inf, $_, @asmfilelist;\r
+ $subbing = 1;\r
+ next;\r
+ }\r
+ }\r
+ if ( $_ =~ "# Autogenerated files list ends here" ) {\r
+ push @new_inf, $_;\r
+ $subbing = 0;\r
+ next;\r
+ }\r
+\r
+ push @new_inf, $_\r
+ unless ($subbing);\r
+}\r
+\r
+$new_inf_file = $inf_file . ".new";\r
+open( FD, ">" . $new_inf_file ) ||\r
+ die $new_inf_file;\r
+print( FD @new_inf ) ||\r
+ die $new_inf_file;\r
+close(FD) ||\r
+ die $new_inf_file;\r
+rename( $new_inf_file, $inf_file ) ||\r
+ die "rename $inf_file";\r
+print "Done!";\r
+\r
#\r
# Copy opensslconf.h and dso_conf.h generated from OpenSSL Configuration\r
#\r