From: Richard Levitte Date: Tue, 16 Feb 2016 19:37:28 +0000 (+0100) Subject: Big rename fest of MingW shared libraries X-Git-Tag: OpenSSL_1_1_0-pre4~592 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=520f434b42c83d63d8777075eb66967618551d5b;p=oweals%2Fopenssl.git 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 --- diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf index 4372d92614..5ab71b5c1f 100644 --- a/Configurations/10-main.conf +++ b/Configurations/10-main.conf @@ -1174,11 +1174,12 @@ bn_ops => "BN_LLONG EXPORT_VAR_AS_FN", perlasm_scheme => "coff", dso_scheme => "win32", - shared_target => "cygwin-shared", + shared_target => "mingw-shared", shared_cflag => add(" ", "-D_WINDLL"), shared_ldflag => "-static-libgcc", shared_rcflag => "--target=pe-i386", shared_extension => ".dll", + multilib => "", }, "mingw64" => { # As for OPENSSL_USE_APPLINK. Applink makes it possible to use @@ -1200,11 +1201,12 @@ bn_ops => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN", perlasm_scheme => "mingw64", dso_scheme => "win32", - shared_target => "cygwin-shared", + shared_target => "mingw-shared", shared_cflag => add(" ", "-D_WINDLL"), shared_ldflag => "-static-libgcc", shared_rcflag => "--target=pe-x86-64", shared_extension => ".dll", + multilib => "64", }, #### UEFI diff --git a/Makefile.in b/Makefile.in index b56cc7c70e..a7cd7570a9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -388,14 +388,15 @@ do_$(SHLIB_TARGET): cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \ ;; \ mingw*) \ - case $$i in \ - crypto) i=libeay32;; \ - ssl) i=ssleay32;; \ - esac; \ - rm -f apps/$$i.dll; \ - rm -f test/$$i.dll; \ - cp $$i.dll apps/; \ - cp $$i.dll test/; \ + arch=; \ + if expr $(PLATFORM) : mingw64 > /dev/null; then \ + arch=-x64; \ + fi; \ + rm -f apps/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \ + rm -f test/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \ + cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll apps/; \ + cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll test/; \ + ;; \ esac; \ done @@ -589,30 +590,40 @@ install_sw: for i in $${tmp:-x}; \ do \ if [ -f "$$i" -o -f "$$i.a" ]; then \ - ( echo installing $$i; \ - if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \ - c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ + case "$(PLATFORM)" in \ + Cygwin*) \ + c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ + echo installing $$c; \ cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \ chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \ mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \ - cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ - chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ - mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ - else \ + echo installing $$i.a; \ + cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \ + chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \ + mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + ;; \ + mingw*) \ + arch=; \ + if expr $(PLATFORM) : mingw64 > /dev/null; then \ + arch=-x64; \ + fi; \ + m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \ + echo installing $$m; \ + cp $$m $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \ + chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \ + mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$m.new $(DESTDIR)$(INSTALLTOP)/bin/$$m; \ + echo installing $$i.a; \ + cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \ + chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \ + mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + ;; \ + *) \ + echo installing $$i; \ cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \ mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ - fi ); \ - if expr $(PLATFORM) : 'mingw' > /dev/null; then \ - ( case $$i in \ - *crypto*) i=libeay32.dll;; \ - *ssl*) i=ssleay32.dll;; \ - esac; \ - echo installing $$i; \ - cp $$i $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \ - chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \ - mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$i.new $(DESTDIR)$(INSTALLTOP)/bin/$$i ); \ - fi; \ + ;; \ + esac; \ fi; \ done; \ ( here="`pwd`"; \ @@ -643,24 +654,30 @@ uninstall_sw: for i in $${tmp:-x}; \ do \ if [ -f "$$i" -o -f "$$i.a" ]; then \ - if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \ - c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ + case "$(PLATFORM)" in \ + Cygwin*) \ + c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \ echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \ $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \ + echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + ;; \ + mingw*) \ + arch=; \ + if expr $(PLATFORM) : mingw64 > /dev/null; then \ + arch=-x64; \ + fi; \ + m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \ + echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \ + $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \ + echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \ + ;; \ + *) \ echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ - else \ - echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \ - fi; \ - if expr $(PLATFORM) : 'mingw' > /dev/null; then \ - case $$i in \ - *crypto*) i=libeay32.dll;; \ - *ssl*) i=ssleay32.dll;; \ - esac; \ - echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \ - $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \ - fi; \ + ;; \ + esac; \ fi; \ done; \ fi 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 diff --git a/build.info b/build.info index 9a3d9bdf7b..f56b531907 100644 --- a/build.info +++ b/build.info @@ -10,8 +10,8 @@ IF[{- $config{target} =~ /^Cygwin/ -}] SHARED_NAME[libcrypto]=cygcrypto-{- $config{shlib_major}.".".$config{shlib_minor} -} SHARED_NAME[libssl]=cygssl-{- $config{shlib_major}.".".$config{shlib_minor} -} ELSIF[{- $config{target} =~ /^mingw/ -}] - SHARED_NAME[libcrypto]=libeay32 - SHARED_NAME[libssl]=ssleay32 + SHARED_NAME[libcrypto]=libcrypto-{- $config{shlib_major}."_".$config{shlib_minor} -}{- $config{target} eq "mingw64" ? "-x64" : "" -} + SHARED_NAME[libssl]=libssl-{- $config{shlib_major}."_".$config{shlib_minor} -}{- $config{target} eq "mingw64" ? "-x64" : "" -} ENDIF # VMS has a cultural standard where all libraries are prefixed.