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: Sat, 24 Mar 2018 21:16:52
Message-Id: 1521926203.060fb03cf25dca1aa7adf2659092a930e88b5dde.slyfox@gentoo
1 commit: 060fb03cf25dca1aa7adf2659092a930e88b5dde
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 24 21:16:23 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 24 21:16:43 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=060fb03c
7
8 dev-util/mingw64-runtime: switch to --prefix=/usr (from --prefix=/)
9
10 A couple of changes:
11 - Allow dev-util/mingw64-runtime[headers-only] for cross-building case.
12 One day crossdew won't need cross-${CTARGET}/mingw64-runtime packages
13 and will be able to use dev-util/mingw64-runtime directly.
14 This change is a step in that direction.
15 - Awitch to --prefix=/usr (from --prefix=/). This allow cross-building
16 dev-util/mingw64-runtime itself and installing libraries into /usr/lib
17 (instead of /lib).
18
19 Tested as:
20 - generated working toolchain:
21 $ crossdev -t x86_64-w64-mingw32
22 - cross-built mingw64-runtime successfully:
23 $ x86_64-w64-mingw32-emerge -v1 dev-util/mingw64-runtime
24
25 Package-Manager: Portage-2.3.24, Repoman-2.3.6
26
27 .../mingw64-runtime-5.0.3-r2.ebuild | 117 +++++++++++++++++++++
28 1 file changed, 117 insertions(+)
29
30 diff --git a/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r2.ebuild b/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r2.ebuild
31 new file mode 100644
32 index 00000000000..e52536087f3
33 --- /dev/null
34 +++ b/dev-util/mingw64-runtime/mingw64-runtime-5.0.3-r2.ebuild
35 @@ -0,0 +1,117 @@
36 +# Copyright 1999-2018 Gentoo Foundation
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=6
40 +
41 +export CBUILD=${CBUILD:-${CHOST}}
42 +export CTARGET=${CTARGET:-${CHOST}}
43 +if [[ ${CTARGET} == ${CHOST} ]] ; then
44 + if [[ ${CATEGORY} == cross-* ]] ; then
45 + export CTARGET=${CATEGORY#cross-}
46 + fi
47 +fi
48 +
49 +WANT_AUTOMAKE="1.15"
50 +
51 +inherit autotools flag-o-matic eutils
52 +
53 +DESCRIPTION="Free Win64 runtime and import library definitions"
54 +HOMEPAGE="http://mingw-w64.sourceforge.net/"
55 +SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2"
56 +
57 +LICENSE="BSD"
58 +SLOT="0"
59 +KEYWORDS="~amd64 ~x86"
60 +IUSE="headers-only idl libraries tools"
61 +RESTRICT="strip"
62 +
63 +S="${WORKDIR}/mingw-w64-v${PV}"
64 +
65 +PATCHES=(
66 + "${FILESDIR}/${P}-build.patch"
67 +)
68 +
69 +is_crosscompile() {
70 + [[ ${CHOST} != ${CTARGET} ]]
71 +}
72 +just_headers() {
73 + use headers-only
74 +}
75 +alt_prefix() {
76 + is_crosscompile && echo /usr/${CTARGET}
77 +}
78 +crt_with() {
79 + just_headers && echo --without-$1 || echo --with-$1
80 +}
81 +crt_use_enable() {
82 + just_headers && echo --without-$2 || use_enable "$@"
83 +}
84 +crt_use_with() {
85 + just_headers && echo --without-$2 || use_with "$@"
86 +}
87 +
88 +pkg_setup() {
89 + if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then
90 + die "Invalid configuration"
91 + fi
92 +}
93 +
94 +src_prepare() {
95 + default
96 + eautoreconf
97 +}
98 +
99 +src_configure() {
100 + CHOST=${CTARGET} strip-unsupported-flags
101 +
102 + if ! just_headers; then
103 + mkdir "${WORKDIR}/headers"
104 + pushd "${WORKDIR}/headers" > /dev/null
105 + CHOST=${CTARGET} "${S}/configure" \
106 + --prefix="${T}/tmproot" \
107 + --with-headers \
108 + --without-crt \
109 + || die
110 + popd > /dev/null
111 + append-cppflags "-I${T}/tmproot/include"
112 + fi
113 +
114 + # By default configure tries to set --sysroot=${prefix}. We disable
115 + # this behaviour with --with-sysroot=no to use gcc's sysroot default.
116 + # That way we can cross-build mingw64-runtime with cross-emerge.
117 + CHOST=${CTARGET} econf \
118 + --with-sysroot=no \
119 + --prefix="${EPREFIX}"$(alt_prefix)/usr \
120 + --with-headers \
121 + --enable-sdk \
122 + $(crt_with crt) \
123 + $(crt_use_enable idl idl) \
124 + $(crt_use_with libraries libraries) \
125 + $(crt_use_with tools tools) \
126 + $(
127 + $(tc-getCPP ${CTARGET}) ${CPPFLAGS} -dM - < /dev/null | grep -q __MINGW64__ \
128 + && echo --disable-lib32 --enable-lib64 \
129 + || echo --enable-lib32 --disable-lib64
130 + )
131 +}
132 +
133 +src_compile() {
134 + if ! just_headers; then
135 + emake -C "${WORKDIR}/headers" install
136 + fi
137 + default
138 +}
139 +
140 +src_install() {
141 + default
142 +
143 + if is_crosscompile ; then
144 + # gcc is configured to look at specific hard-coded paths for mingw #419601
145 + dosym usr /usr/${CTARGET}/mingw
146 + dosym usr /usr/${CTARGET}/${CTARGET}
147 + dosym usr/include /usr/${CTARGET}/sys-include
148 + fi
149 +
150 + env -uRESTRICT CHOST=${CTARGET} prepallstrip
151 + rm -rf "${ED}/usr/share"
152 +}