From 520f434b42c83d63d8777075eb66967618551d5b Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 16 Feb 2016 20:37:28 +0100 Subject: Big rename fest of MingW shared libraries So far, MingW shared libraries were named like this libeay32.dll + libeay32.dll.a ssleay32.dll + ssleay32.dll.a That naming scheme is antiquated, a reminicense of SSLeay. We're therefore changing the scheme to something that's more like the rest of OpenSSL. There are two factors to remember: - Windows libraries have no recorded SOvers, which means that the shared library version must be encoded in the name. According to some, it's unwise to encode extra periods in a Windows file name, so we convert version number periods to underscores. - MingW has multilib ability. However, DLLs need to reside with the binaries that use them, so to allow both 32-bit and 64-bit DLLs to reside in the same place, we add '-x64' in the name of the 64-bit ones. The resulting name scheme (for SOver 1.1) is this: on x86: libcrypto-1_1.dll + libcrypto.dll.a libssl-1_1.dll + libssl.dll.a on x86_64: libcrypto-1_1-x64.dll + libcrypto.dll.a libssl-1_1-x64.dll + libssl.dll.a An observation is that the import lib is the same for both architectures. Not to worry, though, as they will be installed in PREFIX/lib/ for x86 and PREFIX/lib64/ for x86_64. As a side effect, MingW got its own targets in Makefile.shared. link_dso.mingw-shared and link_app.mingw-shared are aliases for the corresponding cygwin-shared targets. link_shlib.mingw-shared is, however, a target separated from the cygwin one. Reviewed-by: Andy Polyakov --- Makefile.shared | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) (limited to 'Makefile.shared') diff --git a/Makefile.shared b/Makefile.shared index b72781d57c..57e1936b9e 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -266,37 +266,49 @@ link_dso.cygwin: base=-Wl,--enable-auto-image-base; \ SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \ $(LINK_SO_DSO) -#for mingw target if def-file is in use dll-name should match library-name link_shlib.cygwin: @ $(CALC_VERSIONS); \ INHIBIT_SYMLINKS=yes; \ SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \ - dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \ - base=-Wl,--enable-auto-image-base; \ - if expr $(PLATFORM) : 'mingw' > /dev/null; then \ - case $(LIBNAME) in \ - crypto) SHLIB=libeay;; \ - ssl) SHLIB=ssleay;; \ - esac; \ - SHLIB_SOVER=32; \ - extras="$(LIBNAME).def"; \ - $(PERL) $(SRCDIR)/util/mkdef.pl 32 $$SHLIB > $$extras; \ - base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \ - fi; \ dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ echo "$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name |" \ "$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o"; \ $(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \ $(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o; \ - extras="$$extras 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 $$extras"; \ + SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a rc.o"; \ $(LINK_SO_SHLIB) || exit 1; \ - rm $$extras + rm rc.o link_app.cygwin: $(LINK_APP) +# link_dso.mingw-shared and link_app.mingw-shared are mapped to the +# corresponding cygwin targets, as they do the exact same thing. +link_shlib.mingw: + @ $(CALC_VERSIONS); \ + INHIBIT_SYMLINKS=yes; \ + arch=; \ + if expr $(PLATFORM) : mingw64 > /dev/null; then arch=-x64; fi; \ + sover=`echo $(LIBVERSION) | sed -e 's/\./_/g'` ; \ + SHLIB=lib$(LIBNAME); \ + SHLIB_SOVER=-$$sover$$arch; \ + SHLIB_SUFFIX=.dll; \ + dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ + base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \ + $(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \ + | 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"; \ + $(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \ + $(CROSS_COMPILE)windres $(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"; \ + $(LINK_SO_SHLIB) || exit 1; \ + rm $(LIBNAME).def rc.o + link_dso.alpha-osf1: @ if $(DETECT_GNU_LD); then \ $(DO_GNU_SO_NOCALC); \ @@ -560,6 +572,10 @@ link_dso.cygwin-shared: link_dso.cygwin link_shlib.cygwin-shared: link_shlib.cygwin link_app.cygwin-shared: link_app.cygwin symlink.cygwin-shared: symlink.cygwin +link_dso.mingw-shared: link_dso.cygwin +link_shlib.mingw-shared: link_shlib.mingw +link_app.mingw-shared: link_app.cygwin +symlink.mingw-shared: symlink.cygwin link_dso.alpha-osf1-shared: link_dso.alpha-osf1 link_shlib.alpha-osf1-shared: link_shlib.alpha-osf1 link_app.alpha-osf1-shared: link_app.alpha-osf1 -- cgit v1.2.3