From 6d4692b159033a35fe31ab8cbeba4248e8334b67 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Fri, 2 Aug 2024 16:13:39 +0100 Subject: [PATCH] sys-devel/sysroot-wrappers: Drop as Gentoo's gcc will handle sysroot It will patch gcc to respect ESYSROOT when cross-compiling, effectively adding the --sysroot flag without the use of flags or wrappers. This hasn't been merged into Gentoo yet, but it has been given the nod. When it does get merged, it was only be for newer gcc versions than we're currently using, so we'll need this user patch in the meantime regardless. Signed-off-by: James Le Cuirot --- build_library/toolchain_util.sh | 1 - ...ld => hard-host-depends-0.0.1-r210.ebuild} | 0 .../hard-host-depends-0.0.1.ebuild | 1 - .../cross-aarch64-cros-linux-gnu/gcc | 1 + .../cross-x86_64-cros-linux-gnu/gcc | 1 + .../user-patches/sys-devel/gcc/README.md | 4 ++++ .../sys-devel/gcc/gcc-esysroot.patch | 20 ++++++++++++++++++ .../profiles/coreos/base/profile.bashrc | 6 ------ .../sys-devel/sysroot-wrappers/Manifest | 1 - .../sys-devel/sysroot-wrappers/metadata.xml | 4 ---- .../sysroot-wrappers-0.2.ebuild | 15 ------------- .../sysroot-wrappers-9999.ebuild | 21 ------------------- update_chroot | 1 - 13 files changed, 26 insertions(+), 50 deletions(-) rename sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/{hard-host-depends-0.0.1-r209.ebuild => hard-host-depends-0.0.1-r210.ebuild} (100%) create mode 120000 sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-aarch64-cros-linux-gnu/gcc create mode 120000 sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-x86_64-cros-linux-gnu/gcc create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/README.md create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/gcc-esysroot.patch delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/Manifest delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/metadata.xml delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-0.2.ebuild delete mode 100644 sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-9999.ebuild diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index 65848e9130..2d8a9e8980 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -423,7 +423,6 @@ install_cross_toolchain() { # Setup environment and wrappers for our shiny new toolchain binutils_set_latest_profile "${cross_chost}" gcc_set_latest_profile "${cross_chost}" - "${sudo[@]}" CC_QUIET=1 sysroot-config --install-links "${cross_chost}" } # Build/install toolchain dependencies into the cross sysroot for a diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r209.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r210.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r209.ebuild rename to sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1-r210.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild index 64489799b2..e86c18075e 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/hard-host-depends/hard-host-depends-0.0.1.ebuild @@ -20,7 +20,6 @@ RDEPEND="${RDEPEND} dev-embedded/u-boot-tools !arm64? ( sys-boot/syslinux ) sys-devel/crossdev - sys-devel/sysroot-wrappers sys-fs/dosfstools " diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-aarch64-cros-linux-gnu/gcc b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-aarch64-cros-linux-gnu/gcc new file mode 120000 index 0000000000..c59b0e7dcd --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-aarch64-cros-linux-gnu/gcc @@ -0,0 +1 @@ +../sys-devel/gcc \ No newline at end of file diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-x86_64-cros-linux-gnu/gcc b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-x86_64-cros-linux-gnu/gcc new file mode 120000 index 0000000000..c59b0e7dcd --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/cross-x86_64-cros-linux-gnu/gcc @@ -0,0 +1 @@ +../sys-devel/gcc \ No newline at end of file diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/README.md b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/README.md new file mode 100644 index 0000000000..a1eeecf70f --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/README.md @@ -0,0 +1,4 @@ +The ESYSROOT patch is pending inclusion into Gentoo's gcc patch set. Once +merged, this will most likely be applied from 14.1 or 14.2 onwards. Check the +[GitHub pull request](https://github.com/gentoo/gcc-patches/pull/3) for the +current situation. diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/gcc-esysroot.patch b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/gcc-esysroot.patch new file mode 100644 index 0000000000..46117f12e7 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/user-patches/sys-devel/gcc/gcc-esysroot.patch @@ -0,0 +1,20 @@ +diff -Naur a/gcc/gcc.cc b/gcc/gcc.cc +--- a/gcc/gcc.cc 2024-08-01 23:34:33.525082176 +0100 ++++ b/gcc/gcc.cc 2024-08-01 23:43:31.557156041 +0100 +@@ -5527,6 +5527,16 @@ + "BINUTILS", PREFIX_PRIORITY_LAST, 0, 1); + free (tooldir_prefix); + ++ if (*cross_compile == '1' && !target_system_root_changed) ++ { ++ const char *esysroot = env.get("ESYSROOT"); ++ if (esysroot && esysroot[0] != '\0' && strcmp(esysroot, "/") != 0 && (!target_system_root || strcmp(esysroot, target_system_root) != 0)) ++ { ++ target_system_root = esysroot; ++ target_system_root_changed = 1; ++ } ++ } ++ + #if defined(TARGET_SYSTEM_ROOT_RELOCATABLE) && !defined(VMS) + /* If the normal TARGET_SYSTEM_ROOT is inside of $exec_prefix, + then consider it to relocate with the rest of the GCC installation diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc index 7abb2c7af0..06def4ad28 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/profile.bashrc @@ -110,12 +110,6 @@ cros_post_src_install_set_up_var_lib_selinux() { # Source hooks for SLSA build provenance report generation source "${BASH_SOURCE[0]}.slsa-provenance" -# Insert our sysroot wrappers into the path -SYSROOT_WRAPPERS_BIN="/usr/lib64/sysroot-wrappers/bin" -if [[ "$PATH" != *"$SYSROOT_WRAPPERS_BIN"* ]]; then - export PATH="$SYSROOT_WRAPPERS_BIN:$PATH" -fi - # Improve the chance that ccache is valid across versions by making all # paths under $S relative to $S, avoiding encoding the package version # contained in the path into __FILE__ expansions and debug info. diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/Manifest deleted file mode 100644 index 2cb182fa58..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/Manifest +++ /dev/null @@ -1 +0,0 @@ -DIST sysroot-wrappers-0.2.tar.gz 138063 BLAKE2B 04c5072fd48c0b931ea971aac4e242dc9a213429ebe03527cca5f4dd6c970eb15dee900c6e64d798a41fde48457c241e91ff8dcfbd678282bad390d5a7e07063 SHA512 bb27e2737ecde63bb877b75430c65b18e192b13671bb1a10d939694bff57412e59e51d4151aedf3ebf5f4d17e789a2f34ed1ab6506c20503c878b9c04efcfda6 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/metadata.xml b/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/metadata.xml deleted file mode 100644 index 097975e3ad..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/metadata.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-0.2.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-0.2.ebuild deleted file mode 100644 index 57e66703b2..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-0.2.ebuild +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) 2013 CoreOS Inc. All rights reserved. -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit autotools - -DESCRIPTION="Build tool wrappers for using custom SYSROOTs" -HOMEPAGE="https://github.com/flatcar/sysroot-wrappers" -SRC_URI="https://github.com/flatcar/${PN}/releases/download/v${PV}/${P}.tar.gz" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="amd64 arm64" -IUSE="" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-9999.ebuild deleted file mode 100644 index 2d6741f5a1..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/sys-devel/sysroot-wrappers/sysroot-wrappers-9999.ebuild +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013 CoreOS Inc. All rights reserved. -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit autotools git-r3 - -DESCRIPTION="Build tool wrappers for using custom SYSROOTs" -HOMEPAGE="https://github.com/coreos/sysroot-wrappers" -EGIT_REPO_URI="https://github.com/coreos/sysroot-wrappers" -SRC_URI="" - -LICENSE="GPL-3" -SLOT="0" -KEYWORDS="-*" -IUSE="" - -src_prepare() { - default - eautoreconf -} diff --git a/update_chroot b/update_chroot index 2a9cbeb321..be8190d260 100755 --- a/update_chroot +++ b/update_chroot @@ -211,7 +211,6 @@ info "Updating basic system packages" sudo -E ${EMERGE_CMD} "${EMERGE_FLAGS[@]}" \ sys-apps/portage \ sys-devel/crossdev \ - sys-devel/sysroot-wrappers \ sys-libs/nss-usrfiles \ "${TOOLCHAIN_PKGS[@]}"