summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-libs/libcxx
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-libs/libcxx')
-rw-r--r--sys-libs/libcxx/Manifest6
-rw-r--r--sys-libs/libcxx/files/Makefile38
-rwxr-xr-xsys-libs/libcxx/files/prepare_snapshot.sh16
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20130725.ebuild168
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20131222.ebuild169
-rw-r--r--sys-libs/libcxx/libcxx-0.0_p20140322.ebuild169
-rw-r--r--sys-libs/libcxx/libcxx-3.6.0.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-3.6.1.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-3.6.2.ebuild170
-rw-r--r--sys-libs/libcxx/libcxx-9999.ebuild170
-rw-r--r--sys-libs/libcxx/metadata.xml15
11 files changed, 1261 insertions, 0 deletions
diff --git a/sys-libs/libcxx/Manifest b/sys-libs/libcxx/Manifest
new file mode 100644
index 000000000000..f7608c7bbd94
--- /dev/null
+++ b/sys-libs/libcxx/Manifest
@@ -0,0 +1,6 @@
+DIST libcxx-0.0_p20130725.tar.xz 833240 SHA256 16428d2a493d2f833bc695300f4fc4e2bfd756fa4eb8e0b7696af10ff5e82653 SHA512 756cb089dc6514125b53623a410039c0edc2fb56a734b7faabee018e073adb96a30f7413546ba42fb40dd815697f27735fbbb6bbcce2e7dea10d284a3ed394d3 WHIRLPOOL 329817e70c27e13d37d75d3d15f0b49375e59d660d784b2e174b059046090a2514d7ddd39ac8fc917da784899f7d394842e73f7c81301d4fdf9add74d259f086
+DIST libcxx-0.0_p20131222.tar.xz 872416 SHA256 d77b7555daa368a493a71c99d9d5868706cc3a66a4e37e002a860733407d21ee SHA512 d4466a4e66365d38c552813f9d4be251bbc956ca0f2800dcd08b3d5633e6bd1a48601016e0e63a92cb4cd2f7863b31ece0ce9b68f2de2c76cf457a7093920fec WHIRLPOOL 07acd16939694e2cfc946f8f021a2b8a4d4ae40dfe2128273a6e0c76b9a2ac8d9f2e6347d091861219044674ea02b76caf80b3f55f74e8e504c58fe96b19eb91
+DIST libcxx-0.0_p20140322.tar.xz 879256 SHA256 b5eae28ced378349e4b7ec6f2e944d0630213462159a0bb2393dc82b536d77d8 SHA512 a80cc3b47acdc1de1a24f5aad19ed0b2518529fe6e8d56cbbe6801874ea334dabd6cec38c27cccbaec961de69b731e22462f0faae30f371e3acb8ecd1b46b2b4 WHIRLPOOL 9374e2b717a3a00f3046f06920775a31403e36ee9a6c5049e4a50173eae947c5e4641dafd178e459ab3caf6dcad6c99baf37cd5587ebf8a3e2d021e18ac36793
+DIST libcxx-3.6.0.src.tar.xz 946380 SHA256 299c1e82b0086a79c5c1aa1885ea3be3bbce6979aaa9b886409b14f9b387fbb7 SHA512 fe16d129a4e2429677a2b87aa2da27fcb5331d6335a0b819ea67de6498e82293bc13661602baafabb56a7f0a4e8f304d468088b8d3e0b5d1c0d01976f7cf3e92 WHIRLPOOL 527b4d1c54e5d76d0958c6d8ac622be4cb7b1a2feb3a9f2d2efa09564ab8d2f8f8cb15a536b8390f80c327dc8b86fee4fcc0b3d7c3771b11ca64885505fb449a
+DIST libcxx-3.6.1.src.tar.xz 943756 SHA256 5a5c653becf3978d4c4f6095708660855bed691210a9426bb839eecd88b6c0f9 SHA512 96d7700ef1c15327b68e8865c2294a3455f09e166991d4465c45bf870fe2d9ce4ddc9af1cd52b900a8a6a9f89c096b9ee1b2c2af58b550f7bc224505eb04d8ea WHIRLPOOL e7eba2d69d679198725147845d2e92631294b27ab2eb73bc057f6851bffbae941fb2570d66bdc28a7382b69d7dc87558e12b730f87a7e9a54f9d149eea1209c9
+DIST libcxx-3.6.2.src.tar.xz 944020 SHA256 52f3d452f48209c9df1792158fdbd7f3e98ed9bca8ebb51fcd524f67437c8b81 SHA512 1eb575921ca0d636c4b7ba21b3ad2c09468d779c69b3106ceefde294344cf20a48a03f9d38ea0db9f8b909f56f0fd1a56a255101305318e04d9f2d20af358ba6 WHIRLPOOL ec225d10cbfe3ca5eba2ed5f16ac6c19914ee75d71db2a1d8ca30f326c9fd5576899361f4397f2ee5d09dd3e8abaca82080c63e303b90d6f19f755465a11a065
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/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-0.0_p20130725.ebuild b/sys-libs/libcxx/libcxx-0.0_p20130725.ebuild
new file mode 100644
index 000000000000..dde2eea354f8
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20130725.ebuild
@@ -0,0 +1,168 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+else
+ SRC_URI=""
+fi
+
+LICENSE="|| ( UoI-NCSA MIT )"
+SLOT="0"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ KEYWORDS="~amd64 ~mips ~x86 ~amd64-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" \
+ ./testit || die
+}
+
+# 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-0.0_p20131222.ebuild b/sys-libs/libcxx/libcxx-0.0_p20131222.ebuild
new file mode 100644
index 000000000000..4ceb09fe3904
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20131222.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+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-0.0_p20140322.ebuild b/sys-libs/libcxx/libcxx-0.0_p20140322.ebuild
new file mode 100644
index 000000000000..4ceb09fe3904
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-0.0_p20140322.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
+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.6.0.ebuild b/sys-libs/libcxx/libcxx-3.6.0.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.0.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://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.6.1.ebuild b/sys-libs/libcxx/libcxx-3.6.1.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.1.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://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.6.2.ebuild b/sys-libs/libcxx/libcxx-3.6.2.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-3.6.2.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://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-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild
new file mode 100644
index 000000000000..92689d826fc6
--- /dev/null
+++ b/sys-libs/libcxx/libcxx-9999.ebuild
@@ -0,0 +1,170 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+ESVN_REPO_URI="http://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="http://libcxx.llvm.org/"
+if [ "${PV%9999}" = "${PV}" ] ; then
+ SRC_URI="http://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/metadata.xml b/sys-libs/libcxx/metadata.xml
new file mode 100644
index 000000000000..578f810d9f7a
--- /dev/null
+++ b/sys-libs/libcxx/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>bsd</herd>
+ <!-- BSD is here because the plan is to have libc++ as the standard C++
+ library with clang. A llvm herd would make a lot of sense here too -->
+ <maintainer>
+ <email>aballier@gentoo.org</email>
+ <name>Alexis Ballier</name>
+ </maintainer>
+ <use>
+ <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
+ </use>
+</pkgmetadata>
+