commit:     64d5b0a6b70eb5088ad48e2e69e4414047219d6f
Author:     Bertrand Jacquin <bertrand <AT> jacquin <DOT> bzh>
AuthorDate: Mon May 22 09:25:29 2017 +0000
Commit:     Alon Bar-Lev <alonbl <AT> gentoo <DOT> org>
CommitDate: Mon May 22 09:45:57 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=64d5b0a6

dev-util/mingw64-runtime: Enforce libdir to gcc hardcoded path

cross-x86_64-w64-mingw32/gcc has the following default search dir:
  $ x86_64-w64-mingw32-gcc -print-search-dirs
  install: /usr/lib/gcc/x86_64-w64-mingw32/5.4.0/
  programs: 
=/usr/libexec/gcc/x86_64-w64-mingw32/5.4.0/:/usr/libexec/gcc/x86_64-w64-mingw32/5.4.0/:/usr/libexec/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/
  libraries: 
=/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/5.4.0/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/../lib/:/usr/x86_64-w64-mingw32/mingw/lib/x86_64-w64-mingw32/5.4.0/:/usr/x86_64-w64-mingw32/mingw/lib/../lib/:/usr/lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/mingw/lib/

This default does not contain /usr/x86_64-w64-mingw32/lib64 where libraries
installed with USE=libraries such as libpthread.dll.a are installed.

Applications that need to link with lib pthread cannot link properly unless
LDFLAGS are manually modified.

This patch append --libdir=/usr/${CTARGET}/usr/lib in order to install such
libraries in the default gcc search directory.

 .../mingw64-runtime-5.0.2-r1.ebuild                | 113 +++++++++++++++++++++
 1 file changed, 113 insertions(+)

diff --git a/dev-util/mingw64-runtime/mingw64-runtime-5.0.2-r1.ebuild 
b/dev-util/mingw64-runtime/mingw64-runtime-5.0.2-r1.ebuild
new file mode 100644
index 00000000000..e37ad32d072
--- /dev/null
+++ b/dev-util/mingw64-runtime/mingw64-runtime-5.0.2-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+       if [[ ${CATEGORY} == cross-* ]] ; then
+               export CTARGET=${CATEGORY#cross-}
+       fi
+fi
+
+WANT_AUTOMAKE="1.15"
+
+inherit autotools flag-o-matic eutils
+
+DESCRIPTION="Free Win64 runtime and import library definitions"
+HOMEPAGE="http://mingw-w64.sourceforge.net/";
+SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="crosscompile_opts_headers-only idl libraries tools"
+RESTRICT="strip"
+
+S="${WORKDIR}/mingw-w64-v${PV}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-4.0.1-winpthreads.patch"
+       "${FILESDIR}/${PN}-4.0.1-build.patch"
+)
+
+is_crosscompile() {
+       [[ ${CHOST} != ${CTARGET} ]]
+}
+just_headers() {
+       use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
+}
+crt_with() {
+       just_headers && echo --without-$1 || echo --with-$1
+}
+crt_use_enable() {
+       just_headers && echo --without-$2 || use_enable "$@"
+}
+crt_use_with() {
+       just_headers && echo --without-$2 || use_with "$@"
+}
+
+pkg_setup() {
+       if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
+               die "Invalid configuration"
+       fi
+}
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       CHOST=${CTARGET} strip-unsupported-flags
+
+       if ! just_headers; then
+               mkdir "${WORKDIR}/headers"
+               pushd "${WORKDIR}/headers" > /dev/null
+               CHOST=${CTARGET} "${S}/configure" \
+                       --prefix="${T}/tmproot" \
+                       --with-headers \
+                       --without-crt \
+                       || die
+               popd > /dev/null
+               append-cppflags "-I${T}/tmproot/include"
+       fi
+
+       CHOST=${CTARGET} econf \
+               --prefix=/usr/${CTARGET} \
+               --includedir=/usr/${CTARGET}/usr/include \
+               --libdir=/usr/${CTARGET}/usr/lib \
+               --with-headers \
+               --enable-sdk \
+               $(crt_with crt) \
+               $(crt_use_enable idl) \
+               $(crt_use_with libraries libraries winpthreads,libmangle) \
+               $(crt_use_with tools) \
+               $(
+                       $(tc-getCPP ${CTARGET}) ${CPPFLAGS} -dM - < /dev/null | 
grep -q __MINGW64__ \
+                               && echo --disable-lib32 --enable-lib64 \
+                               || echo --enable-lib32 --disable-lib64
+               )
+}
+
+src_compile() {
+       if ! just_headers; then
+               emake -C "${WORKDIR}/headers" install
+       fi
+       default
+}
+
+src_install() {
+       default
+
+       if is_crosscompile ; then
+               # gcc is configured to look at specific hard-coded paths for 
mingw #419601
+               dosym usr /usr/${CTARGET}/mingw
+               dosym usr /usr/${CTARGET}/${CTARGET}
+               dosym usr/include /usr/${CTARGET}/sys-include
+       fi
+
+       env -uRESTRICT CHOST=${CTARGET} prepallstrip
+       rm -rf "${ED}/usr/share"
+}

Reply via email to