summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-10-01 20:58:18 +0200
committerMichał Górny <mgorny@gentoo.org>2016-10-01 21:05:59 +0200
commit93a7dfc1e15d39ae382e56d6da1e775e08efbdd3 (patch)
treee6df10290c50b5333418501543d4fb11ae31e232 /sys-libs
parentsys-libs/compiler-rt-sanitizers: Use app-portage/unsandbox for tests (diff)
downloadgentoo-93a7dfc1e15d39ae382e56d6da1e775e08efbdd3.tar.gz
gentoo-93a7dfc1e15d39ae382e56d6da1e775e08efbdd3.tar.bz2
gentoo-93a7dfc1e15d39ae382e56d6da1e775e08efbdd3.zip
sys-libs/compiler-rt: Support bootstrapping with runtime-less clang
Diffstat (limited to 'sys-libs')
-rw-r--r--sys-libs/compiler-rt/compiler-rt-9999.ebuild15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild
index 751fac90d8b0..1f8d17441573 100644
--- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild
+++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild
@@ -9,7 +9,7 @@ CMAKE_MIN_VERSION=3.4.3
PYTHON_COMPAT=( python2_7 )
# TODO: fix unnecessary dep on Python upstream
-inherit cmake-utils flag-o-matic git-r3 python-any-r1
+inherit cmake-utils flag-o-matic git-r3 python-any-r1 toolchain-funcs
DESCRIPTION="Compiler runtime library for clang (built-in part)"
HOMEPAGE="http://llvm.org/"
@@ -28,10 +28,23 @@ DEPEND="${RDEPEND}
~sys-devel/llvm-${PV}
${PYTHON_DEPS}"
+test_compiler() {
+ $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
+ <<<'int main() { return 0; }' &>/dev/null
+}
+
src_configure() {
# pre-set since we need to pass it to cmake
BUILD_DIR=${WORKDIR}/${P}_build
+ if ! test_compiler; then
+ local extra_flags=( -nodefaultlibs -lc )
+ if test_compiler "${extra_flags[@]}"; then
+ local -x LDFLAGS="${LDFLAGS} ${extra_flags[*]}"
+ ewarn "${CC} seems to lack runtime, trying with ${extra_flags[*]}"
+ fi
+ fi
+
local clang_version=4.0.0
local libdir=$(get_libdir)
local mycmakeargs=(