summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Floyd <cognifloyd@gmail.com>2020-12-20 16:03:21 -0600
committerFabian Groffen <grobian@gentoo.org>2020-12-27 10:49:33 +0100
commit597a22dec78d405170e09ec9f971d5146e0bfadf (patch)
tree01fb5113b7f6a5a069fac412d99dc746f920d0c6 /sys-libs/compiler-rt-sanitizers
parentsys-libs/compiler-rt: Fix Darwin prefix paths (diff)
downloadgentoo-597a22dec78d405170e09ec9f971d5146e0bfadf.tar.gz
gentoo-597a22dec78d405170e09ec9f971d5146e0bfadf.tar.bz2
gentoo-597a22dec78d405170e09ec9f971d5146e0bfadf.zip
sys-libs/compiler-rt-sanitizers: Fix Darwin prefix paths
Gentoo Prefix does not follow standard Apple practice of using --sysroot or --isysroot on everything because we have to account for two "root"s. 1) EPREFIX is "root" 2) EPREFIX/MacOSX.sdk is also sysroot as it provides system headers. So, adjust sys-libs/compiler-rt-sanitizers to prevent them from adding the sysroot flags on Darwin. Also adjust some CMAKE args to ensure it is using EPREFIX/MacOSX.sdk instead of looking things up with xcrun. Bug: https://bugs.gentoo.org/758167 Signed-off-by: Jacob Floyd <cognifloyd@gmail.com> Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'sys-libs/compiler-rt-sanitizers')
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.0.ebuild15
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1.9999.ebuild15
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc1.ebuild15
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-11.0.1_rc2.ebuild15
-rw-r--r--sys-libs/compiler-rt-sanitizers/compiler-rt-sanitizers-12.0.0.9999.ebuild15
-rw-r--r--sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch79
6 files changed, 144 insertions, 10 deletions
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
index 24deafb66665..f767718861ce 100644
--- 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
@@ -35,6 +35,10 @@ BDEPEND="
sys-libs/compiler-rt:${SLOT} )
${PYTHON_DEPS}"
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
python_check_deps() {
use test || return 0
has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -110,8 +114,15 @@ src_configure() {
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
mycmakeargs+=(
- # disable use of SDK for the system itself
- -DDARWIN_macosx_CACHED_SYSROOT=/
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+ # this allows adding arm64 support using SDK in EPREFIX
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+ # Set version based on the SDK in EPREFIX
+ # This disables i386 for SDK >= 10.15
+ # Will error while building tsan if SDK < 10.12
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+ # Use our libtool instead of looking it up with xcrun
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
)
fi
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
index 81547ee16054..14dbd46a8dbc 100644
--- 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
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
python_check_deps() {
use test || return 0
has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -145,8 +149,15 @@ src_configure() {
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
mycmakeargs+=(
- # disable use of SDK for the system itself
- -DDARWIN_macosx_CACHED_SYSROOT=/
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+ # this allows adding arm64 support using SDK in EPREFIX
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+ # Set version based on the SDK in EPREFIX
+ # This disables i386 for SDK >= 10.15
+ # Will error if has_use tsan and SDK < 10.12
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+ # Use our libtool instead of looking it up with xcrun
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
)
fi
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
index 1e3a849c675a..cc4d0af346b9 100644
--- 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
@@ -37,6 +37,10 @@ LLVM_COMPONENTS=( compiler-rt )
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
python_check_deps() {
use test || return 0
has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -112,8 +116,15 @@ src_configure() {
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
mycmakeargs+=(
- # disable use of SDK for the system itself
- -DDARWIN_macosx_CACHED_SYSROOT=/
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+ # this allows adding arm64 support using SDK in EPREFIX
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+ # Set version based on the SDK in EPREFIX
+ # This disables i386 for SDK >= 10.15
+ # Will error if has_use tsan and SDK < 10.12
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+ # Use our libtool instead of looking it up with xcrun
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
)
fi
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
index f5ea6f732f74..938e4e371e8d 100644
--- 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
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
python_check_deps() {
use test || return 0
has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -149,8 +153,15 @@ src_configure() {
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
mycmakeargs+=(
- # disable use of SDK for the system itself
- -DDARWIN_macosx_CACHED_SYSROOT=/
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+ # this allows adding arm64 support using SDK in EPREFIX
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+ # Set version based on the SDK in EPREFIX
+ # This disables i386 for SDK >= 10.15
+ # Will error if has_use tsan and SDK < 10.12
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+ # Use our libtool instead of looking it up with xcrun
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
)
fi
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
index 81547ee16054..14dbd46a8dbc 100644
--- 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
@@ -48,6 +48,10 @@ LLVM_COMPONENTS=( compiler-rt )
LLVM_TEST_COMPONENTS=( llvm/lib/Testing/Support llvm/utils/unittest )
llvm.org_set_globals
+PATCHES=(
+ "${FILESDIR}/9999/compiler-rt-prefix-paths.patch"
+)
+
python_check_deps() {
use test || return 0
has_version "dev-python/lit[${PYTHON_USEDEP}]"
@@ -145,8 +149,15 @@ src_configure() {
if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
mycmakeargs+=(
- # disable use of SDK for the system itself
- -DDARWIN_macosx_CACHED_SYSROOT=/
+ # setting -isysroot is disabled with compiler-rt-prefix-paths.patch
+ # this allows adding arm64 support using SDK in EPREFIX
+ -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+ # Set version based on the SDK in EPREFIX
+ # This disables i386 for SDK >= 10.15
+ # Will error if has_use tsan and SDK < 10.12
+ -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath ${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+ # Use our libtool instead of looking it up with xcrun
+ -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
)
fi
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
new file mode 100644
index 000000000000..c27e3c44f684
--- /dev/null
+++ b/sys-libs/compiler-rt-sanitizers/files/9999/compiler-rt-prefix-paths.patch
@@ -0,0 +1,79 @@
+--- a/compiler-rt/cmake/config-ix.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/config-ix.cmake 2020-12-13 16:17:43.000000000 -0600
+@@ -424,10 +424,7 @@
+ ${DARWIN_COMMON_LINK_FLAGS}
+ ${DARWIN_osx_MIN_VER_FLAG}=${SANITIZER_MIN_OSX_VERSION})
+
+- if(DARWIN_osx_SYSROOT)
+- list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
+- list(APPEND DARWIN_osx_LINK_FLAGS -isysroot ${DARWIN_osx_SYSROOT})
+- endif()
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
+
+ # Figure out which arches to use for each OS
+ darwin_get_toolchain_supported_archs(toolchain_arches)
+--- a/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:17:13.000000000 -0600
++++ b/compiler-rt/cmake/base-config-ix.cmake 2020-12-13 16:18:59.000000000 -0600
+@@ -102,23 +102,8 @@
+ endif()
+
+ if(APPLE)
+- # On Darwin if /usr/include/c++ doesn't exist, the user probably has Xcode but
+- # not the command line tools (or is using macOS 10.14 or newer). If this is
+- # the case, we need to find the OS X sysroot to pass to clang.
+- if(NOT EXISTS /usr/include/c++)
+- execute_process(COMMAND xcrun -sdk macosx --show-sdk-path
+- OUTPUT_VARIABLE OSX_SYSROOT
+- ERROR_QUIET
+- OUTPUT_STRIP_TRAILING_WHITESPACE)
+- if (NOT OSX_SYSROOT OR NOT EXISTS ${OSX_SYSROOT})
+- message(WARNING "Detected OSX_SYSROOT ${OSX_SYSROOT} does not exist")
+- else()
+- message(STATUS "Found OSX_SYSROOT: ${OSX_SYSROOT}")
+- set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
+- endif()
+- else()
+- set(OSX_SYSROOT_FLAG "")
+- endif()
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++ set(OSX_SYSROOT_FLAG "")
+
+ option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
+ option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
+--- a/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/CompilerRTDarwinUtils.cmake 2020-12-13 16:21:32.000000000 -0600
+@@ -273,7 +273,8 @@
+ ${ARGN})
+ set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
+ add_library(${libname} STATIC ${LIB_SOURCES})
+- if(DARWIN_${LIB_OS}_SYSROOT)
++ # Do not add -isysroot flag on Gentoo Prefix (search paths handled by cmake)
++ if(DARWIN_${LIB_OS}_SYSROOT AND NOT "${LIB_OS}" STREQUAL "osx")
+ set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
+ endif()
+
+--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-10-07 05:10:48.000000000 -0500
++++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake 2020-12-13 18:12:27.000000000 -0600
+@@ -277,9 +277,10 @@
+ if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
+ list(APPEND extra_cflags_${libname} "--target=${CMAKE_C_COMPILER_TARGET}")
+ endif()
++ # Do not add --sysroot flag on Gentoo Prefix (search paths handled by cmake)
+- if(CMAKE_SYSROOT)
++ if(CMAKE_SYSROOT AND NOT APPLE)
+ list(APPEND extra_cflags_${libname} "--sysroot=${CMAKE_SYSROOT}")
+ endif()
+ string(REPLACE ";" " " extra_cflags_${libname} "${extra_cflags_${libname}}")
+ string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
+ ${CMAKE_C_COMPILE_OBJECT})
+--- a/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:02.000000000 -0600
++++ b/compiler-rt/lib/tsan/CMakeLists.txt 2020-12-13 19:42:38.000000000 -0600
+@@ -244,6 +244,7 @@
+ # and Clang's versions. As a workaround do not use --sysroot=. on FreeBSD/NetBSD
+ # until this is addressed.
+ if(COMPILER_RT_HAS_SYSROOT_FLAG AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
++ AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin"
+ AND NOT CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+ file(GLOB _tsan_generic_sources rtl/tsan*)
+ file(GLOB _tsan_platform_sources rtl/tsan*posix* rtl/tsan*mac*
+