1 |
commit: f4fe64524e1c5b5c86a4ab81bbc235b1287c0376 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Aug 31 21:10:12 2016 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Aug 31 21:11:26 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4fe6452 |
7 |
|
8 |
sys-libs/compiler-rt: Support running tests |
9 |
|
10 |
sys-libs/compiler-rt/compiler-rt-9999.ebuild | 67 +++++++++++++++++++++++++--- |
11 |
1 file changed, 62 insertions(+), 5 deletions(-) |
12 |
|
13 |
diff --git a/sys-libs/compiler-rt/compiler-rt-9999.ebuild b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
14 |
index 7c93672..43363fe 100644 |
15 |
--- a/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
16 |
+++ b/sys-libs/compiler-rt/compiler-rt-9999.ebuild |
17 |
@@ -8,7 +8,7 @@ EAPI=6 |
18 |
CMAKE_MIN_VERSION=3.4.3 |
19 |
PYTHON_COMPAT=( python2_7 ) |
20 |
|
21 |
-inherit cmake-utils git-r3 python-single-r1 |
22 |
+inherit cmake-utils flag-o-matic git-r3 python-single-r1 |
23 |
|
24 |
DESCRIPTION="Compiler runtime libraries for clang" |
25 |
HOMEPAGE="http://llvm.org/" |
26 |
@@ -19,31 +19,88 @@ EGIT_REPO_URI="http://llvm.org/git/compiler-rt.git |
27 |
LICENSE="UoI-NCSA" |
28 |
SLOT="0/${PV%.*}" |
29 |
KEYWORDS="" |
30 |
-IUSE="+sanitize" |
31 |
+IUSE="+sanitize test" |
32 |
|
33 |
RDEPEND=" |
34 |
~sys-devel/llvm-${PV} |
35 |
!<sys-devel/llvm-${PV} |
36 |
sanitize? ( ${PYTHON_DEPS} )" |
37 |
DEPEND="${RDEPEND} |
38 |
+ test? ( ~sys-devel/clang-${PV} ) |
39 |
${PYTHON_DEPS}" |
40 |
|
41 |
-REQUIRED_USE=${PYTHON_REQUIRED_USE} |
42 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE} |
43 |
+ test? ( sanitize )" |
44 |
+ |
45 |
+src_unpack() { |
46 |
+ if use test; then |
47 |
+ # needed for patched gtest |
48 |
+ git-r3_fetch "http://llvm.org/git/llvm.git |
49 |
+ https://github.com/llvm-mirror/llvm.git" |
50 |
+ fi |
51 |
+ git-r3_fetch |
52 |
+ |
53 |
+ if use test; then |
54 |
+ git-r3_checkout http://llvm.org/git/llvm.git \ |
55 |
+ "${WORKDIR}"/llvm |
56 |
+ fi |
57 |
+ git-r3_checkout |
58 |
+} |
59 |
+ |
60 |
+src_prepare() { |
61 |
+ # Support setting LLVM_MAIN_SRC_DIR and other llvm-config overrides |
62 |
+ eapply "${FILESDIR}"/9999/0001-compiler-rt-cmake-Support-overriding-llvm-config-que.patch |
63 |
+ |
64 |
+ default |
65 |
+} |
66 |
|
67 |
src_configure() { |
68 |
+ # pre-set since we need to pass it to cmake |
69 |
+ BUILD_DIR=${WORKDIR}/${P}_build |
70 |
+ |
71 |
local clang_version=4.0.0 |
72 |
local libdir=$(get_libdir) |
73 |
local mycmakeargs=( |
74 |
# used to find cmake modules |
75 |
-DLLVM_LIBDIR_SUFFIX="${libdir#lib}" |
76 |
-DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${clang_version}" |
77 |
+ # use a build dir structure consistent with install |
78 |
+ # this makes it possible to easily deploy test-friendly clang |
79 |
+ -DCOMPILER_RT_OUTPUT_DIR="${BUILD_DIR}/lib/clang/${clang_version}" |
80 |
|
81 |
- # TODO: tests do not support standalone builds |
82 |
- -DCOMPILER_RT_INCLUDE_TESTS=OFF |
83 |
+ -DCOMPILER_RT_INCLUDE_TESTS=$(usex test) |
84 |
-DCOMPILER_RT_BUILD_SANITIZERS=$(usex sanitize) |
85 |
) |
86 |
+ if use test; then |
87 |
+ mycmakeargs+=( |
88 |
+ -DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm" |
89 |
+ |
90 |
+ # they are created during src_test() |
91 |
+ -DCOMPILER_RT_TEST_COMPILER="${BUILD_DIR}/bin/clang" |
92 |
+ -DCOMPILER_RT_TEST_CXX_COMPILER="${BUILD_DIR}/bin/clang++" |
93 |
+ ) |
94 |
+ |
95 |
+ # same flags are passed for build & tests, so we need to strip |
96 |
+ # them down to a subset supported by clang |
97 |
+ filter-flags -msahf -frecord-gcc-switches |
98 |
+ fi |
99 |
|
100 |
cmake-utils_src_configure |
101 |
+ |
102 |
+ if use test; then |
103 |
+ # copy clang over since resource_dir is located relatively to binary |
104 |
+ # therefore, we can put our new libraries in it |
105 |
+ mkdir -p "${BUILD_DIR}"/{bin,lib/clang/"${clang_version}"/include} || die |
106 |
+ cp "${EPREFIX}/usr/bin/clang" "${EPREFIX}/usr/bin/clang++" \ |
107 |
+ "${BUILD_DIR}"/bin/ || die |
108 |
+ cp "${EPREFIX}/usr/lib/clang/${clang_version}/include"/*.h \ |
109 |
+ "${BUILD_DIR}/lib/clang/${clang_version}/include/" || die |
110 |
+ fi |
111 |
+} |
112 |
+ |
113 |
+src_test() { |
114 |
+ # TODO: tests are broken by sandbox |
115 |
+ cmake-utils_src_make check-all |
116 |
} |
117 |
|
118 |
src_install() { |