2
0

mkrc.pl 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #! /usr/bin/env perl
  2. # Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the OpenSSL license (the "License"). You may not use
  5. # this file except in compliance with the License. You can obtain a copy
  6. # in the file LICENSE in the source distribution or at
  7. # https://www.openssl.org/source/license.html
  8. use strict;
  9. use warnings;
  10. use lib ".";
  11. use configdata;
  12. use File::Spec::Functions;
  13. my $versionfile = catfile( $config{sourcedir}, "include/openssl/opensslv.h" );
  14. my ( $ver, $v1, $v2, $v3, $v4, $beta, $version );
  15. open FD, $versionfile or die "Couldn't open include/openssl/opensslv.h: $!\n";
  16. while (<FD>) {
  17. if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) {
  18. $ver = hex($1);
  19. $v1 = ( $ver >> 28 );
  20. $v2 = ( $ver >> 20 ) & 0xff;
  21. $v3 = ( $ver >> 12 ) & 0xff;
  22. $v4 = ( $ver >> 4 ) & 0xff;
  23. $beta = $ver & 0xf;
  24. $version = "$v1.$v2.$v3";
  25. if ( $beta == 0xf ) {
  26. $version .= chr( ord('a') + $v4 - 1 ) if ($v4);
  27. } elsif ( $beta == 0 ) {
  28. $version .= "-dev";
  29. } else {
  30. $version .= "-beta$beta";
  31. }
  32. last;
  33. }
  34. }
  35. close(FD);
  36. my $filename = $ARGV[0];
  37. my $description = "OpenSSL library";
  38. my $vft = "VFT_DLL";
  39. if ( $filename =~ /openssl/i ) {
  40. $description = "OpenSSL application";
  41. $vft = "VFT_APP";
  42. }
  43. my $YEAR = [localtime()]->[5] + 1900;
  44. print <<___;
  45. #include <winver.h>
  46. LANGUAGE 0x09,0x01
  47. 1 VERSIONINFO
  48. FILEVERSION $v1,$v2,$v3,$v4
  49. PRODUCTVERSION $v1,$v2,$v3,$v4
  50. FILEFLAGSMASK 0x3fL
  51. #ifdef _DEBUG
  52. FILEFLAGS 0x01L
  53. #else
  54. FILEFLAGS 0x00L
  55. #endif
  56. FILEOS VOS__WINDOWS32
  57. FILETYPE $vft
  58. FILESUBTYPE 0x0L
  59. BEGIN
  60. BLOCK "StringFileInfo"
  61. BEGIN
  62. BLOCK "040904b0"
  63. BEGIN
  64. // Required:
  65. VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
  66. VALUE "FileDescription", "$description\\0"
  67. VALUE "FileVersion", "$version\\0"
  68. VALUE "InternalName", "$filename\\0"
  69. VALUE "OriginalFilename", "$filename\\0"
  70. VALUE "ProductName", "The OpenSSL Toolkit\\0"
  71. VALUE "ProductVersion", "$version\\0"
  72. // Optional:
  73. //VALUE "Comments", "\\0"
  74. VALUE "LegalCopyright", "Copyright 1998-$YEAR The OpenSSL Authors. All rights reserved.\\0"
  75. //VALUE "LegalTrademarks", "\\0"
  76. //VALUE "PrivateBuild", "\\0"
  77. //VALUE "SpecialBuild", "\\0"
  78. END
  79. END
  80. BLOCK "VarFileInfo"
  81. BEGIN
  82. VALUE "Translation", 0x409, 0x4b0
  83. END
  84. END
  85. ___