dev-lang/swift: set LLDB to respect PYTHON_SINGLE_TARGET

Closes: https://bugs.gentoo.org/939685
Signed-off-by: Itai Ferber <itai@itaiferber.net>
This commit is contained in:
Itai Ferber
2024-09-15 19:49:12 -04:00
parent bf4e72001e
commit c9dfaf59e3
2 changed files with 30 additions and 2 deletions

View File

@@ -0,0 +1,15 @@
# The LLDB Python bindings rely on CMake to find Python, and by default, CMake
# tries to use the newest Python version found on disk. To get CMake to respect
# the version of Python set up by `python_setup`, we to set
# `-DPython3_FIND_UNVERSIONED_NAMES=FIRST`, which is only available from CMake
# 3.20. (Even if the `cmake` executable is a newer version, it still relies on
# `cmake_minimum_required` for feature testing.)
--- a/llvm-project/lldb/CMakeLists.txt
+++ b/llvm-project/lldb/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13.4)
+cmake_minimum_required(VERSION 3.20)
# Add path for custom modules.
set(CMAKE_MODULE_PATH

View File

@@ -51,6 +51,7 @@ SRC_URI="
PATCHES=(
"${FILESDIR}/${P}-link-with-lld.patch"
"${FILESDIR}/${P}-llbuild-link-ncurses-tinfo-gentoo.patch"
"${FILESDIR}/${P}-lldb-cmake-minimum-version.patch"
)
S="${WORKDIR}"
@@ -119,7 +120,8 @@ src_unpack() {
src_configure() {
default
# Necessary to respect PYTHON_SINGLE_TARGET, if defined.
# Sets `${EPYTHON}` according to `PYTHON_SINGLE_TARGET`, sets up
# `${T}/${EPYTHON}` with that version, and adds it to the `PATH`.
python_setup
}
@@ -159,7 +161,18 @@ src_compile() {
# The Clang `compiler-rt` library builds the LLVM ORC JIT component by
# default, which we don't need; the component builds with an executable
# stack, which we'd like to avoid.
'-DCOMPILER_RT_BUILD_ORC:BOOL=NO'
'-DCOMPILER_RT_BUILD_ORC:BOOL=NO',
# LLDB ships with Python bindings, and uses CMake to search for Python.
# By default, CMake tries to find the latest version of Python available
# on disk (currently `python3.13`, then `python3.12`, then...). This
# might not be the version of Python the rest of the system uses, or
# which is specified by `PYTHON_SINGLE_TARGET`.
#
# Since `python_setup` already places `${EPYTHON}` in the `PATH`, we can
# tell CMake to use the unversioned `python` rather than a versioned
# one to end up respecting `PYTHON_SINGLE_TARGET`.
'-DPython3_FIND_UNVERSIONED_NAMES=FIRST'
)
local extra_cmake_options="$(IFS=,; echo "${_extra_cmake_options[*]}")"