Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 538364 | Differences between
and this patch

Collapse All | Expand All

(-)sys-libs/libcxx/libcxx-9999.ebuild.orig (-13 / +79 lines)
Lines 13-19 Link Here
13
DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
13
DESCRIPTION="New implementation of the C++ standard library, targeting C++11"
14
HOMEPAGE="http://libcxx.llvm.org/"
14
HOMEPAGE="http://libcxx.llvm.org/"
15
if [ "${PV%9999}" = "${PV}" ] ; then
15
if [ "${PV%9999}" = "${PV}" ] ; then
16
	SRC_URI="mirror://gentoo/${P}.tar.xz"
16
	SRC_URI="mirror://gentoo/${P}.src.tar.xz
17
		http://llvm.org/releases/${PV}/${P}.src.tar.xz"
18
	S="${WORKDIR}"/"${P}".src
17
else
19
else
18
	SRC_URI=""
20
	SRC_URI=""
19
fi
21
fi
Lines 21-34 Link Here
21
LICENSE="|| ( UoI-NCSA MIT )"
23
LICENSE="|| ( UoI-NCSA MIT )"
22
SLOT="0"
24
SLOT="0"
23
if [ "${PV%9999}" = "${PV}" ] ; then
25
if [ "${PV%9999}" = "${PV}" ] ; then
24
	KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
26
	KEYWORDS="~amd64 ~mips ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos ~x86-macos"
25
else
27
else
26
	KEYWORDS=""
28
	KEYWORDS=""
27
fi
29
fi
28
IUSE="elibc_glibc +libcxxrt static-libs test"
30
IUSE="elibc_glibc libsupc static-libs test"
29
31
30
RDEPEND="libcxxrt? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
32
REQUIRED_USE="kernel_Darwin? ( !libsupc !static-libs )"
31
	!libcxxrt? ( >=sys-devel/gcc-4.7[cxx] )"
33
RDEPEND="!kernel_Darwin? (
34
		!libsupc? ( >=sys-libs/libcxxrt-0.0_p20130725[static-libs?,${MULTILIB_USEDEP}] )
35
		libsupc? ( >=sys-devel/gcc-4.7[cxx] ) )
36
	kernel_Darwin? ( sys-libs/libcxx-headers sys-libs/libcxxabi sys-devel/clang )"
32
DEPEND="${RDEPEND}
37
DEPEND="${RDEPEND}
33
	test? ( sys-devel/clang )
38
	test? ( sys-devel/clang )
34
	app-arch/xz-utils"
39
	app-arch/xz-utils"
