| # Copyright 2021 The Chromium OS Authors. All rights reserved. |
| # Distributed under the terms of the GNU General Public License v2 |
| # |
| # This package provides 4.9.2 GCC toolchains for Chrome OS |
| # for ARM32, ARM64 and X86_64 ABIs. |
| # This package is provided purely for compatibility reasons to be used by |
| # packages that cannot use clang compiler or newer versions of GCC. |
| # These toolchains are based on standalone toolchain binaries generated by |
| # chromiumos-sdk builder. |
| # No fixes including security are planned for these toolchains. |
| |
| EAPI=7 |
| |
| DESCRIPTION="Frozen GCC 4.9.2 toolchains for Chrome OS" |
| |
| # Use the toolchains generated by SDK builder on Jan 04, 2021 that has been |
| # verified to work with Chrome OS GCC user packages. |
| CROS_TC_VERSION="2021.01.04.014317" |
| SRC_URI="gs://chromiumos-sdk/2021/01/aarch64-cros-linux-gnu-${CROS_TC_VERSION}.tar.xz |
| gs://chromiumos-sdk/2021/01/armv7a-cros-linux-gnueabihf-${CROS_TC_VERSION}.tar.xz |
| gs://chromiumos-sdk/2021/01/x86_64-cros-linux-gnu-${CROS_TC_VERSION}.tar.xz" |
| HOMEPAGE="https://www.chromium.org/chromium-os" |
| |
| LICENSE="GPL-3 LGPL-3 libgcc FDL-1.2" |
| SLOT=0 |
| KEYWORDS="*" |
| IUSE="" |
| |
| RESTRICT="binchecks strip" |
| QA_PREBUILT="*" |
| |
| CROS_ABIS=("aarch64-cros-linux-gnu" "armv7a-cros-linux-gnueabihf" "x86_64-cros-linux-gnu") |
| INSTALL_DIR="/opt/gcc-bin-${PV}" |
| |
| S="${WORKDIR}" |
| |
| # Unpack the standalone toolchain tarballs to <abi> directories. |
| src_unpack() { |
| local abi |
| for abi in "${CROS_ABIS[@]}"; do |
| cd "${WORKDIR}" || die |
| mkdir "${abi}" || die |
| cd "${abi}" || die |
| unpack "${abi}-${CROS_TC_VERSION}.tar.xz" |
| done |
| } |
| |
| # Remove files that we do not need for gcc to reduce installation size |
| # e.g. llvm/gdb/gconv etc. |
| src_prepare() { |
| default |
| local abi |
| for abi in "${CROS_ABIS[@]}"; do |
| cd "${WORKDIR}/${abi}" || die |
| rm -f bin/*gcov* bin/*gdb* bin/*clang* bin/*lld* bin/*llvm* || die |
| rm -f lib/*clang* lib/*rust* lib/*libstd-* lib/*libc++* || die |
| rm -rf usr/"${abi}"*/usr/lib*/gconv || die |
| rm -rf usr/bin || die |
| rm -rf usr/include/c++ usr/include/llvm* usr/include/clang* usr/share/clang* || die |
| # Delete anything not binutils related from usr/lib64. |
| local file |
| for file in "${WORKDIR}/${abi}/usr/lib64"/*; do |
| if [[ -d "${file}" && "${file}" == *binutils* ]]; then |
| continue |
| else |
| rm -rf "${file}" || die |
| fi |
| done |
| # Delete anything that is not prefixed with the abi inside top bin dir. |
| for file in "${WORKDIR}/${abi}/bin"/*; do |
| if [[ -f "${file}" || -L "${file}" ]]; then |
| local name="$(basename "${file}")" |
| if [[ "${name}" != "${abi}"* ]]; then |
| rm -f "${file}" || die |
| fi |
| fi |
| done |
| done |
| } |
| |
| src_install() { |
| dodir "${INSTALL_DIR}" |
| local abi |
| for abi in "${CROS_ABIS[@]}"; do |
| mv "${WORKDIR}/${abi}" "${D}/${INSTALL_DIR}" || die |
| done |
| } |