1 |
commit: 6d628e49032d182a45ee5b9150911ade92b570c9 |
2 |
Author: Lei Zhang <zhanglei.april <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Sep 3 11:30:01 2016 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Oct 3 08:51:20 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d628e49 |
7 |
|
8 |
sys-libs/libcxx: version bump to 3.9.0 |
9 |
|
10 |
to synchronize with live ebuild. |
11 |
|
12 |
sys-libs/libcxx/Manifest | 2 + |
13 |
.../libcxx/files/libcxx-3.9-cmake-static-lib.patch | 196 +++++++++++++++++++++ |
14 |
sys-libs/libcxx/libcxx-3.9.0.ebuild | 196 +++++++++++++++++++++ |
15 |
3 files changed, 394 insertions(+) |
16 |
|
17 |
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest |
18 |
index 8e2fb79..d6884e0 100644 |
19 |
--- a/sys-libs/libcxx/Manifest |
20 |
+++ b/sys-libs/libcxx/Manifest |
21 |
@@ -2,3 +2,5 @@ DIST libcxx-3.7.0.src.tar.xz 994580 SHA256 c18f3c8333cd7e678c1424a57fe5e25efe740 |
22 |
DIST libcxx-3.7.1.src.tar.xz 995724 SHA256 357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144 SHA512 08d2399a8b36aa15290733256c896c9fa43f1a1223bc5c73bbcd014fddf8880e514d2a6dcc456bcf18b537c01fb6911b092e6d9958bccd8e64e9f375ed7a1ab9 WHIRLPOOL 19f77946abf48cbdd3e7ea21fd009ca3cc5f607dfe0512a44b102847044bb1d5ae4b16f503f18b14ebd9ea115256e87af07409907ba2a65f6061e217a502a359 |
23 |
DIST libcxx-3.8.0.src.tar.xz 1062884 SHA256 36804511b940bc8a7cefc7cb391a6b28f5e3f53f6372965642020db91174237b SHA512 3a9f0c9b4b0c22757028800b28c5fd7b28fc79d0cbf33cad2087de493dc778c93f2df4b919f162638d883069f60a633f36ddc18d7da8ae00c6af409266a05e6b WHIRLPOOL 6f1328c8b220f91d15f6644e34dd74e3d204ee0ee56769df4442d14b884e31626a289e6ab5e7d075438c7527b2efde92763b362791914bcd18c269405c9c7c8e |
24 |
DIST libcxx-3.8.1.src.tar.xz 1074164 SHA256 77d7f3784c88096d785bd705fa1bab7031ce184cd91ba8a7008abf55264eeecc SHA512 782ff3cdb85d02e92404e943474d0266ff601725c202f0667d60e7807f1ba3cfdebbdb062e27a52fec96be1c99339044be93a88ba7e396682f98d99c9ac175b2 WHIRLPOOL a729c44060972edee79b0019fd4c6c23fa56dd625e564f4c5965682d9fc79be4094df0643f67c5d2ffa3ae3c743c892c3c9ba19719b2307aada35775f64ed104 |
25 |
+DIST libcxx-3.9.0.src.tar.xz 1198308 SHA256 d0b38d51365c6322f5666a2a8105785f2e114430858de4c25a86b49f227f5b06 SHA512 55d5c4adff378ee02b0b99d732bc9f326910f9e49ab8c320a588eccdd0362fe009bc9a6a4337d29faf6338420c91b10d0d7d67f66128268f01258d30502c4f4a WHIRLPOOL 3ee3519acfe95287a862a6c44e30ed52ced1204332913007797da4e4da40dfdc5991ae120f5686827cc208b559936da5bc5485dab75617bdd5cbbd9e95a6032a |
26 |
+DIST llvm-3.9.0.src.tar.xz 18235716 SHA256 66c73179da42cee1386371641241f79ded250e117a79f571bbd69e56daa48948 SHA512 f18ae32531218ab156c3e56c11826be0fd05f0799c82eaf2e6a043b38e1277560b4d921987513b88b11d97ea2619feaf277eec72181dd2ae4f4108c2836bf7b2 WHIRLPOOL a36c1bcee6e7995067a9a7a51e3fdb0f10d51d0239250eefab92ed2e46b024a203fa10a17a25a5aca69046bcb413628e288427f1a6690d0862e07cd95694c8a8 |
27 |
|
28 |
diff --git a/sys-libs/libcxx/files/libcxx-3.9-cmake-static-lib.patch b/sys-libs/libcxx/files/libcxx-3.9-cmake-static-lib.patch |
29 |
new file mode 100644 |
30 |
index 00000000..5f0e318 |
31 |
--- /dev/null |
32 |
+++ b/sys-libs/libcxx/files/libcxx-3.9-cmake-static-lib.patch |
33 |
@@ -0,0 +1,196 @@ |
34 |
+From b640da0b315ead39690d4d65c76938ab8aeb5449 Mon Sep 17 00:00:00 2001 |
35 |
+From: Petr Hosek <phosek@××××××××.org> |
36 |
+Date: Mon, 8 Aug 2016 22:57:25 +0000 |
37 |
+Subject: [PATCH] Allow building both shared and static library |
38 |
+ |
39 |
+This change allows building both shared and static version of libc++ |
40 |
+in a single build, sharing object files between both versions. |
41 |
+ |
42 |
+Differential Revision: https://reviews.llvm.org/D23232 |
43 |
+ |
44 |
+git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278068 91177308-0d34-0410-b5e6-96231b3b80d8 |
45 |
+--- |
46 |
+ CMakeLists.txt | 5 ++++ |
47 |
+ docs/BuildingLibcxx.rst | 11 ++++++-- |
48 |
+ lib/CMakeLists.txt | 71 ++++++++++++++++++++++++++++++++++--------------- |
49 |
+ 3 files changed, 63 insertions(+), 24 deletions(-) |
50 |
+ |
51 |
+diff --git a/CMakeLists.txt b/CMakeLists.txt |
52 |
+index 950070d..98886b0 100644 |
53 |
+--- a/CMakeLists.txt |
54 |
++++ b/CMakeLists.txt |
55 |
+@@ -52,6 +52,7 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD( |
56 |
+ # Basic options --------------------------------------------------------------- |
57 |
+ option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) |
58 |
+ option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) |
59 |
++option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) |
60 |
+ option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) |
61 |
+ option(LIBCXX_ENABLE_FILESYSTEM |
62 |
+ "Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) |
63 |
+@@ -68,6 +69,10 @@ option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY "Install libc++experimental.a" OFF) |
64 |
+ set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.") |
65 |
+ option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) |
66 |
+ |
67 |
++if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) |
68 |
++ message(FATAL_ERROR "libc++ must be built as either a shared or static library.") |
69 |
++endif() |
70 |
++ |
71 |
+ # ABI Library options --------------------------------------------------------- |
72 |
+ set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING |
73 |
+ "Specify C++ ABI library to use." FORCE) |
74 |
+diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst |
75 |
+index 5dd174a..6709352 100644 |
76 |
+--- a/docs/BuildingLibcxx.rst |
77 |
++++ b/docs/BuildingLibcxx.rst |
78 |
+@@ -150,8 +150,15 @@ libc++ specific options |
79 |
+ |
80 |
+ **Default**: ``ON`` |
81 |
+ |
82 |
+- Build libc++ as a shared library. If ``OFF`` is specified then libc++ is |
83 |
+- built as a static library. |
84 |
++ Build libc++ as a shared library. Either :option:`LIBCXX_ENABLE_SHARED` or |
85 |
++ :option:`LIBCXX_ENABLE_STATIC` has to be enabled. |
86 |
++ |
87 |
++.. option:: LIBCXX_ENABLE_STATIC:BOOL |
88 |
++ |
89 |
++ **Default**: ``ON`` |
90 |
++ |
91 |
++ Build libc++ as a static library. Either :option:`LIBCXX_ENABLE_SHARED` or |
92 |
++ :option:`LIBCXX_ENABLE_STATIC` has to be enabled. |
93 |
+ |
94 |
+ .. option:: LIBCXX_LIBDIR_SUFFIX:STRING |
95 |
+ |
96 |
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt |
97 |
+index afc388e..cabf2e6 100644 |
98 |
+--- a/lib/CMakeLists.txt |
99 |
++++ b/lib/CMakeLists.txt |
100 |
+@@ -28,16 +28,6 @@ if(NOT LIBCXX_INSTALL_LIBRARY) |
101 |
+ set(exclude_from_all EXCLUDE_FROM_ALL) |
102 |
+ endif() |
103 |
+ |
104 |
+-if (LIBCXX_ENABLE_SHARED) |
105 |
+- add_library(cxx SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) |
106 |
+-else() |
107 |
+- add_library(cxx STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) |
108 |
+-endif() |
109 |
+- |
110 |
+-if (DEFINED LIBCXX_CXX_ABI_DEPS) |
111 |
+- add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) |
112 |
+-endif() |
113 |
+- |
114 |
+ #if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path. |
115 |
+ add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}") |
116 |
+ |
117 |
+@@ -139,18 +129,51 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR |
118 |
+ endif() |
119 |
+ endif() |
120 |
+ |
121 |
+-target_link_libraries(cxx ${LIBCXX_LIBRARIES}) |
122 |
+ split_list(LIBCXX_COMPILE_FLAGS) |
123 |
+ split_list(LIBCXX_LINK_FLAGS) |
124 |
+ |
125 |
+-set_target_properties(cxx |
126 |
++# Add a object library that contains the compiled source files. |
127 |
++add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) |
128 |
++ |
129 |
++set_target_properties(cxx_objects |
130 |
+ PROPERTIES |
131 |
+ COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" |
132 |
+- LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
133 |
+- OUTPUT_NAME "c++" |
134 |
+- VERSION "${LIBCXX_ABI_VERSION}.0" |
135 |
+- SOVERSION "${LIBCXX_ABI_VERSION}" |
136 |
++) |
137 |
++ |
138 |
++set(LIBCXX_TARGETS) |
139 |
++ |
140 |
++# Build the shared library. |
141 |
++if (LIBCXX_ENABLE_SHARED) |
142 |
++ add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>) |
143 |
++ target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) |
144 |
++ set_target_properties(cxx_shared |
145 |
++ PROPERTIES |
146 |
++ LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
147 |
++ OUTPUT_NAME "c++" |
148 |
++ VERSION "${LIBCXX_ABI_VERSION}.0" |
149 |
++ SOVERSION "${LIBCXX_ABI_VERSION}" |
150 |
+ ) |
151 |
++ list(APPEND LIBCXX_TARGETS "cxx_shared") |
152 |
++endif() |
153 |
++ |
154 |
++# Build the static library. |
155 |
++if (LIBCXX_ENABLE_STATIC) |
156 |
++ add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) |
157 |
++ target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) |
158 |
++ set_target_properties(cxx_static |
159 |
++ PROPERTIES |
160 |
++ LINK_FLAGS "${LIBCXX_LINK_FLAGS}" |
161 |
++ OUTPUT_NAME "c++" |
162 |
++ ) |
163 |
++ list(APPEND LIBCXX_TARGETS "cxx_static") |
164 |
++endif() |
165 |
++ |
166 |
++# Add a meta-target for both libraries. |
167 |
++add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) |
168 |
++ |
169 |
++if (DEFINED LIBCXX_CXX_ABI_DEPS) |
170 |
++ add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) |
171 |
++endif() |
172 |
+ |
173 |
+ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
174 |
+ file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) |
175 |
+@@ -158,7 +181,11 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) |
176 |
+ file(GLOB LIBCXX_FILESYSTEM_SOURCES ../src/experimental/filesystem/*.cpp) |
177 |
+ endif() |
178 |
+ add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES} ${LIBCXX_FILESYSTEM_SOURCES}) |
179 |
+- target_link_libraries(cxx_experimental cxx) |
180 |
++ if (LIBCXX_ENABLE_SHARED) |
181 |
++ target_link_libraries(cxx_experimental cxx_shared) |
182 |
++ else() |
183 |
++ target_link_libraries(cxx_experimental cxx_static) |
184 |
++ endif() |
185 |
+ |
186 |
+ set(experimental_flags "${LIBCXX_COMPILE_FLAGS}") |
187 |
+ check_flag_supported(-std=c++14) |
188 |
+@@ -174,7 +201,7 @@ endif() |
189 |
+ |
190 |
+ # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
191 |
+ # after cxx builds. |
192 |
+-if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
193 |
++if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
194 |
+ # Get the name of the ABI library and handle the case where CXXABI_LIBNAME |
195 |
+ # is a target name and not a library. Ex cxxabi_shared. |
196 |
+ set(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}") |
197 |
+@@ -183,11 +210,11 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
198 |
+ endif() |
199 |
+ # Generate a linker script inplace of a libc++.so symlink. Rerun this command |
200 |
+ # after cxx builds. |
201 |
+- add_custom_command(TARGET cxx POST_BUILD |
202 |
++ add_custom_command(TARGET cxx_shared POST_BUILD |
203 |
+ COMMAND |
204 |
+ ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py |
205 |
+ ARGS |
206 |
+- "$<TARGET_LINKER_FILE:cxx>" |
207 |
++ "$<TARGET_LINKER_FILE:cxx_shared>" |
208 |
+ "${SCRIPT_ABI_LIBNAME}" |
209 |
+ WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} |
210 |
+ ) |
211 |
+@@ -197,13 +224,13 @@ if (LIBCXX_INSTALL_LIBRARY) |
212 |
+ if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) |
213 |
+ set(experimental_lib cxx_experimental) |
214 |
+ endif() |
215 |
+- install(TARGETS cxx ${experimental_lib} |
216 |
++ install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib} |
217 |
+ LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx |
218 |
+ ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx |
219 |
+ ) |
220 |
+ # NOTE: This install command must go after the cxx install command otherwise |
221 |
+ # it will not be executed after the library symlinks are installed. |
222 |
+- if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
223 |
++ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) |
224 |
+ # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx> |
225 |
+ # after we required CMake 3.0. |
226 |
+ install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}" |
227 |
+-- |
228 |
+2.4.10 |
229 |
+ |
230 |
|
231 |
diff --git a/sys-libs/libcxx/libcxx-3.9.0.ebuild b/sys-libs/libcxx/libcxx-3.9.0.ebuild |
232 |
new file mode 100644 |
233 |
index 00000000..25e0b69 |
234 |
--- /dev/null |
235 |
+++ b/sys-libs/libcxx/libcxx-3.9.0.ebuild |
236 |
@@ -0,0 +1,196 @@ |
237 |
+# Copyright 1999-2016 Gentoo Foundation |
238 |
+# Distributed under the terms of the GNU General Public License v2 |
239 |
+# $Id$ |
240 |
+ |
241 |
+EAPI=6 |
242 |
+ |
243 |
+# Ninja provides better scalability and cleaner verbose output, and is used |
244 |
+# throughout all LLVM projects. |
245 |
+: ${CMAKE_MAKEFILE_GENERATOR:=ninja} |
246 |
+EGIT_REPO_URI="http://llvm.org/git/libcxx.git |
247 |
+ https://github.com/llvm-mirror/libcxx.git" |
248 |
+CMAKE_MIN_VERSION=3.4.3 |
249 |
+PYTHON_COMPAT=( python2_7 ) |
250 |
+ |
251 |
+[[ ${PV} == 9999 ]] && SCM="git-r3" || SCM="" |
252 |
+ |
253 |
+inherit ${SCM} cmake-multilib python-any-r1 toolchain-funcs |
254 |
+ |
255 |
+DESCRIPTION="New implementation of the C++ standard library, targeting C++11" |
256 |
+HOMEPAGE="http://libcxx.llvm.org/" |
257 |
+if [[ ${PV} != 9999 ]] ; then |
258 |
+ SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz |
259 |
+ test? ( http://llvm.org/releases/${PV}/llvm-${PV}.src.tar.xz )" |
260 |
+ S="${WORKDIR}/${P}.src" |
261 |
+ LLVM_S="${WORKDIR}/llvm-${PV}.src" |
262 |
+else |
263 |
+ SRC_URI="" |
264 |
+ LLVM_S="${WORKDIR}/llvm" |
265 |
+fi |
266 |
+ |
267 |
+LICENSE="|| ( UoI-NCSA MIT )" |
268 |
+SLOT="0" |
269 |
+if [[ ${PV} != 9999 ]] ; then |
270 |
+ KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" |
271 |
+else |
272 |
+ KEYWORDS="" |
273 |
+fi |
274 |
+IUSE="elibc_glibc elibc_musl +libcxxrt libunwind +static-libs test" |
275 |
+REQUIRED_USE="libunwind? ( libcxxrt )" |
276 |
+ |
277 |
+RDEPEND="libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) |
278 |
+ !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )" |
279 |
+# llvm-3.9.0 needed because its cmake files installation path changed, which is |
280 |
+# needed by libcxx |
281 |
+DEPEND="${RDEPEND} |
282 |
+ test? ( sys-devel/clang[${MULTILIB_USEDEP}] |
283 |
+ ${PYTHON_DEPS} ) |
284 |
+ app-arch/xz-utils |
285 |
+ >=sys-devel/llvm-3.9.0[${MULTILIB_USEDEP}]" |
286 |
+ |
287 |
+DOCS=( CREDITS.TXT ) |
288 |
+ |
289 |
+PATCHES=( |
290 |
+ # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a |
291 |
+ # out-of-tree build. |
292 |
+ "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" |
293 |
+ |
294 |
+ # Back-port of https://reviews.llvm.org/D23232, allowing building both |
295 |
+ # shared and static libs in one run. |
296 |
+ "${FILESDIR}/${PN}-3.9-cmake-static-lib.patch" |
297 |
+) |
298 |
+ |
299 |
+pkg_setup() { |
300 |
+ use test && python_setup |
301 |
+ |
302 |
+ if ! use libcxxrt && ! tc-is-gcc ; then |
303 |
+ eerror "To build ${PN} against libsupc++, you have to use gcc. Other" |
304 |
+ eerror "compilers are not supported. Please set CC=gcc and CXX=g++" |
305 |
+ eerror "and try again." |
306 |
+ die |
307 |
+ fi |
308 |
+ if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then |
309 |
+ eerror "${PN} needs to be built with gcc-4.7 or later (or other" |
310 |
+ eerror "conformant compilers). Please use gcc-config to switch to" |
311 |
+ eerror "gcc-4.7 or later version." |
312 |
+ die |
313 |
+ fi |
314 |
+} |
315 |
+ |
316 |
+src_unpack() { |
317 |
+ [[ ${PV} != 9999 ]] && default && return |
318 |
+ |
319 |
+ if use test; then |
320 |
+ # needed for tests |
321 |
+ git-r3_fetch "http://llvm.org/git/llvm.git |
322 |
+ https://github.com/llvm-mirror/llvm.git" |
323 |
+ fi |
324 |
+ git-r3_fetch |
325 |
+ |
326 |
+ if use test; then |
327 |
+ git-r3_checkout http://llvm.org/git/llvm.git \ |
328 |
+ "${WORKDIR}"/llvm |
329 |
+ fi |
330 |
+ git-r3_checkout |
331 |
+} |
332 |
+ |
333 |
+multilib_src_configure() { |
334 |
+ local cxxabi cxxabi_incs |
335 |
+ if use libcxxrt; then |
336 |
+ cxxabi=libcxxrt |
337 |
+ cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" |
338 |
+ else |
339 |
+ local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" |
340 |
+ cxxabi=libsupc++ |
341 |
+ cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" |
342 |
+ fi |
343 |
+ |
344 |
+ local libdir=$(get_libdir) |
345 |
+ local mycmakeargs=( |
346 |
+ -DLLVM_LIBDIR_SUFFIX=${libdir#lib} |
347 |
+ -DLIBCXX_ENABLE_SHARED=ON |
348 |
+ -DLIBCXX_ENABLE_STATIC=$(usex static-libs) |
349 |
+ -DLIBCXX_CXX_ABI=${cxxabi} |
350 |
+ -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} |
351 |
+ # we're using our own mechanism for generating linker scripts |
352 |
+ -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF |
353 |
+ -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) |
354 |
+ -DLIBCXX_HAS_GCC_S_LIB=$(usex !libunwind) |
355 |
+ -DLIBCXX_INCLUDE_TESTS=$(usex test) |
356 |
+ -DCMAKE_SHARED_LINKER_FLAGS=$(usex libunwind "-lunwind" "") |
357 |
+ ) |
358 |
+ if use test; then |
359 |
+ mycmakeargs+=( |
360 |
+ -DLLVM_MAIN_SRC_DIR=${LLVM_S} |
361 |
+ ) |
362 |
+ fi |
363 |
+ cmake-utils_src_configure |
364 |
+} |
365 |
+ |
366 |
+multilib_src_test() { |
367 |
+ local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) |
368 |
+ |
369 |
+ [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" |
370 |
+ sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die |
371 |
+ |
372 |
+ cmake-utils_src_make check-libcxx |
373 |
+} |
374 |
+ |
375 |
+# Usage: deps |
376 |
+gen_ldscript() { |
377 |
+ local output_format |
378 |
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') |
379 |
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" |
380 |
+ |
381 |
+ cat <<-END_LDSCRIPT |
382 |
+/* GNU ld script |
383 |
+ Include missing dependencies |
384 |
+*/ |
385 |
+${output_format} |
386 |
+GROUP ( $@ ) |
387 |
+END_LDSCRIPT |
388 |
+} |
389 |
+ |
390 |
+gen_static_ldscript() { |
391 |
+ local libdir=$(get_libdir) |
392 |
+ local cxxabi_lib=$(usex libcxxrt "libcxxrt.a" "libsupc++.a") |
393 |
+ |
394 |
+ # Move it first. |
395 |
+ mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die |
396 |
+ # Generate libc++.a ldscript for inclusion of its dependencies so that |
397 |
+ # clang++ -stdlib=libc++ -static works out of the box. |
398 |
+ local deps="libc++_static.a ${cxxabi_lib}" |
399 |
+ # On Linux/glibc it does not link without libpthread or libdl. It is |
400 |
+ # fine on FreeBSD. |
401 |
+ use elibc_glibc && deps+=" libpthread.a libdl.a" |
402 |
+ # unlike libgcc_s, libunwind is not implicitly linked |
403 |
+ use libunwind && deps+=" libunwind.a" |
404 |
+ |
405 |
+ gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die |
406 |
+} |
407 |
+ |
408 |
+gen_shared_ldscript() { |
409 |
+ local libdir=$(get_libdir) |
410 |
+ # libsupc++ doesn't have a shared version |
411 |
+ local cxxabi_lib=$(usex libcxxrt "libcxxrt.so" "libsupc++.a") |
412 |
+ |
413 |
+ mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die |
414 |
+ local deps="libc++_shared.so ${cxxabi_lib}" |
415 |
+ use libunwind && deps+=" libunwind.so" |
416 |
+ |
417 |
+ gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die |
418 |
+} |
419 |
+ |
420 |
+multilib_src_install() { |
421 |
+ cmake-utils_src_install |
422 |
+ gen_shared_ldscript |
423 |
+ use static-libs && gen_static_ldscript |
424 |
+} |
425 |
+ |
426 |
+pkg_postinst() { |
427 |
+ elog "This package (${PN}) is mainly intended as a replacement for the C++" |
428 |
+ elog "standard library when using clang." |
429 |
+ elog "To use it, instead of libstdc++, use:" |
430 |
+ elog " clang++ -stdlib=libc++" |
431 |
+ elog "to compile your C++ programs." |
432 |
+} |