diff options
Diffstat (limited to 'sys-libs/libcxx/libcxx-9999.ebuild')
-rw-r--r-- | sys-libs/libcxx/libcxx-9999.ebuild | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild index b6e69d2a4005..95fbec047ff2 100644 --- a/sys-libs/libcxx/libcxx-9999.ebuild +++ b/sys-libs/libcxx/libcxx-9999.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxx/libcxx-9999.ebuild,v 1.9 2013/05/31 01:16:29 aballier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/libcxx/libcxx-9999.ebuild,v 1.10 2013/06/17 18:18:34 aballier Exp $ EAPI=5 @@ -8,7 +8,7 @@ ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk" [ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM="" -inherit cmake-utils ${SCM} base flag-o-matic toolchain-funcs +inherit cmake-utils ${SCM} base flag-o-matic toolchain-funcs multilib DESCRIPTION="New implementation of the C++ standard library, targeting C++11" HOMEPAGE="http://libcxx.llvm.org/" @@ -25,7 +25,7 @@ if [ "${PV%9999}" = "${PV}" ] ; then else KEYWORDS="" fi -IUSE="+libcxxrt static-libs" +IUSE="elibc_glibc +libcxxrt static-libs" RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130530[static-libs?] ) !libcxxrt? ( sys-devel/gcc[cxx] )" @@ -87,8 +87,40 @@ src_test() { ./testit || die } +gen_static_ldscript() { + if use libcxxrt ; then + # Move it first. + mv "${D}/${EPREFIX}/usr/$(get_libdir)/libc++.a" "${D}/${EPREFIX}/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. + # Taken from toolchain-funcs.eclass: + 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} )" + + 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" + + cat > "${D}/${EPREFIX}/usr/$(get_libdir)/libc++.a" <<-END_LDSCRIPT +/* GNU ld script + Include libc++.a dependencies for 'clang++ -stdlib=libc++ -static' to work + out of the box. + */ +${output_format} +GROUP ( ${deps} ) +END_LDSCRIPT + fi + # TODO: Generate a libc++.a ldscript when building against libsupc++ +} + src_install() { - use static-libs && BUILD_DIR="${S}_static" cmake-utils_src_install + if use static-libs ; then + BUILD_DIR="${S}_static" cmake-utils_src_install + gen_static_ldscript + fi BUILD_DIR="${S}_shared" cmake-utils_src_install } |