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