Add support for RC / WINDRES env variables
authorRichard Levitte <levitte@openssl.org>
Mon, 16 May 2016 15:08:13 +0000 (17:08 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 16 May 2016 16:03:40 +0000 (18:03 +0200)
RT#2558

Reviewed-by: Tim Hudson <tjh@openssl.org>
Configurations/unix-Makefile.tmpl
Configure
Makefile.shared

index a31867e..de20ad7 100644 (file)
@@ -169,7 +169,6 @@ LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag}
                # $prefix is not /usr.
                . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
                   ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
-RCFLAGS={- $target{shared_rcflag} -}
 DSO_CFLAGS={- $target{shared_cflag} || "" -}
 DSO_LDFLAGS=$(LIB_LDFLAGS)
 BIN_CFLAGS={- $target{bin_cflags} -}
@@ -180,6 +179,8 @@ ARFLAGS= {- $target{arflags} -}
 AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
 RANLIB= {- $target{ranlib} -}
 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
+RCFLAGS={- $target{shared_rcflag} -}
+RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
 RM= rm -f
 RMDIR= rmdir
 TAR= {- $target{tar} || "tar" -}
@@ -959,9 +960,9 @@ $target: $lib$libext $deps $ordinalsfile
                LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
                LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\
                CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
-               CROSS_COMPILE='\$(CROSS_COMPILE)' LDFLAGS='\$(LDFLAGS)' \\
+               LDFLAGS='\$(LDFLAGS)' \\
                SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\
-               SHARED_RCFLAGS='\$(RCFLAGS)' \\
+               RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
                link_shlib.$shlib_target
 EOF
          . (windowsdll() ? <<"EOF" : "");
index 060ba24..4d3346e 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -915,6 +915,8 @@ $target{ranlib} =  $ENV{'RANLIB'}  || $target{ranlib}  ||
                           "\$(CROSS_COMPILE)ranlib" : "true");
 $target{ar} =      $ENV{'AR'}      || $target{ar}      || "ar";
 $target{nm} =      $ENV{'NM'}      || $target{nm}      || "nm";
+$target{rc} =
+    $ENV{'RC'}  || $ENV{'WINDRES'} || $target{rc}      || "windres";
 
 # For cflags, lflags, plib_lflags, ex_libs and defines, add the debug_
 # or release_ attributes.
index 65980b2..68b87a7 100644 (file)
@@ -14,6 +14,7 @@ CFLAGS=$(CFLAG)
 LDFLAGS=$(LDFLAG)
 SHARED_LDFLAGS=$(SHARED_LDFLAG)
 
+RC=windres
 # SHARED_RCFLAGS are flags used with windres, i.e. when build for Cygwin
 # or Mingw.
 SHARED_RCFLAGS=$(SHARED_RCFLAG)
@@ -278,9 +279,9 @@ link_shlib.cygwin:
        SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
        dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
        echo "$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name |" \
-                    "$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o"; \
+                    "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
        $(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \
-               $(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o; \
+               $(RC) $(SHARED_RCFLAGS) -o rc.o; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
        SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a rc.o"; \
@@ -306,9 +307,9 @@ link_shlib.mingw:
                | sed -e 's|^\(LIBRARY  *\)$(LIBNAME)32|\1'"$$dll_name"'|' \
                > $(LIBNAME).def; \
        echo "$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name |" \
-               "$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o"; \
+               "$(RC) $(SHARED_RCFLAGS) -o rc.o"; \
        $(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \
-               $(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o; \
+               $(RC) $(SHARED_RCFLAGS) -o rc.o; \
        ALLSYMSFLAGS='-Wl,--whole-archive'; \
        NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
        SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $(LIBNAME).def rc.o"; \