diff options
Diffstat (limited to 'sys-libs/libcxx')
-rw-r--r-- | sys-libs/libcxx/Manifest | 22 | ||||
-rw-r--r-- | sys-libs/libcxx/files/Makefile | 38 | ||||
-rw-r--r-- | sys-libs/libcxx/files/libcxx-3.8.1-musl-support.patch | 15 | ||||
-rw-r--r-- | sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch | 23 | ||||
-rw-r--r-- | sys-libs/libcxx/files/libcxx-3.9-cmake-static-lib.patch | 196 | ||||
-rwxr-xr-x | sys-libs/libcxx/files/prepare_snapshot.sh | 16 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-3.7.1.ebuild | 169 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-3.8.1.ebuild | 176 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-3.9.0.ebuild | 216 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-3.9.1.ebuild | 216 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-4.0.1.ebuild | 199 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-5.0.0.ebuild | 199 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-5.0.9999.ebuild | 211 | ||||
-rw-r--r-- | sys-libs/libcxx/libcxx-9999.ebuild | 208 | ||||
-rw-r--r-- | sys-libs/libcxx/metadata.xml | 21 |
15 files changed, 1925 insertions, 0 deletions
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest new file mode 100644 index 000000000000..70d2cbfbb407 --- /dev/null +++ b/sys-libs/libcxx/Manifest @@ -0,0 +1,22 @@ +AUX Makefile 874 SHA256 ba99d3b7b98ed88a64f8370ba2d90e245f8e5ea9bfe302382ef8eeded0ec00b4 SHA512 96eef2e897075bc7d9fc799ce6c54f6a33ee917efd5666376ac578cb16e15d965205630dbd076f92a3a7091d58ecc235e37bc327c211bf3594244981f089135f WHIRLPOOL 0680b69fdc46c0d6fac01fc2fa0b93ff62d167a03b3ce1cc80fbe57ff04356f5ab4e71f0daec517e629697d5e34f295b66e8263f7506eaa347a500b27442933d +AUX libcxx-3.8.1-musl-support.patch 442 SHA256 2f0127c39e96b27e46b4c769cfee3e0e88ed75ac27280275d76275b7dcf2d2bf SHA512 7b2568cbf3afcf2bcd33c3c8db2c24ed75f542081bcb5a7defdc9a4a39a750bbb4106ab7bce09864f146f7710b224802d9e3cc3ced8bb937d0ff6af7a6549e80 WHIRLPOOL f6fbad0ed76fa6118139bd35ce4d0c29cd2c6a02554049af53d353345d4d79be9a76165f05d45ea826f518eda031b06072f20d7896c43033c23ae21006ece930 +AUX libcxx-3.9-cmake-link-flags.patch 1014 SHA256 2a67d309f5aa802a8cb3d7fe76dff0a9c797e88a63f43fda758f9626afc8d4d0 SHA512 5df85c66bf865900197effe3905976bf165b4c4d79b8d14352753f6baca93ab5dc26bf735fd9478a0c13df489b860d8b629240134b7e26be6233138ea95dbab3 WHIRLPOOL b99590b6a0e1f4c0738d6bf95b4b379685a5ca5a32370938928656481234e22cf1acc788075a6af331406a70c8d8b0f81111ad392454df72ef58181d07d76d56 +AUX libcxx-3.9-cmake-static-lib.patch 7507 SHA256 f4c829b4eb930949571323b13ab67c4e9764d8dbfb245d1318f1cf30627d101e SHA512 435c14edfb7bca9ef35fa1e9e44ab9655d5b47e373e6437839027b6d56894a37dfb0f228cce062d84aaaf60677d9435b2cdee2c9248b4f25cf3f6890ec353f46 WHIRLPOOL 0ae4d12869d233fa549fd65f673729d60f1e34d400e7b02cb433b61ae5ff03efbdc321aa33314fe56caa3d78275e2f629eb6d47db5237f0e234b50161a29d423 +AUX prepare_snapshot.sh 427 SHA256 9ebf22257a2e296dee41a56b0a721cd1ba459c620009ca8422ba812515ff726f SHA512 ebac2a467f8b1dfb68f1dc46a35f8294d1cf74b70be2a008217fa13b3366ddf4a9f2ebbe611cd63824f42305c5c0304aac2f46386b2956c9e07d82d5d984b435 WHIRLPOOL 232a60d6a22f50c424ec9cf6f325bbb4e8e96815ba9dffdad0a5b1b872b19d20126d316ced71956978eb5ce098f72584d21104c14e232330b3893a73e4c3c358 +DIST libcxx-3.7.1.src.tar.xz 995724 SHA256 357fbd4288ce99733ba06ae2bec6f503413d258aeebaab8b6a791201e6f7f144 SHA512 08d2399a8b36aa15290733256c896c9fa43f1a1223bc5c73bbcd014fddf8880e514d2a6dcc456bcf18b537c01fb6911b092e6d9958bccd8e64e9f375ed7a1ab9 WHIRLPOOL 19f77946abf48cbdd3e7ea21fd009ca3cc5f607dfe0512a44b102847044bb1d5ae4b16f503f18b14ebd9ea115256e87af07409907ba2a65f6061e217a502a359 +DIST libcxx-3.8.1.src.tar.xz 1074164 SHA256 77d7f3784c88096d785bd705fa1bab7031ce184cd91ba8a7008abf55264eeecc SHA512 782ff3cdb85d02e92404e943474d0266ff601725c202f0667d60e7807f1ba3cfdebbdb062e27a52fec96be1c99339044be93a88ba7e396682f98d99c9ac175b2 WHIRLPOOL a729c44060972edee79b0019fd4c6c23fa56dd625e564f4c5965682d9fc79be4094df0643f67c5d2ffa3ae3c743c892c3c9ba19719b2307aada35775f64ed104 +DIST libcxx-3.9.0.src.tar.xz 1198308 SHA256 d0b38d51365c6322f5666a2a8105785f2e114430858de4c25a86b49f227f5b06 SHA512 55d5c4adff378ee02b0b99d732bc9f326910f9e49ab8c320a588eccdd0362fe009bc9a6a4337d29faf6338420c91b10d0d7d67f66128268f01258d30502c4f4a WHIRLPOOL 3ee3519acfe95287a862a6c44e30ed52ced1204332913007797da4e4da40dfdc5991ae120f5686827cc208b559936da5bc5485dab75617bdd5cbbd9e95a6032a +DIST libcxx-3.9.1.src.tar.xz 1209020 SHA256 25e615e428f60e651ed09ffd79e563864e3f4bc69a9e93ee41505c419d1a7461 SHA512 a5976e4096624a7307b3e43f4a22ac2dc74572226e0f57af9f3ef537a14c3cff1601b7042aef9dc40a0ee53ca76b08d72eb9c253dcf34f115d3153c302db7070 WHIRLPOOL cad439979570192b195338d752a24fb0ad8704c0c8efed3b6d7724437763eab7bc3b8baaf2f0e6fff55c6d9be211dff6f7baf18dec55e3a29ad3b8a423cefb1e +DIST libcxx-4.0.1.src.tar.xz 1446380 SHA256 520a1171f272c9ff82f324d5d89accadcec9bc9f3c78de11f5575cdb99accc4c SHA512 91f3f397be606989be99865d0b279557f9afb93f7a74ed10c3a74f4440e38b5694ddf452bbf2f487cacd4391606dd5c7edfe5130f2de19e2acfd6cce619d028a WHIRLPOOL fe7c71e8dc2d17d14e94896837229c5ed872e7c04aea79a207e8fa98aa4539a7445e402b848d0c0d009f154f00d970159ad009d16bfdb9ae012ce5c7c6d9ba51 +DIST libcxx-5.0.0.src.tar.xz 1518940 SHA256 eae5981e9a21ef0decfcac80a1af584ddb064a32805f95a57c7c83a5eb28c9b1 SHA512 210749f6585d8fd39fc63a32dd85d68de4aa480c91915cbf419b9e8a3b300fa4624f03200ed963cecc8ab233777c36e8c522fa0762a2aa068bc65e6f48118328 WHIRLPOOL c791f6718e1c2a97fae26741284d861fc869721fca11b4ab4d3e9b4052ce17fca1fd99f945f406fdcdbfde43622cb7afe351e0268d773f6b42d1da2f5dc0f1f5 +EBUILD libcxx-3.7.1.ebuild 5341 SHA256 b650e8a4dd09153792c9301f941b970e6611fe04403781f4ca54a4d185036eb2 SHA512 12d94732f3446447a0ed025dd7df4ec7711c3d3278c98c2922c85c6b78afe369bcbebee65e259825b4008417decfa4f6438ed803a8e271418b061864ee5de9c0 WHIRLPOOL e27f65ef8dc68e16ba1837b563617a6960dfeab015e64c8e25761003938498dfd7c1577cfa7ac1427ed03a9e24bb5b45ae591d1f226c7ce0bc21a6fe927a74e1 +EBUILD libcxx-3.8.1.ebuild 5720 SHA256 9081a591d0c48fa9ed45866234fdc59f55e44c8ca9056713c2014adf266ea832 SHA512 f674c2647756a1157bdaaa0dfb2ceb923830369d473f4d20bc896f94a3b4aaa5c6e8500b3449ec5e8b7c9b54a74a0002706848f60355a688c5c25425d0a3d1c4 WHIRLPOOL 9b0d7b452c22faf58dec629b0e18ce9013958bdfca2e7455422515988bf4c61cf131e4031e0a7927441f4bc5ad5c3a103d3379f4a583a69628791460d09f78c8 +EBUILD libcxx-3.9.0.ebuild 6794 SHA256 e1b0ed6b0bf8d124110c6c3731cbb31e37a00d4428b50cdd477c92b617a4ad93 SHA512 326cbb999424e5fca216a57b90b850c0d98d43bd93835525aed06fc6fc9354d35cfd51fb1d08683fa06da595dbb4719bf3d90dc67dd5b881b6242f964aba0438 WHIRLPOOL 06afc5984856bcc76e3d1baf47563eaa5fea7af464617620628bf8a6cabd32b84ada983346cca3d132e9a8dc61d533a9f99e30d1f06141566329170db48627b2 +EBUILD libcxx-3.9.1.ebuild 6815 SHA256 15bfb6ec3bdb0fd47a04182a276ed89f4b2acfbad24c2a62c4bcca5190a54283 SHA512 9c9632590b49cd01ad324641ee296f08442940ab1dda1f0c7cdc77abe6b653f70d0baa9b796ef7d77e1f4728e96fe27fcd42d79a389cfcf2b2427b087b9985af WHIRLPOOL 6fff12c49a78e456411cdc6a73b23055f8fc72c154d9a7e5cbf7ad1d5dde21be6b9e2e9e634f2b64377e0045b79370001beb1fba50d21748c6259fffe8cbb7cb +EBUILD libcxx-4.0.1.ebuild 6303 SHA256 0d1f9bef569a478c14363ef05adb1c87739fd8d21574ba7efbcd1f328cc78eb9 SHA512 72a1d367d03be76b8cc43ea3653563be2c86376c796b759fc99feff4e7489a86875548fffe89ab87b26885a94028a1131a5f295c5e5ec5270dea80f2a6e189aa WHIRLPOOL e3a3549175db909eb606a3dde9581ec52999be593fac27a0b57adb7b493e8ec6a215d7fdfaad3371ca33f4eaac5bd617040f083cc1123fd7737f122d22bca639 +EBUILD libcxx-5.0.0.ebuild 6303 SHA256 0d1f9bef569a478c14363ef05adb1c87739fd8d21574ba7efbcd1f328cc78eb9 SHA512 72a1d367d03be76b8cc43ea3653563be2c86376c796b759fc99feff4e7489a86875548fffe89ab87b26885a94028a1131a5f295c5e5ec5270dea80f2a6e189aa WHIRLPOOL e3a3549175db909eb606a3dde9581ec52999be593fac27a0b57adb7b493e8ec6a215d7fdfaad3371ca33f4eaac5bd617040f083cc1123fd7737f122d22bca639 +EBUILD libcxx-5.0.9999.ebuild 6614 SHA256 7207175d2df08f2bfaf8a451587e1e28faa1cfe3712051171ae9ddad7ec48809 SHA512 b15a6eb21ea58907beed4603cab1088ee9b53adece3a8fded74c50763afe5b565d2cd7ac80b4b5326829a9e32fdf728ddb99c17f5bd3a9a691689a56c8203522 WHIRLPOOL 02caaa85e3c678f6e007ca80ee522d87699bc97cb2eeaa85e09a22d4c26bb3f2a05565afc70ac5aee43a81fe28cf12622ff7e0e7936d96a1a409474664b3cef4 +EBUILD libcxx-9999.ebuild 6458 SHA256 30884b27dd5880833b6efbab08317d43df9b8c09ed264f9c1c52c4cec39a83e7 SHA512 7f73a4a5c868c67e2c479740e6c98f53fea359956fd3758d8f4270a0107158354a4c703810976c65e5d943c46394870f965ffa3d0f930e694d037f400859f36f WHIRLPOOL 27c87c8bd41b9d0fdf97e5ba86a8bb7cf9d9d745e5f8cb39e81e1d22b44760edce245e2c3e1e466dc7a8f257c0c790c4da8ef836cdc4f946860ab7ec587f8191 +MISC ChangeLog 6417 SHA256 9fd5bef2d8c2ac1bae01f2d67f9dfe3a555ef2dd4effa763119a35959d700a83 SHA512 2b377fe2f4c992d75e0442a50cd88647140743dc7b8551e59fc24ad987ceb033cd23c29d832afacb78125497900ed7d9da6c027e58d33acd5da5d0ab026d11f8 WHIRLPOOL 380c99e461793281a68a198d5181bb3c33616a81236aff51da07afc87cadb96459bb94ce1dac9cde87af4517d684de540eb1ce9ce56aec174a95926f185d5cc6 +MISC ChangeLog-2015 7192 SHA256 1f19c485028b68143e12fe8fb77250e7b0cee933dba3390418d398e02ff7bf86 SHA512 648d68c5b8f759170eb6011afc1ef01797f5549068fbc733d6d8e0330a3a08afdadbb3256db04df624ba7e4539eff4489a262fdcc5f00bf67d146dd4c5513755 WHIRLPOOL 73fbaabbb064852de27ad52ee2558764aa9cd5c08e185b397ff92b2435eefcb32bf14caab3c0334c95655ed6e50f414836b2beec10e492ae37813f7e2eca273c +MISC metadata.xml 854 SHA256 3ec547619ec9246a8013afa8185cc2ec300c77ea5f7794627765fa54e5b8f621 SHA512 8ef3feab266e09442a42baced2d72667fa8b1290624c2c84bab7b173ead72669568847f6e995388fc1d7bc722381f60805d87b2a0cc2d04ae0c49e36bec3802a WHIRLPOOL 3ef9e4095a710085257d418bbb2ad7f10bfe026d65f1684fb75a36418ccd3c314521cb24ec7afd552551a114edc958aa7d3cafab5e8b38975f697767c6adb355 diff --git a/sys-libs/libcxx/files/Makefile b/sys-libs/libcxx/files/Makefile new file mode 100644 index 000000000000..029e7295b889 --- /dev/null +++ b/sys-libs/libcxx/files/Makefile @@ -0,0 +1,38 @@ +CXXFLAGS+=-std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \ + -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 + +SRCDIR=.. +LIB=libc++ +STATIC=libc++.a +MAJOR=1 +MINOR=0 +SHEXT?=.so +SHLIB=$(LIB)$(SHEXT).$(MAJOR).$(MINOR) +SONAME=$(LIB)$(SHEXT).$(MAJOR) + +SRC=$(wildcard $(SRCDIR)/src/*.cpp) +OBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.o) +SOBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.So) + + +%.So: $(SRCDIR)/src/%.cpp + $(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -fPIC -nostdinc++ -c $< -o $@ + +%.o: $(SRCDIR)/src/%.cpp + $(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -nostdinc++ -c $< -o $@ + +$(STATIC): $(OBJ) + $(AR) cr $@ $^ + +static: $(STATIC) + +$(SHLIB): $(SOBJ) + $(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(LIBS) + +$(SONAME): $(SHLIB) + ln -s $< $@ + +$(LIB)$(SHEXT): $(SONAME) + ln -s $< $@ + +shared: $(SHLIB) $(SONAME) $(LIB)$(SHEXT) 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 new file mode 100644 index 000000000000..ef86254dff17 --- /dev/null +++ b/sys-libs/libcxx/files/libcxx-3.8.1-musl-support.patch @@ -0,0 +1,15 @@ +diff --git a/include/__config b/include/__config +index db5a832..f463557 100644 +--- a/include/__config ++++ b/include/__config +@@ -11,6 +11,10 @@ + #ifndef _LIBCPP_CONFIG + #define _LIBCPP_CONFIG + ++// Normally this definition is handled by cmake; but since we're not using ++// cmake, we have to hardcode it here. ++#define _LIBCPP_HAS_MUSL_LIBC ++ + #if defined(_MSC_VER) && !defined(__clang__) + #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER + #endif diff --git a/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch b/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch new file mode 100644 index 000000000000..bef5bc187547 --- /dev/null +++ b/sys-libs/libcxx/files/libcxx-3.9-cmake-link-flags.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d618e83..0e76525 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -293,6 +293,18 @@ remove_flags(-DNDEBUG -UNDEBUG -D_DEBUG + # so they don't get transformed into -Wno and -errors respectivly. + remove_flags(-Wno-pedantic -pedantic-errors -pedantic) + ++# FIXME: this is cribbed from HandleLLVMOptions.cmake. ++if(LIBCXX_STANDALONE_BUILD) ++ # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO ++ # build might work on ELF but fail on MachO/COFF. ++ if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR WIN32 OR CYGWIN OR ++ ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ++ ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") AND ++ NOT LLVM_USE_SANITIZER) ++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs") ++ endif() ++endif() ++ + # Required flags ============================================================== + add_compile_flags_if_supported(-std=c++11) + if (NOT MSVC AND NOT LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG) 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 new file mode 100644 index 000000000000..5f0e31864dfd --- /dev/null +++ b/sys-libs/libcxx/files/libcxx-3.9-cmake-static-lib.patch @@ -0,0 +1,196 @@ +From b640da0b315ead39690d4d65c76938ab8aeb5449 Mon Sep 17 00:00:00 2001 +From: Petr Hosek <phosek@chromium.org> +Date: Mon, 8 Aug 2016 22:57:25 +0000 +Subject: [PATCH] Allow building both shared and static library + +This change allows building both shared and static version of libc++ +in a single build, sharing object files between both versions. + +Differential Revision: https://reviews.llvm.org/D23232 + +git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@278068 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + CMakeLists.txt | 5 ++++ + docs/BuildingLibcxx.rst | 11 ++++++-- + lib/CMakeLists.txt | 71 ++++++++++++++++++++++++++++++++++--------------- + 3 files changed, 63 insertions(+), 24 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 950070d..98886b0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,6 +52,7 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD( + # Basic options --------------------------------------------------------------- + option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON) + option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON) ++option(LIBCXX_ENABLE_STATIC "Build libc++ as a static library." ON) + option(LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY "Build libc++experimental.a" ON) + option(LIBCXX_ENABLE_FILESYSTEM + "Build filesystem as part of libc++experimental.a" ${LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY}) +@@ -68,6 +69,10 @@ option(LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY "Install libc++experimental.a" OFF) + set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.") + option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) + ++if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) ++ message(FATAL_ERROR "libc++ must be built as either a shared or static library.") ++endif() ++ + # ABI Library options --------------------------------------------------------- + set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING + "Specify C++ ABI library to use." FORCE) +diff --git a/docs/BuildingLibcxx.rst b/docs/BuildingLibcxx.rst +index 5dd174a..6709352 100644 +--- a/docs/BuildingLibcxx.rst ++++ b/docs/BuildingLibcxx.rst +@@ -150,8 +150,15 @@ libc++ specific options + + **Default**: ``ON`` + +- Build libc++ as a shared library. If ``OFF`` is specified then libc++ is +- built as a static library. ++ Build libc++ as a shared library. Either :option:`LIBCXX_ENABLE_SHARED` or ++ :option:`LIBCXX_ENABLE_STATIC` has to be enabled. ++ ++.. option:: LIBCXX_ENABLE_STATIC:BOOL ++ ++ **Default**: ``ON`` ++ ++ Build libc++ as a static library. Either :option:`LIBCXX_ENABLE_SHARED` or ++ :option:`LIBCXX_ENABLE_STATIC` has to be enabled. + + .. option:: LIBCXX_LIBDIR_SUFFIX:STRING + +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +index afc388e..cabf2e6 100644 +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -28,16 +28,6 @@ if(NOT LIBCXX_INSTALL_LIBRARY) + set(exclude_from_all EXCLUDE_FROM_ALL) + endif() + +-if (LIBCXX_ENABLE_SHARED) +- add_library(cxx SHARED ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) +-else() +- add_library(cxx STATIC ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) +-endif() +- +-if (DEFINED LIBCXX_CXX_ABI_DEPS) +- add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) +-endif() +- + #if LIBCXX_CXX_ABI_LIBRARY_PATH is defined we want to add it to the search path. + add_link_flags_if(LIBCXX_CXX_ABI_LIBRARY_PATH "-L${LIBCXX_CXX_ABI_LIBRARY_PATH}") + +@@ -139,18 +129,51 @@ if ( APPLE AND (LIBCXX_CXX_ABI_LIBNAME STREQUAL "libcxxabi" OR + endif() + endif() + +-target_link_libraries(cxx ${LIBCXX_LIBRARIES}) + split_list(LIBCXX_COMPILE_FLAGS) + split_list(LIBCXX_LINK_FLAGS) + +-set_target_properties(cxx ++# Add a object library that contains the compiled source files. ++add_library(cxx_objects OBJECT ${exclude_from_all} ${LIBCXX_SOURCES} ${LIBCXX_HEADERS}) ++ ++set_target_properties(cxx_objects + PROPERTIES + COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" +- LINK_FLAGS "${LIBCXX_LINK_FLAGS}" +- OUTPUT_NAME "c++" +- VERSION "${LIBCXX_ABI_VERSION}.0" +- SOVERSION "${LIBCXX_ABI_VERSION}" ++) ++ ++set(LIBCXX_TARGETS) ++ ++# Build the shared library. ++if (LIBCXX_ENABLE_SHARED) ++ add_library(cxx_shared SHARED $<TARGET_OBJECTS:cxx_objects>) ++ target_link_libraries(cxx_shared ${LIBCXX_LIBRARIES}) ++ set_target_properties(cxx_shared ++ PROPERTIES ++ LINK_FLAGS "${LIBCXX_LINK_FLAGS}" ++ OUTPUT_NAME "c++" ++ VERSION "${LIBCXX_ABI_VERSION}.0" ++ SOVERSION "${LIBCXX_ABI_VERSION}" + ) ++ list(APPEND LIBCXX_TARGETS "cxx_shared") ++endif() ++ ++# Build the static library. ++if (LIBCXX_ENABLE_STATIC) ++ add_library(cxx_static STATIC $<TARGET_OBJECTS:cxx_objects>) ++ target_link_libraries(cxx_static ${LIBCXX_LIBRARIES}) ++ set_target_properties(cxx_static ++ PROPERTIES ++ LINK_FLAGS "${LIBCXX_LINK_FLAGS}" ++ OUTPUT_NAME "c++" ++ ) ++ list(APPEND LIBCXX_TARGETS "cxx_static") ++endif() ++ ++# Add a meta-target for both libraries. ++add_custom_target(cxx DEPENDS ${LIBCXX_TARGETS}) ++ ++if (DEFINED LIBCXX_CXX_ABI_DEPS) ++ add_dependencies(cxx LIBCXX_CXX_ABI_DEPS) ++endif() + + if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) + file(GLOB LIBCXX_EXPERIMENTAL_SOURCES ../src/experimental/*.cpp) +@@ -158,7 +181,11 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) + file(GLOB LIBCXX_FILESYSTEM_SOURCES ../src/experimental/filesystem/*.cpp) + endif() + add_library(cxx_experimental STATIC ${LIBCXX_EXPERIMENTAL_SOURCES} ${LIBCXX_FILESYSTEM_SOURCES}) +- target_link_libraries(cxx_experimental cxx) ++ if (LIBCXX_ENABLE_SHARED) ++ target_link_libraries(cxx_experimental cxx_shared) ++ else() ++ target_link_libraries(cxx_experimental cxx_static) ++ endif() + + set(experimental_flags "${LIBCXX_COMPILE_FLAGS}") + check_flag_supported(-std=c++14) +@@ -174,7 +201,7 @@ endif() + + # Generate a linker script inplace of a libc++.so symlink. Rerun this command + # after cxx builds. +-if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) ++if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) + # Get the name of the ABI library and handle the case where CXXABI_LIBNAME + # is a target name and not a library. Ex cxxabi_shared. + set(SCRIPT_ABI_LIBNAME "${LIBCXX_CXX_ABI_LIBRARY}") +@@ -183,11 +210,11 @@ if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) + endif() + # Generate a linker script inplace of a libc++.so symlink. Rerun this command + # after cxx builds. +- add_custom_command(TARGET cxx POST_BUILD ++ add_custom_command(TARGET cxx_shared POST_BUILD + COMMAND + ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/gen_link_script/gen_link_script.py + ARGS +- "$<TARGET_LINKER_FILE:cxx>" ++ "$<TARGET_LINKER_FILE:cxx_shared>" + "${SCRIPT_ABI_LIBNAME}" + WORKING_DIRECTORY ${LIBCXX_BUILD_DIR} + ) +@@ -197,13 +224,13 @@ if (LIBCXX_INSTALL_LIBRARY) + if (LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY) + set(experimental_lib cxx_experimental) + endif() +- install(TARGETS cxx ${experimental_lib} ++ install(TARGETS ${LIBCXX_TARGETS} ${experimental_lib} + LIBRARY DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx + ARCHIVE DESTINATION lib${LIBCXX_LIBDIR_SUFFIX} COMPONENT libcxx + ) + # NOTE: This install command must go after the cxx install command otherwise + # it will not be executed after the library symlinks are installed. +- if (LIBCXX_ENABLE_ABI_LINKER_SCRIPT) ++ if (LIBCXX_ENABLE_SHARED AND LIBCXX_ENABLE_ABI_LINKER_SCRIPT) + # Replace the libc++ filename with $<TARGET_LINKER_FILE:cxx> + # after we required CMake 3.0. + install(FILES "${LIBCXX_LIBRARY_DIR}/libc++${CMAKE_SHARED_LIBRARY_SUFFIX}" +-- +2.4.10 + diff --git a/sys-libs/libcxx/files/prepare_snapshot.sh b/sys-libs/libcxx/files/prepare_snapshot.sh new file mode 100755 index 000000000000..3de5a97a8096 --- /dev/null +++ b/sys-libs/libcxx/files/prepare_snapshot.sh @@ -0,0 +1,16 @@ +#!/bin/sh +VERSION=$(date +%Y%m%d) +BASE_VERSION="0.0" +PACKAGE="libcxx-${BASE_VERSION}_p${VERSION}" + +svn co http://llvm.org/svn/llvm-project/libcxx/trunk ${PACKAGE} + +find "${PACKAGE}" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf +find "${PACKAGE}" -type d -name '.git' -prune -print0 | xargs -0 rm -rf + +tar cJf ${PACKAGE}.tar.xz ${PACKAGE} +rm -rf ${PACKAGE}/ + +echo "Tarball: \"${PACKAGE}.tar.xz\"" + +echo "** all done **" diff --git a/sys-libs/libcxx/libcxx-3.7.1.ebuild b/sys-libs/libcxx/libcxx-3.7.1.ebuild new file mode 100644 index 000000000000..3535d3d94043 --- /dev/null +++ b/sys-libs/libcxx/libcxx-3.7.1.ebuild @@ -0,0 +1,169 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +ESVN_REPO_URI="https://llvm.org/svn/llvm-project/libcxx/trunk" + +[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM="" + +inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [ "${PV%9999}" = "${PV}" ] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [ "${PV%9999}" = "${PV}" ] ; then + KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc +libcxxrt +static-libs test" + +RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] ) + !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )" +DEPEND="${RDEPEND} + test? ( sys-devel/clang ) + app-arch/xz-utils" + +DOCS=( CREDITS.TXT ) + +pkg_setup() { + if ! use libcxxrt ; then + ewarn "You have disabled USE=libcxxrt. This will build ${PN} against" + ewarn "libsupc++. Please note that this is not well supported." + ewarn "In particular, static linking will not work." + fi + if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then + eerror "${PN} needs to be built with clang++ or gcc-4.7 or later." + eerror "Please use gcc-config to switch to gcc-4.7 or later version." + die + fi +} + +src_prepare() { + cp -f "${FILESDIR}/Makefile" lib/ || die + multilib_copy_sources +} + +src_configure() { + export LIBS="-lpthread -lrt -lc -lgcc_s" + if use libcxxrt ; then + append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/" + LIBS="-lcxxrt ${LIBS}" + cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include" + else + # Very hackish, see $HOMEPAGE + # If someone has a clever idea, please share it! + local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')" + local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')" + append-cppflags -D__GLIBCXX__ ${includes} + LIBS="-lsupc++ ${LIBS}" + local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h" + for i in ${libsupcxx_includes} ; do + local found="" + [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})" + for j in ${libcxx_gcc_dirs} ; do + if [ -f "${j}/${i}" ] ; then + cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die + found=yes + fi + done + [ -n "${found}" ] || die "Header not found: ${i}" + done + fi + + tc-export AR CC CXX + + append-ldflags "-Wl,-z,defs" # make sure we are not underlinked +} + +multilib_src_compile() { + cd "${BUILD_DIR}/lib" || die + emake shared + use static-libs && emake static +} + +# Tests fail for now, if anybody is able to fix them, help is very welcome. +multilib_src_test() { + cd "${BUILD_DIR}/test" + LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \ + CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \ + HEADER_INCLUDE="-I${BUILD_DIR}/include" \ + SOURCE_LIB="-L${BUILD_DIR}/lib" \ + LIBS="-lm $(usex libcxxrt -lcxxrt "")" \ + ./testit || die + # TODO: fix link against libsupc++ +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + if use libcxxrt ; then + # Move it first. + mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die + + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a" + fi + # TODO: Generate a libc++.a ldscript when building against libsupc++ +} + +gen_shared_ldscript() { + if use libcxxrt ; then + mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so" + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so" + fi + # TODO: Generate the linker script for other confiurations too. +} + +multilib_src_install() { + cd "${BUILD_DIR}/lib" + if use static-libs ; then + dolib.a libc++.a + gen_static_ldscript + fi + dolib.so libc++.so* + gen_shared_ldscript +} + +multilib_src_install_all() { + einstalldocs + insinto /usr/include/c++/v1 + doins -r include/* +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-3.8.1.ebuild b/sys-libs/libcxx/libcxx-3.8.1.ebuild new file mode 100644 index 000000000000..33c990ecd408 --- /dev/null +++ b/sys-libs/libcxx/libcxx-3.8.1.ebuild @@ -0,0 +1,176 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +ESVN_REPO_URI="https://llvm.org/svn/llvm-project/libcxx/trunk" + +[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM="" + +inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [ "${PV%9999}" = "${PV}" ] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [ "${PV%9999}" = "${PV}" ] ; then + KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc elibc_musl +libcxxrt libunwind +static-libs test" +REQUIRED_USE="libunwind? ( libcxxrt )" + +RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )" +DEPEND="${RDEPEND} + test? ( sys-devel/clang ) + app-arch/xz-utils" + +DOCS=( CREDITS.TXT ) + +pkg_setup() { + if ! use libcxxrt ; then + ewarn "You have disabled USE=libcxxrt. This will build ${PN} against" + ewarn "libsupc++. Please note that this is not well supported." + ewarn "In particular, static linking will not work." + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +src_prepare() { + cp -f "${FILESDIR}/Makefile" lib/ || die + use elibc_musl && epatch "${FILESDIR}/${P}-musl-support.patch" + multilib_copy_sources +} + +src_configure() { + export LIBS="-lpthread -lrt -lc -l$(usex libunwind unwind gcc_s)" + if use libcxxrt ; then + append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/" + LIBS="-lcxxrt ${LIBS}" + cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include" + else + # Very hackish, see $HOMEPAGE + # If someone has a clever idea, please share it! + local includes="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | sed -e 's/^ /-I/' | tr '\n' ' ')" + local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')" + append-cppflags -D__GLIBCXX__ ${includes} + LIBS="-lsupc++ ${LIBS}" + local libsupcxx_includes="cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h bits/cxxabi_tweaks.h bits/cxxabi_forced.h" + for i in ${libsupcxx_includes} ; do + local found="" + [ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})" + for j in ${libcxx_gcc_dirs} ; do + if [ -f "${j}/${i}" ] ; then + cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die + found=yes + fi + done + [ -n "${found}" ] || die "Header not found: ${i}" + done + fi + + tc-export AR CC CXX + + append-ldflags "-Wl,-z,defs" # make sure we are not underlinked +} + +multilib_src_compile() { + cd "${BUILD_DIR}/lib" || die + emake shared + use static-libs && emake static +} + +# Tests fail for now, if anybody is able to fix them, help is very welcome. +multilib_src_test() { + cd "${BUILD_DIR}/test" + LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \ + CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \ + HEADER_INCLUDE="-I${BUILD_DIR}/include" \ + SOURCE_LIB="-L${BUILD_DIR}/lib" \ + LIBS="-lm $(usex libcxxrt -lcxxrt "")" \ + ./testit || die + # TODO: fix link against libsupc++ +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + if use libcxxrt ; then + # Move it first. + mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die + + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a" + + # unlike libgcc_s, libunwind is not implicitly linked + use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.a" + + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a" + fi + # TODO: Generate a libc++.a ldscript when building against libsupc++ +} + +gen_shared_ldscript() { + if use libcxxrt ; then + mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die + local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so" + use libunwind && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libunwind.so" + gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so" + fi + # TODO: Generate the linker script for other configurations too. +} + +multilib_src_install() { + cd "${BUILD_DIR}/lib" + if use static-libs ; then + dolib.a libc++.a + gen_static_ldscript + fi + dolib.so libc++.so* + gen_shared_ldscript +} + +multilib_src_install_all() { + einstalldocs + insinto /usr/include/c++/v1 + doins -r include/* +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-3.9.0.ebuild b/sys-libs/libcxx/libcxx-3.9.0.ebuild new file mode 100644 index 000000000000..185bbc3d7be0 --- /dev/null +++ b/sys-libs/libcxx/libcxx-3.9.0.ebuild @@ -0,0 +1,216 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +EGIT_REPO_URI="https://llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" +PYTHON_COMPAT=( python2_7 ) + +[[ ${PV} == 9999 ]] && SCM="git-r3" || SCM="" + +inherit ${SCM} cmake-multilib python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [[ ${PV} != 9999 ]] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [[ ${PV} != 9999 ]] ; then + KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc elibc_musl libcxxabi +libcxxrt libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# llvm-3.9.0 needed because its cmake files installation path changed, which is +# needed by libcxx +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-3.9.0" + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" + + # Back-port of https://reviews.llvm.org/D23232, allowing building both + # shared and static libs in one run. + "${FILESDIR}/${PN}-3.9-cmake-static-lib.patch" +) + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +src_configure() { + NATIVE_LIBDIR=$(get_libdir) + cmake-multilib_src_configure +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + # LLVM_LIBDIR_SUFFIX is used to find CMake files + # and we are happy to use the native set + -DLLVM_LIBDIR_SUFFIX=${NATIVE_LIBDIR#lib} + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-3.9.1.ebuild b/sys-libs/libcxx/libcxx-3.9.1.ebuild new file mode 100644 index 000000000000..e847a9f5d318 --- /dev/null +++ b/sys-libs/libcxx/libcxx-3.9.1.ebuild @@ -0,0 +1,216 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +EGIT_REPO_URI="https://llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" +PYTHON_COMPAT=( python2_7 ) + +[[ ${PV} == 9999 ]] && SCM="git-r3" || SCM="" + +inherit ${SCM} cmake-multilib python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [[ ${PV} != 9999 ]] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [[ ${PV} != 9999 ]] ; then + KEYWORDS="amd64 ~arm64 x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="amd64 ~arm64 x86" +fi +IUSE="elibc_glibc elibc_musl libcxxabi +libcxxrt libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# llvm-3.9.0 needed because its cmake files installation path changed, which is +# needed by libcxx +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-3.9.0" + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" + + # Back-port of https://reviews.llvm.org/D23232, allowing building both + # shared and static libs in one run. + "${FILESDIR}/${PN}-3.9-cmake-static-lib.patch" +) + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +src_configure() { + NATIVE_LIBDIR=$(get_libdir) + cmake-multilib_src_configure +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + # LLVM_LIBDIR_SUFFIX is used to find CMake files + # and we are happy to use the native set + -DLLVM_LIBDIR_SUFFIX=${NATIVE_LIBDIR#lib} + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-4.0.1.ebuild b/sys-libs/libcxx/libcxx-4.0.1.ebuild new file mode 100644 index 000000000000..43a14f9abb6b --- /dev/null +++ b/sys-libs/libcxx/libcxx-4.0.1.ebuild @@ -0,0 +1,199 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-multilib llvm python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +SRC_URI="https://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz" + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# LLVM 4 required for llvm-config --cmakedir +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-4" + +S=${WORKDIR}/${P/_/}.src + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" +) + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + # FIXME: remove this once https://reviews.llvm.org/D25093 is merged + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-5.0.0.ebuild b/sys-libs/libcxx/libcxx-5.0.0.ebuild new file mode 100644 index 000000000000..43a14f9abb6b --- /dev/null +++ b/sys-libs/libcxx/libcxx-5.0.0.ebuild @@ -0,0 +1,199 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +PYTHON_COMPAT=( python2_7 ) + +inherit cmake-multilib llvm python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +SRC_URI="https://releases.llvm.org/${PV/_//}/${P/_/}.src.tar.xz" + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# LLVM 4 required for llvm-config --cmakedir +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-4" + +S=${WORKDIR}/${P/_/}.src + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" +) + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + # FIXME: remove this once https://reviews.llvm.org/D25093 is merged + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-5.0.9999.ebuild b/sys-libs/libcxx/libcxx-5.0.9999.ebuild new file mode 100644 index 000000000000..fde85c232023 --- /dev/null +++ b/sys-libs/libcxx/libcxx-5.0.9999.ebuild @@ -0,0 +1,211 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +EGIT_REPO_URI="https://git.llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" +EGIT_BRANCH="release_50" +PYTHON_COMPAT=( python2_7 ) + +[[ ${PV} == *9999 ]] && SCM="git-r3" || SCM="" + +inherit ${SCM} cmake-multilib llvm python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [[ ${PV} != *9999 ]] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [[ ${PV} != *9999 ]] ; then + KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# LLVM 4 required for llvm-config --cmakedir +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-4" + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" +) + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + # this can be any directory, it just needs to exist... + # FIXME: remove this once https://reviews.llvm.org/D25093 is merged + -DLLVM_MAIN_SRC_DIR="${T}" + -DLIT_COMMAND="${EPREFIX}"/usr/bin/lit + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild new file mode 100644 index 000000000000..17104067dfdc --- /dev/null +++ b/sys-libs/libcxx/libcxx-9999.ebuild @@ -0,0 +1,208 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +# Ninja provides better scalability and cleaner verbose output, and is used +# throughout all LLVM projects. +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +# (needed due to CMAKE_BUILD_TYPE != Gentoo) +CMAKE_MIN_VERSION=3.7.0-r1 +EGIT_REPO_URI="https://git.llvm.org/git/libcxx.git + https://github.com/llvm-mirror/libcxx.git" +PYTHON_COMPAT=( python2_7 ) + +[[ ${PV} == 9999 ]] && SCM="git-r3" || SCM="" + +inherit ${SCM} cmake-multilib llvm python-any-r1 toolchain-funcs + +DESCRIPTION="New implementation of the C++ standard library, targeting C++11" +HOMEPAGE="https://libcxx.llvm.org/" +if [[ ${PV} != 9999 ]] ; then + SRC_URI="https://llvm.org/releases/${PV}/${P}.src.tar.xz" + S="${WORKDIR}/${P}.src" +else + SRC_URI="" +fi + +LICENSE="|| ( UoI-NCSA MIT )" +SLOT="0" +if [[ ${PV} != 9999 ]] ; then + KEYWORDS="~amd64 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux" +else + KEYWORDS="" +fi +IUSE="elibc_glibc elibc_musl +libcxxabi libcxxrt +libunwind +static-libs test" +REQUIRED_USE="libunwind? ( || ( libcxxabi libcxxrt ) ) + ?? ( libcxxabi libcxxrt )" + +RDEPEND=" + libcxxabi? ( ~sys-libs/libcxxabi-${PV}[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + libcxxrt? ( sys-libs/libcxxrt[libunwind=,static-libs?,${MULTILIB_USEDEP}] ) + !libcxxabi? ( !libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] ) )" +# LLVM 4 required for llvm-config --cmakedir +# clang-3.9.0 installs necessary target symlinks unconditionally +# which removes the need for MULTILIB_USEDEP +DEPEND="${RDEPEND} + test? ( >=sys-devel/clang-3.9.0 + $(python_gen_any_dep 'dev-python/lit[${PYTHON_USEDEP}]') ) + app-arch/xz-utils + >=sys-devel/llvm-4" + +DOCS=( CREDITS.TXT ) + +PATCHES=( + # Add link flag "-Wl,-z,defs" to avoid underlinking; this is needed in a + # out-of-tree build. + "${FILESDIR}/${PN}-3.9-cmake-link-flags.patch" +) + +# least intrusive of all +CMAKE_BUILD_TYPE=RelWithDebInfo + +python_check_deps() { + has_version "dev-python/lit[${PYTHON_USEDEP}]" +} + +pkg_setup() { + llvm_pkg_setup + use test && python-any-r1_pkg_setup + + if ! use libcxxabi && ! use libcxxrt && ! tc-is-gcc ; then + eerror "To build ${PN} against libsupc++, you have to use gcc. Other" + eerror "compilers are not supported. Please set CC=gcc and CXX=g++" + eerror "and try again." + die + fi + if tc-is-gcc && [[ $(gcc-version) < 4.7 ]] ; then + eerror "${PN} needs to be built with gcc-4.7 or later (or other" + eerror "conformant compilers). Please use gcc-config to switch to" + eerror "gcc-4.7 or later version." + die + fi +} + +multilib_src_configure() { + local cxxabi cxxabi_incs + if use libcxxabi; then + cxxabi=libcxxabi + cxxabi_incs="${EPREFIX}/usr/include/libcxxabi" + elif use libcxxrt; then + cxxabi=libcxxrt + cxxabi_incs="${EPREFIX}/usr/include/libcxxrt" + else + local gcc_inc="${EPREFIX}/usr/lib/gcc/${CHOST}/$(gcc-fullversion)/include/g++-v$(gcc-major-version)" + cxxabi=libsupc++ + cxxabi_incs="${gcc_inc};${gcc_inc}/${CHOST}" + fi + + # we want -lgcc_s for unwinder, and for compiler runtime when using + # gcc, clang with gcc runtime (or any unknown compiler) + local extra_libs=() want_gcc_s=ON + if use libunwind; then + # work-around missing -lunwind upstream + extra_libs+=( -lunwind ) + # if we're using libunwind and clang with compiler-rt, we want + # to link to compiler-rt instead of -lgcc_s + if tc-is-clang; then + # get the full library list out of 'pretend mode' + # and grep it for libclang_rt references + local args=( $($(tc-getCC) -### -x c - 2>&1 | tail -n 1) ) + local i + for i in "${args[@]}"; do + if [[ ${i} == *libclang_rt* ]]; then + want_gcc_s=OFF + extra_libs+=( "${i}" ) + fi + done + fi + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + -DLIBCXX_LIBDIR_SUFFIX=${libdir#lib} + -DLIBCXX_ENABLE_SHARED=ON + -DLIBCXX_ENABLE_STATIC=$(usex static-libs) + -DLIBCXX_CXX_ABI=${cxxabi} + -DLIBCXX_CXX_ABI_INCLUDE_PATHS=${cxxabi_incs} + # we're using our own mechanism for generating linker scripts + -DLIBCXX_ENABLE_ABI_LINKER_SCRIPT=OFF + -DLIBCXX_HAS_MUSL_LIBC=$(usex elibc_musl) + -DLIBCXX_HAS_GCC_S_LIB=${want_gcc_s} + -DLIBCXX_INCLUDE_TESTS=$(usex test) + -DCMAKE_SHARED_LINKER_FLAGS="${extra_libs[*]} ${LDFLAGS}" + ) + + if use test; then + mycmakeargs+=( + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit" + -DLLVM_LIT_ARGS="-vv" + ) + fi + cmake-utils_src_configure +} + +multilib_src_test() { + local clang_path=$(type -P "${CHOST:+${CHOST}-}clang" 2>/dev/null) + + [[ -n ${clang_path} ]] || die "Unable to find ${CHOST}-clang for tests" + sed -i -e "/cxx_under_test/s^\".*\"^\"${clang_path}\"^" test/lit.site.cfg || die + + cmake-utils_src_make check-libcxx +} + +# Usage: deps +gen_ldscript() { + local output_format + output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p') + [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )" + + cat <<-END_LDSCRIPT +/* GNU ld script + Include missing dependencies +*/ +${output_format} +GROUP ( $@ ) +END_LDSCRIPT +} + +gen_static_ldscript() { + local libdir=$(get_libdir) + local cxxabi_lib=$(usex libcxxabi "libc++abi.a" "$(usex libcxxrt "libcxxrt.a" "libsupc++.a")") + + # Move it first. + mv "${ED}/usr/${libdir}/libc++.a" "${ED}/usr/${libdir}/libc++_static.a" || die + # Generate libc++.a ldscript for inclusion of its dependencies so that + # clang++ -stdlib=libc++ -static works out of the box. + local deps="libc++_static.a ${cxxabi_lib} $(usex libunwind libunwind.a libgcc_eh.a)" + # On Linux/glibc it does not link without libpthread or libdl. It is + # fine on FreeBSD. + use elibc_glibc && deps+=" libpthread.a libdl.a" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.a" || die +} + +gen_shared_ldscript() { + local libdir=$(get_libdir) + # libsupc++ doesn't have a shared version + local cxxabi_lib=$(usex libcxxabi "libc++abi.so" "$(usex libcxxrt "libcxxrt.so" "libsupc++.a")") + + mv "${ED}/usr/${libdir}/libc++.so" "${ED}/usr/${libdir}/libc++_shared.so" || die + local deps="libc++_shared.so ${cxxabi_lib} $(usex libunwind libunwind.so libgcc_s.so)" + + gen_ldscript "${deps}" > "${ED}/usr/${libdir}/libc++.so" || die +} + +multilib_src_install() { + cmake-utils_src_install + gen_shared_ldscript + use static-libs && gen_static_ldscript +} + +pkg_postinst() { + elog "This package (${PN}) is mainly intended as a replacement for the C++" + elog "standard library when using clang." + elog "To use it, instead of libstdc++, use:" + elog " clang++ -stdlib=libc++" + elog "to compile your C++ programs." +} diff --git a/sys-libs/libcxx/metadata.xml b/sys-libs/libcxx/metadata.xml new file mode 100644 index 000000000000..df0c52dcfcdf --- /dev/null +++ b/sys-libs/libcxx/metadata.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>aballier@gentoo.org</email> + <name>Alexis Ballier</name> + </maintainer> + <maintainer type="project"> + <email>bsd@gentoo.org</email> + <name>BSD Project</name> + </maintainer> + <maintainer type="project"> + <email>llvm@gentoo.org</email> + <name>LLVM Project</name> + </maintainer> + <use> + <flag name="libcxxabi">Build on top of <pkg>sys-libs/libcxxabi</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag> + <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag> + <flag name="libunwind">Use libunwind instead of libgcc_s for stack unwinding, thus avoiding dependence on gcc.</flag> + </use> +</pkgmetadata> |