1 |
commit: 25efe91bae6323a6ab9e853132d847274e53f7ef |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Aug 13 07:09:26 2019 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 13 07:10:24 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25efe91b |
7 |
|
8 |
dev-util/mingw64-runtime: add USE=+secure-api, bug #691980 |
9 |
|
10 |
Expose *_s() family of functions by default from headers. |
11 |
|
12 |
Reported-by: Jason A. Donenfeld |
13 |
Closes: https://bugs.gentoo.org/691980 |
14 |
Package-Manager: Portage-2.3.71, Repoman-2.3.17 |
15 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
16 |
|
17 |
dev-util/mingw64-runtime/metadata.xml | 1 + |
18 |
.../mingw64-runtime-6.0.0-r2.ebuild | 113 +++++++++++++++++++++ |
19 |
2 files changed, 114 insertions(+) |
20 |
|
21 |
diff --git a/dev-util/mingw64-runtime/metadata.xml b/dev-util/mingw64-runtime/metadata.xml |
22 |
index 1b348ca856b..df0beeaf2e9 100644 |
23 |
--- a/dev-util/mingw64-runtime/metadata.xml |
24 |
+++ b/dev-util/mingw64-runtime/metadata.xml |
25 |
@@ -8,6 +8,7 @@ |
26 |
<use> |
27 |
<flag name="idl">Install idl files.</flag> |
28 |
<flag name="libraries">Build extra libraries: mangle, pseh, winpthreads.</flag> |
29 |
+ <flag name="secure-api">Expose secure API (*_s function) by default.</flag> |
30 |
<flag name="tools">Build extra tools: gendef, genidl.</flag> |
31 |
</use> |
32 |
<upstream> |
33 |
|
34 |
diff --git a/dev-util/mingw64-runtime/mingw64-runtime-6.0.0-r2.ebuild b/dev-util/mingw64-runtime/mingw64-runtime-6.0.0-r2.ebuild |
35 |
new file mode 100644 |
36 |
index 00000000000..9dc20f91b73 |
37 |
--- /dev/null |
38 |
+++ b/dev-util/mingw64-runtime/mingw64-runtime-6.0.0-r2.ebuild |
39 |
@@ -0,0 +1,113 @@ |
40 |
+# Copyright 1999-2019 Gentoo Authors |
41 |
+# Distributed under the terms of the GNU General Public License v2 |
42 |
+ |
43 |
+EAPI=6 |
44 |
+ |
45 |
+export CBUILD=${CBUILD:-${CHOST}} |
46 |
+export CTARGET=${CTARGET:-${CHOST}} |
47 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
48 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
49 |
+ export CTARGET=${CATEGORY#cross-} |
50 |
+ fi |
51 |
+fi |
52 |
+ |
53 |
+inherit autotools flag-o-matic eutils |
54 |
+ |
55 |
+DESCRIPTION="Free Win64 runtime and import library definitions" |
56 |
+HOMEPAGE="http://mingw-w64.sourceforge.net/" |
57 |
+SRC_URI="mirror://sourceforge/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2" |
58 |
+ |
59 |
+LICENSE="BSD" |
60 |
+SLOT="0" |
61 |
+KEYWORDS="~amd64 ~x86" |
62 |
+# USE=libraries needs working stage2 compiler: bug #665512 |
63 |
+IUSE="headers-only idl libraries +secure-api tools" |
64 |
+RESTRICT="strip" |
65 |
+ |
66 |
+S="${WORKDIR}/mingw-w64-v${PV}" |
67 |
+ |
68 |
+is_crosscompile() { |
69 |
+ [[ ${CHOST} != ${CTARGET} ]] |
70 |
+} |
71 |
+just_headers() { |
72 |
+ use headers-only |
73 |
+} |
74 |
+alt_prefix() { |
75 |
+ is_crosscompile && echo /usr/${CTARGET} |
76 |
+} |
77 |
+crt_with() { |
78 |
+ just_headers && echo --without-$1 || echo --with-$1 |
79 |
+} |
80 |
+crt_use_enable() { |
81 |
+ just_headers && echo --without-$2 || use_enable "$@" |
82 |
+} |
83 |
+crt_use_with() { |
84 |
+ just_headers && echo --without-$2 || use_with "$@" |
85 |
+} |
86 |
+ |
87 |
+pkg_setup() { |
88 |
+ if [[ ${CBUILD} == ${CHOST} ]] && [[ ${CHOST} == ${CTARGET} ]] ; then |
89 |
+ die "Invalid configuration" |
90 |
+ fi |
91 |
+} |
92 |
+ |
93 |
+src_configure() { |
94 |
+ CHOST=${CTARGET} strip-unsupported-flags |
95 |
+ # Normally mingw-64 does not use dynamic linker. |
96 |
+ # But at configure time it uses $LDFLAGS. |
97 |
+ # When default -Wl,--hash-style=gnu is passed |
98 |
+ # __CTORS_LIST__ / __DTORS_LIST__ is mis-detected |
99 |
+ # for target ld and binaries crash at shutdown. |
100 |
+ filter-ldflags '-Wl,--hash-style=*' |
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 |
+ $(use_enable secure-api) \ |
127 |
+ $( |
128 |
+ $(tc-getCPP ${CTARGET}) ${CPPFLAGS} -dM - < /dev/null | grep -q __MINGW64__ \ |
129 |
+ && echo --disable-lib32 --enable-lib64 \ |
130 |
+ || echo --enable-lib32 --disable-lib64 |
131 |
+ ) |
132 |
+} |
133 |
+ |
134 |
+src_compile() { |
135 |
+ if ! just_headers; then |
136 |
+ emake -C "${WORKDIR}/headers" install |
137 |
+ fi |
138 |
+ default |
139 |
+} |
140 |
+ |
141 |
+src_install() { |
142 |
+ default |
143 |
+ |
144 |
+ if is_crosscompile ; then |
145 |
+ # gcc is configured to look at specific hard-coded paths for mingw #419601 |
146 |
+ dosym usr /usr/${CTARGET}/mingw |
147 |
+ dosym usr /usr/${CTARGET}/${CTARGET} |
148 |
+ dosym usr/include /usr/${CTARGET}/sys-include |
149 |
+ fi |
150 |
+ |
151 |
+ rm -rf "${ED}/usr/share" |
152 |
+} |