Build resource files
authorTanzinul Islam <tanzinul.islam@gmail.com>
Wed, 9 Dec 2020 00:29:14 +0000 (00:29 +0000)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 19 Apr 2021 09:05:54 +0000 (11:05 +0200)
We need to compile with [brcc32.exe][1] and link with [ilink32.exe][2].
The latter expects the `.res` files to be given in the final comma-
separated section in the command line (after the `.def` file).

[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/BRCC32.EXE,_the_Resource_Compiler
[2]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_ILINK32_and_ILINK64_on_the_Command_Line#Command-Line_Elements

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)

Configurations/00-base-templates.conf
Configurations/10-main.conf
Configurations/50-cppbuilder.conf
Configurations/windows-makefile.tmpl
apps/build.info
build.info

index 3c569814aeb6c5fdf5d391b7d730cd3e8491114c..0e5d38d5a63273cf118819046ace4dd8665dae54 100644 (file)
@@ -108,8 +108,6 @@ my %targets=(
                 return ();
             },
 
-        RC               => "rc",
-        rcoutflag        => "/fo",
         MT              => "mt",
         MTFLAGS         => "-nologo",
         mtinflag        => "-manifest ",
index 3d6fbba5e41db3f9b999d6122ff01e77167fbbf2..4d42c7fae813aa073705934da7258ad44db5852a 100644 (file)
@@ -1288,6 +1288,8 @@ my %targets = (
         ARFLAGS          => "/nologo",
         aroutflag        => "/out:",
         ar_resp_delim    => "\n",
+        RC               => "rc",
+        rcoutflag        => "/fo",
         defines          => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
                                 "UNICODE", "_UNICODE",
                                 "_CRT_SECURE_NO_DEPRECATE",
@@ -1301,6 +1303,7 @@ my %targets = (
         shared_ldflag    => "/dll",
         shared_target    => "win-shared", # meaningless except it gives Configure a hint
         lddefflag        => "/def:",
+        ldresflag        => " ",
         ld_implib_flag   => "/implib:",
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
index cb293afcb9589a6fcf5c82724581c4fd17f32daa..40b89b403eec0adc071f05296d07708ef0767acb 100644 (file)
@@ -38,10 +38,14 @@ my %targets = (
         AR               => "tlib",
         ARFLAGS          => "/P256 /N /u",
         ar_resp_delim    => " &\n",
+        RC               => "brcc32",
+        RCFLAGS          => '-i"$(BDS)\include\windows\sdk"',
+        rcoutflag        => "-fo",
         shared_target    => "win-shared",
         shared_ldflag    => "-Tpd c0d32.obj",
         dso_lflags       => "-Tpd c0d32.obj",
         lddefflag        => ",",
+        ldresflag        => ",",
         ld_implib_rule   => 'implib $< $**',
         dso_scheme       => "win32",
     }
index 1e3d63f8d10f067e2e24cf455b76af2234b10c54..521f72d7b7b05e116d21cefed13e36a0eba134fe 100644 (file)
@@ -848,7 +848,10 @@ EOF
      my %args = @_;
      my $lib = $args{lib};
      my @objs = map { platform->convertext($_) }
-                grep { platform->isobj($_) || platform->isres($_) }
+                grep { platform->isobj($_) }
+                @{$args{objs}};
+     my @ress = map { platform->convertext($_) }
+                grep { platform->isres($_) }
                 @{$args{objs}};
      my @defs = map { platform->def($_) }
                 grep { platform->isdef($_) }
@@ -857,10 +860,11 @@ EOF
      die "More than one exported symbols list" if scalar @defs > 1;
      my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
      my $objs = join($target{ld_resp_delim}, @objs);
-     my $deps = join(" ", @objs, @defs, @deps);
+     my $ress = join($target{ld_resp_delim}, @ress);
+     my $deps = join(" ", @objs, @ress, @defs, @deps);
      my $import = platform->sharedlib_import($lib);
      my $dll =  platform->sharedlib($lib);
-     my $shared_def = join("", map { " $target{lddefflag}$_" } @defs);
+     my $shared_def = $target{lddefflag} . join("", @defs);
      my $implib_rule = $target{ld_implib_rule} || "";
      my $implib_flag = $target{ld_implib_flag}
                        ? "$target{ld_implib_flag}$import"
@@ -875,7 +879,7 @@ $dll: $deps
        IF EXIST $full.manifest DEL /F /Q $full.manifest
        IF EXIST \$@ DEL /F /Q \$@
        \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import; EXIT 1)
-$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$shared_def
+$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress
 <<
        IF EXIST $dll.manifest \\
           \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
@@ -892,21 +896,26 @@ EOF
      my $dso = platform->dso($args{module});
      my $dso_n = platform->dsoname($args{module});
      my @objs = map { platform->convertext($_) }
-                grep { platform->isobj($_) || platform->isres($_) }
+                grep { platform->isobj($_) }
+                @{$args{objs}};
+     my @ress = map { platform->convertext($_) }
+                grep { platform->isres($_) }
                 @{$args{objs}};
      my @defs = map { platform->def($_) }
                 grep { platform->isdef($_) }
                 @{$args{objs}};
      my @deps = compute_lib_depends(@{$args{deps}});
+     die "More than one exported symbols list" if scalar @defs > 1;
      my $objs = join($target{ld_resp_delim}, @objs);
+     my $ress = join($target{ld_resp_delim}, @ress);
      my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
-     my $deps = join(" ", @objs, @defs, @deps);
-     my $shared_def = join("", map { " $target{lddefflag}$_" } @defs);
+     my $deps = join(" ", @objs, @ress, @defs, @deps);
+     my $shared_def = $target{lddefflag} . join("", @defs);
      return <<"EOF";
 $dso: $deps
        IF EXIST $dso.manifest DEL /F /Q $dso.manifest
        \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.*; EXIT 1)
