Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 560826
Collapse All | Expand All

(-)a/sys-libs/libcxx/Manifest (+6 lines)
Line 0 Link Here
1
AUX Makefile 874 SHA256 ba99d3b7b98ed88a64f8370ba2d90e245f8e5ea9bfe302382ef8eeded0ec00b4 SHA512 96eef2e897075bc7d9fc799ce6c54f6a33ee917efd5666376ac578cb16e15d965205630dbd076f92a3a7091d58ecc235e37bc327c211bf3594244981f089135f WHIRLPOOL 0680b69fdc46c0d6fac01fc2fa0b93ff62d167a03b3ce1cc80fbe57ff04356f5ab4e71f0daec517e629697d5e34f295b66e8263f7506eaa347a500b27442933d
2
AUX libcxx-3.7.0-musl-compatibility.patch 2673 SHA256 9671760510032749208f4eacc3b1cea1757f1e7485d6449e23b2d3b69a75f62d SHA512 f42d465880087c67f782d004729b2a75574afb752961339d7501a3d4767964b5476a071d02fb610894ff4a24631ad60ac335434abe5a0643b41dcdb70ac8638e WHIRLPOOL 4da05e7820e6e813ef029efb9a8fc136d2f5c669809cc609d9e29cb56e9e8990678797a23110dec4b4e765180aa064587e04dd090aafda1eb8b8a751e935f701
3
AUX prepare_snapshot.sh 427 SHA256 9ebf22257a2e296dee41a56b0a721cd1ba459c620009ca8422ba812515ff726f SHA512 ebac2a467f8b1dfb68f1dc46a35f8294d1cf74b70be2a008217fa13b3366ddf4a9f2ebbe611cd63824f42305c5c0304aac2f46386b2956c9e07d82d5d984b435 WHIRLPOOL 232a60d6a22f50c424ec9cf6f325bbb4e8e96815ba9dffdad0a5b1b872b19d20126d316ced71956978eb5ce098f72584d21104c14e232330b3893a73e4c3c358
4
DIST libcxx-3.7.0.src.tar.xz 994580 SHA256 c18f3c8333cd7e678c1424a57fe5e25efe740ca7caf62ac67152b4723f3ad08e SHA512 e71d04efa0fafab129a97ca6f4fd7b5f185258de7455c7a25d0964f459bc6068c69c5d67199f6d7cd3541bdce630106cbaf3b7099e4737dddbdd57c77a3fe054 WHIRLPOOL 26672e3f6e0772504e7ee174c37e5fc20079c730ac8bd0d2563d5415ca9589360aa3be42a8aac15eb5a63c69227bd4911aa822b158b9a35e3d74ec0d71bb1300
5
EBUILD libcxx-3.7.0-r99.ebuild 5444 SHA256 caf6ad314fdbdf86e9290bbcbb1b7619b215afbcee279d3dac9b67278aae36da SHA512 d17bc205320ec01c3546e99289d9923c1dc65214c49762f6fa41d498727c5e5cd658fe665c87b657ad41bc2c07640cd1b7fa907d6a30d9fa87e8d3fd61bbc703 WHIRLPOOL 0825e0cd24aebcfbe2bb23e5c1b3aba04fd65ea0a966b72c186f2ef736328b2a129eb7087e234d2ea88ddc30ab397630002a63bb898c0d76e67f16a19b58c714
6
MISC metadata.xml 558 SHA256 c9fe7077a8c7f767d7cdbe154d85dd344fb86ea246b16613242c70a40f3e1ef2 SHA512 3f324c4959a7c9f2613b29928957fd010b35c6e9c1601f0296e7e8b7c8d59a3c27c5c04fef87ac825f2f7bb07553bc617c4405e1e22847dc8db3e7a1ebb21f50 WHIRLPOOL 3ade5e3852afcd533c89ce0aeead55101f23d1b31825718bfccd60fac485961df617c93962be4c60333a21335dcd6bb5630c8002fe06f456c4e177c14d434455
(-)a/sys-libs/libcxx/files/Makefile (+38 lines)
Line 0 Link Here
1
CXXFLAGS+=-std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
2
	  -Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4
