Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/mingw64-runtime/
Date: Fri, 29 Dec 2017 11:45:48
Message-Id: 1514547907.e579457fd49eef426c8cc4d6170cf83b9a42328f.slyfox@gentoo
1 commit: e579457fd49eef426c8cc4d6170cf83b9a42328f
2 Author: Marty E. Plummer <hanetzer <AT> protonmail <DOT> com>
3 AuthorDate: Fri Dec 29 05:52:43 2017 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 29 11:45:07 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e579457f
7
8 dev-util/mingw64-runtime: prefixify build
9
10 Currently building a mingw-w64 toolchain inside of gentoo prefix with
11 crossdev will fail, due to installing files outside of the prefix. Added
12 ${EPREFIX} where apropriate fixed this issue.
13
14 Tested in a prefix with toolchain x86_64-w64-mingw32, and tested on bare
15 gentoo with x86_64-w64-mingw32 & i686-w64-mingw32.
16
17 Package-Manager: Portage-2.3.19, Repoman-2.3.6
18 Closes: https://github.com/gentoo/gentoo/pull/6675
19
20 .../mingw64-runtime-5.0.3-r1.ebuild | 112 +++++++++++++++++++++
21 1 file changed, 112 insertions(+)
22
23 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
24 new file mode 100644
25 index 00000000000..1b9f05639b8
26 --- /dev/null
27 +++ b/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r1.ebuild
28 @@ -0,0 +1,112 @@
29 +# Copyright 1999-2017 Gentoo Foundation
30 +# Distributed under the terms of the GNU General Public License v2
31 +
32 +EAPI=6
33 +
34 +export CBUILD=${CBUILD:-${CHOST}}
35 +export CTARGET=${CTARGET:-${CHOST}}
36 +if [[ ${CTARGET} == ${CHOST} ]] ; then
37 + if [[ ${CATEGORY} == cross-* ]] ; then
38 + export CTARGET=${CATEGORY#cross-}
39 + fi
40 +fi
41 +
42 +WANT_AUTOMAKE="1.15"
43 +
44 +inherit autotools flag-o-matic eutils
45 +
46 +DESCRIPTION="Free Win64 runtime and import library definitions"
47 +HOMEPAGE="http://mingw-w64.sourceforge.net/"
48 +SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"
49 +
50 +LICENSE="BSD"
51 +SLOT="0"
52 +KEYWORDS="~amd64 ~x86"
53 +IUSE="crosscompile_opts_headers-only idl libraries tools"
54 +RESTRICT="strip"
55 +
56 +S="${WORKDIR}/mingw-w64-v${PV}"
57 +
58 +PATCHES=(
59 + "${FILESDIR}/${P}-build.patch"
60 +)
61 +
62 +is_crosscompile() {
63 + [[ ${CHOST} != ${CTARGET} ]]
64 +}
65 +just_headers() {
66 + use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
67 +}
68 +crt_with() {
69 + just_headers && echo --without-$1 || echo --with-$1
70 +}
71 +crt_use_enable() {
72 + just_headers && echo --without-$2 || use_enable "$@"
73 +}
74 +crt_use_with() {
75 + just_headers && echo --without-$2 || use_with "$@"
76 +}
77 +
78 +pkg_setup() {
79 + if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
80 + die "Invalid configuration"
81 + fi
82 +}
83 +
84 +src_prepare() {
85 + default
86 + eautoreconf
87 +}
88 +
89 +src_configure() {
90 + CHOST=${CTARGET} strip-unsupported-flags
91 +
92 + if ! just_headers; then
93 + mkdir "${WORKDIR}/headers"
94 + pushd "${WORKDIR}/headers" > /dev/null
95 + CHOST=${CTARGET} "${S}/configure" \
96 + --prefix="${T}/tmproot" \
97 + --with-headers \
98 + --without-crt \
99 + || die
100 + popd > /dev/null
101 + append-cppflags "-I${T}/tmproot/include"
102 + fi
103 +
104 + CHOST=${CTARGET} econf \
105 + --prefix="${EPREFIX}"/usr/${CTARGET} \
106 + --includedir="${EPREFIX}"/usr/${CTARGET}/usr/include \
107 + --libdir="${EPREFIX}"/usr/${CTARGET}/usr/lib \
108 + --with-headers \
109 + --enable-sdk \
110 + $(crt_with crt) \
111 + $(crt_use_enable idl idl) \
112 + $(crt_use_with libraries libraries) \
113 + $(crt_use_with tools tools) \
114 + $(
115 + $(tc-getCPP ${CTARGET}) ${CPPFLAGS} -dM - < /dev/null | grep -q __MINGW64__ \
116 + && echo --disable-lib32 --enable-lib64 \
117 + || echo --enable-lib32 --disable-lib64
118 + )
119 +}
120 +
121 +src_compile() {
122 + if ! just_headers; then
123 + emake -C "${WORKDIR}/headers" install
124 + fi
125 + default
126 +}
127 +
128 +src_install() {
129 + default
130 +
131 + if is_crosscompile ; then
132 + # gcc is configured to look at specific hard-coded paths for mingw #419601
133 + dosym usr /usr/${CTARGET}/mingw
134 + dosym usr /usr/${CTARGET}/${CTARGET}
135 + dosym usr/include /usr/${CTARGET}/sys-include
136 + fi
137 +
138 + env -uRESTRICT CHOST=${CTARGET} prepallstrip
139 + rm -rf "${ED}/usr/share"
140 +}