Fix resource files
authorRich Salz <rsalz@openssl.org>
Thu, 22 Mar 2018 14:21:33 +0000 (10:21 -0400)
committerRich Salz <rsalz@openssl.org>
Thu, 22 Mar 2018 14:53:22 +0000 (10:53 -0400)
Add it to apps as well as libraries.
Fix the copyright year generation.
Thanks to user RTT for pointing this out.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5704)

Configure
apps/build.info
apps/progs.pl
util/mkrc.pl

index 0934088d2ddab77fda552ddb779764d960b529ec..ce33f488d6e76a8856e89285563028c567c59954 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -2015,6 +2015,13 @@ EOF
                     $o = cleanfile($buildd, $o, $blddir);
                     $unified_info{sources}->{$ddest}->{$o} = 1;
                     $unified_info{sources}->{$o}->{$s} = 1;
+                } elsif ($s =~ /\.rc$/) {
+                    # We also recognise resource files
+                    my $o = $_;
+                    $o =~ s/\.rc$/.res/; # Resource configuration
+                    my $o = cleanfile($buildd, $o, $blddir);
+                    $unified_info{sources}->{$ddest}->{$o} = 1;
+                    $unified_info{sources}->{$o}->{$s} = 1;
                 } else {
                     $unified_info{sources}->{$ddest}->{$s} = 1;
                 }
index e72437330e002302428605f262468e8e5acacb49..4a11a18fbebc55d967d417804eaf85506c338c27 100644 (file)
@@ -23,6 +23,11 @@ IF[{- !$disabled{apps} -}]
   INCLUDE[openssl]=.. ../include
   DEPEND[openssl]=libapps.a ../libssl
 
+IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+  GENERATE[openssl.rc]=../util/mkrc.pl openssl
+  SOURCE[openssl]=openssl.rc
+ENDIF
+
   {- join("\n  ", map { (my $x = $_) =~ s|\.c$|.o|; "DEPEND[$x]=progs.h" }
                   @apps_openssl_src) -}
   GENERATE[progs.h]=progs.pl $(APPS_OPENSSL)
index f832467b57d845785a7edf0e18c8cc0a8c80e84e..8b9a95bcadddc7684741c293405fef11779bb6a0 100644 (file)
@@ -17,12 +17,14 @@ use configdata qw/@disablables %unified_info/;
 my %commands     = ();
 my $cmdre        = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
 my $apps_openssl = shift @ARGV;
+my $YEAR         = [localtime()]->[5] + 1900;
 
 # because the program apps/openssl has object files as sources, and
 # they then have the corresponding C files as source, we need to chain
 # the lookups in %unified_info
 my @openssl_source =
     map { @{$unified_info{sources}->{$_}} }
+    grep { /\.o$/ }
         @{$unified_info{sources}->{$apps_openssl}};
 
 foreach my $filename (@openssl_source) {
@@ -36,12 +38,12 @@ foreach my $filename (@openssl_source) {
 
 @ARGV = sort keys %commands;
 
-print <<'EOF';
+print <<"EOF";
 /*
  * WARNING: do not edit!
  * Generated by apps/progs.pl
  *
- * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-$YEAR The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
index b98a6946ca947b26e368247ab9b3934ff994f50d..08b0af1a7ab9605b75e470e6a28b0b37c886beef 100755 (executable)
@@ -39,13 +39,14 @@ while (<FD>) {
 close(FD);
 
 my $filename = $ARGV[0];
-$filename =~ /(.*)\.([^.]+)$/;
-my $basename = $1;
-my $extname  = $2;
-
-my $description = "OpenSSL application";
-$description = "OpenSSL shared library" if $extname =~ /dll/i;
+my $description = "OpenSSL library";
+my $vft = "VFT_DLL";
+if ( $filename =~ /openssl/i ) {
+    $description = "OpenSSL application";
+    $vft = "VFT_APP";
+}
 
+my $YEAR = [localtime()]->[5] + 1900;
 print <<___;
 #include <winver.h>
 
@@ -61,7 +62,7 @@ LANGUAGE 0x09,0x01
   FILEFLAGS 0x00L
 #endif
   FILEOS VOS__WINDOWS32
-  FILETYPE VFT_DLL
+  FILETYPE $vft
   FILESUBTYPE 0x0L
 BEGIN
     BLOCK "StringFileInfo"
@@ -72,13 +73,13 @@ BEGIN
             VALUE "CompanyName", "The OpenSSL Project, http://www.openssl.org/\\0"
             VALUE "FileDescription", "$description\\0"
             VALUE "FileVersion", "$version\\0"
-            VALUE "InternalName", "$basename\\0"
+            VALUE "InternalName", "$filename\\0"
             VALUE "OriginalFilename", "$filename\\0"
             VALUE "ProductName", "The OpenSSL Toolkit\\0"
             VALUE "ProductVersion", "$version\\0"
             // Optional:
             //VALUE "Comments", "\\0"
-            VALUE "LegalCopyright", "Copyright 1998-2016 The OpenSSL Authors. All rights reserved.\\0"
+            VALUE "LegalCopyright", "Copyright 1998-$YEAR The OpenSSL Authors. All rights reserved.\\0"
             //VALUE "LegalTrademarks", "\\0"
             //VALUE "PrivateBuild", "\\0"
             //VALUE "SpecialBuild", "\\0"