1 |
commit: 597a22dec78d405170e09ec9f971d5146e0bfadf |
2 |
Author: Jacob Floyd <cognifloyd <AT> gmail <DOT> com> |
3 |
AuthorDate: Sun Dec 20 22:03:21 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 27 09:49:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=597a22de |
7 |
|
8 |
sys-libs/compiler-rt-sanitizers: Fix Darwin prefix paths |
9 |
|
10 |
Gentoo Prefix does not follow standard Apple practice of using --sysroot |
11 |
or --isysroot on everything because we have to account for two "root"s. |
12 |
1) EPREFIX is "root" |
13 |
2) EPREFIX/MacOSX.sdk is also sysroot as it provides system headers. |
14 |
|
15 |
So, adjust sys-libs/compiler-rt-sanitizers to prevent them from adding |
16 |
the sysroot flags on Darwin. |
17 |
|
18 |
Also adjust some CMAKE args to ensure it is using EPREFIX/MacOSX.sdk |
19 |
instead of looking things up with xcrun. |
20 |
|
21 |
Bug: https://bugs.gentoo.org/758167 |
22 |
Signed-off-by: Jacob Floyd <cognifloyd <AT> gmail.com> |
23 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
24 |
|
25 |
.../compiler-rt-sanitizers-11.0.0.ebuild | 15 +++- |
26 |
.../compiler-rt-sanitizers-11.0.1.9999.ebuild | 15 +++- |
27 |
.../compiler-rt-sanitizers-11.0.1_rc1.ebuild | 15 +++- |
28 |
.../compiler-rt-sanitizers-11.0.1_rc2.ebuild | 15 +++- |
29 |
.../compiler-rt-sanitizers-12.0.0.9999.ebuild | 15 +++- |
30 |
.../files/9999/compiler-rt-prefix-paths.patch | 79 ++++++++++++++++++++++ |
31 |
6 files changed, 144 insertions(+), 10 deletions(-) |
32 |
|
33 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild |
34 |
index 24deafb6666..f767718861c 100644 |
35 |
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild |
36 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild |
37 |
@@ -35,6 +35,10 @@ BDEPEND=" |
38 |
sys-libs/compiler-rt:${SLOT} ) |
39 |
${PYTHON_DEPS}" |
40 |
|
41 |
+PATCHES=( |
42 |
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch" |
43 |
+) |
44 |
+ |
45 |
python_check_deps() { |
46 |
use test || return 0 |
47 |
has_version "dev-python/lit[${PYTHON_USEDEP}]" |
48 |
@@ -110,8 +114,15 @@ src_configure() { |
49 |
|
50 |
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
51 |
mycmakeargs+=( |
52 |
- # disable use of SDK for the system itself |
53 |
- -DDARWIN_macosx_CACHED_SYSROOT=/ |
54 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
55 |
+ # this allows adding arm64 support using SDK in EPREFIX |
56 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
57 |
+ # Set version based on the SDK in EPREFIX |
58 |
+ # This disables i386 for SDK >= 10.15 |
59 |
+ # Will error while building tsan if SDK < 10.12 |
60 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
61 |
+ # Use our libtool instead of looking it up with xcrun |
62 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
63 |
) |
64 |
fi |
65 |
|
66 |
|
67 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild |
68 |
index 81547ee1605..14dbd46a8db 100644 |
69 |
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild |
70 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild |
71 |
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt ) |
72 |
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest ) |
73 |
llvm.org_set_globals |
74 |
|
75 |
+PATCHES=( |
76 |
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch" |
77 |
+) |
78 |
+ |
79 |
python_check_deps() { |
80 |
use test || return 0 |
81 |
has_version "dev-python/lit[${PYTHON_USEDEP}]" |
82 |
@@ -145,8 +149,15 @@ src_configure() { |
83 |
|
84 |
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
85 |
mycmakeargs+=( |
86 |
- # disable use of SDK for the system itself |
87 |
- -DDARWIN_macosx_CACHED_SYSROOT=/ |
88 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
89 |
+ # this allows adding arm64 support using SDK in EPREFIX |
90 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
91 |
+ # Set version based on the SDK in EPREFIX |
92 |
+ # This disables i386 for SDK >= 10.15 |
93 |
+ # Will error if has_use tsan and SDK < 10.12 |
94 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
95 |
+ # Use our libtool instead of looking it up with xcrun |
96 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
97 |
) |
98 |
fi |
99 |
|
100 |
|
101 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild |
102 |
index 1e3a849c675..cc4d0af346b 100644 |
103 |
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild |
104 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild |
105 |
@@ -37,6 +37,10 @@ LLVM_COMPONENTS=( compiler-rt ) |
106 |
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest ) |
107 |
llvm.org_set_globals |
108 |
|
109 |
+PATCHES=( |
110 |
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch" |
111 |
+) |
112 |
+ |
113 |
python_check_deps() { |
114 |
use test || return 0 |
115 |
has_version "dev-python/lit[${PYTHON_USEDEP}]" |
116 |
@@ -112,8 +116,15 @@ src_configure() { |
117 |
|
118 |
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
119 |
mycmakeargs+=( |
120 |
- # disable use of SDK for the system itself |
121 |
- -DDARWIN_macosx_CACHED_SYSROOT=/ |
122 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
123 |
+ # this allows adding arm64 support using SDK in EPREFIX |
124 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
125 |
+ # Set version based on the SDK in EPREFIX |
126 |
+ # This disables i386 for SDK >= 10.15 |
127 |
+ # Will error if has_use tsan and SDK < 10.12 |
128 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
129 |
+ # Use our libtool instead of looking it up with xcrun |
130 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
131 |
) |
132 |
fi |
133 |
|
134 |
|
135 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild |
136 |
index f5ea6f732f7..938e4e371e8 100644 |
137 |
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild |
138 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild |
139 |
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt ) |
140 |
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest ) |
141 |
llvm.org_set_globals |
142 |
|
143 |
+PATCHES=( |
144 |
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch" |
145 |
+) |
146 |
+ |
147 |
python_check_deps() { |
148 |
use test || return 0 |
149 |
has_version "dev-python/lit[${PYTHON_USEDEP}]" |
150 |
@@ -149,8 +153,15 @@ src_configure() { |
151 |
|
152 |
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
153 |
mycmakeargs+=( |
154 |
- # disable use of SDK for the system itself |
155 |
- -DDARWIN_macosx_CACHED_SYSROOT=/ |
156 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
157 |
+ # this allows adding arm64 support using SDK in EPREFIX |
158 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
159 |
+ # Set version based on the SDK in EPREFIX |
160 |
+ # This disables i386 for SDK >= 10.15 |
161 |
+ # Will error if has_use tsan and SDK < 10.12 |
162 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
163 |
+ # Use our libtool instead of looking it up with xcrun |
164 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
165 |
) |
166 |
fi |
167 |
|
168 |
|
169 |
diff --git a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild |
170 |
index 81547ee1605..14dbd46a8db 100644 |
171 |
--- a/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild |
172 |
+++ b/sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild |
173 |
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt ) |
174 |
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest ) |
175 |
llvm.org_set_globals |
176 |
|
177 |
+PATCHES=( |
178 |
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch" |
179 |
+) |
180 |
+ |
181 |
python_check_deps() { |
182 |
use test || return 0 |
183 |
has_version "dev-python/lit[${PYTHON_USEDEP}]" |
184 |
@@ -145,8 +149,15 @@ src_configure() { |
185 |
|
186 |
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then |
187 |
mycmakeargs+=( |
188 |
- # disable use of SDK for the system itself |
189 |
- -DDARWIN_macosx_CACHED_SYSROOT=/ |
190 |
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch |
191 |
+ # this allows adding arm64 support using SDK in EPREFIX |
192 |
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk" |
193 |
+ # Set version based on the SDK in EPREFIX |
194 |
+ # This disables i386 for SDK >= 10.15 |
195 |
+ # Will error if has_use tsan and SDK < 10.12 |
196 |
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')" |
197 |
+ # Use our libtool instead of looking it up with xcrun |
198 |
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool" |
199 |
) |
200 |
fi |
201 |
|
202 |
|
203 |
diff --git a/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch |
204 |
new file mode 100644 |
205 |
index 00000000000..c27e3c44f68 |
206 |
--- /dev/null |
207 |
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch |
208 |
@@ -0,0 +1,79 @@ |
209 |
+--- a/compiler-rt/cmake/config-ix.cmake 2020-10-07 05:10:48.000000000 -0500 |
210 |
++++ b/compiler-rt/cmake/config-ix.cmake 2020-12-13 16:17:43.000000000 -0600 |
211 |
+@@ -424,10 +424,7 @@ |
212 |
+ ${DARWIN_COMMON_LINK_FLAGS} |
213 |
+ ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION}) |
214 |
+ |
215 |
+- if(DARWIN_osx_SYSROOT) |
216 |
+- list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT}) |
217 |
+- list(APPEND DARWIN_osx_LINK_FLAGS -isysroot ${DARWIN_osx_SYSROOT}) |
218 |
+- endif() |
219 |
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake) |
220 |
+ |
221 |
+ # Figure out which arches to use for each OS |
222 |
+ darwin_get_toolchain_supported_archs(toolchain_arches) |
223 |
+--- a/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:17:13.000000000 -0600 |
224 |
++++ b/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:18:59.000000000 -0600 |
225 |
+@@ -102,23 +102,8 @@ |
226 |
+ endif() |
227 |
+ |
228 |
+ if(APPLE) |
229 |
+- # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but |
230 |
+- # not the command line tools (or is using macOS 10.14 or newer). If this is |
231 |
+- # the case, we need to find the OS X sysroot to pass to clang. |
232 |
+- if(NOT EXISTS /usr/include/c++) |
233 |
+- execute_process(COMMAND xcrun -sdk macosx --show-sdk-path |
234 |
+- OUTPUT_VARIABLE OSX_SYSROOT |
235 |
+- ERROR_QUIET |
236 |
+- OUTPUT_STRIP_TRAILING_WHITESPACE) |
237 |
+- if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT}) |
238 |
+- message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist") |
239 |
+- else() |
240 |
+- message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}") |
241 |
+- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}") |
242 |
+- endif() |
243 |
+- else() |
244 |
+- set(OSX_SYSROOT_FLAG "") |
245 |
+- endif() |
246 |
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake) |
247 |
++ set(OSX_SYSROOT_FLAG "") |
248 |
+ |
249 |
+ option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On) |
250 |
+ option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off) |
251 |
+--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-10-07 05:10:48.000000000 -0500 |
252 |
++++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-12-13 16:21:32.000000000 -0600 |
253 |
+@@ -273,7 +273,8 @@ |
254 |
+ ${ARGN}) |
255 |
+ set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}") |
256 |
+ add_library(${libname} STATIC ${LIB_SOURCES}) |
257 |
+- if(DARWIN_${LIB_OS}_SYSROOT) |
258 |
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake) |
259 |
++ if(DARWIN_${LIB_OS}_SYSROOT AND NOT "${LIB_OS}" STREQUAL "osx") |
260 |
+ set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT}) |
261 |
+ endif() |
262 |
+ |
263 |
+--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-10-07 05:10:48.000000000 -0500 |
264 |
++++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-12-13 18:12:27.000000000 -0600 |
265 |
+@@ -277,9 +277,10 @@ |
266 |
+ if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET) |
267 |
+ list(APPEND extra_cflags_${libname} "--target=${CMAKE_C_COMPILER_TARGET}") |
268 |
+ endif() |
269 |
++ # Do not add --sysroot flag on Gentoo Prefix (search paths handled by cmake) |
270 |
+- if(CMAKE_SYSROOT) |
271 |
++ if(CMAKE_SYSROOT AND NOT APPLE) |
272 |
+ list(APPEND extra_cflags_${libname} "--sysroot=${CMAKE_SYSROOT}") |
273 |
+ endif() |
274 |
+ string(REPLACE ";" " " extra_cflags_${libname} "${extra_cflags_${libname}}") |
275 |
+ string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions |
276 |
+ ${CMAKE_C_COMPILE_OBJECT}) |
277 |
+--- a/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:02.000000000 -0600 |
278 |
++++ b/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:38.000000000 -0600 |
279 |
+@@ -244,6 +244,7 @@ |
280 |
+ # and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD |
281 |
+ # until this is addressed. |
282 |
+ if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" |
283 |
++ AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" |
284 |
+ AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD") |
285 |
+ file(GLOB _tsan_generic_sources rtl/tsan*) |
286 |
+ file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac* |
287 |
+ |