From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-993757-garchives=archives.gentoo.org@lists.gentoo.org>
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 D3784138AE9
	for <garchives@archives.gentoo.org>; Fri, 29 Dec 2017 11:45:48 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 40851E0E90;
	Fri, 29 Dec 2017 11:45:48 +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 12E53E0E90
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Dec 2017 11:45:48 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(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 0E7D833E4AD
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Dec 2017 11:45:47 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 8DA62AE8F
	for <gentoo-commits@lists.gentoo.org>; Fri, 29 Dec 2017 11:45:45 +0000 (UTC)
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" <slyfox@gentoo.org>
Message-ID: <1514547907.e579457fd49eef426c8cc4d6170cf83b9a42328f.slyfox@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/mingw64-runtime/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r1.ebuild
X-VCS-Directories: dev-util/mingw64-runtime/
X-VCS-Committer: slyfox
X-VCS-Committer-Name: Sergei Trofimovich
X-VCS-Revision: e579457fd49eef426c8cc4d6170cf83b9a42328f
X-VCS-Branch: master
Date: Fri, 29 Dec 2017 11:45:45 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: b9c24051-1810-46da-8d5e-cf8138d8b9f7
X-Archives-Hash: d5f1956354b3e565fea0d7c998ee4c39

commit:     e579457fd49eef426c8cc4d6170cf83b9a42328f
Author:     Marty E. Plummer <hanetzer <AT> protonmail <DOT> com>
AuthorDate: Fri Dec 29 05:52:43 2017 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Dec 29 11:45:07 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e579457f

dev-util/mingw64-runtime: prefixify build

Currently building a mingw-w64 toolchain inside of gentoo prefix with
crossdev will fail, due to installing files outside of the prefix. Added
${EPREFIX} where apropriate fixed this issue.

Tested in a prefix with toolchain x86_64-w64-mingw32, and tested on bare
gentoo with x86_64-w64-mingw32 & i686-w64-mingw32.

Package-Manager: Portage-2.3.19, Repoman-2.3.6
Closes: https://github.com/gentoo/gentoo/pull/6675

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

diff --git a/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r1.ebuild b/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r1.ebuild
new file mode 100644
index 00000000000..1b9f05639b8
--- /dev/null
+++ b/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r1.ebuild
@@ -0,0 +1,112 @@
+# 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}/${P}-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="${EPREFIX}"/usr/${CTARGET} \
+		--includedir="${EPREFIX}"/usr/${CTARGET}/usr/include \
+		--libdir="${EPREFIX}"/usr/${CTARGET}/usr/lib \
+		--with-headers \
+		--enable-sdk \
+		$(crt_with crt) \
+		$(crt_use_enable idl idl) \
+		$(crt_use_with libraries libraries) \
+		$(crt_use_with tools 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"
+}