Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/compiler-rt/
Date: Wed, 16 Jan 2019 14:52:56
Message-Id: 1547650353.17e1cb2ce66626999b94dfde3a40769940a99620.mgorny@gentoo
1 commit: 17e1cb2ce66626999b94dfde3a40769940a99620
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 16 13:50:13 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 16 14:52:33 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17e1cb2c
7
8 sys-libs/compiler-rt: Add a live ebuild for 8.* branch
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 sys-libs/compiler-rt/compiler-rt-8.0.9999.ebuild | 111 +++++++++++++++++++++++
13 1 file changed, 111 insertions(+)
14
15 diff --git a/sys-libs/compiler-rt/compiler-rt-8.0.9999.ebuild b/sys-libs/compiler-rt/compiler-rt-8.0.9999.ebuild
16 new file mode 100644
17 index 00000000000..6e1eec0d94f
18 --- /dev/null
19 +++ b/sys-libs/compiler-rt/compiler-rt-8.0.9999.ebuild
20 @@ -0,0 +1,111 @@
21 +# Copyright 1999-2019 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +
26 +: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
27 +# (needed due to CMAKE_BUILD_TYPE != Gentoo)
28 +CMAKE_MIN_VERSION=3.7.0-r1
29 +PYTHON_COMPAT=( python2_7 )
30 +
31 +inherit cmake-utils flag-o-matic git-r3 llvm multiprocessing \
32 + python-any-r1 toolchain-funcs
33 +
34 +DESCRIPTION="Compiler runtime library for clang (built-in part)"
35 +HOMEPAGE="https://llvm.org/"
36 +SRC_URI=""
37 +EGIT_REPO_URI="https://git.llvm.org/git/compiler-rt.git
38 + https://github.com/llvm-mirror/compiler-rt.git"
39 +EGIT_BRANCH="release_80"
40 +
41 +LICENSE="|| ( UoI-NCSA MIT )"
42 +# Note: this needs to be updated to match version of clang-9999
43 +SLOT="8.0.0"
44 +KEYWORDS=""
45 +IUSE="+clang test"
46 +RESTRICT="!test? ( test ) !clang? ( test )"
47 +
48 +CLANG_SLOT=${SLOT%%.*}
49 +# llvm-6 for new lit options
50 +DEPEND="
51 + >=sys-devel/llvm-6
52 + clang? ( sys-devel/clang )
53 + test? (
54 + $(python_gen_any_dep "dev-python/lit[\${PYTHON_USEDEP}]")
55 + =sys-devel/clang-${PV%_*}*:${CLANG_SLOT} )
56 + ${PYTHON_DEPS}"
57 +
58 +# least intrusive of all
59 +CMAKE_BUILD_TYPE=RelWithDebInfo
60 +
61 +pkg_pretend() {
62 + if ! use clang && ! tc-is-clang; then
63 + ewarn "Building using a compiler other than clang may result in broken atomics"
64 + ewarn "library. Enable USE=clang unless you have a very good reason not to."
65 + fi
66 +}
67 +
68 +pkg_setup() {
69 + llvm_pkg_setup
70 + python-any-r1_pkg_setup
71 +}
72 +
73 +test_compiler() {
74 + $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
75 + <<<'int main() { return 0; }' &>/dev/null
76 +}
77 +
78 +src_configure() {
79 + # pre-set since we need to pass it to cmake
80 + BUILD_DIR=${WORKDIR}/${P}_build
81 +
82 + local nolib_flags=( -nodefaultlibs -lc )
83 + if use clang; then
84 + local -x CC=${CHOST}-clang
85 + local -x CXX=${CHOST}-clang++
86 + # ensure we can use clang before installing compiler-rt
87 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
88 + strip-unsupported-flags
89 + elif ! test_compiler; then
90 + if test_compiler "${nolib_flags[@]}"; then
91 + local -x LDFLAGS="${LDFLAGS} ${nolib_flags[*]}"
92 + ewarn "${CC} seems to lack runtime, trying with ${nolib_flags[*]}"
93 + fi
94 + fi
95 +
96 + local mycmakeargs=(
97 + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
98 +
99 + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
100 + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
101 + -DCOMPILER_RT_BUILD_PROFILE=OFF
102 + -DCOMPILER_RT_BUILD_SANITIZERS=OFF
103 + -DCOMPILER_RT_BUILD_XRAY=OFF
104 + )
105 +
106 + if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
107 + mycmakeargs+=(
108 + # disable use of SDK for the system itself
109 + -DDARWIN_macosx_CACHED_SYSROOT=/
110 + )
111 + fi
112 +
113 + if use test; then
114 + mycmakeargs+=(
115 + -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
116 + -DLLVM_LIT_ARGS="-vv;-j;${LIT_JOBS:-$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")}"
117 +
118 + -DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang"
119 + -DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++"
120 + )
121 + fi
122 +
123 + cmake-utils_src_configure
124 +}
125 +
126 +src_test() {
127 + # respect TMPDIR!
128 + local -x LIT_PRESERVES_TMP=1
129 +
130 + cmake-utils_src_make check-builtins
131 +}