3
4
SRCDIR=..
5
LIB=libc++
6
STATIC=libc++.a
7
MAJOR=1
8
MINOR=0
9
SHEXT?=.so
10
SHLIB=$(LIB)$(SHEXT).$(MAJOR).$(MINOR)
11
SONAME=$(LIB)$(SHEXT).$(MAJOR)
12
13
SRC=$(wildcard $(SRCDIR)/src/*.cpp)
14
OBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.o)
15
SOBJ=$(SRC:$(SRCDIR)/src/%.cpp=%.So)
16
17
18
%.So: $(SRCDIR)/src/%.cpp
19
	$(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -fPIC -nostdinc++ -c $< -o $@
20
21
%.o: $(SRCDIR)/src/%.cpp
22
	$(CXX) -I$(SRCDIR)/include $(CPPFLAGS) $(CXXFLAGS) -nostdinc++ -c $< -o $@
23
24
$(STATIC): $(OBJ)
25
	$(AR) cr $@ $^
26
27
static: $(STATIC)
28
29
$(SHLIB): $(SOBJ)
30
	$(CXX) -fPIC -nodefaultlibs $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(LIBS)
31
32
$(SONAME): $(SHLIB)
33
	ln -s $< $@
34
35
$(LIB)$(SHEXT): $(SONAME)
36
	ln -s $< $@
37
38
shared: $(SHLIB) $(SONAME) $(LIB)$(SHEXT)
(-)a/sys-libs/libcxx/files/prepare_snapshot.sh (+18 lines)
Line 0 Link Here
1
diff -Naur libcxx-3.7.0.src.orig/include/__config libcxx-3.7.0.src/include/__config
2
--- libcxx-3.7.0.src.orig/include/__config	2015-07-17 00:58:59.000000000 +0000
Line 0 Link Here
1
#!/bin/sh
2
VERSION=$(date +%Y%m%d)
3
BASE_VERSION="0.0"
4
PACKAGE="libcxx-${BASE_VERSION}_p${VERSION}"
5
6
svn co http://llvm.org/svn/llvm-project/libcxx/trunk ${PACKAGE}
7
8
find "${PACKAGE}" -type d -name '.svn' -prune -print0 | xargs -0 rm -rf
9
find "${PACKAGE}" -type d -name '.git' -prune -print0 | xargs -0 rm -rf
10
11
tar cJf ${PACKAGE}.tar.xz ${PACKAGE}
12
rm -rf ${PACKAGE}/
13
14
echo "Tarball: \"${PACKAGE}.tar.xz\""
15
16
echo "** all done **"
(-)a/sys-libs/libcxx/libcxx-3.7.0-r99.ebuild (+176 lines)
Line 0 Link Here
1
# Copyright 1999-2015 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
3
# $Id$
4
5
EAPI=5
6
7
ESVN_REPO_URI="http://llvm.org/svn/llvm-project/libcxx/trunk"
8
9
[ "${PV%9999}" != "${PV}" ] && SCM="subversion" || SCM=""
10
11
inherit ${SCM} flag-o-matic toolchain-funcs multilib multilib-minimal
12
13
DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
14
HOMEPAGE="http://libcxx.llvm.org/"
15
if [ "${PV%9999}" = "${PV}" ] ; then
16
	SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"
17
	S="${WORKDIR}/${P}.src"
18
else
19
	SRC_URI=""
20
fi
21
22
LICENSE="|| ( UoI-NCSA MIT )"
23
SLOT="0"
24
if [ "${PV%9999}" = "${PV}" ] ; then
25
	KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
26
else
27
	KEYWORDS=""
28
fi
29
IUSE="elibc_glibc +libcxxrt +static-libs test"
30
31
RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
32
	!libcxxrt? ( >=sys-devel/gcc-4.7:=[cxx] )"
33
DEPEND="${RDEPEND}
34
	test? ( sys-devel/clang )
35
	app-arch/xz-utils"
36
37
DOCS=( CREDITS.TXT )
38
39
pkg_setup() {
40
	if ! use libcxxrt ; then
41
		ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
42
		ewarn "libsupc++. Please note that this is not well supported."
43
		ewarn "In particular, static linking will not work."
44
	fi
45
	if [[ $(gcc-version) < 4.7 ]] && [[ $(tc-getCXX) != *clang++* ]] ; then
46
		eerror "${PN} needs to be built with clang++ or gcc-4.7 or later."
47
		eerror "Please use gcc-config to switch to gcc-4.7 or later version."
48
		die
49
	fi
50
}
51
52
src_prepare() {
53
	cp -f "${FILESDIR}/Makefile" lib/ || die
54
	multilib_copy_sources
55
}
56
57
src_unpack() {
58
	unpack ${A}
59
	cd ${S}
60
	epatch "${FILESDIR}/${PN}-3.7.0-musl-compatibility.patch"
61
}
62
63
src_configure() {
64
	export LIBS="-lpthread -lrt -lc -lgcc_s"
65
	if use libcxxrt ; then
66
		append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
67
		LIBS="-lcxxrt ${LIBS}"
68
		cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
69
	else
70
		# Very hackish, see $HOMEPAGE
71
		# If someone has a clever idea, please share it!
72
		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' ' ')"
73
		local libcxx_gcc_dirs="$(echo | ${CHOST}-g++ -Wp,-v -x c++ - -fsyntax-only 2>&1 | grep -C 2 '#include.*<...>' | tail -n 2 | tr '\n' ' ')"
74
		append-cppflags -D__GLIBCXX__ ${includes}
75
		LIBS="-lsupc++ ${LIBS}"
76
		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"
77
		for i in ${libsupcxx_includes} ; do
78
			local found=""
79
			[ -d "${S}/include/$(dirname ${i})/" ] || mkdir -p "${S}/include/$(dirname ${i})"
80
			for j in ${libcxx_gcc_dirs} ; do
81
				if [ -f "${j}/${i}" ] ; then
82
					cp "${j}/${i}" "${S}/include/$(dirname ${i})/" || die
83
					found=yes
84
				fi
85
			done
86
			[ -n "${found}" ] || die "Header not found: ${i}"
87
		done
88
	fi
89
90
	tc-export AR CC CXX
91
92
	append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
93
}
94
95
multilib_src_compile() {
96
	cd "${BUILD_DIR}/lib" || die
97
	emake shared
98
	use static-libs && emake static
99
}
100
101
# Tests fail for now, if anybody is able to fix them, help is very welcome.
102
multilib_src_test() {
103
	cd "${BUILD_DIR}/test"
104
	LD_LIBRARY_PATH="${BUILD_DIR}/lib:${LD_LIBRARY_PATH}" \
105
		CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
106
		HEADER_INCLUDE="-I${BUILD_DIR}/include" \
107
		SOURCE_LIB="-L${BUILD_DIR}/lib" \
108
		LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
109
		./testit || die
110
	# TODO: fix link against libsupc++
111
}
112
113
# Usage: deps
114
gen_ldscript() {
115
	local output_format
116
	output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
117
	[[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
118
119
	cat <<-END_LDSCRIPT
120
/* GNU ld script
121
   Include missing dependencies
122
*/
123
${output_format}
124
GROUP ( $@ )
125
END_LDSCRIPT
126
}
127
128
gen_static_ldscript() {
129
	if use libcxxrt ; then
130
		# Move it first.
131
		mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
132
133
		# Generate libc++.a ldscript for inclusion of its dependencies so that
134
		# clang++ -stdlib=libc++ -static works out of the box.
135
		local deps="${EPREFIX}/usr/$(get_libdir)/libc++_static.a ${EPREFIX}/usr/$(get_libdir)/libcxxrt.a"
136
		# On Linux/glibc it does not link without libpthread or libdl. It is
137
		# fine on FreeBSD.
138
		use elibc_glibc && deps="${deps} ${EPREFIX}/usr/$(get_libdir)/libpthread.a ${EPREFIX}/usr/$(get_libdir)/libdl.a"
139
140
		gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.a"
141
	fi
142
	# TODO: Generate a libc++.a ldscript when building against libsupc++
143
}
144
145
gen_shared_ldscript() {
146
	if use libcxxrt ; then
147
		mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
148
		local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
149
		gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
150
	fi
151
	# TODO: Generate the linker script for other confiurations too.
152
}
153
154
multilib_src_install() {
155
	cd "${BUILD_DIR}/lib"
156
	if use static-libs ; then
157
		dolib.a libc++.a
158
		gen_static_ldscript
159
	fi
160
	dolib.so libc++.so*
161
	gen_shared_ldscript
162
}
163
164
multilib_src_install_all() {
165
	einstalldocs
166
	insinto /usr/include/c++/v1
167
	doins -r include/*
168
}
169
170
pkg_postinst() {
171
	elog "This package (${PN}) is mainly intended as a replacement for the C++"
172
	elog "standard library when using clang."
173
	elog "To use it, instead of libstdc++, use:"
174
	elog "    clang++ -stdlib=libc++"
175
	elog "to compile your C++ programs."
176
}
(-)a/sys-libs/libcxx/metadata.xml (-1 / +15 lines)
Line 0 Link Here
0
- 
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
3
<pkgmetadata>
4
  <herd>bsd</herd>
5
  <!-- BSD is here because the plan is to have libc++ as the standard C++
6
	   library with clang. A llvm herd would make a lot of sense here too -->
7
  <maintainer>
8
    <email>aballier@gentoo.org</email>
9
    <name>Alexis Ballier</name>
10
  </maintainer>
11
  <use>
12
	  <flag name="libcxxrt">Build on top of <pkg>sys-libs/libcxxrt</pkg> instead of gcc's libsupc++ (avoids depending on gcc).</flag>
13
  </use>
14
</pkgmetadata>
15

Return to bug 560826