commit: c9dfaf59e30a6e3d6bb138eb47d1fa8d03c19d51 Author: Itai Ferber <itai <AT> itaiferber <DOT> net> AuthorDate: Sun Sep 15 23:49:12 2024 +0000 Commit: Itai Ferber <itai <AT> itaiferber <DOT> net> CommitDate: Sun Sep 15 23:50:13 2024 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c9dfaf59
dev-lang/swift: set LLDB to respect PYTHON_SINGLE_TARGET Closes: https://bugs.gentoo.org/939685 Signed-off-by: Itai Ferber <itai <AT> itaiferber.net> .../files/swift-5.10.1-lldb-cmake-minimum-version.patch | 15 +++++++++++++++ dev-lang/swift/swift-5.10.1.ebuild | 17 +++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch b/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch new file mode 100644 index 000000000..1e29f956c --- /dev/null +++ b/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch @@ -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 diff --git a/dev-lang/swift/swift-5.10.1.ebuild b/dev-lang/swift/swift-5.10.1.ebuild index dc70e51ae..29980b12b 100644 --- a/dev-lang/swift/swift-5.10.1.ebuild +++ b/dev-lang/swift/swift-5.10.1.ebuild @@ -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[*]}")"