1 |
commit: 8fd5ec6ed78c005139cc7ef4aab6bd7e6798e26d |
2 |
Author: Lei Zhang <zhanglei.april <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Jul 16 09:45:54 2016 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 1 21:49:26 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8fd5ec6e |
7 |
|
8 |
sys-libs/libcxx: bump to 3.8.1, support libunwind & musl (#589352) |
9 |
|
10 |
With USE=libunwind, libcxx will be built against libunwind (either |
11 |
sys-libs/libunwind or sys-libs/llvm-libunwind), instead of libgcc_s. |
12 |
In addition, a patch will be applied when building libcxx against musl. |
13 |
|
14 |
Package-Manager: portage-2.2.28 |
15 |
|
16 |
sys-libs/libcxx/Manifest | 1 + |
17 |
.../libcxx/files/libcxx-3.8.1-musl-support.patch | 15 ++++++++++++++ |
18 |
.../{libcxx-9999.ebuild => libcxx-3.8.1.ebuild} | 23 ++++++++++++++-------- |
19 |
sys-libs/libcxx/libcxx-9999.ebuild | 16 ++++++++++----- |
20 |
sys-libs/libcxx/metadata.xml | 1 + |
21 |
5 files changed, 43 insertions(+), 13 deletions(-) |
22 |
|
23 |
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest |
24 |
index c39b7c2..8e2fb79 100644 |
25 |
--- a/sys-libs/libcxx/Manifest |
26 |
+++ b/sys-libs/libcxx/Manifest |
27 |
@@ -1,3 +1,4 @@ |
28 |
DIST libcxx-3.7.0.src.tar.xz 994580 SHA256 c18f3c8333cd7e678c1424a57fe5e25efe740ca7caf62ac67152b4723f3ad08e SHA512 e71d04efa0fafab129a97ca6f4fd7b5f185258de7455c7a25d0964f459bc6068c69c5d67199f6d7cd3541bdce630106cbaf3b7099e4737dddbdd57c77a3fe054 WHIRLPOOL 26672e3f6e0772504e7ee174c37e5fc20079c730ac8bd0d2563d5415ca9589360aa3be42a8aac15eb5a63c69227bd4911aa822b158b9a35e3d74ec0d71bb1300 |
29 |
DIST libcxx-3.7.1.src.tar.xz 995724 SHA256 357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144 SHA512 08d2399a8b36aa15290733256c896c9fa43f1a1223bc5c73bbcd014fddf8880e514d2a6dcc456bcf18b537c01fb6911b092e6d9958bccd8e64e9f375ed7a1ab9 WHIRLPOOL 19f77946abf48cbdd3e7ea21fd009ca3cc5f607dfe0512a44b102847044bb1d5ae4b16f503f18b14ebd9ea115256e87af07409907ba2a65f6061e217a502a359 |
30 |
DIST libcxx-3.8.0.src.tar.xz 1062884 SHA256 36804511b940bc8a7cefc7cb391a6b28f5e3f53f6372965642020db91174237b SHA512 3a9f0c9b4b0c22757028800b28c5fd7b28fc79d0cbf33cad2087de493dc778c93f2df4b919f162638d883069f60a633f36ddc18d7da8ae00c6af409266a05e6b WHIRLPOOL 6f1328c8b220f91d15f6644e34dd74e3d204ee0ee56769df4442d14b884e31626a289e6ab5e7d075438c7527b2efde92763b362791914bcd18c269405c9c7c8e |
31 |
+DIST libcxx-3.8.1.src.tar.xz 1074164 SHA256 77d7f3784c88096d785bd705fa1bab7031ce184cd91ba8a7008abf55264eeecc SHA512 782ff3cdb85d02e92404e943474d0266ff601725c202f0667d60e7807f1ba3cfdebbdb062e27a52fec96be1c99339044be93a88ba7e396682f98d99c9ac175b2 WHIRLPOOL a729c44060972edee79b0019fd4c6c23fa56dd625e564f4c5965682d9fc79be4094df0643f67c5d2ffa3ae3c743c892c3c9ba19719b2307aada35775f64ed104 |
32 |
|
33 |
diff --git a/sys-libs/libcxx/files/libcxx-3.8.1-musl-support.patch b/sys-libs/libcxx/files/libcxx-3.8.1-musl-support.patch |
34 |
new file mode 100644 |
35 |
index 0000000..ef86254 |
36 |
--- /dev/null |
37 |
+++ b/sys-libs/libcxx/files/libcxx-3.8.1-musl-support.patch |
38 |
@@ -0,0 +1,15 @@ |
39 |
+diff --git a/include/__config b/include/__config |
40 |
+index db5a832..f463557 100644 |
41 |
+--- a/include/__config |
42 |
++++ b/include/__config |
43 |
+@@ -11,6 +11,10 @@ |
44 |
+ #ifndef _LIBCPP_CONFIG |
45 |
+ #define _LIBCPP_CONFIG |
46 |
+ |
47 |
++// Normally this definition is handled by cmake; but since we're not using |
48 |
++// cmake, we have to hardcode it here. |
49 |
++#define _LIBCPP_HAS_MUSL_LIBC |
50 |
++ |
51 |
+ #if defined(_MSC_VER) && !defined(__clang__) |
52 |
+ #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER |
53 |
+ #endif |
54 |
|
55 |
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-3.8.1.ebuild |
56 |
similarity index 84% |
57 |
copy from sys-libs/libcxx/libcxx-9999.ebuild |
58 |
copy to sys-libs/libcxx/libcxx-3.8.1.ebuild |
59 |
index 92689d8..e0fb610 100644 |
60 |
--- a/sys-libs/libcxx/libcxx-9999.ebuild |
61 |
+++ b/sys-libs/libcxx/libcxx-3.8.1.ebuild |
62 |
@@ -1,4 +1,4 @@ |
63 |
-# Copyright 1999-2015 Gentoo Foundation |
64 |
+# Copyright 1999-2016 Gentoo Foundation |
65 |
# Distributed under the terms of the GNU General Public License v2 |
66 |
# $Id$ |
67 |
|
68 |
@@ -26,9 +26,10 @@ if [ "${PV%9999}" = "${PV}" ] ; then |
69 |
else |
70 |
KEYWORDS="" |
71 |
fi |
72 |
-IUSE="elibc_glibc +libcxxrt +static-libs test" |
73 |
+IUSE="elibc_glibc elibc_musl +libcxxrt libunwind +static-libs test" |
74 |
+REQUIRED_USE="libunwind? ( libcxxrt )" |
75 |
|
76 |
-RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] ) |
77 |
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) |
78 |
!libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )" |
79 |
DEPEND="${RDEPEND} |
80 |
test? ( sys-devel/clang ) |
81 |
@@ -42,20 +43,22 @@ pkg_setup() { |
82 |
ewarn "libsupc++. Please note that this is not well supported." |
83 |
ewarn "In particular, static linking will not work." |
84 |
fi |
85 |
- if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then |
86 |
- eerror "${PN} needs to be built with clang++ or gcc-4.7 or later." |
87 |
- eerror "Please use gcc-config to switch to gcc-4.7 or later version." |
88 |
+ if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then |
89 |
+ eerror "${PN} needs to be built with gcc-4.7 or later (or other" |
90 |
+ eerror "conformant compilers). Please use gcc-config to switch to" |
91 |
+ eerror "gcc-4.7 or later version." |
92 |
die |
93 |
fi |
94 |
} |
95 |
|
96 |
src_prepare() { |
97 |
cp -f "${FILESDIR}/Makefile" lib/ || die |
98 |
+ use elibc_musl && epatch "${FILESDIR}/${P}-musl-support.patch" |
99 |
multilib_copy_sources |
100 |
} |
101 |
|
102 |
src_configure() { |
103 |
- export LIBS="-lpthread -lrt -lc -lgcc_s" |
104 |
+ export LIBS="-lpthread -lrt -lc -l$(usex libunwind unwind gcc_s)" |
105 |
if use libcxxrt ; then |
106 |
append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/" |
107 |
LIBS="-lcxxrt ${LIBS}" |
108 |
@@ -131,6 +134,9 @@ gen_static_ldscript() { |
109 |
# fine on FreeBSD. |
110 |
use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a" |
111 |
|
112 |
+ # unlike libgcc_s, libunwind is not implicitly linked |
113 |
+ use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.a" |
114 |
+ |
115 |
gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a" |
116 |
fi |
117 |
# TODO: Generate a libc++.a ldscript when building against libsupc++ |
118 |
@@ -140,9 +146,10 @@ gen_shared_ldscript() { |
119 |
if use libcxxrt ; then |
120 |
mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die |
121 |
local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so" |
122 |
+ use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.so" |
123 |
gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so" |
124 |
fi |
125 |
- # TODO: Generate the linker script for other confiurations too. |
126 |
+ # TODO: Generate the linker script for other configurations too. |
127 |
} |
128 |
|
129 |
multilib_src_install() { |
130 |
|
131 |
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild |
132 |
index 92689d8..06a6211 100644 |
133 |
--- a/sys-libs/libcxx/libcxx-9999.ebuild |
134 |
+++ b/sys-libs/libcxx/libcxx-9999.ebuild |
135 |
@@ -1,4 +1,4 @@ |
136 |
-# Copyright 1999-2015 Gentoo Foundation |
137 |
+# Copyright 1999-2016 Gentoo Foundation |
138 |
# Distributed under the terms of the GNU General Public License v2 |
139 |
# $Id$ |
140 |
|
141 |
@@ -26,9 +26,10 @@ if [ "${PV%9999}" = "${PV}" ] ; then |
142 |
else |
143 |
KEYWORDS="" |
144 |
fi |
145 |
-IUSE="elibc_glibc +libcxxrt +static-libs test" |
146 |
+IUSE="elibc_glibc elibc_musl +libcxxrt libunwind +static-libs test" |
147 |
+REQUIRED_USE="libunwind? ( libcxxrt )" |
148 |
|
149 |
-RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] ) |
150 |
+RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[libunwind?,static-libs?,${MULTILIB_USEDEP}] ) |
151 |
!libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )" |
152 |
DEPEND="${RDEPEND} |
153 |
test? ( sys-devel/clang ) |
154 |
@@ -51,11 +52,12 @@ pkg_setup() { |
155 |
|
156 |
src_prepare() { |
157 |
cp -f "${FILESDIR}/Makefile" lib/ || die |
158 |
+ use elibc_musl && epatch "${FILESDIR}/${P}-musl-support.patch" |
159 |
multilib_copy_sources |
160 |
} |
161 |
|
162 |
src_configure() { |
163 |
- export LIBS="-lpthread -lrt -lc -lgcc_s" |
164 |
+ export LIBS="-lpthread -lrt -lc -l$(usex libunwind unwind gcc_s)" |
165 |
if use libcxxrt ; then |
166 |
append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/" |
167 |
LIBS="-lcxxrt ${LIBS}" |
168 |
@@ -131,6 +133,9 @@ gen_static_ldscript() { |
169 |
# fine on FreeBSD. |
170 |
use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a" |
171 |
|
172 |
+ # unlike libgcc_s, libunwind is not implicitly linked |
173 |
+ use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.a" |
174 |
+ |
175 |
gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a" |
176 |
fi |
177 |
# TODO: Generate a libc++.a ldscript when building against libsupc++ |
178 |
@@ -140,9 +145,10 @@ gen_shared_ldscript() { |
179 |
if use libcxxrt ; then |
180 |
mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die |
181 |
local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so" |
182 |
+ use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.so" |
183 |
gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so" |
184 |
fi |
185 |
- # TODO: Generate the linker script for other confiurations too. |
186 |
+ # TODO: Generate the linker script for other configurations too. |
187 |
} |
188 |
|
189 |
multilib_src_install() { |
190 |
|
191 |
diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml |
192 |
index 77398bd..cd53c38 100644 |
193 |
--- a/sys-libs/libcxx/metadata.xml |
194 |
+++ b/sys-libs/libcxx/metadata.xml |
195 |
@@ -13,5 +13,6 @@ |
196 |
</maintainer> |
197 |
<use> |
198 |
<flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag> |
199 |
+ <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependence on gcc.</flag> |
200 |
</use> |
201 |
</pkgmetadata> |