From 8f41ff2d53eb43046012c7843f1f1e213b3650ea Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 16 May 2016 17:08:13 +0200 Subject: [PATCH] Add support for RC / WINDRES env variables RT#2558 Reviewed-by: Tim Hudson --- Configurations/unix-Makefile.tmpl | 7 ++++--- Configure | 2 ++ Makefile.shared | 9 +++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl index a31867ed32..de20ad7d06 100644 --- a/Configurations/unix-Makefile.tmpl +++ b/Configurations/unix-Makefile.tmpl @@ -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" : ""); diff --git a/Configure b/Configure index 060ba24a9f..4d3346e834 100755 --- 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. diff --git a/Makefile.shared b/Makefile.shared index 65980b293f..68b87a7cc8 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -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"; \ -- GitLab