Lines 36-43 Link Here
36
DOCS=( CREDITS.TXT )
41
DOCS=( CREDITS.TXT )
37
42
38
pkg_setup() {
43
pkg_setup() {
39
	if ! use libcxxrt ; then
44
	if [[ ${CHOST} == *darwin* ]] ; then
40
		ewarn "You have disabled USE=libcxxrt. This will build ${PN} against"
45
		MY_CC=$(tc-getCC)
46
		MY_CXX=$(tc-getCXX)
47
		if [[ ${MY_CC} != *clang* || ${MY_CXX} != *clang++* ]] ; then
48
			eerror "${PN} needs to be built with clang++. Please do not override"
49
			eerror "CC ($MY_CC) and CXX ($MY_CXX)"
50
			eerror "or point them at clang and eerror clang++ respectively."
51
			die
52
		fi
53
		return
54
	fi
55
	if use libsupc ; then
56
		ewarn "You have enabled USE=libsupc. This will build ${PN} against"
41
		ewarn "libsupc++. Please note that this is not well supported."
57
		ewarn "libsupc++. Please note that this is not well supported."
42
		ewarn "In particular, static linking will not work."
58
		ewarn "In particular, static linking will not work."
43
	fi
59
	fi
Lines 50-61 Link Here
50
66
51
src_prepare() {
67
src_prepare() {
52
	cp -f "${FILESDIR}/Makefile" lib/ || die
68
	cp -f "${FILESDIR}/Makefile" lib/ || die
69
70
	if [[ ${CHOST} == *darwin* ]] ; then
71
		epatch "${FILESDIR}"/${PN}-3.5.1-olddarwin.patch
72
73
		[[ "${CHOST##*-darwin}" -le 10 ]] && \
74
			epatch "${FILESDIR}"/${PN}-3.5.1-cmath-conv.patch
75
76
		# libc++abi needs stack unwinding functions provided by libSystem on
77
		# Mac OS X >= 10.6. On < 10.6 they're in libgcc_s. So force link
78
		# against that. Additionally, the crt1.o provided by our gcc-apple
79
		# toolchain isn't universal. Since that's needed for linking any
80
		# program on OS X < 10.7, universal support is effectively broken on
81
		# those older OS Xes even if clang and libc++{,abi} were to support it.
82
		# So we can just disable universal compilation.
83
		gcc_s=gcc_s.1
84
		[[ "${CHOST##*-darwin}" -eq 9 ]] && gcc_s=gcc_s.10.5
85
		[[ "${CHOST##*-darwin}" -eq 8 ]] && gcc_s=gcc_s.10.4
86
		[[ "${CHOST##*-darwin}" -le 9 ]]  && \
87
			sed -i -e "s,/usr/lib/libSystem.B.dylib,-lSystem -l${gcc_s},g" \
88
				-e "s,-arch i386 -arch x86_64,,g" \
89
				lib/buildit
90
91
		if [[ "${CHOST##*-darwin}" -le 8 ]] ; then
92
			epatch "${FILESDIR}"/${PN}-3.5.1-availability.patch
93
			epatch "${FILESDIR}"/${PN}-3.5.1-eprintf.patch
94
		fi
95
96
		# fix library install names
97
		sed -i \
98
			-e "s,/usr/lib/libc++abi\.dylib,${EPREFIX}/usr/lib/libc++abi.dylib,g" \
99
			-e "s,/usr/lib/libc++\.1\.dylib,${EPREFIX}/usr/lib/libc++.1.dylib,g" \
100
			lib/buildit
101
	fi
102
53
	multilib_copy_sources
103
	multilib_copy_sources
54
}
104
}
55
105
56
src_configure() {
106
src_configure() {
107
	tc-export AR CC CXX
108
109
	# on Darwin we're all set
110
	[[ ${CHOST} == *darwin* ]] && return
111
57
	export LIBS="-lpthread -lrt -lc -lgcc_s"
112
	export LIBS="-lpthread -lrt -lc -lgcc_s"
58
	if use libcxxrt ; then
113
	if ! use libsupc ; then
59
		append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
114
		append-cppflags -DLIBCXXRT "-I${EPREFIX}/usr/include/libcxxrt/"
60
		LIBS="-lcxxrt ${LIBS}"
115
		LIBS="-lcxxrt ${LIBS}"
61
		cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
116
		cp "${EPREFIX}/usr/include/libcxxrt/"*.h "${S}/include"
Lines 80-92 Link Here
80
		done
135
		done
81
	fi
136
	fi
82
137
83
	tc-export AR CC CXX
84
85
	append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
138
	append-ldflags "-Wl,-z,defs" # make sure we are not underlinked
86
}
139
}
87
140
88
multilib_src_compile() {
141
multilib_src_compile() {
89
	cd "${BUILD_DIR}/lib" || die
142
	cd "${BUILD_DIR}/lib" || die
143
	if [[ ${CHOST} == *darwin* ]] ; then
144
		TRIPLE=-apple- ./buildit || die
145
		return
146
	fi
147
90
	emake shared
148
	emake shared
91
	use static-libs && emake static
149
	use static-libs && emake static
92
}
150
}
Lines 98-104 Link Here
98
		CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
156
		CC="clang++ $(get_abi_CFLAGS) ${CXXFLAGS}" \
99
		HEADER_INCLUDE="-I${BUILD_DIR}/include" \
157
		HEADER_INCLUDE="-I${BUILD_DIR}/include" \
100
		SOURCE_LIB="-L${BUILD_DIR}/lib" \
158
		SOURCE_LIB="-L${BUILD_DIR}/lib" \
101
		LIBS="-lm $(usex libcxxrt -lcxxrt "")" \
159
		LIBS="-lm $(usex libsupc "" -lcxxrt)" \
102
		./testit || die
160
		./testit || die
103
	# TODO: fix link against libsupc++
161
	# TODO: fix link against libsupc++
104
}
162
}
Lines 119-125 Link Here
119
}
177
}
120
178
121
gen_static_ldscript() {
179
gen_static_ldscript() {
122
	if use libcxxrt ; then
180
	if ! use libsupc ; then
123
		# Move it first.
181
		# Move it first.
124
		mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
182
		mv "${ED}/usr/$(get_libdir)/libc++.a" "${ED}/usr/$(get_libdir)/libc++_static.a" || die
125
183
Lines 136-142 Link Here
136
}
194
}
137
195
138
gen_shared_ldscript() {
196
gen_shared_ldscript() {
139
	if use libcxxrt ; then
197
	if ! use libsupc ; then
140
		mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
198
		mv "${ED}/usr/$(get_libdir)/libc++.so" "${ED}/usr/$(get_libdir)/libc++_shared.so" || die
141
		local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
199
		local deps="${EPREFIX}/usr/$(get_libdir)/libc++_shared.so ${EPREFIX}/usr/$(get_libdir)/libcxxrt.so"
142
		gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
200
		gen_ldscript "${deps}" > "${ED}/usr/$(get_libdir)/libc++.so"
Lines 146-151 Link Here
146
204
147
multilib_src_install() {
205
multilib_src_install() {
148
	cd "${BUILD_DIR}/lib"
206
	cd "${BUILD_DIR}/lib"
207
	if [[ ${CHOST} == *darwin* ]] ; then
208
		dolib.so libc++*dylib
209
		return
210
	fi
211
149
	if use static-libs ; then
212
	if use static-libs ; then
150
		dolib.a libc++.a
213
		dolib.a libc++.a
151
		gen_static_ldscript
214
		gen_static_ldscript
Lines 156-161 Link Here
156
219
157
multilib_src_install_all() {
220
multilib_src_install_all() {
158
	einstalldocs
221
	einstalldocs
222
	# libc++abi needs the libc++ headers and we need libc++abi so the headers
223
	# are already installed
224
	[[ ${CHOST} == *darwin* ]] && return
159
	insinto /usr/include/c++/v1
225
	insinto /usr/include/c++/v1
160
	doins -r include/*
226
	doins -r include/*
161
}
227
}

Return to bug 538364