xref: /freebsd/crypto/openssl/util/mkrc.pl (revision 49b49cda41feabe3439f7318e8bf40e3896c7bf4)
1#!/bin/env perl
2#
3open FD,"crypto/opensslv.h";
4while(<FD>) {
5    if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
6	$ver = hex($1);
7	$v1 = ($ver>>28);
8	$v2 = ($ver>>20)&0xff;
9	$v3 = ($ver>>12)&0xff;
10	$v4 = ($ver>> 4)&0xff;
11	$beta = $ver&0xf;
12	$version = "$v1.$v2.$v3";
13	if ($beta==0xf)	{ $version .= chr(ord('a')+$v4-1) if ($v4);	}
14	elsif ($beta==0){ $version .= "-dev";				}
15	else		{ $version .= "-beta$beta";			}
16	last;
17    }
18}
19close(FD);
20
21$filename = $ARGV[0]; $filename =~ /(.*)\.([^.]+)$/;
22$basename = $1;
23$extname  = $2;
24
25if ($extname =~ /dll/i)	{ $description = "OpenSSL shared library"; }
26else			{ $description = "OpenSSL application";    }
27
28print <<___;
29#include <winver.h>
30
31LANGUAGE 0x09,0x01
32
331 VERSIONINFO
34  FILEVERSION $v1,$v2,$v3,$v4
35  PRODUCTVERSION $v1,$v2,$v3,$v4
36  FILEFLAGSMASK 0x3fL
37#ifdef _DEBUG
38  FILEFLAGS 0x01L
39#else
40  FILEFLAGS 0x00L
41#endif
42  FILEOS VOS__WINDOWS32
43  FILETYPE VFT_DLL
44  FILESUBTYPE 0x0L
45BEGIN
46    BLOCK "StringFileInfo"
47    BEGIN
48        BLOCK "040904b0"
49        BEGIN
50            // Required:
51            VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
52            VALUE "FileDescription", "$description\\0"
53            VALUE "FileVersion", "$version\\0"
54            VALUE "InternalName", "$basename\\0"
55            VALUE "OriginalFilename", "$filename\\0"
56            VALUE "ProductName", "The OpenSSL Toolkit\\0"
57            VALUE "ProductVersion", "$version\\0"
58            // Optional:
59            //VALUE "Comments", "\\0"
60            VALUE "LegalCopyright", "Copyright © 1998-2006 The OpenSSL Project. Copyright © 1995-1998 Eric A. Young, Tim J. Hudson. All rights reserved.\\0"
61            //VALUE "LegalTrademarks", "\\0"
62            //VALUE "PrivateBuild", "\\0"
63            //VALUE "SpecialBuild", "\\0"
64        END
65    END
66    BLOCK "VarFileInfo"
67    BEGIN
68        VALUE "Translation", 0x409, 0x4b0
69    END
70END
71___
72