2711. [port] win32: Add the bin/pkcs11 tools into the full

build. [RT #20372]
This commit is contained in:
Evan Hunt
2009-10-12 16:41:13 +00:00
parent 30bb4870da
commit 6a90baa0d5
8 changed files with 697 additions and 600 deletions

View File

@@ -14,16 +14,16 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: setpk11provider.pl,v 1.1 2009/10/06 22:14:13 each Exp $
# $Id: setpk11provider.pl,v 1.2 2009/10/12 16:41:13 each Exp $
# setpk11provider
# setpk11provider.pl
# This script sets the PKCS#11 provider name in the build scripts.
#
# for instance: perl setpk11provider bp201w32HSM
# for instance: setpk11provider.pl bp201w32HSM
#
if ($#ARGV != 0) {
die "Usage: perl setpk11provider <pkcs11_provider_dll_name>\n"
die "Usage: perl setpk11provider.pl <pkcs11_provider_dll_name>\n"
}
my $provider=$ARGV[0];
@@ -31,12 +31,12 @@ my $provider=$ARGV[0];
$provider =~ s|\.[dD][lL][lL]$||;
# List of files that need to be updated
@filelist = ("../bin/pkcs11/win32/pk11keygen.mak",
"../bin/pkcs11/win32/pk11keygen.dsp",
"../bin/pkcs11/win32/pk11list.mak",
"../bin/pkcs11/win32/pk11list.dsp",
"../bin/pkcs11/win32/pk11destroy.mak",
"../bin/pkcs11/win32/pk11destroy.dsp");
@filelist = ("../bin/pkcs11/win32//pk11keygen.mak",
"../bin/pkcs11/win32//pk11keygen.dsp",
"../bin/pkcs11/win32//pk11list.mak",
"../bin/pkcs11/win32//pk11list.dsp",
"../bin/pkcs11/win32//pk11destroy.mak",
"../bin/pkcs11/win32//pk11destroy.dsp");
# function to replace the provider define
sub updatefile {
@@ -62,6 +62,33 @@ sub updatefile {
close(RFILE);
}
# update config.h to define or undefine USE_PKCS11
sub updateconfig {
my($havexml, $substr, $line);
my(@Lines);
$havexml = $_[0];
open (RFILE, "../config.h") || die "Can't open config.h";
@Lines = <RFILE>;
close (RFILE);
foreach $line (@Lines) {
if ($havexml) {
$line =~ s/^.*#undef USE_PKCS11.*$/define USE_PKCS11 1/;
} else {
$line =~ s/^#define USE_PKCS11 .*$/\/\* #undef USE_PKCS11 \*\//;
}
}
open (RFILE, ">../config.h") || die "Can't open config.h";
print "Updating file ../config.h\n";
foreach $line (@Lines) {
print RFILE $line;
}
close(RFILE);
}
#Update the list of files
if ($provider ne 0) {
$ind = 0;
@@ -71,4 +98,8 @@ if ($provider ne 0) {
updatefile($file, $provider);
$ind++;
}
updateconfig(1);
} else {
updateconfig(0);
}