summaryrefslogtreecommitdiff
blob: 9b65c05da88e5dd228aa7ef7af51925a01dc42b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit flag-o-matic eutils cmake-multilib

S="${WORKDIR}/${P}.src"

DESCRIPTION="New implementation of low level support for a standard C++ library"
HOMEPAGE="http://libcxxabi.llvm.org/"
SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz"

LICENSE="|| ( UoI-NCSA MIT )"
SLOT="0"
KEYWORDS="~x64-macos ~x86-macos"
IUSE="static-libs"

RDEPEND=""
DEPEND="${RDEPEND}
	=sys-libs/libcxx-headers-${PV}"

# note the abscense of a requirement to compile with clang on OS X - it
# actually compiles and works with recent gcc as well

src_prepare() {
	sed -i -e "/set.LLVM_CMAKE_PATH.*\\/cmake\\/modules/s@cmake/modules@cmake@" CMakeLists.txt
}

src_configure() {
	local mycmakeargs=(
		-DLLVM_PATH=${EPREFIX}/usr/share/llvm
		-DLIBCXXABI_LIBCXX_INCLUDES=${EPREFIX}/usr/include/c++/v1
		# silence warning "LIBCXXABI_LIBCXX_PATH was not specified and couldn't
		# be infered" which is redundant because we have successfully provided
		# the libc++ include path via LIBCXXABI_LIBCXX_INCLUDES already
		-DLIBCXXABI_LIBCXX_PATH=shutup
	)

	# make sure we build multilib on OSX, because llvm insists on
	# building multilib too
	if [[ ${CHOST} == *86*-darwin* ]] ; then
		append-flags -arch i386 -arch x86_64
		append-cxxflags -std=c++11
	fi

	use static-libs && \
		mycmakeargs+=( -DLIBCXXABI_ENABLE_STATIC=ON ) || \
		mycmakeargs+=( -DLIBCXXABI_ENABLE_STATIC=OFF )

	cmake-multilib_src_configure
}

multilib_src_install_all() {
	# do not install unwind.h and others since they're only in-source
	# build-time dependencies
	insinto /usr/include
	doins -r include/cxxabi.h
	doins -r include/__cxxabi_config.h
}