-$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$shared_def
+$objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress
 <<
        IF EXIST $dso.manifest \\
           \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso
@@ -929,17 +938,20 @@ EOF
      my %args = @_;
      my $bin = platform->bin($args{bin});
      my @objs = map { platform->convertext($_) }
-                grep { platform->isobj($_) || platform->isres($_) }
+                grep { platform->isobj($_) }
+                @{$args{objs}};
+     my @ress = map { platform->convertext($_) }
+                grep { platform->isres($_) }
                 @{$args{objs}};
      my @deps = compute_lib_depends(@{$args{deps}});
      my $objs = join($target{ld_resp_delim}, @objs);
      my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
-     my $deps = join(" ", @objs, @deps);
+     my $deps = join(" ", @objs, @ress, @deps);
      return <<"EOF";
 $bin: $deps
        IF EXIST $bin.manifest DEL /F /Q $bin.manifest
        \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<<
-$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)
+$objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
 <<
        IF EXIST $bin.manifest \\
           \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin
index 146e9009f50751892acedf14127088fa117d9c5c..06759b2f94bab209ea3bfa5164653cf2d805f34e 100644 (file)
@@ -71,7 +71,7 @@ IF[{- !$disabled{apps} -}]
   # always depend on a changed configuration.
   DEPEND[progs.c]=../configdata.pm
 
-  IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+  IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
     GENERATE[openssl.rc]=../util/mkrc.pl openssl
     SOURCE[openssl]=openssl.rc
   ENDIF
index f631d6c7809b0266d5fc442383c7ffc7b3cfd740..6c91e22309fc851c80d8aa58e964955e18b33138 100644 (file)
@@ -79,7 +79,7 @@ IF[{- defined $target{shared_defflag} -}]
   GENERATE[libssl.ld]=util/libssl.num libssl
 ENDIF
 
-IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
   GENERATE[libcrypto.rc]=util/mkrc.pl libcrypto
   GENERATE[libssl.rc]=util/mkrc.pl libssl