From 1e4abad322b13e1bbf9ff4f6657c7adb4c97f3a6 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 11 Jun 2024 17:21:09 +0100 Subject: [PATCH] coreos-cargo.eclass: Drop this eclass and the associated overrides Cross-compiling is handled in the upstream cargo.eclass now. Signed-off-by: James Le Cuirot --- .../coreos/config/env/sys-apps/zram-generator | 8 -- .../env/sys-block/thin-provisioning-tools | 16 --- .../coreos-overlay/eclass/coreos-cargo.eclass | 113 ------------------ 3 files changed, 137 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/zram-generator delete mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-block/thin-provisioning-tools delete mode 100644 sdk_container/src/third_party/coreos-overlay/eclass/coreos-cargo.eclass diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/zram-generator b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/zram-generator deleted file mode 100644 index 2ca892c2bf..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-apps/zram-generator +++ /dev/null @@ -1,8 +0,0 @@ -cros_pre_src_unpack_coreos_unpack() { - local _COREOS_CARGO_SKIP_INHERIT=1 - source "${CROS_ADDONS_TREE}"/../eclass/coreos-cargo.eclass - src_unpack() { - einfo "Running coreos-cargo_src_unpack" - coreos-cargo_src_unpack - } -} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-block/thin-provisioning-tools b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-block/thin-provisioning-tools deleted file mode 100644 index e2b17a5677..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/sys-block/thin-provisioning-tools +++ /dev/null @@ -1,16 +0,0 @@ -cros_pre_src_unpack_coreos_unpack() { - local _COREOS_CARGO_SKIP_INHERIT=1 - source "${CROS_ADDONS_TREE}"/../eclass/coreos-cargo.eclass - src_unpack() { - einfo "Running coreos-cargo_src_unpack" - coreos-cargo_src_unpack - } -} - -cros_pre_src_install_rust_cross() { - pushd "${S}" - local rust_target="$(ls -d target/*-unknown-linux-gnu)" - rust_target="${rust_target#target/}" - ln -f target/{"${rust_target}",}/"$(usex debug debug release)/pdata_tools" || die - popd -} diff --git a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-cargo.eclass b/sdk_container/src/third_party/coreos-overlay/eclass/coreos-cargo.eclass deleted file mode 100644 index 405696dc22..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/eclass/coreos-cargo.eclass +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2017-2018 CoreOS, Inc. -# Distributed under the terms of the GNU General Public License v2 - -# @ECLASS: coreos-cargo.eclass -# @MAINTAINER: -# team-os@coreos.com -# @AUTHOR: -# David Michael -# @BLURB: cargo cross-compilation support for CoreOS/ChromeOS targets - -if [[ -z ${_COREOS_CARGO_ECLASS} ]]; then -_COREOS_CARGO_ECLASS=1 - -# XXX: Don't require host dependencies to also be in the sysroot. -if [[ -z ${_COREOS_CARGO_SKIP_INHERIT} ]]; then - CATEGORY=dev-util PN=cargo inherit cargo - inherit toolchain-funcs - - EXPORT_FUNCTIONS src_unpack -fi - -# @FUNCTION: coreos-cargo_src_unpack -# @DESCRIPTION: -# This amends the src_unpack from cargo.eclass to add support for Rust -# cross-compiling to the ChromeOS targets. It maps the host triplet to -# one built into rustc and uses the board root as its sysroot. -coreos-cargo_src_unpack() { - debug-print-function ${FUNCNAME} "$@" - cargo_src_unpack "$@" - - [[ ${CBUILD:-${CHOST}} != ${CHOST} ]] || return 0 - - # Map the SDK host triplet to one that is built into rustc. - function rust_builtin_target() case "$1" in - aarch64-*-linux-gnu) echo aarch64-unknown-linux-gnu ;; - x86_64-*-linux-gnu) echo x86_64-unknown-linux-gnu ;; - *) die "Unknown host triplet: $1" ;; - esac - - # Set the gcc-rs flags for cross-compiling. - export TARGET_CFLAGS="${CFLAGS}" - export TARGET_CXXFLAGS="${CXXFLAGS}" - - # Wrap ar for gcc-rs to work around rust-lang/cargo#4456. - export TARGET_AR="${T}/rustproof-ar" - cat <<- EOF > "${TARGET_AR}" && chmod 0755 "${TARGET_AR}" - #!/bin/sh - unset LD_LIBRARY_PATH - exec $(tc-getAR) "\$@" - EOF - - # Wrap gcc for gcc-rs to work around rust-lang/cargo#4456. - export TARGET_CC="${T}/rustproof-cc" - cat <<- EOF > "${TARGET_CC}" && chmod 0755 "${TARGET_CC}" - #!/bin/sh - unset LD_LIBRARY_PATH - exec $(tc-getCC) "\$@" - EOF - - # Wrap g++ for gcc-rs to work around rust-lang/cargo#4456. - export TARGET_CXX="${T}/rustproof-cxx" - cat <<- EOF > "${TARGET_CXX}" && chmod 0755 "${TARGET_CXX}" - #!/bin/sh - unset LD_LIBRARY_PATH - exec $(tc-getCXX) "\$@" - EOF - - # Create a compiler wrapper that uses a sysroot for cross-compiling. - export RUSTC_WRAPPER="${T}/wrustc" - cat <<- 'EOF' > "${RUSTC_WRAPPER}" && chmod 0755 "${RUSTC_WRAPPER}" - #!/bin/bash -e - rustc=${1:?Missing rustc command} - shift - xflags=() - # rustlib is part of host rustc now, so no: [ "x$*" = "x${*#--target}" ] || xflags=( --sysroot="${ROOT:-/}usr" ) - exec "${rustc}" "${xflags[@]}" "$@" - EOF - - # Compile for the built-in target, using the SDK cross-tools. - export RUST_TARGET=$(rust_builtin_target "${CHOST}") - local -a config_lines - local build_amended=0 - local target_rust_target_amended=0 - local REPLY - readonly b_header='[build]' - readonly t_header="[target.${RUST_TARGET}]" - readonly target_line="target = \"${RUST_TARGET}\"" - readonly ar_line="ar = \"${TARGET_AR}\"" - readonly linker_line="linker = \"${TARGET_CC}\"" - while read -r; do - config_lines+=("${REPLY}") - case "${REPLY}" in - "${b_header}") - config_lines+=("${target_line}") - build_amended=1 - ;; - "${t_header}") - config_lines+=("${ar_line}") - config_lines+=("${linker_line}") - target_rust_target_amended=1 - ;; - esac - done <"${ECARGO_HOME}/config" - if [[ "${build_amended}" -eq 0 ]]; then - config_lines+=('' "${b_header}" "${target_line}") - fi - if [[ "${target_rust_target_amended}" -eq 0 ]]; then - config_lines+=('' "${t_header}" "${ar_line}" "${linker_line}") - fi - printf '%s\n' "${config_lines[@]}" >"${ECARGO_HOME}/config" -} - -fi