From 20596288aee01a9b9abb50b29dda224812650092 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 18 Feb 2026 07:28:53 +0100 Subject: [PATCH] build_library/catalyst_toolchains: Copy binaries from sysroot too Any meson package now uses sysroot.eclass as a part of the cross-file creation and the eclass requires ld.so and ldd to be available in ${ROOT}/usr/bin, so copy over the bin and sbin directories too, just in case. Signed-off-by: Krzesimir Nowak --- build_library/catalyst_toolchains.sh | 36 +++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/build_library/catalyst_toolchains.sh b/build_library/catalyst_toolchains.sh index 92d6e93213..d1b032f79b 100644 --- a/build_library/catalyst_toolchains.sh +++ b/build_library/catalyst_toolchains.sh @@ -28,13 +28,37 @@ build_target_toolchain() { local ROOT="/build/${board}" local SYSROOT="/usr/$(get_board_chost "${board}")" - mkdir -p "${ROOT}/usr" - cp -at "${ROOT}" "${SYSROOT}"/lib* - cp -at "${ROOT}"/usr "${SYSROOT}"/usr/include "${SYSROOT}"/usr/lib* + function btt_emerge() { + # --root is required because run_merge overrides ROOT= + PORTAGE_CONFIGROOT="$ROOT" run_merge --root="$ROOT" --sysroot="$ROOT" "${@}" + } - # --root is required because run_merge overrides ROOT= - PORTAGE_CONFIGROOT="$ROOT" \ - run_merge -u --root="$ROOT" --sysroot="$ROOT" "${TOOLCHAIN_PKGS[@]}" + # install baselayout first so we have the basic directory + # structure for libraries and binaries copied from sysroot + btt_emerge --oneshot --nodeps sys-apps/baselayout + + # copy libraries, binaries and header files from sysroot to root - + # sysroot may be using split-usr, whereas root does not, so take + # this into account + ( + shopt -s nullglob + local d f + local -a files + for d in "${SYSROOT}"/{,usr/}{bin,sbin,lib*}; do + if [[ ! -d ${d} ]]; then + continue + fi + files=( "${d}"/* ) + if [[ ${#files[@]} -gt 0 ]]; then + f=${d##*/} + cp -at "${ROOT}/usr/${f}" "${files[@]}" + fi + done + cp -at "${ROOT}"/usr "${SYSROOT}"/usr/include + ) + + btt_emerge --update "${TOOLCHAIN_PKGS[@]}" + unset -f btt_emerge } configure_crossdev_overlay / /usr/local/portage/crossdev