summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-03-10 00:05:14 +0100
committerMichał Górny <mgorny@gentoo.org>2018-03-10 00:11:26 +0100
commit54a35a5810b0475469b43d235f050cf8a8b7a54e (patch)
treeb9c3bcf200fa3d71ba43d81a1e56b92f6360d442 /sys-libs/libcxx
parentsys-devel/clang: Raise libcxx dep for USE=default-libcxx (diff)
downloadgentoo-54a35a5810b0475469b43d235f050cf8a8b7a54e.tar.gz
gentoo-54a35a5810b0475469b43d235f050cf8a8b7a54e.tar.bz2
gentoo-54a35a5810b0475469b43d235f050cf8a8b7a54e.zip
sys-libs/libcxx: Try building with -nodefaultlibs for bootstrap
Add a hack that appends -nodefaultlibs if the C++ compiler fails to link software otherwise. This is based on what we do in sys-libs/compiler-rt already and it should make it possible to bootstrap libc++ on systems without C++ standard library.
Diffstat (limited to 'sys-libs/libcxx')
-rw-r--r--sys-libs/libcxx/libcxx-6.0.0.ebuild14
-rw-r--r--sys-libs/libcxx/libcxx-6.0.9999.ebuild14
-rw-r--r--sys-libs/libcxx/libcxx-9999.ebuild14
3 files changed, 42 insertions, 0 deletions
diff --git a/sys-libs/libcxx/libcxx-6.0.0.ebuild b/sys-libs/libcxx/libcxx-6.0.0.ebuild
index 9c9b75e3d7f1..0948ab0c6825 100644
--- a/sys-libs/libcxx/libcxx-6.0.0.ebuild
+++ b/sys-libs/libcxx/libcxx-6.0.0.ebuild
@@ -73,6 +73,11 @@ pkg_setup() {
fi
}
+test_compiler() {
+ $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
+ <<<'int main() { return 0; }' &>/dev/null
+}
+
multilib_src_configure() {
local cxxabi cxxabi_incs
if use libcxxabi; then
@@ -109,6 +114,15 @@ multilib_src_configure() {
fi
fi
+ # bootstrap: cmake is unhappy if compiler can't link to stdlib
+ local nolib_flags=( -nodefaultlibs -lc )
+ if ! test_compiler; then
+ if test_compiler "${nolib_flags[@]}"; then
+ local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+ ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
+ fi
+ fi
+
local libdir=$(get_libdir)
local mycmakeargs=(
-DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
diff --git a/sys-libs/libcxx/libcxx-6.0.9999.ebuild b/sys-libs/libcxx/libcxx-6.0.9999.ebuild
index cf76bba5fdfd..4e687c722c60 100644
--- a/sys-libs/libcxx/libcxx-6.0.9999.ebuild
+++ b/sys-libs/libcxx/libcxx-6.0.9999.ebuild
@@ -85,6 +85,11 @@ pkg_setup() {
fi
}
+test_compiler() {
+ $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
+ <<<'int main() { return 0; }' &>/dev/null
+}
+
multilib_src_configure() {
local cxxabi cxxabi_incs
if use libcxxabi; then
@@ -121,6 +126,15 @@ multilib_src_configure() {
fi
fi
+ # bootstrap: cmake is unhappy if compiler can't link to stdlib
+ local nolib_flags=( -nodefaultlibs -lc )
+ if ! test_compiler; then
+ if test_compiler "${nolib_flags[@]}"; then
+ local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+ ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
+ fi
+ fi
+
local libdir=$(get_libdir)
local mycmakeargs=(
-DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}
diff --git a/sys-libs/libcxx/libcxx-9999.ebuild b/sys-libs/libcxx/libcxx-9999.ebuild
index 214c61d31f67..f304a076c171 100644
--- a/sys-libs/libcxx/libcxx-9999.ebuild
+++ b/sys-libs/libcxx/libcxx-9999.ebuild
@@ -84,6 +84,11 @@ pkg_setup() {
fi
}
+test_compiler() {
+ $(tc-getCXX) ${CXXFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c++ - \
+ <<<'int main() { return 0; }' &>/dev/null
+}
+
multilib_src_configure() {
local cxxabi cxxabi_incs
if use libcxxabi; then
@@ -120,6 +125,15 @@ multilib_src_configure() {
fi
fi
+ # bootstrap: cmake is unhappy if compiler can't link to stdlib
+ local nolib_flags=( -nodefaultlibs -lc )
+ if ! test_compiler; then
+ if test_compiler "${nolib_flags[@]}"; then
+ local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
+ ewarn "${CXX} seems to lack runtime, trying with ${nolib_flags[*]}"
+ fi
+ fi
+
local libdir=$(get_libdir)
local mycmakeargs=(
-DLIBCXX_LIBDIR_SUFFIX=${libdir#lib}