From 8390062853513e1b42cac98078db184bc6100ca7 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Thu, 22 Mar 2018 10:21:33 -0400 Subject: [PATCH] Fix resource files 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 (Merged from https://github.com/openssl/openssl/pull/5704) --- Configure | 7 +++++++ apps/build.info | 5 +++++ apps/progs.pl | 6 ++++-- util/mkrc.pl | 19 ++++++++++--------- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Configure b/Configure index 0934088d2d..ce33f488d6 100755 --- 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; } diff --git a/apps/build.info b/apps/build.info index e72437330e..4a11a18fbe 100644 --- a/apps/build.info +++ b/apps/build.info @@ -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) diff --git a/apps/progs.pl b/apps/progs.pl index f832467b57..8b9a95bcad 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -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 diff --git a/util/mkrc.pl b/util/mkrc.pl index b98a6946ca..08b0af1a7a 100755 --- a/util/mkrc.pl +++ b/util/mkrc.pl @@ -39,13 +39,14 @@ while () { 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 @@ -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" -- 2.25.1