commit: 3732e5b0cbdb990e57172a660c5c297f9ae2dad9 Author: idealseal <realidealseal <AT> protonmail <DOT> com> AuthorDate: Wed Mar 26 18:23:13 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Fri Mar 28 15:07:55 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3732e5b0
app-shells/fish: sync live ebuild, 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> Closes: https://github.com/gentoo/gentoo/pull/41068 Signed-off-by: Sam James <sam <AT> gentoo.org> .../fish-9999-use-cargo-eclass-for-build.patch | 46 ++++++++++++++++++++++ app-shells/fish/fish-9999.ebuild | 13 ++---- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/app-shells/fish/files/fish-9999-use-cargo-eclass-for-build.patch b/app-shells/fish/files/fish-9999-use-cargo-eclass-for-build.patch new file mode 100644 index 000000000000..f20510a54bd8 --- /dev/null +++ b/app-shells/fish/files/fish-9999-use-cargo-eclass-for-build.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0510cd2d7..c49f80d69 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,17 +41,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 c5bb1b1b3..618b47183 100644 +--- a/cmake/Rust.cmake ++++ b/cmake/Rust.cmake +@@ -5,7 +5,7 @@ set(Rust_RESOLVE_RUSTUP_TOOLCHAINS Off) + include(FindRust) + find_package(Rust 1.70 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 propagate CMake flags/options to build.rs. We need to get CMake to evaluate the diff --git a/app-shells/fish/fish-9999.ebuild b/app-shells/fish/fish-9999.ebuild index 6912899db052..43f063210450 100644 --- a/app-shells/fish/fish-9999.ebuild +++ b/app-shells/fish/fish-9999.ebuild @@ -50,6 +50,10 @@ BDEPEND=" # Release tarballs contain prebuilt documentation. [[ ${PV} == 9999 ]] && BDEPEND+=" doc? ( dev-python/sphinx )" +PATCHES=( + "${FILESDIR}/${PN}-9999-use-cargo-eclass-for-build.patch" +) + QA_FLAGS_IGNORED="usr/bin/.*" python_check_deps() { @@ -101,14 +105,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() { @@ -129,7 +125,6 @@ src_test() { # Enable colored output for building tests. local -x CARGO_TERM_COLOR=always - # TODO: Figure out why we link again. cargo_env cmake_build fish_run_tests }
