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