1 |
commit: 52937c53de83b925db8a7b20cebf0e18284bc75e |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Apr 1 21:48:30 2018 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Apr 1 22:27:16 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52937c53 |
7 |
|
8 |
sys-devel/clang: Backport FreeBSD test fixes to 5.0.1 |
9 |
|
10 |
sys-devel/clang/clang-5.0.1.ebuild | 19 ++++-- |
11 |
...est-Fix-clang-test-for-FreeBSD-and-NetBSD.patch | 76 ++++++++++++++++++++++ |
12 |
...shared-library-path-variable-is-LD_LIBRAR.patch | 37 +++++++++++ |
13 |
3 files changed, 125 insertions(+), 7 deletions(-) |
14 |
|
15 |
diff --git a/sys-devel/clang/clang-5.0.1.ebuild b/sys-devel/clang/clang-5.0.1.ebuild |
16 |
index b16d9564915..c79d4d26b48 100644 |
17 |
--- a/sys-devel/clang/clang-5.0.1.ebuild |
18 |
+++ b/sys-devel/clang/clang-5.0.1.ebuild |
19 |
@@ -65,13 +65,6 @@ S=${WORKDIR}/x/y/${MY_P} |
20 |
# least intrusive of all |
21 |
CMAKE_BUILD_TYPE=RelWithDebInfo |
22 |
|
23 |
-PATCHES=( |
24 |
- # fix finding compiler-rt libs |
25 |
- "${FILESDIR}"/5.0.1/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch |
26 |
- # add Prefix include paths for Darwin |
27 |
- "${FILESDIR}"/5.0.1/darwin_prefix-include-paths.patch |
28 |
-) |
29 |
- |
30 |
# Multilib notes: |
31 |
# 1. ABI_* flags control ABIs libclang* is built for only. |
32 |
# 2. clang is always capable of compiling code for all ABIs for enabled |
33 |
@@ -113,6 +106,18 @@ src_unpack() { |
34 |
} |
35 |
|
36 |
src_prepare() { |
37 |
+ # fix finding compiler-rt libs |
38 |
+ eapply "${FILESDIR}"/5.0.1/0001-Driver-Use-arch-type-to-find-compiler-rt-libraries-o.patch |
39 |
+ # fix setting LD_LIBRARY_PATH for tests on *BSD |
40 |
+ eapply "${FILESDIR}"/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch |
41 |
+ # add Prefix include paths for Darwin |
42 |
+ eapply "${FILESDIR}"/5.0.1/darwin_prefix-include-paths.patch |
43 |
+ |
44 |
+ cd tools/extra || die |
45 |
+ # fix setting LD_LIBRARY_PATH for tests on *BSD (extra part) |
46 |
+ eapply "${FILESDIR}"/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch |
47 |
+ cd ../.. || die |
48 |
+ |
49 |
cmake-utils_src_prepare |
50 |
eprefixify lib/Frontend/InitHeaderSearch.cpp |
51 |
} |
52 |
|
53 |
diff --git a/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch b/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch |
54 |
new file mode 100644 |
55 |
index 00000000000..1751a4f479f |
56 |
--- /dev/null |
57 |
+++ b/sys-devel/clang/files/5.0.1/0002-test-Fix-clang-test-for-FreeBSD-and-NetBSD.patch |
58 |
@@ -0,0 +1,76 @@ |
59 |
+From 4650c277d616e5d297baf28682eb792e2e0144b1 Mon Sep 17 00:00:00 2001 |
60 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
61 |
+Date: Sun, 1 Apr 2018 23:20:56 +0200 |
62 |
+Subject: [PATCH] [test] Fix clang-test for FreeBSD and NetBSD |
63 |
+ |
64 |
+Lit tries to inject the shared library paths, but no action is taken |
65 |
+when platform.system() is not recognized, results in an environment |
66 |
+variable with an empty name, which is illegal. |
67 |
+ |
68 |
+The patch fixes this mechanism for FreeBSD and NetBSD, and gives an |
69 |
+warning on other platforms, so that the latecomers don't have to spend |
70 |
+time on debugging lit. |
71 |
+ |
72 |
+Thanks Zhihao Yuan for the patch! |
73 |
+ |
74 |
+Differential Revision: https://reviews.llvm.org/D39162 |
75 |
+ |
76 |
+git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@316411 91177308-0d34-0410-b5e6-96231b3b80d8 |
77 |
+ |
78 |
+(rebased for release_50 branch) |
79 |
+--- |
80 |
+ test/Unit/lit.cfg | 41 ++++++++++++++++++++--------------------- |
81 |
+ 1 file changed, 20 insertions(+), 21 deletions(-) |
82 |
+ |
83 |
+diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg |
84 |
+index 90eb2ac604..2cabf4bba1 100644 |
85 |
+--- a/test/Unit/lit.cfg |
86 |
++++ b/test/Unit/lit.cfg |
87 |
+@@ -87,24 +87,23 @@ if config.test_exec_root is None: |
88 |
+ lit_config.load_config(config, site_cfg) |
89 |
+ raise SystemExit |
90 |
+ |
91 |
+-shlibpath_var = '' |
92 |
+-if platform.system() == 'Linux': |
93 |
+- shlibpath_var = 'LD_LIBRARY_PATH' |
94 |
+-elif platform.system() == 'Darwin': |
95 |
+- shlibpath_var = 'DYLD_LIBRARY_PATH' |
96 |
+-elif platform.system() == 'Windows': |
97 |
+- shlibpath_var = 'PATH' |
98 |
+- |
99 |
+-# in stand-alone builds, shlibdir is clang's build tree |
100 |
+-# while llvm_libs_dir is installed LLVM (and possibly older clang) |
101 |
+-llvm_shlib_dir = getattr(config, 'shlibdir', None) |
102 |
+-if not llvm_shlib_dir: |
103 |
+- lit_config.fatal('No shlibdir set!') |
104 |
+-# Point the dynamic loader at dynamic libraries in 'lib'. |
105 |
+-llvm_libs_dir = getattr(config, 'llvm_libs_dir', None) |
106 |
+-if not llvm_libs_dir: |
107 |
+- lit_config.fatal('No LLVM libs dir set!') |
108 |
+-shlibpath = os.path.pathsep.join((llvm_shlib_dir, llvm_libs_dir, |
109 |
+- config.environment.get(shlibpath_var,''))) |
110 |
+- |
111 |
+-config.environment[shlibpath_var] = shlibpath |
112 |
++def find_shlibpath_var(): |
113 |
++ if platform.system() in ['Linux', 'FreeBSD', 'NetBSD']: |
114 |
++ yield 'LD_LIBRARY_PATH' |
115 |
++ elif platform.system() == 'Darwin': |
116 |
++ yield 'DYLD_LIBRARY_PATH' |
117 |
++ elif platform.system() == 'Windows': |
118 |
++ yield 'PATH' |
119 |
++ |
120 |
++for shlibpath_var in find_shlibpath_var(): |
121 |
++ # in stand-alone builds, shlibdir is clang's build tree |
122 |
++ # while llvm_libs_dir is installed LLVM (and possibly older clang) |
123 |
++ shlibpath = os.path.pathsep.join( |
124 |
++ (config.shlibdir, |
125 |
++ config.llvm_libs_dir, |
126 |
++ config.environment.get(shlibpath_var, ''))) |
127 |
++ config.environment[shlibpath_var] = shlibpath |
128 |
++ break |
129 |
++else: |
130 |
++ lit_config.warning("unable to inject shared library path on '{}'" |
131 |
++ .format(platform.system())) |
132 |
+-- |
133 |
+2.17.0.rc2 |
134 |
+ |
135 |
|
136 |
diff --git a/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch b/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch |
137 |
new file mode 100644 |
138 |
index 00000000000..cbdb0b807aa |
139 |
--- /dev/null |
140 |
+++ b/sys-devel/clang/files/5.0.1/extra/0001-Assume-the-shared-library-path-variable-is-LD_LIBRAR.patch |
141 |
@@ -0,0 +1,37 @@ |
142 |
+From 5c5bb3948697f2ca184a03dedd5666eb2de547ba Mon Sep 17 00:00:00 2001 |
143 |
+From: Dimitry Andric <dimitry@××××××.com> |
144 |
+Date: Sat, 20 Jan 2018 14:34:33 +0000 |
145 |
+Subject: [PATCH] Assume the shared library path variable is LD_LIBRARY_PATH on |
146 |
+ systems except Darwin and Windows. This prevents inserting an environment |
147 |
+ variable with an empty name (which is illegal and leads to a Python |
148 |
+ exception) on any of the BSDs. |
149 |
+ |
150 |
+git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@323040 91177308-0d34-0410-b5e6-96231b3b80d8 |
151 |
+--- |
152 |
+ test/Unit/lit.cfg | 7 +++---- |
153 |
+ 1 file changed, 3 insertions(+), 4 deletions(-) |
154 |
+ |
155 |
+diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg |
156 |
+index fc63afdb..b40e1cae 100644 |
157 |
+--- a/test/Unit/lit.cfg |
158 |
++++ b/test/Unit/lit.cfg |
159 |
+@@ -19,13 +19,12 @@ config.test_exec_root = config.test_source_root |
160 |
+ # ;-separated list of subdirectories). |
161 |
+ config.test_format = lit.formats.GoogleTest('.', 'Tests') |
162 |
+ |
163 |
+-shlibpath_var = '' |
164 |
+-if platform.system() == 'Linux': |
165 |
+- shlibpath_var = 'LD_LIBRARY_PATH' |
166 |
+-elif platform.system() == 'Darwin': |
167 |
++if platform.system() == 'Darwin': |
168 |
+ shlibpath_var = 'DYLD_LIBRARY_PATH' |
169 |
+ elif platform.system() == 'Windows': |
170 |
+ shlibpath_var = 'PATH' |
171 |
++else: |
172 |
++ shlibpath_var = 'LD_LIBRARY_PATH' |
173 |
+ |
174 |
+ # Point the dynamic loader at dynamic libraries in 'lib'. |
175 |
+ shlibpath = os.path.pathsep.join((config.shlibdir, config.llvm_libs_dir, |
176 |
+-- |
177 |
+2.17.0.rc2 |
178 |
+ |