Skip to content

Commit

Permalink
Add version info to Win32 DLLs.
Browse files Browse the repository at this point in the history
We might want to edit the strings a bit...

Maybe add to 0.9.7 too?
  • Loading branch information
snhenson committed Oct 4, 2002
1 parent 3d840c8 commit fc6a6a1
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

Changes between 0.9.7 and 0.9.8 [xx XXX 2002]

*) Add version info to Win32 DLLs.
[Peter 'Luna' Runestig" <[email protected]>]

*) Add new 'medium level' PKCS#12 API. Certificates and keys
can be added using this API to created arbitrary PKCS#12
files while avoiding the low level API.
Expand Down
64 changes: 64 additions & 0 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ if ($rmd160_obj =~ /\.o$/)
$cflags =~ s/([\\\"])/\\\1/g;

my $version = "unknown";
my $version_num = "unknown";
my $major = "unknown";
my $minor = "unknown";
my $shlib_version_number = "unknown";
Expand All @@ -1167,6 +1168,7 @@ open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
while (<IN>)
{
$version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
$version_num=$1 if /OPENSSL.VERSION.NUMBER.*0x(\S+)/;
$shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
$shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
}
Expand Down Expand Up @@ -1499,6 +1501,68 @@ EOF
}
}

# create the ms/version32.rc file if needed
if ($IsWindows) {
my ($v1, $v2, $v3, $v4);
if ($version_num =~ /(^[0-9a-f]{1})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i) {
$v1=hex $1;
$v2=hex $2;
$v3=hex $3;
$v4=hex $4;
}
open (OUT,">ms/version32.rc") || die "Can't open ms/version32.rc";
print OUT <<EOF;
#include <winver.h>

LANGUAGE 0x09,0x01

1 VERSIONINFO
FILEVERSION $v1,$v2,$v3,$v4
PRODUCTVERSION $v1,$v2,$v3,$v4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x01L
#else
FILEFLAGS 0x00L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
// Required:
VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
VALUE "FileDescription", "OpenSSL Shared Library\\0"
VALUE "FileVersion", "$version\\0"
#if defined(CRYPTO)
VALUE "InternalName", "libeay32\\0"
VALUE "OriginalFilename", "libeay32.dll\\0"
#elif defined(SSL)
VALUE "InternalName", "ssleay32\\0"
VALUE "OriginalFilename", "ssleay32.dll\\0"
#endif
VALUE "ProductName", "The OpenSSL Toolkit\\0"
VALUE "ProductVersion", "$version\\0"
// Optional:
//VALUE "Comments", "\\0"
VALUE "LegalCopyright", "Copyright � 1998-2002 The OpenSSL Project. Copyright � 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
//VALUE "LegalTrademarks", "\\0"
//VALUE "PrivateBuild", "\\0"
//VALUE "SpecialBuild", "\\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 0x4b0
END
END
EOF
close(OUT);
}

print <<EOF;

Configured for $target.
Expand Down
21 changes: 21 additions & 0 deletions util/mk1mf.pl
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
LINK=$link
LFLAGS=$lflags
RSC=$rsc
BN_ASM_OBJ=$bn_asm_obj
BN_ASM_SRC=$bn_asm_src
Expand Down Expand Up @@ -600,6 +601,18 @@
$rules.=&do_compile_rule("\$(OBJ_D)",$lib_obj{$_},$lib);
}

# hack to add version info on MSVC
if (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) {
$rules.= <<"EOF";
\$(OBJ_D)\\\$(CRYPTO).res: ms\\version32.rc
\$(RSC) /fo"\$(OBJ_D)\\\$(CRYPTO).res" /d CRYPTO ms\\version32.rc
\$(OBJ_D)\\\$(SSL).res: ms\\version32.rc
\$(RSC) /fo"\$(OBJ_D)\\\$(SSL).res" /d SSL ms\\version32.rc
EOF
}

$defs.=&do_defs("T_EXE",$test,"\$(TEST_D)",$exep);
foreach (split(/\s+/,$test))
{
Expand Down Expand Up @@ -755,6 +768,14 @@ sub do_defs
$Vars{$var}.="$t ";
$ret.=$t;
}
# hack to add version info on MSVC
if ($shlib && ($platform eq "VC-WIN32") || ($platform eq "VC-NT"))
{
if ($var eq "CRYPTOOBJ")
{ $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
elsif ($var eq "SSLOBJ")
{ $ret.="\$(OBJ_D)\\\$(SSL).res "; }
}
chop($ret);
$ret.="\n\n";
return($ret);
Expand Down
1 change: 1 addition & 0 deletions util/pl/VC-32.pl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

# EXE linking stuff
$link="link";
$rsc="rc";
$efile="/out:";
$exep='.exe';
if ($no_sock)
Expand Down

0 comments on commit fc6a6a1

Please sign in to comment.