commit: ba26d86a4688e913386828b90d43c76822dbeddf
Author: idealseal <realidealseal <AT> protonmail <DOT> com>
AuthorDate: Wed Mar 26 17:56:57 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 28 15:07:54 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba26d86a
app-shells/fish: fix link failure with gcc
This happens when we rebuild the code with Fish's CMake wrapper (we need
that to install auxilary files and run test), since cargo.eclass and
Fish's build system put the target executables in different output
directories.
First we patch CMake so that it doesn't even try to execute cargo for
it's targets and just retain the target to copy the executables over into
the CMake build directory.
Also we need to set the cargo output directory in the CMake scripts to
point to the target directory of cargo.eclass so it reuses the already
build binaries.
And since Fish sometimes uses a custom cargo build profile which alters
the target directory in a way not handled by cargo.eclass we remove that
as well.
Signed-off-by: idealseal <realidealseal <AT> protonmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../fish-4.0.1-use-cargo-eclass-for-build.patch | 46 ++++++++++++++++++++++
app-shells/fish/fish-4.0.1.ebuild | 12 ++----
2 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/app-shells/fish/files/fish-4.0.1-use-cargo-eclass-for-build.patch
b/app-shells/fish/files/fish-4.0.1-use-cargo-eclass-for-build.patch
new file mode 100644
index 000000000000..3f2bf9c6ec40
--- /dev/null
+++ b/app-shells/fish/files/fish-4.0.1-use-cargo-eclass-for-build.patch
@@ -0,0 +1,46 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 496226e89..cb032d6d5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -51,17 +51,6 @@ function(CREATE_TARGET target)
+ add_custom_target(
+ ${target} ALL
+ COMMAND
+- "${CMAKE_COMMAND}" -E
+- env ${VARS_FOR_CARGO}
+- ${Rust_CARGO}
+- build --bin ${target}
+- $<$<CONFIG:Release>:--release>
+- $<$<CONFIG:RelWithDebInfo>:--profile=release-with-debug>
+- --target ${Rust_CARGO_TARGET}
+- --no-default-features
+- ${CARGO_FLAGS}
+- ${FEATURES_ARG}
+- &&
+ "${CMAKE_COMMAND}" -E
+ copy "${rust_target_dir}/${rust_profile}/${target}"
"${CMAKE_CURRENT_BINARY_DIR}"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+diff --git a/cmake/Rust.cmake b/cmake/Rust.cmake
+index 40887be45..fa0f7ab6f 100644
+--- a/cmake/Rust.cmake
++++ b/cmake/Rust.cmake
+@@ -5,7 +5,7 @@ set(Rust_RESOLVE_RUSTUP_TOOLCHAINS Off)
+ include(FindRust)
+ find_package(Rust REQUIRED)
+
+-set(FISH_RUST_BUILD_DIR "${CMAKE_BINARY_DIR}/cargo/build")
++set(FISH_RUST_BUILD_DIR "${CMAKE_SOURCE_DIR}/target")
+
+ if(DEFINED ASAN)
+ list(APPEND CARGO_FLAGS "-Z" "build-std")
+@@ -22,8 +22,8 @@ else()
+ set(rust_target_dir "${FISH_RUST_BUILD_DIR}/${Rust_CARGO_HOST_TARGET}")
+ endif()
+
+-set(rust_profile
$<IF:$<CONFIG:Debug>,debug,$<IF:$<CONFIG:RelWithDebInfo>,release-with-debug,release>>)
+-set(rust_debugflags "$<$<CONFIG:Debug>:-g>$<$<CONFIG:RelWithDebInfo>:-g>")
++set(rust_profile $<IF:$<CONFIG:Debug>,debug,release>)
++set(rust_debugflags "$<$<CONFIG:Debug>:-g>")
+
+
+ # Temporary hack to propogate CMake flags/options to build.rs. We need to get
CMake to evaluate the
diff --git a/app-shells/fish/fish-4.0.1.ebuild
b/app-shells/fish/fish-4.0.1.ebuild
index 38ea9817d238..8e85d81223a9 100644
--- a/app-shells/fish/fish-4.0.1.ebuild
+++ b/app-shells/fish/fish-4.0.1.ebuild
@@ -46,6 +46,10 @@ BDEPEND="
# Release tarballs contain prebuilt documentation.
[[ ${PV} == 9999 ]] && BDEPEND+=" doc? ( dev-python/sphinx )"
+PATCHES=(
+ "${FILESDIR}/${PN}-4.0.1-use-cargo-eclass-for-build.patch"
+)
+
QA_FLAGS_IGNORED="usr/bin/.*"
src_unpack() {
@@ -86,14 +90,6 @@ src_compile() {
fi
cargo_src_compile
-
- # Copy built binaries into the cmake build directory to mark the targets
- # up-to-date in cmake.
- for target in fish fish_indent fish_key_reader; do
- cp "$(cargo_target_dir)/${target}" "${BUILD_DIR}" || die
- done
-
- cmake_src_compile
}
src_test() {