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