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-sanitizers/
Date: Mon, 24 Jul 2017 19:04:08
Message-Id: 1500923027.7c02e9368a187e1b70666d504f96e356afd65442.mgorny@gentoo
1 commit: 7c02e9368a187e1b70666d504f96e356afd65442
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 23 16:49:09 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 24 19:03:47 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c02e936
7
8 sys-libs/compiler-rt-sanitizers: Branch for 5.0.0 release
9
10 .../compiler-rt-sanitizers-5.0.9999.ebuild | 134 +++++++++++++++++++++
11 1 file changed, 134 insertions(+)
12
13 diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild
14 new file mode 100644
15 index 00000000000..d6070ffebfc
16 --- /dev/null
17 +++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-5.0.9999.ebuild
18 @@ -0,0 +1,134 @@
19 +# Copyright 1999-2017 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 check-reqs cmake-utils flag-o-matic git-r3 llvm python-any-r1 versionator
30 +
31 +DESCRIPTION="Compiler runtime libraries for clang (sanitizers & xray)"
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_50"
37 +
38 +LICENSE="|| ( UoI-NCSA MIT )"
39 +# Note: this needs to be updated to match version of clang-9999
40 +SLOT="5.0.0"
41 +KEYWORDS=""
42 +IUSE="test"
43 +
44 +LLVM_SLOT=${SLOT%%.*}
45 +# llvm-4 needed for --cmakedir
46 +DEPEND="
47 + >=sys-devel/llvm-4
48 + test? (
49 + app-portage/unsandbox
50 + $(python_gen_any_dep "~dev-python/lit-${PV}[\${PYTHON_USEDEP}]")
51 + =sys-devel/clang-${PV%_*}*:${LLVM_SLOT}
52 + sys-libs/compiler-rt:${SLOT} )
53 + ${PYTHON_DEPS}"
54 +
55 +# least intrusive of all
56 +CMAKE_BUILD_TYPE=RelWithDebInfo
57 +
58 +check_space() {
59 + if use test; then
60 + local CHECKREQS_DISK_BUILD=11G
61 + check-reqs_pkg_pretend
62 + fi
63 +}
64 +
65 +pkg_pretend() {
66 + check_space
67 +}
68 +
69 +pkg_setup() {
70 + check_space
71 + llvm_pkg_setup
72 + python-any-r1_pkg_setup
73 +}
74 +
75 +src_unpack() {
76 + if use test; then
77 + # needed for patched gtest
78 + git-r3_fetch "https://git.llvm.org/git/llvm.git
79 + https://github.com/llvm-mirror/llvm.git"
80 + fi
81 + git-r3_fetch
82 +
83 + if use test; then
84 + git-r3_checkout https://llvm.org/git/llvm.git \
85 + "${WORKDIR}"/llvm
86 + fi
87 + git-r3_checkout
88 +}
89 +
90 +src_configure() {
91 + # pre-set since we need to pass it to cmake
92 + BUILD_DIR=${WORKDIR}/${P}_build
93 +
94 + local mycmakeargs=(
95 + -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
96 + # use a build dir structure consistent with install
97 + # this makes it possible to easily deploy test-friendly clang
98 + -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${SLOT}"
99 +
100 + -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
101 + # built-ins installed by sys-libs/compiler-rt
102 + -DCOMPILER_RT_BUILD_BUILTINS=OFF
103 + -DCOMPILER_RT_BUILD_SANITIZERS=ON
104 + -DCOMPILER_RT_BUILD_XRAY=ON
105 + )
106 + if use test; then
107 + mycmakeargs+=(
108 + -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
109 + -DLIT_COMMAND="${EPREFIX}/usr/bin/unsandbox;${EPREFIX}/usr/bin/lit"
110 +
111 + # they are created during src_test()
112 + -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang"
113 + -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/lib/llvm/${LLVM_SLOT}/bin/clang++"
114 + )
115 +
116 + # same flags are passed for build & tests, so we need to strip
117 + # them down to a subset supported by clang
118 + CC=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang \
119 + CXX=${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/bin/clang++ \
120 + strip-unsupported-flags
121 + fi
122 +
123 + cmake-utils_src_configure
124 +
125 + if use test; then
126 + local sys_dir=( "${EPREFIX}"/usr/lib/clang/${SLOT}/lib/* )
127 + [[ -e ${sys_dir} ]] || die "Unable to find ${sys_dir}"
128 + [[ ${#sys_dir[@]} -eq 1 ]] || die "Non-deterministic compiler-rt install: ${sys_dir[*]}"
129 +
130 + # copy clang over since resource_dir is located relatively to binary
131 + # therefore, we can put our new libraries in it
132 + mkdir -p "${BUILD_DIR}"/lib/{llvm/${LLVM_SLOT}/{bin,$(get_libdir)},clang/${SLOT}/include} || die
133 + cp "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/bin/clang{,++} \
134 + "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/bin/ || die
135 + cp "${EPREFIX}"/usr/lib/clang/${SLOT}/include/*.h \
136 + "${BUILD_DIR}"/lib/clang/${SLOT}/include/ || die
137 + cp "${sys_dir}"/*builtins*.a \
138 + "${BUILD_DIR}/lib/clang/${SLOT}/lib/${sys_dir##*/}/" || die
139 + # we also need LLVMgold.so for gold-based tests
140 + if [[ -f ${EPREFIX}/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so ]]; then
141 + ln -s "${EPREFIX}"/usr/lib/llvm/${LLVM_SLOT}/$(get_libdir)/LLVMgold.so \
142 + "${BUILD_DIR}"/lib/llvm/${LLVM_SLOT}/$(get_libdir)/ || die
143 + fi
144 + fi
145 +}
146 +
147 +src_test() {
148 + # respect TMPDIR!
149 + local -x LIT_PRESERVES_TMP=1
150 +
151 + cmake-utils_src_make check-all
152 +}