From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B373A138350 for ; Wed, 11 Mar 2020 15:51:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 03834E099B; Wed, 11 Mar 2020 15:51:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D3676E099B for ; Wed, 11 Mar 2020 15:51:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5E04234F212 for ; Wed, 11 Mar 2020 15:51:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DFFB615A for ; Wed, 11 Mar 2020 15:51:03 +0000 (UTC) From: "Michael Haubenwallner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michael Haubenwallner" Message-ID: <1583941637.1eb082db1646e66713be974d53ba71bd7737300d.haubi@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/prefix/windows/winnt/ X-VCS-Repository: repo/gentoo X-VCS-Files: profiles/prefix/windows/winnt/profile.bashrc X-VCS-Directories: profiles/prefix/windows/winnt/ X-VCS-Committer: haubi X-VCS-Committer-Name: Michael Haubenwallner X-VCS-Revision: 1eb082db1646e66713be974d53ba71bd7737300d X-VCS-Branch: master Date: Wed, 11 Mar 2020 15:51:03 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 79694f69-96e2-44e1-aa31-7b01c6555d2e X-Archives-Hash: e8a9e930c043f2deb375510e4a453998 commit: 1eb082db1646e66713be974d53ba71bd7737300d Author: Michael Haubenwallner gentoo org> AuthorDate: Wed Mar 11 14:22:47 2020 +0000 Commit: Michael Haubenwallner gentoo org> CommitDate: Wed Mar 11 15:47:17 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1eb082db prefix/winnt/profile.bashrc: ensure libNAME.lib, libNAME.a Libtool for winnt does create libNAME.lib as the static library, but some build tools may expect libNAME.a. Non-libtool build tools may also create a static library NAME.lib, which needs to be duplicated to both libNAME.lib and libNAME.a, but not to libNAME.so just because it does match the shared library naming scheme. Also, do not provide symlinks but real files only, for some build tools may source the MSVC environment and use the native toolchain. Signed-off-by: Michael Haubenwallner gentoo.org> profiles/prefix/windows/winnt/profile.bashrc | 95 ++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 25 deletions(-) diff --git a/profiles/prefix/windows/winnt/profile.bashrc b/profiles/prefix/windows/winnt/profile.bashrc index b9496a65232..0670a48a5b1 100644 --- a/profiles/prefix/windows/winnt/profile.bashrc +++ b/profiles/prefix/windows/winnt/profile.bashrc @@ -35,9 +35,16 @@ export PKG_CONFIG_PATH="${EPREFIX}/lib/pkgconfig:${EPREFIX}/usr/lib/pkgconfig" # As Gentoo ebuilds may remove libNAME.la, we need the libNAME.so # because we don't want to have libNAME.dll as an import library. # -# Here, for whatever import library name we find, make sure there -# is both the NAME.lib and the libNAME.so for linkability via both -# the -lNAME and the NAME.lib linker option. +# The static library may be created as libNAME.a, libNAME.lib or even +# NAME.lib - the latter we need to check for static or import library. +# +# For whatever import library file we find, make sure there is both the +# NAME.lib and the libNAME.so for dynamic linkability via all the +# -lNAME, the NAME.lib and the libNAME.so linker option. +# +# For whatever static library file we find, make sure there is both the +# libNAME.lib and the libNAME.a for static linkability via all the +# -lNAME, the libNAME.lib and the libNAME.a linker option. # ####################################################################### @@ -62,12 +69,13 @@ post_src_install() { # # File names being treated as import library: # libNAME.so - # NAME.lib + # NAME.lib if CHOST-dumpbin yields 'DLL name' # libNAME.dll.lib # libNAME.dll.a # - # File names being ignored as static library: + # File names being treated as static library: # libNAME.lib + # NAME.lib if CHOST-dumpbin lacks 'DLL name' # libNAME.a # # File names being warned about as suspect: @@ -83,46 +91,83 @@ post_src_install() { libdir=$(dirname "${f}") libfile=${f##*/} libname= + NAMElib= # import lib to create + libNAMEso= # import lib to create + libNAMElib= # static lib to create + libNAMEa= # static lib to create case ${libfile} in - lib.so) ;; # paranoia - lib*.so) + lib*.so) # found import library libname=${libfile%.so} libname=${libname#lib} + NAMElib=${libname}.lib + libNAMEso=lib${libname}.so ;; - lib.dll.lib) ;; # paranoia - lib*.dll.lib) + *.so) ;; # warn + lib*.dll.lib) # found import library libname=${libfile%.dll.lib} libname=${libname#lib} + NAMElib=${libname}.lib + libNAMEso=lib${libname}.so ;; - lib.lib) ;; # paranoia - lib*.lib) continue ;; # ignore static library - .lib) ;; # paranoia - *.lib) - libname=${libfile%.lib} + *.dll.lib) ;; # warn + *.lib) # found static or import library + ${CHOST}-dumpbin.exe /headers "./${libdir}/${libfile}" | grep -q 'DLL name' + case "${PIPESTATUS[*]}" in + '0 0') # found import library + libname=${libfile%.lib} + libname=${libname#lib} + NAMElib=${libname}.lib + libNAMEso=lib${libname}.so + ;; + '0 1') # found static library + libname=${libfile%.lib} + libname=${libname#lib} + libNAMEa=lib${libname}.a + libNAMElib=lib${libname}.lib + ;; + *) + die "Cannot run ${CHOST}-dumpbin on ${libdir}/${libfile}" + ;; + esac ;; - lib.dll.a) ;; # paranoia - lib*.dll.a) + lib*.dll.a) # found import library libname=${libfile%.dll.a} libname=${libname#lib} + NAMElib=${libname}.lib + libNAMEso=lib${libname}.so + ;; + *.dll.a) ;; # warn + lib*.a) # found static library + libname=${libfile%.a} + libname=${libname#lib} + libNAMEa=lib${libname}.a + libNAMElib=lib${libname}.lib ;; - lib.a) ;; # paranoia - lib*.a) continue ;; # ignore static library + *.a) ;; # warn esac if [[ -z ${libname} ]]; then ewarn "Ignoring suspect file with library extension: ${f}" continue fi - NAMElib=${libname}.lib - libNAMEso=lib${libname}.so - if [[ ! -e ./${libdir}/${NAMElib} ]]; then - ebegin "creating ${NAMElib} copied from ${f##*/} for MSVC linkability" + if [[ ${NAMElib} && ! -e ./${libdir}/${NAMElib} ]]; then + ebegin "creating ${NAMElib} from ${libfile} for MSVC linkability" cp -pf "./${libdir}/${libfile}" "./${libdir}/${NAMElib}" || die eend $? fi - if [[ ! -e "./${libdir}/${libNAMEso}" ]]; then - ebegin "creating ${libNAMEso} symlink to ${f##*/} for libtool linkability" - ln -sf "${libfile}" "./${libdir}/${libNAMEso}" || die + if [[ ${libNAMElib} && ! -e ./${libdir}/${libNAMElib} ]]; then + ebegin "creating ${libNAMElib} from ${libfile} for MSVC linkability" + cp -pf "./${libdir}/${libfile}" "./${libdir}/${libNAMElib}" || die + eend $? + fi + if [[ ${libNAMEso} && ! -e ./${libdir}/${libNAMEso} ]]; then + ebegin "creating ${libNAMEso} from ${f##*/} for POSIX linkability" + cp -pf "./${libdir}/${libfile}" "./${libdir}/${libNAMEso}" || die + eend $? + fi + if [[ ${libNAMEa} && ! -e ./${libdir}/${libNAMEa} ]]; then + ebegin "creating ${libNAMEa} from ${f##*/} for POSIX linkability" + cp -pf "./${libdir}/${libfile}" "./${libdir}/${libNAMEa}" || die eend $? fi done