New paste Repaste Download
declare -x ABI="amd64"
declare -x ABI_MIPS=""
declare -x ABI_S390=""
declare -x ABI_X86="64"
declare -x ADA_TARGET=""
declare -x ALSA_CARDS=""
declare -x AMDGPU_TARGETS=""
declare -x APACHE2_MODULES=""
declare -x APACHE2_MPMS=""
declare -x ARCH="amd64"
declare BDEPEND=$'\n\tapp-alternatives/bc\n\tapp-alternatives/lex\n\tdev-util/pahole\n\tvirtual/libelf\n\tapp-alternatives/yacc\n\tamd64? ( app-crypt/sbsigntools )\n\tarm64? ( app-crypt/sbsigntools )\n \n\ttest? (\n\t\tdev-tcltk/expect\n\t\tsys-apps/coreutils\n\t\tsys-kernel/dracut\n\t\tsys-fs/e2fsprogs\n\t\tamd64? ( app-emulation/qemu[qemu_softmmu_targets_x86_64] )\n\t\tarm64? ( app-emulation/qemu[qemu_softmmu_targets_aarch64] )\n\t\tppc? ( app-emulation/qemu[qemu_softmmu_targets_ppc] )\n\t\tppc64? ( app-emulation/qemu[qemu_softmmu_targets_ppc64] )\n\t\tsparc? ( app-emulation/qemu[qemu_softmmu_targets_sparc,qemu_softmmu_targets_sparc64] )\n\t\tx86? ( app-emulation/qemu[qemu_softmmu_targets_i386] )\n\t)'
declare -- BINPKG="gentoo-kernel-6.12.34-1"
declare -x BINPKG_FORMAT="gpkg"
declare -x BINPKG_GPG_SIGNING_BASE_COMMAND="/usr/bin/flock /run/lock/portage-binpkg-gpg.lock /usr/bin/gpg --sign --armor [PORTAGE_CONFIG]"
declare -x BINPKG_GPG_SIGNING_DIGEST="SHA512"
declare -x BINPKG_GPG_VERIFY_BASE_COMMAND="/usr/bin/gpg --verify --batch --no-tty --no-auto-check-trustdb --status-fd 2 [PORTAGE_CONFIG] [SIGNATURE]"
declare -x BINPKG_GPG_VERIFY_GPG_HOME="/etc/portage/gnupg"
declare -x BOOTSTRAP_USE="unicode pkg-config split-usr xml python_targets_python3_13 python_single_target_python3_13 multilib zstd cet"
declare -x CALLIGRA_FEATURES=""
declare -x CAMERAS=""
declare -x CBUILD="x86_64-pc-linux-gnu"
declare -x CFLAGS="-O3 -pipe -march=native"
declare -x CFLAGS_amd64="-m64"
declare -x CFLAGS_x32="-mx32"
declare -x CFLAGS_x86="-m32 -mfpmath=sse"
declare -x CHOST="x86_64-pc-linux-gnu"
declare -x CHOST_amd64="x86_64-pc-linux-gnu"
declare -x CHOST_x32="x86_64-pc-linux-gnux32"
declare -x CHOST_x86="i686-pc-linux-gnu"
declare -x COLLECTD_PLUGINS=""
declare -x COMMON_FLAGS="-O3 -pipe -march=native"
declare -x CPU_FLAGS_ARM=""
declare -x CPU_FLAGS_PPC=""
declare -x CPU_FLAGS_X86=""
declare -x CURL_QUIC=""
declare -x CURL_SSL=""
declare -x CXXFLAGS="-O3 -pipe -march=native"
declare -x DEBUGINFOD_IMA_CERT_PATH="/etc/keys/ima:"
declare -x DEBUGINFOD_URLS="https://debuginfod.fedoraproject.org/ "
declare -x DEFAULT_ABI="amd64"
declare -x DEFINED_PHASES=" config configure install postinst postrm preinst prepare pretend test unpack"
declare DEPEND=""
declare DESCRIPTION="Pre-built Linux kernel with Gentoo patches"
declare -x DIROPTIONS="-m0755"
declare -x EAPI="8"
declare -x ELIBC="glibc"
declare -x ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
declare -- EPOCHREALTIME="1751226060.534062"
declare -- EPOCHSECONDS="1751226060"
declare -x EXEOPTIONS="-m0755"
declare -- E_IDEPEND=$'\n\t\tgeneric-uki? (\n\t\t\tapp-crypt/sbsigntools\n\t\t\t>=sys-kernel/installkernel-14[-dracut(-),-ugrd(-),-ukify(-)]\n\t\t)\n\t\t!generic-uki? (\n\t\t\t\n\t!initramfs? (\n\t\t>=sys-kernel/installkernel-14\n\t)\n\tinitramfs? (\n\t\t|| (\n\t\t\t>=sys-kernel/installkernel-14[dracut(-)]\n\t\t\t>=sys-kernel/installkernel-14[ugrd(-)]\n\t\t)\n\t)\n\n\t\t)\n\t'
declare -x FCFLAGS="-O3 -pipe -march=native"
declare -x FETCHCOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
declare -x FFLAGS="-O3 -pipe -march=native"
declare -x FFTOOLS=""
declare -x GCC_SPECS=""
declare -- GENPATCHES_P="genpatches-6.12-39"
declare -x GNUMAKEFLAGS="--load-average 16 --output-sync=line"
declare -x GPG_TTY="/dev/pts/1"
declare -x GPG_VERIFY_GROUP_DROP="nogroup"
declare -x GPG_VERIFY_USER_DROP="nobody"
declare -x GPSD_PROTOCOLS=""
declare -x GRUB_PLATFORMS=""
declare -x GSETTINGS_BACKEND="dconf"
declare -x GUESTFISH_INIT="\\e[1;34m"
declare -x GUESTFISH_OUTPUT="\\e[0m"
declare -x GUESTFISH_PS1="\\[\\e[1;32m\\]><fs>\\[\\e[0;31m\\] "
declare -x GUESTFISH_RESTORE="\\e[0m"
declare -x GUILE_SINGLE_TARGET=""
declare -x GUILE_TARGETS=""
declare -x HISTSIZE="50000"
declare HOMEPAGE="https://www.kernel.org/"
declare IDEPEND=$'\n\t\tgeneric-uki? (\n\t\t\tapp-crypt/sbsigntools\n\t\t\t>=sys-kernel/installkernel-14[-dracut(-),-ugrd(-),-ukify(-)]\n\t\t)\n\t\t!generic-uki? (\n\t\t\t\n\t!initramfs? (\n\t\t>=sys-kernel/installkernel-14\n\t)\n\tinitramfs? (\n\t\t|| (\n\t\t\t>=sys-kernel/installkernel-14[dracut(-)]\n\t\t\t>=sys-kernel/installkernel-14[ugrd(-)]\n\t\t)\n\t)\n\n\t\t)\n\t'
declare -x INHERITED=" mount-boot-utils toolchain-funcs dist-kernel-utils multiprocessing kernel-install unpacker"
declare -A INITRD_PACKAGES=(["net-misc/networkmanager[iwd]"]="GPL-2+ LGPL-2.1+" [sys-libs/pam]="|| ( BSD GPL-2 )" [dev-libs/libp11]="LGPL-2.1" [sys-libs/libcap]="|| ( GPL-2 BSD )" [net-fs/nfs-utils]="GPL-2" [net-fs/cifs-utils]="GPL-3" [sys-libs/readline]="GPL-3+" [net-libs/libmnl]="LGPL-2.1" [sys-apps/kmod]="LGPL-2" [app-arch/zstd]="|| ( BSD GPL-2 )" [media-libs/libmtp]="LGPL-2.1" [sys-fs/dosfstools]="GPL-3" [sys-apps/coreutils]="GPL-3+" [dev-libs/libevent]="BSD" [dev-libs/libpcre2]="BSD" [dev-libs/glib]="LGPL-2.1+" [app-crypt/argon2]="|| ( Apache-2.0 CC0-1.0 )" [app-arch/bzip2]="BZIP2" [sys-libs/libxcrypt]="LGPL-2.1+ public-domain BSD BSD-2" [sys-block/nbd]="GPL-2" [dev-libs/hidapi]="|| ( BSD GPL-3 HIDAPI )" [sys-apps/dbus]="|| ( AFL-2.1 GPL-2 )" [dev-libs/libffi]="MIT" [x11-libs/libdrm]="MIT" [dev-libs/nss]="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" ["sys-boot/plymouth[drm,systemd(+),udev]"]="GPL-2+" [sys-auth/polkit]="LGPL-2" [dev-libs/userspace-rcu]="LGPL-2.1" [app-arch/lz4]="BSD-2 GPL-2" [sys-apps/gawk]="GPL-3+" ["app-crypt/gnupg[smartcard,tpm(-)]"]="GPL-3+" [sys-apps/acl]="LGPL-2.1" [sys-apps/hwdata]="GPL-2+" [app-crypt/tpm2-tss]="BSD-2" [net-misc/curl]="BSD curl ISC" [dev-libs/libaio]="LGPL-2" [app-alternatives/awk]="CC0-1.0" [sys-libs/libapparmor]="GPL-2 LGPL-2.1" [dev-libs/lzo]="GPL-2+" [sys-fs/e2fsprogs]="GPL-2 BSD" [sys-fs/mdadm]="GPL-2" [app-crypt/tpm2-tools]="BSD" [sys-libs/libseccomp]="LGPL-2.1" ["sys-fs/lvm2[lvm]"]="GPL-2" [sys-apps/keyutils]="GPL-2 LGPL-2.1" [dev-libs/json-c]="MIT" [sys-apps/util-linux]="GPL-2 GPL-3 LGPL-2.1 BSD-4 MIT public-domain" ["x86? ( sys-firmware/intel-microcode )"]="x86? ( intel-ucode )" [dev-libs/libgpg-error]="GPL-2 LGPL-2.1" [dev-db/sqlite]="public-domain" [">=sys-apps/systemd-257[boot(-),cryptsetup,pkcs11,policykit,tpm,ukify(-)]"]="GPL-2 LGPL-2.1 MIT public-domain" ["amd64? ( sys-firmware/intel-microcode )"]="amd64? ( intel-ucode )" [sys-libs/ncurses]="MIT" [sys-fs/cryptsetup]="GPL-2+" [sys-apps/rng-tools]="GPL-2" [dev-libs/libassuan]="GPL-3 LGPL-2.1" [sys-fs/xfsprogs]="LGPL-2.1" [net-wireless/iwd]="GPL-2" [net-libs/nghttp2]="MIT" [sys-apps/attr]="LGPL-2.1" [net-dns/libidn2]="|| ( GPL-2+ LGPL-3+ ) GPL-3+ unicode" [sys-kernel/dracut]="GPL-2" [sys-apps/nvme-cli]="GPL-2 GPL-2+" [net-libs/libndp]="LGPL-2.1+" [sys-process/procps]="GPL-2+ LGPL-2+ LGPL-2.1+" [dev-libs/npth]="LGPL-2.1+" [net-nds/openldap]="OPENLDAP GPL-2" [sys-apps/baselayout]="GPL-2" [sys-fs/dmraid]="GPL-2" [net-libs/libtirpc]="BSD BSD-2 BSD-4 LGPL-2.1+" [sys-fs/multipath-tools]="GPL-2" [sys-fs/btrfs-progs]="GPL-2" [sys-apps/sed]="GPL-3+" [net-fs/samba]="GPL-3" [dev-libs/oniguruma]="BSD-2" [sys-libs/glibc]="LGPL-2.1+ BSD HPND ISC inner-net rc PCRE" [dev-libs/icu]="BSD" [app-arch/xz-utils]="public-domain LGPL-2.1+ GPL-2+" [app-alternatives/gzip]="CC0-1.0" [dev-libs/cyrus-sasl]="BSD-with-attribution" [sys-libs/libnvme]="LGPL-2.1+" [app-misc/jq]="MIT CC-BY-3.0" [dev-libs/expat]="MIT" [sys-apps/iproute2]="GPL-2" [media-libs/libv4l]="LGPL-2.1+" [sys-libs/zlib]="ZLIB" [dev-libs/libusb]="LGPL-2.1" [net-wireless/bluez]="GPL-2+ LGPL-2.1+" [sys-devel/gcc]="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+" [dev-libs/libunistring]="|| ( LGPL-3+ GPL-2+ ) || ( FDL-1.2 GPL-3+ )" [app-arch/gzip]="GPL-3+" [dev-libs/openssl]="Apache-2.0" [sys-apps/shadow]="BSD GPL-2" [app-misc/ddcutil]="GPL-2" ["sys-kernel/linux-firmware[redistributable,-unknown-license]"]="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT" [sys-apps/less]="|| ( GPL-3 BSD-2 )" [app-shells/bash]="GPL-3+" [dev-libs/opensc]="LGPL-2.1" [sys-apps/fwupd]="LGPL-2.1+" [dev-libs/libgcrypt]="LGPL-2.1 MIT" [sys-apps/pcsc-lite]="BSD ISC MIT GPL-3+ GPL-2" [dev-libs/libtasn1]="LGPL-2.1+" [app-crypt/p11-kit]="MIT" [sys-libs/libcap-ng]="LGPL-2.1" [app-alternatives/sh]="CC0-1.0" [net-dns/c-ares]="MIT ISC" [sys-apps/kbd]="GPL-2" )
declare -x INPUT_DEVICES=""
declare -x INSOPTIONS="-m0644"
declare IUSE="debug +initramfs test generic-uki modules-compress"
declare -x IUSE_EFFECTIVE="abi_x86_64 alpha amd64 amd64-linux arm arm64 arm64-macos debug elibc_Darwin elibc_SunOS elibc_bionic elibc_glibc elibc_mingw elibc_musl generic-uki hppa initramfs kernel_Darwin kernel_SunOS kernel_linux loong m68k mips modules-compress ppc ppc-macos ppc64 ppc64-linux prefix prefix-guest prefix-stack riscv s390 sparc test x64-macos x64-solaris x86 x86-linux"
declare -x IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack"
declare -x KDEDIRS="/usr"
declare -x KERNEL="linux"
declare -- KERNEL_EFI_ZBOOT="1"
declare -- KERNEL_IUSE_GENERIC_UKI="1"
declare -- KERNEL_IUSE_SECUREBOOT="1"
declare -x KEYWORDS="amd64 arm64 ppc64 x86"
declare -- KPV="6.12.34-gentoo-dist"
declare -- KV_LOCALVERSION="-gentoo-dist"
declare -x L10N=""
declare -x LANG="en_US.UTF-8"
declare -x LCD_DEVICES=""
declare -x LC_COLLATE="C"
declare -x LC_MESSAGES="C.utf8"
declare -x LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
declare -x LDFLAGS_amd64="-m elf_x86_64"
declare -x LDFLAGS_x32="-m elf32_x86_64"
declare -x LDFLAGS_x86="-m elf_i386"
declare -x LEX="flex"
declare -x LIBDIR_amd64="lib64"
declare -x LIBDIR_x32="libx32"
declare -x LIBDIR_x86="lib"
declare -x LIBOPTIONS="-m0644"
declare -x LIBREOFFICE_EXTENSIONS=""
declare -x LICENSE=$'GPL-2\n\t\tgeneric-uki? ( GPL-2+ LGPL-2.1+ || ( BSD GPL-2 ) LGPL-2.1 || ( GPL-2 BSD ) GPL-2 GPL-3 GPL-3+ LGPL-2.1 LGPL-2 || ( BSD GPL-2 ) LGPL-2.1 GPL-3 GPL-3+ BSD BSD LGPL-2.1+ || ( Apache-2.0 CC0-1.0 ) BZIP2 LGPL-2.1+ public-domain BSD BSD-2 GPL-2 || ( BSD GPL-3 HIDAPI ) || ( AFL-2.1 GPL-2 ) MIT MIT || ( MPL-2.0 GPL-2 LGPL-2.1 ) GPL-2+ LGPL-2 LGPL-2.1 BSD-2 GPL-2 GPL-3+ GPL-3+ LGPL-2.1 GPL-2+ BSD-2 BSD curl ISC LGPL-2 CC0-1.0 GPL-2 LGPL-2.1 GPL-2+ GPL-2 BSD GPL-2 BSD LGPL-2.1 GPL-2 GPL-2 LGPL-2.1 MIT GPL-2 GPL-3 LGPL-2.1 BSD-4 MIT public-domain x86? ( intel-ucode ) GPL-2 LGPL-2.1 public-domain GPL-2 LGPL-2.1 MIT public-domain amd64? ( intel-ucode ) MIT GPL-2+ GPL-2 GPL-3 LGPL-2.1 LGPL-2.1 GPL-2 MIT LGPL-2.1 || ( GPL-2+ LGPL-3+ ) GPL-3+ unicode GPL-2 GPL-2 GPL-2+ LGPL-2.1+ GPL-2+ LGPL-2+ LGPL-2.1+ LGPL-2.1+ OPENLDAP GPL-2 GPL-2 GPL-2 BSD BSD-2 BSD-4 LGPL-2.1+ GPL-2 GPL-2 GPL-3+ GPL-3 BSD-2 LGPL-2.1+ BSD HPND ISC inner-net rc PCRE BSD public-domain LGPL-2.1+ GPL-2+ CC0-1.0 BSD-with-attribution LGPL-2.1+ MIT CC-BY-3.0 MIT GPL-2 LGPL-2.1+ ZLIB LGPL-2.1 GPL-2+ LGPL-2.1+ GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+ || ( LGPL-3+ GPL-2+ ) || ( FDL-1.2 GPL-3+ ) GPL-3+ Apache-2.0 BSD GPL-2 GPL-2 GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT || ( GPL-3 BSD-2 ) GPL-3+ LGPL-2.1 LGPL-2.1+ LGPL-2.1 MIT BSD ISC MIT GPL-3+ GPL-2 LGPL-2.1+ MIT LGPL-2.1 CC0-1.0 MIT ISC GPL-2 )\n\t'
declare -x LLVM_SLOT=""
declare -x LLVM_TARGETS=""
declare -x LUA_SINGLE_TARGET=""
declare -x LUA_TARGETS=""
declare -x MAIL="/var/spool/mail/obrotowy"
declare -x MAKEOPTS="-j16"
declare -x MANPAGER="manpager"
declare -x MOZ_GMP_PATH="/usr/lib64/mozilla/plugins/gmp-gmpopenh264/system-installed"
declare -x MULTILIB_ABIS="amd64 x86"
declare -x MULTILIB_STRICT_DENY="64-bit.*shared object"
declare -x MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
declare -x MULTILIB_STRICT_EXEMPT="(perl5|gcc|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
declare -- MY_P="linux-6.12"
declare -x NGINX_MODULES_HTTP=""
declare -x NGINX_MODULES_MAIL=""
declare -x NGINX_MODULES_STREAM=""
declare -x OFFICE_IMPLEMENTATION=""
declare -x OPENMPI_FABRICS=""
declare -x OPENMPI_OFED_FEATURES=""
declare -x OPENMPI_RM=""
declare -x PATH="/usr/lib/portage/python3.13/ebuild-helpers/xattr:/usr/lib/portage/python3.13/ebuild-helpers:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/20/bin"
declare PDEPEND=$'\n\t>=virtual/dist-kernel-6.12.34\n '
declare -x PERL_FEATURES=""
declare -x PHP_TARGETS=""
declare -x PORTAGE_BZIP2_COMMAND="bzip2"
declare -x PORTAGE_COMPRESSION_COMMAND="zstd -T16"
declare -a PORTAGE_DOCOMPRESS=([0]="/usr/share/doc" [1]="/usr/share/info" [2]="/usr/share/man")
declare -x PORTAGE_DOCOMPRESS_SIZE_LIMIT="128"
declare -a PORTAGE_DOCOMPRESS_SKIP=([0]="/usr/share/doc/gentoo-kernel-bin-6.12.34/html")
declare -a PORTAGE_DOSTRIP=([0]="/")
declare -a PORTAGE_DOSTRIP_SKIP=()
declare -x PORTAGE_REPO_REVISIONS="{\"gentoo\": \"12df057fcb9130ebe22970d6654506ac729c8b06\"}"
declare -x POSTGRES_TARGETS=""
declare -x PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL"
declare -- PROPERTIES=""
declare -x PYTHONDONTWRITEBYTECODE="1"
declare -x PYTHON_SINGLE_TARGET=""
declare -x PYTHON_TARGETS=""
declare -- QA_PREBUILT="*"
declare -x QEMU_SOFTMMU_TARGETS=""
declare -x QEMU_USER_TARGETS=""
declare -x QTDIR="/usr/lib64/qt-3.3"
declare RDEPEND=$'\n\t!sys-kernel/gentoo-kernel:6.12.34\n \n\t\tsys-apps/kmod[lzma]\n\t\n\tvirtual/libelf'
declare REPOSITORY
declare REQUIRED_USE=""
declare RESTRICT="test"
declare -x RESUMECOMMAND_SSH="bash -c \"x=\\\${2#ssh://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port= ; exec rsync --rsh=\\\"ssh \\\${port:+-p\\\${port}} \\\${3}\\\" -avP \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" rsync \"\${DISTDIR}/\${FILE}\" \"\${URI}\" \"\${PORTAGE_SSH_OPTS}\""
declare -x RUBY_TARGETS=""
declare -x RUSTFLAGS=" -C target-cpu=native"
declare -x S="/var/tmp/portage/sys-kernel/gentoo-kernel-bin-6.12.34/work"
declare -x SANDBOX_DEBUG="0"
declare -x SANDBOX_DENY=""
declare -x SANDBOX_METHOD="any"
declare -x SANDBOX_PREDICT="/var/tmp/portage/sys-kernel/gentoo-kernel-bin-6.12.34/homedir:/dev/crypto:/var/cache/man:/var/cache/fontconfig"
declare -x SANDBOX_READ="/:/var/tmp/portage"
declare -x SANDBOX_VERBOSE="1"
declare -x SANDBOX_WRITE=":/dev/console:/dev/fd:/dev/full:/dev/null:/dev/ptmx:/dev/pts/:/dev/pty:/dev/shm:/dev/tts:/dev/tty:/dev/vc/:/dev/zero:/proc/self/fd:/tmp/:/usr/lib/cf:/usr/lib/conftest:/usr/lib32/cf:/usr/lib32/conftest:/usr/lib64/cf:/usr/lib64/conftest:/usr/tmp/:/usr/tmp/cf:/usr/tmp/conftest:/var/tmp/:/var/tmp/portage:/var/tmp/portage/sys-kernel/gentoo-kernel-bin-6.12.34/homedir/.bash_history"
declare -x SANE_BACKENDS=""
declare -x SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS="0"
declare -x SHELL="/bin/bash"
declare -x SHELL_SETS_TITLE="0"
declare -x SLOT="6.12.34"
declare -i SRANDOM="3822038363"
declare SRC_URI=$'\n\thttps://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.tar.xz\n\thttps://dev.gentoo.org/~mpagano/dist/genpatches/genpatches-6.12-39.base.tar.xz\n\thttps://dev.gentoo.org/~mpagano/dist/genpatches/genpatches-6.12-39.extras.tar.xz\n\tamd64? (\n\t\thttps://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/gentoo-kernel/gentoo-kernel-6.12.34-1.gpkg.tar\n\t\t\t-> gentoo-kernel-6.12.34-1.amd64.gpkg.tar\n\t)\n\tarm64? (\n\t\thttps://dev.gentoo.org/~mgorny/binpkg/arm64/kernel/sys-kernel/gentoo-kernel/gentoo-kernel-6.12.34-1.gpkg.tar\n\t\t\t-> gentoo-kernel-6.12.34-1.arm64.gpkg.tar\n\t)\n\tppc64? (\n\t\thttps://dev.gentoo.org/~mgorny/binpkg/ppc64le/kernel/sys-kernel/gentoo-kernel/gentoo-kernel-6.12.34-1.gpkg.tar\n\t\t\t-> gentoo-kernel-6.12.34-1.ppc64le.gpkg.tar\n\t)\n\tx86? (\n\t\thttps://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/gentoo-kernel/gentoo-kernel-6.12.34-1.gpkg.tar\n\t\t\t-> gentoo-kernel-6.12.34-1.x86.gpkg.tar\n\t)\n'
declare -x SSH_ASKPASS="/usr/bin/ksshaskpass"
declare -x STEAM_FRAME_FORCE_CLOSE="1"
declare -x SUDO_COMMAND="/usr/bin/su"
declare -x SUDO_GID="1000"
declare -x SUDO_UID="1000"
declare -x SUDO_USER="obrotowy"
declare -x SYMLINK_LIB="no"
declare -x TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
declare -x USE="abi_x86_64 amd64 elibc_glibc initramfs kernel_linux"
declare -x USERLAND="GNU"
declare -x USERNAME="obrotowy"
declare -x USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL"
declare -x USE_EXPAND_UNPREFIXED="ARCH"
declare -x USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-linux arm arm64 arm64-macos hppa loong m68k mips ppc ppc64 ppc64-linux ppc-macos riscv s390 sparc x64-macos x64-solaris x86 x86-linux"
declare -x USE_EXPAND_VALUES_ELIBC="bionic Darwin glibc mingw musl SunOS"
declare -x USE_EXPAND_VALUES_KERNEL="Darwin linux SunOS"
declare -x UWSGI_PLUGINS=""
declare -x VIDEO_CARDS=""
declare -x VOICEMAIL_STORAGE=""
declare -x XDG_CONFIG_DIRS="/etc/xdg"
declare -x XDG_DATA_DIRS="/root/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share"
declare -x XDG_SESSION_CLASS="user-early"
declare -x XDG_SESSION_ID="c6"
declare -x XDG_SESSION_TYPE="tty"
declare -x XTABLES_ADDONS=""
declare -- _DIST_KERNEL_UTILS="1"
declare -- _KERNEL_INSTALL_ECLASS="1"
declare -- _MULTIPROCESSING_ECLASS="1"
declare -- _TOOLCHAIN_FUNCS_ECLASS="1"
declare -- _UNPACKER_ECLASS="1"
declare -x __E_DESTTREE="/usr"
declare -x __E_DOCDESTTREE=""
declare -x __E_EXEDESTTREE=""
declare -x __E_INSDESTTREE=""
declare -x ac_cv_c_undeclared_builtin_options="none needed"
declare -x enable_year2038="no"
declare -x gl_cv_compiler_check_decl_option="-Werror=implicit-function-declaration"
declare -x gl_cv_func_getcwd_path_max="yes"
_clang_fullversion ()
{
    local ver="$1";
    shift;
    set -- $($(tc-getCC "$@") -E -P - <<< "__clang_major__ __clang_minor__ __clang_patchlevel__");
    eval echo "${ver}"
}
_eapply_patch ()
{
    local f=${1};
    local prefix=${2};
    ebegin "${prefix:-Applying }${f##*/}";
    local all_opts=(-p1 -f -g0 --no-backup-if-mismatch "${patch_options[@]}");
    if ${patch_cmd} "${all_opts[@]}" --dry-run -s -F0 < "${f}" &> /dev/null; then
        all_opts+=(-s -F0);
    fi;
    ${patch_cmd} "${all_opts[@]}" < "${f}";
    failed=${?};
    if ! eend "${failed}"; then
        __helpers_die "patch -p1 ${patch_options[*]} failed with ${f}";
    fi
}
_gcc-install-dir ()
{
    echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null | awk '$1=="install:" {print $2}')"
}
_gcc-specs-directive_raw ()
{
    local cc=$(tc-getCC);
    local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}');
    ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 'BEGIN { pspec=""; spec=""; outside=1 }
$1=="*"directive":"  { pspec=spec; spec=""; outside=0; next }
outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
{ spec=spec $0 }
END { print spec }';
    return 0
}
_gcc-specs-exists ()
{
    [[ -f $(_gcc-install-dir)/$1 ]]
}
_gcc_fullversion ()
{
    local ver="$1";
    shift;
    set -- $($(tc-getCC "$@") -E -P - <<< "__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__");
    eval echo "${ver}"
}
_get_all_makeopts ()
{
    echo "${MAKEOPTS} ${GNUMAKEFLAGS} ${MAKEFLAGS}"
}
_tc-getPROG ()
{
    local tuple=$1;
    local v var vars=$2;
    local prog=($3);
    var=${vars%% *};
    for v in ${vars};
    do
        if [[ -n ${!v} ]]; then
            export ${var}="${!v}";
            echo "${!v}";
            return 0;
        fi;
    done;
    local search=;
    [[ -n $4 ]] && search=$(type -p $4-${prog[0]});
    [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]});
    [[ -n ${search} ]] && prog[0]=${search##*/};
    export ${var}="${prog[*]}";
    echo "${!var}"
}
_tc-has-openmp ()
{
    local base="${T}/test-tc-openmp";
    cat <<-EOF > "${base}.c"
#include <omp.h>
int main(void) {
int nthreads, tid, ret = 0;
#pragma omp parallel private(nthreads, tid)
{
tid = omp_get_thread_num();
nthreads = omp_get_num_threads();
ret += tid + nthreads;
}
return ret;
}
EOF
    $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" >&/dev/null;
    local ret=$?;
    rm -f "${base}"*;
    return ${ret}
}
_unpacker ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local a=$1;
    local m=${a,,};
    a=$(find_unpackable_file "${a}");
    local comp=$(_unpacker_get_decompressor "${m}");
    local arch="";
    case ${m} in
        *.gpkg.tar)
            arch="unpack_gpkg"
        ;;
        *.tgz | *.tbz | *.tbz2 | *.txz | *.tar.* | *.tar)
            arch="tar --no-same-owner -xof"
        ;;
        *.cpio.* | *.cpio)
            arch="unpack_cpio"
        ;;
        *.deb)
            arch="unpack_deb"
        ;;
        *.run)
            arch="unpack_makeself"
        ;;
        *.sh)
            if head -n 30 "${a}" | grep -qs '#.*Makeself'; then
                arch="unpack_makeself";
            fi
        ;;
        *.bin)
            if head -c 100 "${a}" | grep -qs '#.*Makeself'; then
                arch="unpack_makeself";
            fi
        ;;
        *.zip)
            arch="unpack_zip"
        ;;
    esac;
    if [[ ${EAPI} != 7 ]]; then
        case ${m} in
            *.7z)
                arch="unpack_7z"
            ;;
            *.rar)
                arch="unpack_rar"
            ;;
            *.lha | *.lzh)
                arch="unpack_lha"
            ;;
        esac;
    fi;
    if [[ -z ${arch}${comp} ]]; then
        unpack "$1";
        return $?;
    fi;
    [[ ${arch} != unpack_* ]] && unpack_banner "${a}";
    if [[ -z ${arch} ]]; then
        local _a=${a%.*};
        ${comp} < "${a}" > "${_a##*/}";
    else
        if [[ -z ${comp} ]]; then
            ${arch} "${a}";
        else
            ${comp} < "${a}" | ${arch} -;
        fi;
    fi;
    assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
}
_unpacker_get_decompressor ()
{
    case ${1} in
        *.bz2 | *.tbz | *.tbz2)
            local bzcmd=${PORTAGE_BZIP2_COMMAND:-$(type -P lbzip2 || type -P pbzip2 || type -P bzip2)};
            local bzuncmd=${PORTAGE_BUNZIP2_COMMAND:-${bzcmd} -d};
            : "${UNPACKER_BZ2:=${bzuncmd}}";
            echo "${UNPACKER_BZ2} -c"
        ;;
        *.z | *.gz | *.tgz)
            echo "gzip -dc"
        ;;
        *.lzma | *.xz | *.txz)
            echo "xz -T$(makeopts_jobs) -dc"
        ;;
        *.lz)
            function find_lz_unpacker ()
            {
                if has_version -b ">=app-arch/xz-utils-5.4.0"; then
                    echo xz;
                    return;
                fi;
                local x;
                for x in plzip pdlzip lzip;
                do
                    type -P ${x} && break;
                done
            };
            : "${UNPACKER_LZIP:=$(find_lz_unpacker)}";
            echo "${UNPACKER_LZIP} -dc"
        ;;
        *.zst)
            echo "zstd -dc"
        ;;
        *.lz4)
            echo "lz4 -dc"
        ;;
        *.lzo)
            echo "lzop -dc"
        ;;
    esac
}
clang-fullversion ()
{
    _clang_fullversion '$1.$2.$3' "$@"
}
clang-major-version ()
{
    _clang_fullversion '$1' "$@"
}
clang-micro-version ()
{
    _clang_fullversion '$3' "$@"
}
clang-minor-version ()
{
    _clang_fullversion '$2' "$@"
}
clang-version ()
{
    _clang_fullversion '$1.$2' "$@"
}
dist-kernel_PV_to_KV ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments";
    local pv=${1};
    local kv=${pv%%_*};
    [[ -z $(ver_cut 3- "${kv}") ]] && kv+=".0";
    [[ ${pv} == *_* ]] && kv+=-${pv#*_};
    echo "${kv}"
}
dist-kernel_compressed_module_cleanup ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments";
    local path=${1};
    local config_path=/usr/src/linux-${KV_FULL}/.config;
    local option;
    for option in config source/.config build/.config;
    do
        if [[ -f ${path}/${option} ]]; then
            config_path=${path}/${option};
            break;
        fi;
    done;
    local preferred=;
    [[ -f ${config_path} ]] && preferred=$(dist-kernel_get_module_suffix "${config_path}");
    local basename suffix;
    while read -r basename; do
        local prev=;
        for suffix in .ko .ko.gz .ko.xz .ko.zst;
        do
            [[ ${suffix} == ${preferred} ]] && continue;
            local current=${path}/${basename}${suffix};
            [[ -f ${current} ]] || continue;
            if [[ -f ${path}/${basename}${preferred} ]]; then
                rm -v "${current}" || die;
            else
                if [[ -z ${prev} ]]; then
                    prev=${current};
                else
                    if [[ ${current} -nt ${prev} ]]; then
                        rm -v "${prev}" || die;
                        prev=${current};
                    else
                        rm -v "${current}" || die;
                    fi;
                fi;
            fi;
        done;
    done < <(cd "${path}" && find -type f \( -name '*.ko' -o -name '*.ko.gz' -o -name '*.ko.xz' -o -name '*.ko.zst' \) | sed -e 's:[.]ko\(\|[.]gz\|[.]xz\|[.]zst\)$::' | sort | uniq -d || die)
}
dist-kernel_get_image_path ()
{
    case ${ARCH} in
        amd64 | x86)
            echo arch/x86/boot/bzImage
        ;;
        arm64 | riscv)
            if [[ -n ${KERNEL_EFI_ZBOOT} ]]; then
                echo arch/${ARCH}/boot/vmlinuz.efi;
            else
                echo arch/${ARCH}/boot/Image.gz;
            fi
        ;;
        loong)
            if [[ -n ${KERNEL_EFI_ZBOOT} ]]; then
                echo arch/loongarch/boot/vmlinuz.efi;
            else
                echo arch/loongarch/boot/vmlinux.elf;
            fi
        ;;
        arm)
            echo arch/arm/boot/zImage
        ;;
        hppa | ppc | ppc64 | sparc)
            echo ./vmlinux
        ;;
        *)
            die "${FUNCNAME}: unsupported ARCH=${ARCH}"
        ;;
    esac
}
dist-kernel_get_module_suffix ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments";
    local config=${1};
    if ! in_iuse modules-compress || ! use modules-compress; then
        echo .ko;
    else
        if [[ ! -r ${config} ]]; then
            die "Cannot find kernel config ${config}";
        else
            if grep -q "CONFIG_MODULE_COMPRESS_NONE=y" "${config}" || grep -q "# CONFIG_MODULE_COMPRESS is not set" "${config}"; then
                echo .ko;
            else
                if grep -q "CONFIG_MODULE_COMPRESS_GZIP=y" "${config}"; then
                    echo .ko.gz;
                else
                    if grep -q "CONFIG_MODULE_COMPRESS_XZ=y" "${config}"; then
                        echo .ko.xz;
                    else
                        if grep -q "CONFIG_MODULE_COMPRESS_ZSTD=y" "${config}"; then
                            echo .ko.zst;
                        else
                            die "Module compression is enabled, but compressor not known";
                        fi;
                    fi;
                fi;
            fi;
        fi;
    fi
}
dist-kernel_install_kernel ()
{
    debug-print-function ${FUNCNAME} "$@";
    local version=${1:-${KV_FULL}};
    local image=${2:-${KV_DIR}/$(dist-kernel_get_image_path)};
    local map=${3:-${KV_DIR}/System.map};
    local dir=${4:-${EROOT}/boot};
    local installkernel_args=("${version}" "${image}" "${map}" "${dir}");
    if has_version ">=sys-kernel/installkernel-56"; then
        installkernel_args+=("${@:5}" --verbose);
    fi;
    local success=;
    while true; do
        if [[ -n ${ROOT} ]] && in_iuse initramfs && use initramfs; then
            if ! in_iuse generic-uki || ! use generic-uki; then
                eerror;
                eerror "ROOT is set, and (re-)generation of an initramfs is requested";
                eerror "via the USE=initramfs flag. However, this is currently not";
                eerror "supported via the sys-kernel/installkernel mechanism.";
                eerror;
                if in_iuse generic-uki && ! use generic-uki; then
                    eerror "Generation and installation of a generic initramfs and/or";
                    eerror "Unified Kernel Image is possible via portage by enabling the";
                    eerror "USE=generic-uki flag. Please enable the generic-uki flag, or";
                    eerror "chroot into: ROOT=${ROOT}";
                else
                    eerror "Please chroot into: ROOT=${ROOT}";
                fi;
                break;
            fi;
        fi;
        nonfatal mount-boot_check_status || break;
        mkdir -p "${EROOT}/boot" || break;
        ebegin "Installing the kernel via installkernel";
        ARCH=$(tc-arch-kernel) installkernel "${installkernel_args[@]}" || break;
        eend ${?} || die -n "Installing the kernel failed";
        success=1;
        break;
    done;
    if [[ ! -n ${success} ]]; then
        local kernel="<name of your kernel pakcage>:<kernel version>";
        local k_id_file=${image%$(dist-kernel_get_image_path)}/dist-kernel;
        if [[ -f ${k_id_file} ]]; then
            kernel=\'\=$(< ${k_id_file})\';
        fi;
        eerror;
        eerror "The kernel was not deployed successfully. Inspect the failure";
        eerror "in the logs above and once you resolve the problems please";
        eerror "run the equivalent of the following command to try again:";
        eerror;
        if has --all "${installkernel_args[@]}"; then
            eerror "    installkernel ${installkernel_args[*]}";
        else
            eerror "    emerge --config ${kernel}";
        fi;
        die "Kernel install failed, please fix the problems and run emerge --config";
    fi
}
dist-kernel_reinstall_initramfs ()
{
    debug-print-function ${FUNCNAME} "$@";
    local kernel_dir=${1:-${KV_DIR}};
    local ver=${2:-${KV_FULL}};
    local image_path=${kernel_dir}/$(dist-kernel_get_image_path);
    if [[ ! -f ${image_path} ]]; then
        eerror "Kernel install missing, image not found:";
        eerror "  ${image_path}";
        eerror "Initramfs will not be updated.  Please reinstall kernel ${ver}.";
        return;
    fi;
    dist-kernel_install_kernel "${ver}" "${image_path}" "${kernel_dir}/System.map" "${EROOT}/boot" "${@:3}"
}
econf_build ()
{
    local CBUILD=${CBUILD:-${CHOST}};
    function econf_env ()
    {
        CHOST=${CBUILD} econf "$@"
    };
    tc-env_build econf_env "$@"
}
find_unpackable_file ()
{
    local src=$1;
    if [[ -z ${src} ]]; then
        src=${DISTDIR}/${A};
    else
        if [[ ${src} == ./* ]]; then
            :;
        else
            if [[ -e ${DISTDIR}/${src} ]]; then
                src=${DISTDIR}/${src};
            else
                if [[ -e ${PWD}/${src} ]]; then
                    src=${PWD}/${src};
                else
                    if [[ -e ${src} ]]; then
                        src=${src};
                    fi;
                fi;
            fi;
        fi;
    fi;
    [[ ! -e ${src} ]] && return 1;
    echo "${src}"
}
gcc-fullversion ()
{
    _gcc_fullversion '$1.$2.$3' "$@"
}
gcc-major-version ()
{
    _gcc_fullversion '$1' "$@"
}
gcc-micro-version ()
{
    _gcc_fullversion '$3' "$@"
}
gcc-minor-version ()
{
    _gcc_fullversion '$2' "$@"
}
gcc-specs-directive ()
{
    local directive subdname subdirective;
    directive="$(_gcc-specs-directive_raw $1)";
    while [[ ${directive} == *%\(*\)* ]]; do
        subdname=${directive/*%\(};
        subdname=${subdname/\)*};
        subdirective="$(_gcc-specs-directive_raw ${subdname})";
        directive="${directive//\%(${subdname})/${subdirective}}";
    done;
    echo "${directive}";
    return 0
}
gcc-specs-nostrict ()
{
    local directive;
    directive=$(gcc-specs-directive cc1);
    [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
}
gcc-specs-now ()
{
    local directive;
    directive=$(gcc-specs-directive link_command);
    [[ "${directive/\{!nonow:}" != "${directive}" ]]
}
gcc-specs-pie ()
{
    local directive;
    directive=$(gcc-specs-directive cc1);
    [[ "${directive/\{!nopie:}" != "${directive}" ]]
}
gcc-specs-relro ()
{
    local directive;
    directive=$(gcc-specs-directive link_command);
    [[ "${directive/\{!norelro:}" != "${directive}" ]]
}
gcc-specs-ssp ()
{
    local directive;
    directive=$(gcc-specs-directive cc1);
    [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
}
gcc-specs-ssp-to-all ()
{
    local directive;
    directive=$(gcc-specs-directive cc1);
    [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
}
gcc-specs-stack-check ()
{
    local directive;
    directive=$(gcc-specs-directive cc1);
    [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
}
gcc-version ()
{
    _gcc_fullversion '$1.$2' "$@"
}
get_makeopts_jobs ()
{
    makeopts_jobs "$(_get_all_makeopts)" "${1:-1}"
}
get_makeopts_loadavg ()
{
    makeopts_loadavg "$(_get_all_makeopts)" "${1:-999}"
}
get_nproc ()
{
    local nproc;
    if type -P nproc &> /dev/null; then
        nproc=$(nproc);
    fi;
    if [[ -z ${nproc} ]] && type -P sysctl &> /dev/null; then
        nproc=$(sysctl -n hw.ncpu 2> /dev/null);
    fi;
    if [[ -z ${nproc} ]] && type -P python &> /dev/null; then
        nproc=$(python -c 'import multiprocessing; print(multiprocessing.cpu_count());' 2> /dev/null);
    fi;
    if [[ -n ${nproc} ]]; then
        echo "${nproc}";
    else
        echo "${1:-1}";
    fi
}
kernel-install_can_update_symlink ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments";
    local target=${1};
    [[ ! -e ${target} ]] && return 0;
    [[ ! -e ${target}/Makefile ]] && return 0;
    local symlink_target=$(readlink "${target}");
    [[ ${symlink_target} != ${target##*/}-* ]] && return 1;
    local symlink_ver=${symlink_target#${target##*/}-};
    symlink_ver=${symlink_ver%${KV_LOCALVERSION}};
    [[ -n ${symlink_ver//[0-9.]/} ]] && return 1;
    local symlink_pkg=${CATEGORY}/${PN}-${symlink_ver};
    has "${symlink_ver}" ${REPLACING_VERSIONS} && return 0;
    has_version -r "~${symlink_pkg}" && return 0;
    return 1
}
kernel-install_compress_modules ()
{
    debug-print-function ${FUNCNAME} "$@";
    if use modules-compress; then
        einfo "Compressing kernel modules ...";
        if [[ -z ${KV_FULL} ]]; then
            KV_FULL=${PV}${KV_LOCALVERSION};
        fi;
        local suffix=$(dist-kernel_get_module_suffix "${ED}/usr/src/linux-${KV_FULL}/.config");
        local compress=();
        case ${suffix} in
            .ko)
                return
            ;;
            .ko.gz)
                compress+=(gzip)
            ;;
            .ko.xz)
                compress+=(xz --check=crc32 --lzma2=dict=1MiB)
            ;;
            .ko.zst)
                compress+=(zstd -q --rm)
            ;;
            *)
                die "Unknown compressor: ${suffix}"
            ;;
        esac;
        find "${ED}/lib/modules/${KV_FULL}" -name '*.ko' -print0 | xargs -0 -P "$(makeopts_jobs)" -n 128 "${compress[@]}";
        assert "Compressing kernel modules failed";
        depmod --all --basedir "${ED}" ${KV_FULL} || die;
    fi
}
kernel-install_create_init ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments";
    [[ -z ${1} ]] && die "${FUNCNAME}: empty argument specified";
    local output="${1}";
    [[ -f ${output} ]] && die "${FUNCNAME}: ${output} already exists";
    cat <<-_EOF_ > "${T}/init.c" ||
#include <stdio.h>
#include <sys/utsname.h>
int main() {
struct utsname u;
int ret = uname(&u);
if (ret != 0) {
printf("uname() failed, but that's fine\n");
}
else {
// Booted: Linux 5.10.47 ppc64le #1 SMP Fri Jul 2 12:55:24 PDT 2021
printf("Booted: %s %s %s %s\n", u.sysname, u.release,
u.machine, u.version);
}
printf("Hello, World!\n");
return 0;
}
_EOF_
die
    $(tc-getBUILD_CC) -Os -static "${T}/init.c" -o "${output}" || die;
    $(tc-getBUILD_STRIP) "${output}" || die
}
kernel-install_create_qemu_image ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments";
    [[ -z ${1} ]] && die "${FUNCNAME}: empty argument specified";
    local image="${1}";
    [[ -f ${image} ]] && die "${FUNCNAME}: ${image} already exists";
    local imageroot="${T}/imageroot";
    [[ -d ${imageroot} ]] && die "${FUNCNAME}: ${imageroot} already exists";
    mkdir "${imageroot}" || die;
    mkdir -p "${imageroot}"/{bin,dev,etc,lib,proc,root,sbin,sys} || die;
    touch "${imageroot}/lib/ld-fake.so" || die;
    cp "${BROOT}/etc/os-release" "${imageroot}/etc/os-release" || die;
    kernel-install_create_init "${imageroot}/sbin/init";
    truncate -s 4M "${image}" || die;
    mkfs.ext4 -v -d "${imageroot}" -L groot "${image}" || die
}
kernel-install_extract_from_uki ()
{
    [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments";
    local extract_type=${1};
    local uki=${2};
    local out=${3};
    local out_temp=${T}/${extract_type}-section-dumped;
    $(tc-getOBJCOPY) "${uki}" "${T}/dump.efi" --dump-section ".${extract_type}=${out_temp}" || die "Failed to extract ${extract_type}";
    if [[ ${extract_type} == linux ]] && {
        ! in_iuse secureboot || use secureboot
    }; then
        local cert=${T}/pcrpkey;
        kernel-install_extract_from_uki pcrpkey "${uki}" "${cert}";
        if [[ $(head -n1 "${cert}") != "-----BEGIN CERTIFICATE-----" ]]; then
            openssl x509 -inform DER -in "${cert}" -outform PEM -out "${cert}" || die "Failed to convert pcrpkey to PEM format";
        fi;
        sbverify --cert "${cert}" "${uki}" || die "ERROR: UKI signature is invalid";
        local sbverify_err=$(sbverify --cert "${cert}" "${out_temp}" 2>&1 > /dev/null);
        if [[ ${sbverify_err} == "warning: data remaining"*": gaps between PE/COFF sections?"* ]]; then
            local proper_size=${sbverify_err#"warning: data remaining["};
            proper_size=${proper_size%" vs"*};
            head "${out_temp}" --bytes "${proper_size}" > "${out_temp}_trimmed" || die;
            sbverify_err=$(sbverify --cert "${cert}" "${out_temp}_trimmed" 2>&1 > /dev/null);
            [[ -z ${sbverify_err} ]] && out_temp=${out_temp}_trimmed;
        fi;
        if [[ -n ${sbverify_err} ]]; then
            eerror "${sbverify_err}";
            die "ERROR: Kernel image signature is invalid";
        else
            einfo "Signature verification OK";
        fi;
    fi;
    install -m 644 "${out_temp}" "${out}" || die
}
kernel-install_get_qemu_arch ()
{
    debug-print-function ${FUNCNAME} "$@";
    case ${ARCH} in
        amd64)
            echo x86_64
        ;;
        x86)
            echo i386
        ;;
        arm | ppc | ppc64 | riscv | sparc | sparc64)
            echo ${ARCH}
        ;;
        arm64)
            echo aarch64
        ;;
        loong)
            echo loongarch64
        ;;
        *)
            die "${FUNCNAME}: unsupported ARCH=${ARCH}"
        ;;
    esac
}
kernel-install_install_all ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments";
    local dir_ver=${1};
    local kernel_dir=${EROOT}/usr/src/linux-${dir_ver};
    local relfile=${kernel_dir}/include/config/kernel.release;
    local image_path=$(dist-kernel_get_image_path);
    local image_dir=${image_path%/*};
    local module_ver;
    module_ver=$(< "${relfile}") || die;
    if [[ -n ${KERNEL_IUSE_GENERIC_UKI} ]]; then
        if use generic-uki; then
            kernel-install_extract_from_uki linux "${kernel_dir}/${image_dir}"/uki.efi "${kernel_dir}/${image_path}";
            kernel-install_extract_from_uki initrd "${kernel_dir}/${image_dir}"/uki.efi "${kernel_dir}/${image_dir}"/initrd;
            if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then
                ln -sf "../../../src/linux-${dir_ver}/${image_dir}/initrd" "${EROOT}/usr/lib/modules/${module_ver}/initrd" || die;
                ln -sf "../../../src/linux-${dir_ver}/${image_dir}/uki.efi" "${EROOT}/usr/lib/modules/${module_ver}/uki.efi" || die;
            else
                ln -sf "../../../usr/src/linux-${dir_ver}/${image_dir}/initrd" "${EROOT}/lib/modules/${module_ver}/initrd" || die;
                ln -sf "../../../usr/src/linux-${dir_ver}/${image_dir}/uki.efi" "${EROOT}/lib/modules/${module_ver}/uki.efi" || die;
            fi;
        else
            rm -f "${kernel_dir}/${image_dir}"/{initrd,uki.efi} || die;
        fi;
    fi;
    dist-kernel_install_kernel "${module_ver}" "${kernel_dir}/${image_path}" "${kernel_dir}/System.map"
}
kernel-install_pkg_config ()
{
    if [[ -z ${KV_FULL} ]]; then
        KV_FULL=${PV}${KV_LOCALVERSION};
    fi;
    kernel-install_install_all "${KV_FULL}"
}
kernel-install_pkg_postinst ()
{
    debug-print-function ${FUNCNAME} "$@";
    kernel-install_update_symlink "${EROOT}/usr/src/linux" "${KV_FULL}";
    dist-kernel_compressed_module_cleanup "${EROOT}/lib/modules/${KV_FULL}";
    kernel-install_install_all "${KV_FULL}";
    if [[ -n ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then
        ewarn "The prebuilt initramfs and unified kernel image are highly experimental!";
        ewarn "These images may not work on your system. Please ensure that a working";
        ewarn "alternative kernel(+initramfs) or UKI is also installed before rebooting!";
        ewarn;
        ewarn "Note that when secureboot is enabled in the firmware settings any kernel";
        ewarn "command line arguments supplied to the UKI by the bootloader are ignored.";
        ewarn "To ensure the root partition can be found, systemd-gpt-auto-generator must";
        ewarn "be used. See [1] for more information.";
        ewarn;
        ewarn "[1]: https://wiki.gentoo.org/wiki/Systemd#Automatic_mounting_of_partitions_at_boot";
    fi
}
kernel-install_pkg_postrm ()
{
    debug-print-function ${FUNCNAME} "$@";
    local kernel_dir=${EROOT}/usr/src/linux-${KV_FULL};
    local image_path=$(dist-kernel_get_image_path);
    if [[ ! -n ${KERNEL_IUSE_GENERIC_UKI} && -d ${kernel_dir} ]]; then
        ebegin "Removing initramfs";
        rm -f "${kernel_dir}/${image_path%/*}"/{initrd,uki.efi} && find "${kernel_dir}" -depth -type d -empty -delete;
        eend ${?};
    fi;
    find -L "${EROOT}/lib/modules/${KV_FULL}" -type l -delete
}
kernel-install_pkg_preinst ()
{
    debug-print-function ${FUNCNAME} "$@";
    if [[ -z ${KV_FULL} ]]; then
        KV_FULL=${PV}${KV_LOCALVERSION};
    fi;
    local kernel_dir=${ED}/usr/src/linux-${KV_FULL};
    local image_path=$(dist-kernel_get_image_path);
    [[ ! -d ${kernel_dir} ]] && die "Kernel directory ${kernel_dir} not installed!";
    if [[ -r "${T}/signing_key.pem" ]]; then
        ( umask 066 && cp "${T}/signing_key.pem" "${kernel_dir}/certs/signing_key.pem" ) || die;
    fi;
    if [[ ${PV} != *9999 ]]; then
        local expected_ver=$(dist-kernel_PV_to_KV "${PV}");
        if [[ ${KV_FULL} != ${expected_ver}* ]]; then
            eerror "Kernel version does not match PV!";
            eerror "Source version: ${KV_FULL}";
            eerror "Expected (PV*): ${expected_ver}*";
            eerror "Please ensure you are applying the correct patchset.";
            die "Kernel version mismatch: got ${KV_FULL}, expected ${expected_ver}*";
        fi;
    fi;
    if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then
        rm "${ED}/lib/modules/${KV_FULL}"/{build,source} || die;
        dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/build";
        dosym "../../../src/linux-${KV_FULL}" "/usr/lib/modules/${KV_FULL}/source";
        local file;
        for file in .config System.map;
        do
            if [[ -L "${ED}/lib/modules/${KV_FULL}/${file#.}" ]]; then
                rm "${ED}/lib/modules/${KV_FULL}/${file#.}" || die;
                dosym "../../../src/linux-${KV_FULL}/${file}" "/usr/lib/modules/${KV_FULL}/${file#.}";
            fi;
        done;
        for file in vmlinux vmlinuz;
        do
            if [[ -L "${ED}/lib/modules/${KV_FULL}/${file}" ]]; then
                rm "${ED}/lib/modules/${KV_FULL}/${file}" || die;
                dosym "../../../src/linux-${KV_FULL}/${image_path}" "/usr/lib/modules/${KV_FULL}/${file}";
            fi;
        done;
    fi
}
kernel-install_pkg_pretend ()
{
    debug-print-function ${FUNCNAME} "$@";
    nonfatal mount-boot_check_status;
    if ! has_version -d sys-kernel/linux-firmware; then
        ewarn "sys-kernel/linux-firmware not found installed on your system.";
        ewarn "This package provides various firmware files that may be needed";
        ewarn "for your hardware to work.  If in doubt, it is recommended";
        ewarn "to pause or abort the build process and install it before";
        ewarn "resuming.";
        elog;
        elog "If you decide to install linux-firmware later, you can rebuild";
        elog "the initramfs via issuing a command equivalent to:";
        elog;
        elog "    emerge --config ${CATEGORY}/${PN}:${SLOT}";
    fi;
    if ! use initramfs && ! has_version "${CATEGORY}/${PN}[-initramfs]"; then
        ewarn;
        ewarn "WARNING: The default distribution kernel configuration is designed";
        ewarn "to be used with an initramfs! Although possible, there is no guarantee";
        ewarn "that distribution kernels will boot without an initramfs.";
        ewarn;
        ewarn "You have disabled the initramfs USE flag, and as a result the package manager";
        ewarn "will not enforce the configuration of an initramfs generator in";
        ewarn "sys-kernel/installkernel.";
        ewarn;
        ewarn "If you wish to use a custom initramfs generator, then please ensure that";
        ewarn "/sbin/installkernel is capable of calling it via a kernel installation hook,";
        ewarn "and is also configured to use it via /etc/kernel/install.conf.";
        ewarn;
        ewarn "If you wish to boot without an initramfs, then please ensure that";
        ewarn "all kernel drivers required to boot your system are built into the";
        ewarn "kernel by modifying the default distribution kernel configuration";
        ewarn "using /etc/kernel/config.d";
        ewarn;
        ewarn "Please refer to the installkernel and distribution kernel documentation:";
        ewarn "    https://wiki.gentoo.org/wiki/Installkernel";
        ewarn "    https://wiki.gentoo.org/wiki/Project:Distribution_Kernel";
    fi
}
kernel-install_src_test ()
{
    debug-print-function ${FUNCNAME} "$@";
    die "Please redefine src_test() and call kernel-install_test()."
}
kernel-install_test ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments";
    local version=${1};
    local image=${2};
    local modules=${3};
    local qemu_arch=$(kernel-install_get_qemu_arch);
    local omit_mods=(crypt dm dmraid lvm mdraid multipath nbd network network-manager btrfs cifs nfs zfs zfsexpandknowledge plymouth rngd i18n dracut-systemd systemd systemd-initrd);
    > "${T}"/empty-file || die;
    mkdir -p "${T}"/empty-directory || die;
    local compress="gzip";
    if [[ -n ${KERNEL_IUSE_GENERIC_UKI} ]] && use generic-uki; then
        compress="xz -9e --check=crc32";
    fi;
    dracut --conf "${T}"/empty-file --confdir "${T}"/empty-directory --no-hostonly --kmoddir "${modules}" --force-add "qemu" --omit "${omit_mods[*]}" --nostrip --no-early-microcode --compress="${compress}" "${T}/initrd" "${version}" || die;
    kernel-install_create_qemu_image "${T}/fs.img";
    cd "${T}" || die;
    local qemu_extra_args=;
    local qemu_extra_append=;
    case ${qemu_arch} in
        aarch64)
            qemu_extra_args="-M virt -cpu cortex-a57 -smp 1";
            qemu_extra_append="console=ttyAMA0"
        ;;
        i386 | x86_64)
            qemu_extra_args="-cpu max";
            qemu_extra_append="console=ttyS0,115200n8"
        ;;
        ppc)
            qemu_extra_args="-boot d -L pc-bios -M mac99,via=pmu";
            qemu_extra_append="console=ttyS0,115200n8"
        ;;
        ppc64)
            qemu_extra_args="-nodefaults"
        ;;
        *)
            :
        ;;
    esac;
    if [[ -n ${KERNEL_IUSE_MODULES_SIGN} ]]; then
        use modules-sign && qemu_extra_append+=" module.sig_enforce=1";
    fi;
    cat > run.sh <<-EOF ||
#!/bin/sh
exec qemu-system-${qemu_arch} ${qemu_extra_args} -m 512M -nographic -no-reboot -kernel '${image}' -initrd '${T}/initrd' -serial mon:stdio -drive file=fs.img,format=raw,index=0,media=disk -append 'root=LABEL=groot ${qemu_extra_append}'
EOF
die
    chmod +x run.sh || die;
    expect - <<-EOF ||
set timeout 900
spawn ./run.sh
expect {
"terminating on signal" {
send_error "\n* Qemu killed\n"
exit 1
}
"OS terminated" {
send_error "\n* Qemu terminated OS\n"
exit 1
}
"Kernel panic" {
send_error "\n* Kernel panic\n"
exit 1
}
"Entering emergency mode" {
send_error "\n* Initramfs failed to start the system\n"
exit 1
}
"Hello, World!" {
send_error "\n* Booted successfully\n"
exit 0
}
timeout {
send_error "\n* Kernel boot timed out\n"
exit 2
}
eof {
send_error "\n* qemu terminated before booting the kernel\n"
exit 2
}
}
EOF
die "Booting kernel failed"
}
kernel-install_update_symlink ()
{
    debug-print-function ${FUNCNAME} "$@";
    [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments";
    local target=${1};
    local version=${2};
    if kernel-install_can_update_symlink "${target}"; then
        ebegin "Updating ${target} symlink";
        ln -f -n -s "${target##*/}-${version}" "${target}";
        eend ${?};
    else
        elog "${target} points at another kernel, leaving it as-is.";
        elog "Please use 'eselect kernel' to update it when desired.";
    fi
}
makeopts_jobs ()
{
    [[ $# -eq 0 ]] && set -- "$(_get_all_makeopts)";
    local jobs=$(echo " $* " | sed -r -n -e 's:.*[[:space:]](-[a-z]*j|--jobs[=[:space:]])[[:space:]]*([0-9]+).*:\2:p' -e "s:.*[[:space:]](-[a-z]*j|--jobs)[[:space:]].*:${2:-$(( $(get_nproc) + 1 ))}:p");
    echo ${jobs:-1}
}
makeopts_loadavg ()
{
    [[ $# -eq 0 ]] && set -- "$(_get_all_makeopts)";
    local lavg=$(echo " $* " | sed -r -n -e 's:.*[[:space:]](-[a-z]*l|--(load-average|max-load)[=[:space:]])[[:space:]]*([0-9]+(\.[0-9]+)?)[[:space:]].*:\3:p' -e "s:.*[[:space:]](-[a-z]*l|--(load-average|max-load))[[:space:]].*:${2:-999}:p");
    echo ${lavg:-${2:-999}}
}
mount-boot_check_status ()
{
    mount-boot_is_disabled && return 0;
    local partition=;
    local part_is_not_mounted=;
    local part_is_read_only=;
    local candidates=(/boot);
    if [[ -d /sys/firmware/efi && -z ${DONT_MOUNT_ESP} ]]; then
        candidates+=(/efi /boot/efi /boot/EFI);
    fi;
    for partition in ${candidates[@]};
    do
        local fstabstate=$(awk "!/^[[:blank:]]*#|^\/dev\/BOOT/ && \$2 == \"${partition}\" { print 1; exit }" /etc/fstab || die "awk failed");
        if [[ -z ${fstabstate} ]]; then
            einfo "Assuming you do not have a separate ${partition} partition.";
        else
            local procstate=$(awk "\$2 == \"${partition}\" { split(\$4, a, \",\"); for (i in a) if (a[i] ~ /^r[ow]\$/) { print a[i]; break }; exit }" /proc/mounts || die "awk failed");
            if [[ -z ${procstate} ]]; then
                eerror "Your ${partition} partition is not mounted";
                eerror "Please mount it and retry.";
                die -n "${partition} not mounted";
                part_is_not_mounted=1;
            else
                if [[ ${procstate} == ro ]]; then
                    eerror "Your ${partition} partition, was detected as being mounted," "but is mounted read-only.";
                    eerror "Please remount it as read-write and retry.";
                    die -n "${partition} mounted read-only";
                    part_is_read_only=1;
                else
                    einfo "Your ${partition} partition was detected as being mounted.";
                    einfo "Files will be installed there for ${PN} to function correctly.";
                fi;
            fi;
        fi;
    done;
    if [[ -n ${part_is_not_mounted} ]]; then
        return 1;
    else
        if [[ -n ${part_is_read_only} ]]; then
            return 2;
        else
            return 0;
        fi;
    fi
}
mount-boot_is_disabled ()
{
    if [[ -n ${EROOT} ]]; then
        return 0;
    fi;
    if [[ ${MERGE_TYPE} == buildonly ]]; then
        return 0;
    fi;
    if [[ -n ${DONT_MOUNT_BOOT} ]]; then
        return 0;
    fi;
    return 1
}
pkg_config ()
{
    kernel-install_pkg_config "$@"
}
pkg_nofetch ()
{
    default
}
pkg_postinst ()
{
    kernel-install_pkg_postinst "$@"
}
pkg_postrm ()
{
    kernel-install_pkg_postrm "$@"
}
pkg_preinst ()
{
    kernel-install_pkg_preinst "$@"
}
pkg_pretend ()
{
    kernel-install_pkg_pretend "$@"
}
src_compile ()
{
    default
}
src_configure ()
{
    local HOSTLD="$(tc-getBUILD_LD)";
    if type -P "${HOSTLD}.bfd" &> /dev/null; then
        HOSTLD+=.bfd;
    fi;
    local LD="$(tc-getLD)";
    if type -P "${LD}.bfd" &> /dev/null; then
        LD+=.bfd;
    fi;
    tc-export_build_env;
    local makeargs=(V=1 HOSTCC="$(tc-getBUILD_CC)" HOSTCXX="$(tc-getBUILD_CXX)" HOSTLD="${HOSTLD}" HOSTAR="$(tc-getBUILD_AR)" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" CROSS_COMPILE=${CHOST}- AS="$(tc-getAS)" CC="$(tc-getCC)" LD="${LD}" AR="$(tc-getAR)" NM="$(tc-getNM)" STRIP="$(tc-getSTRIP)" OBJCOPY="$(tc-getOBJCOPY)" OBJDUMP="$(tc-getOBJDUMP)" READELF="$(tc-getREADELF)" ARCH="$(tc-arch-kernel)" O="${WORKDIR}"/modprep);
    local kernel_dir="${BINPKG}/image/usr/src/linux-${KPV}";
    local image="${kernel_dir}/$(dist-kernel_get_image_path)";
    local uki="${image%/*}/uki.efi";
    if [[ -s ${uki} ]]; then
        kernel-install_extract_from_uki linux "${uki}" "${image}";
    fi;
    mkdir modprep || die;
    cp "${kernel_dir}/.config" modprep/ || die;
    emake -C "${MY_P}" "${makeargs[@]}" modules_prepare
}
src_install ()
{
    local rel_kernel_dir=/usr/src/linux-${KPV};
    local kernel_dir="${BINPKG}/image${rel_kernel_dir}";
    local image="${kernel_dir}/$(dist-kernel_get_image_path)";
    local uki="${image%/*}/uki.efi";
    if [[ -s ${uki} ]]; then
        if use generic-uki; then
            > "${image}" || die;
        else
            > "${uki}" || die;
        fi;
    fi;
    echo "${CATEGORY}/${PF}:${SLOT}" > "${kernel_dir}/dist-kernel" || die;
    mv "${BINPKG}"/image/{lib,usr} "${ED}"/ || die;
    if [[ -d ${BINPKG}/image/boot/dtbs ]]; then
        mv "${BINPKG}"/image/boot "${ED}"/ || die;
    fi;
    find modprep -type f '(' -name Makefile -o -name '*.[ao]' -o '(' -name '.*' -a -not -name '.config' ')' ')' -delete || die;
    rm modprep/source || die;
    cp -p -R modprep/. "${ED}${rel_kernel_dir}"/ || die;
    find "${ED}/lib" -name '*.ko' -exec touch {} + || die;
    dostrip -x /lib/modules;
    kernel-install_compress_modules;
    if use ppc64; then
        dostrip -x "${rel_kernel_dir}/$(dist-kernel_get_image_path)";
    else
        if use debug && {
            use amd64 || use arm64
        }; then
            dostrip -x "${rel_kernel_dir}/vmlinux";
            dostrip -x "${rel_kernel_dir}/vmlinux.ctfa";
        fi;
    fi
}
src_prepare ()
{
    local PATCHES=("${WORKDIR}"/*.patch);
    cd "${MY_P}" || die;
    default
}
src_test ()
{
    local kernel_dir="${BINPKG}/image/usr/src/linux-${KPV}";
    kernel-install_test "${KPV}" "${WORKDIR}/${kernel_dir}/$(dist-kernel_get_image_path)" "${BINPKG}/image/lib/modules/${KPV}"
}
src_unpack ()
{
    unpacker_src_unpack "$@"
}
tc-arch ()
{
    tc-ninja_magic_to_arch portage "$@"
}
tc-arch-kernel ()
{
    tc-ninja_magic_to_arch kern "$@"
}
tc-check-min_ver ()
{
    function do_check ()
    {
        debug-print "Compiler version check for ${1}";
        debug-print "Detected: ${2}";
        debug-print "Required: ${3}";
        if ver_test ${2} -lt ${3}; then
            eerror "Your current compiler is too old for this package!";
            die "Active compiler is too old for this package (found ${1} ${2}).";
        fi
    };
    case ${1} in
        gcc)
            tc-is-gcc || return;
            do_check GCC $(gcc-version) ${2}
        ;;
        clang)
            tc-is-clang || return;
            do_check Clang $(clang-version) ${2}
        ;;
        *)
            eerror "Unknown first parameter for ${FUNCNAME} - must be gcc or clang";
            die "${FUNCNAME}: Parameter ${1} unknown"
        ;;
    esac
}
tc-check-openmp ()
{
    if ! _tc-has-openmp; then
        eerror "Your current compiler does not support OpenMP!";
        if tc-is-gcc; then
            eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\".";
        else
            if tc-is-clang; then
                eerror "OpenMP support in llvm-core/clang is provided by llvm-runtimes/openmp.";
            fi;
        fi;
        die "Active compiler does not have required support for OpenMP";
    fi
}
tc-cpp-is-true ()
{
    local CONDITION=${1};
    shift;
    $(tc-getTARGET_CPP) "${@}" -P - <<-EOF > /dev/null 2>&1
#if ${CONDITION}
true
#else
#error false
#endif
EOF
}
tc-detect-is-softfloat ()
{
    [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1;
    case ${CTARGET:-${CHOST}} in
        *-newlib | *-elf | *-eabi | arm64-apple-darwin*)
            return 1
        ;;
        arm*)
            if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
                echo "no";
            else
                if tc-cpp-is-true "defined(__SOFTFP__)"; then
                    echo "yes";
                else
                    echo "softfp";
                fi;
            fi;
            return 0
        ;;
        *)
            return 1
        ;;
    esac
}
tc-enables-cxx-assertions ()
{
    tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS) || defined(_LIBCPP_ENABLE_HARDENED_MODE)" ${CPPFLAGS} ${CXXFLAGS}
}
tc-enables-fortify-source ()
{
    tc-cpp-is-true "defined(_FORTIFY_SOURCE)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
tc-enables-pie ()
{
    tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
tc-enables-ssp ()
{
    tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
tc-enables-ssp-all ()
{
    tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
tc-enables-ssp-strong ()
{
    tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
tc-endian ()
{
    local host=$1;
    [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
    host=${host%%-*};
    case ${host} in
        aarch64*be)
            echo big
        ;;
        aarch64)
            echo little
        ;;
        alpha*)
            echo little
        ;;
        arc*b*)
            echo big
        ;;
        arc*)
            echo little
        ;;
        arm*b*)
            echo big
        ;;
        arm*)
            echo little
        ;;
        cris*)
            echo little
        ;;
        hppa*)
            echo big
        ;;
        i?86*)
            echo little
        ;;
        ia64*)
            echo little
        ;;
        loongarch*)
            echo little
        ;;
        m68*)
            echo big
        ;;
        mips*l*)
            echo little
        ;;
        mips*)
            echo big
        ;;
        powerpc*le)
            echo little
        ;;
        powerpc*)
            echo big
        ;;
        riscv*)
            echo little
        ;;
        s390*)
            echo big
        ;;
        sh*b*)
            echo big
        ;;
        sh*)
            echo little
        ;;
        sparc*)
            echo big
        ;;
        x86_64*)
            echo little
        ;;
        *)
            echo wtf
        ;;
    esac
}
tc-env_build ()
{
    tc-export_build_env;
    CFLAGS=${BUILD_CFLAGS} CXXFLAGS=${BUILD_CXXFLAGS} CPPFLAGS=${BUILD_CPPFLAGS} LDFLAGS=${BUILD_LDFLAGS} AR=$(tc-getBUILD_AR) AS=$(tc-getBUILD_AS) CC=$(tc-getBUILD_CC) CPP=$(tc-getBUILD_CPP) CXX=$(tc-getBUILD_CXX) LD=$(tc-getBUILD_LD) NM=$(tc-getBUILD_NM) PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) RANLIB=$(tc-getBUILD_RANLIB) READELF=$(tc-getBUILD_READELF) "$@"
}
tc-export ()
{
    local var;
    for var in "$@";
    do
        [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'";
        "tc-get${var}" > /dev/null;
    done
}
tc-export_build_env ()
{
    tc-export "$@";
    if tc-is-cross-compiler; then
        : "${BUILD_CFLAGS:=-O1 -pipe}";
        : "${BUILD_CXXFLAGS:=-O1 -pipe}";
        : "${BUILD_CPPFLAGS:= }";
        : "${BUILD_LDFLAGS:= }";
    else
        : "${BUILD_CFLAGS:=${CFLAGS}}";
        : "${BUILD_CXXFLAGS:=${CXXFLAGS}}";
        : "${BUILD_CPPFLAGS:=${CPPFLAGS}}";
        : "${BUILD_LDFLAGS:=${LDFLAGS}}";
    fi;
    export BUILD_{C,CXX,CPP,LD}FLAGS;
    local v;
    for v in BUILD_{C,CXX,CPP,LD}FLAGS;
    do
        export ${v#BUILD_}_FOR_BUILD="${!v}";
    done
}
tc-get-build-ptr-size ()
{
    $(tc-getBUILD_CC) -E -P - <<< __SIZEOF_POINTER__ || die "Could not determine CBUILD pointer size"
}
tc-get-c-rtlib ()
{
    local res=$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -print-libgcc-file-name 2> /dev/null);
    case ${res} in
        *libclang_rt*)
            echo compiler-rt
        ;;
        *libgcc*)
            echo libgcc
        ;;
        *)
            return 1
        ;;
    esac;
    return 0
}
tc-get-compiler-type ()
{
    local code='
#if defined(__PATHSCALE__)
HAVE_PATHCC
#elif defined(__clang__)
HAVE_CLANG
#elif defined(__GNUC__)
HAVE_GCC
#endif
';
    local res=$($(tc-getCC "$@") -E -P - <<< "${code}");
    case ${res} in
        *HAVE_PATHCC*)
            echo pathcc
        ;;
        *HAVE_CLANG*)
            echo clang
        ;;
        *HAVE_GCC*)
            echo gcc
        ;;
        *)
            echo unknown
        ;;
    esac
}
tc-get-cxx-stdlib ()
{
    local code='
#if __cplusplus >= 202002L
#include <version>
#else
#include <ciso646>
#endif
#if defined(_LIBCPP_VERSION)
HAVE_LIBCXX
#elif defined(__GLIBCXX__)
HAVE_LIBSTDCPP
#endif
';
    local res=$($(tc-getCXX) ${CPPFLAGS} ${CXXFLAGS} -x c++ -E -P - <<< "${code}" 2> /dev/null);
    case ${res} in
        *HAVE_LIBCXX*)
            echo libc++
        ;;
        *HAVE_LIBSTDCPP*)
            echo libstdc++
        ;;
        *)
            return 1
        ;;
    esac;
    return 0
}
tc-get-ptr-size ()
{
    $(tc-getCC) -E -P - <<< __SIZEOF_POINTER__ || die "Could not determine CHOST pointer size"
}
tc-getAR ()
{
    tc-getPROG AR ar "$@"
}
tc-getAS ()
{
    tc-getPROG AS as "$@"
}
tc-getBUILD_AR ()
{
    tc-getBUILD_PROG AR ar "$@"
}
tc-getBUILD_AS ()
{
    tc-getBUILD_PROG AS as "$@"
}
tc-getBUILD_CC ()
{
    tc-getBUILD_PROG CC gcc "$@"
}
tc-getBUILD_CPP ()
{
    tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"
}
tc-getBUILD_CXX ()
{
    tc-getBUILD_PROG CXX g++ "$@"
}
tc-getBUILD_LD ()
{
    tc-getBUILD_PROG LD ld "$@"
}
tc-getBUILD_NM ()
{
    tc-getBUILD_PROG NM nm "$@"
}
tc-getBUILD_OBJCOPY ()
{
    tc-getBUILD_PROG OBJCOPY objcopy "$@"
}
tc-getBUILD_PKG_CONFIG ()
{
    tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"
}
tc-getBUILD_PROG ()
{
    local vars="BUILD_$1 $1_FOR_BUILD HOST$1";
    tc-is-cross-compiler || vars+=" $1";
    _tc-getPROG CBUILD "${vars}" "${@:2}"
}
tc-getBUILD_RANLIB ()
{
    tc-getBUILD_PROG RANLIB ranlib "$@"
}
tc-getBUILD_READELF ()
{
    tc-getBUILD_PROG READELF readelf "$@"
}
tc-getBUILD_STRINGS ()
{
    tc-getBUILD_PROG STRINGS strings "$@"
}
tc-getBUILD_STRIP ()
{
    tc-getBUILD_PROG STRIP strip "$@"
}
tc-getCC ()
{
    tc-getPROG CC gcc "$@"
}
tc-getCPP ()
{
    tc-getPROG CPP "${CC:-gcc} -E" "$@"
}
tc-getCXX ()
{
    tc-getPROG CXX g++ "$@"
}
tc-getDLLWRAP ()
{
    tc-getPROG DLLWRAP dllwrap "$@"
}
tc-getF77 ()
{
    tc-getPROG F77 gfortran "$@"
}
tc-getFC ()
{
    tc-getPROG FC gfortran "$@"
}
tc-getGCJ ()
{
    tc-getPROG GCJ gcj "$@"
}
tc-getGO ()
{
    tc-getPROG GO gccgo "$@"
}
tc-getLD ()
{
    tc-getPROG LD ld "$@"
}
tc-getNM ()
{
    tc-getPROG NM nm "$@"
}
tc-getOBJCOPY ()
{
    tc-getPROG OBJCOPY objcopy "$@"
}
tc-getOBJDUMP ()
{
    tc-getPROG OBJDUMP objdump "$@"
}
tc-getPKG_CONFIG ()
{
    tc-getPROG PKG_CONFIG pkg-config "$@"
}
tc-getPROG ()
{
    _tc-getPROG CHOST "$@"
}
tc-getRANLIB ()
{
    tc-getPROG RANLIB ranlib "$@"
}
tc-getRC ()
{
    tc-getPROG RC windres "$@"
}
tc-getREADELF ()
{
    tc-getPROG READELF readelf "$@"
}
tc-getSTRINGS ()
{
    tc-getPROG STRINGS strings "$@"
}
tc-getSTRIP ()
{
    tc-getPROG STRIP strip "$@"
}
tc-getTARGET_CPP ()
{
    if [[ -n ${CTARGET} ]]; then
        _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@";
    else
        tc-getCPP "$@";
    fi
}
tc-has-64bit-time_t ()
{
    $(tc-getCC) ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &> /dev/null
#include <sys/types.h>
int test[sizeof(time_t) >= 8 ? 1 : -1];
EOF
    return $?
}
tc-has-tls ()
{
    local base="${T}/test-tc-tls";
    cat <<-EOF > "${base}.c"
int foo(int *i) {
static __thread int j = 0;
return *i ? j : *i;
}
EOF
    local flags;
    case $1 in
        -s)
            flags="-S"
        ;;
        -c)
            flags="-c"
        ;;
        -l)
        ;;
        -*)
            die "Usage: tc-has-tls [-c|-l] [toolchain prefix]"
        ;;
    esac;
    case "${CHOST}" in
        *-darwin*)
            : ${flags:=-dynamiclib}
        ;;
        *)
            : ${flags:=-fPIC -shared -Wl,-z,defs}
        ;;
    esac;
    [[ $1 == -* ]] && shift;
    $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null;
    local ret=$?;
    rm -f "${base}"*;
    return ${ret}
}
tc-is-clang ()
{
    [[ $(tc-get-compiler-type) == clang ]]
}
tc-is-cross-compiler ()
{
    [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
}
tc-is-gcc ()
{
    [[ $(tc-get-compiler-type) == gcc ]]
}
tc-is-lto ()
{
    local f="${T}/test-lto.o";
    local ret=1;
    case $(tc-get-compiler-type) in
        clang)
            $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<< "" || die;
            llvm-bcanalyzer "${f}" &> /dev/null && ret=0
        ;;
        gcc)
            $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<< "" || die;
            [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
        ;;
    esac;
    rm -f "${f}" || die;
    return "${ret}"
}
tc-is-softfloat ()
{
    tc-detect-is-softfloat || tc-tuple-is-softfloat
}
tc-is-static-only ()
{
    local host=${CTARGET:-${CHOST}};
    [[ ${host} == *-mint* ]]
}
tc-ld-disable-gold ()
{
    tc-ld-is-gold "$@" && tc-ld-force-bfd "$@"
}
tc-ld-force-bfd ()
{
    if tc-ld-is-bfd "$@"; then
        return;
    fi;
    ewarn "Forcing usage of the BFD linker";
    local ld=$(unset LD; tc-getLD "$@");
    local bfd_ld="${ld}.bfd";
    local path_ld=$(type -P "${bfd_ld}" 2> /dev/null);
    [[ -e ${path_ld} ]] && export LD=${bfd_ld};
    if tc-is-gcc || tc-is-clang; then
        export CFLAGS="${CFLAGS} -fuse-ld=bfd";
        export CXXFLAGS="${CXXFLAGS} -fuse-ld=bfd";
        export LDFLAGS="${LDFLAGS} -fuse-ld=bfd";
    fi
}
tc-ld-is-bfd ()
{
    local out;
    local -x LC_ALL=C;
    out=$($(tc-getLD "$@") --version 2>&1);
    if [[ ${out} != "GNU ld"* ]]; then
        return 1;
    fi;
    local base="${T}/test-tc-linker";
    cat <<-EOF > "${base}.c"
int main(void) { return 0; }
EOF
    out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
    rm -f "${base}"*;
    if [[ ! ${out} =~ .*^"GNU ld".* ]]; then
        return 1;
    fi;
    return 0
}
tc-ld-is-gold ()
{
    local out;
    local -x LC_ALL=C;
    out=$($(tc-getLD "$@") --version 2>&1);
    if [[ ${out} == *"GNU gold"* ]]; then
        return 0;
    fi;
    local base="${T}/test-tc-linker";
    cat <<-EOF > "${base}.c"
int main(void) { return 0; }
EOF
    out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
    rm -f "${base}"*;
    if [[ ${out} == *"GNU gold"* ]]; then
        return 0;
    fi;
    return 1
}
tc-ld-is-lld ()
{
    local out;
    local -x LC_ALL=C;
    out=$($(tc-getLD "$@") --version 2>&1);
    if [[ ${out} == *"LLD"* ]]; then
        return 0;
    fi;
    local base="${T}/test-tc-linker";
    cat <<-EOF > "${base}.c"
int main(void) { return 0; }
EOF
    out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
    rm -f "${base}"*;
    if [[ ${out} == *"LLD"* ]]; then
        return 0;
    fi;
    return 1
}
tc-ld-is-mold ()
{
    local out;
    local -x LC_ALL=C;
    out=$($(tc-getLD "$@") --version 2>&1);
    if [[ ${out} == *"mold"* ]]; then
        return 0;
    fi;
    local base="${T}/test-tc-linker";
    cat <<-EOF > "${base}.c"
int main(void) { return 0; }
EOF
    out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1);
    rm -f "${base}"*;
    if [[ ${out} == *"mold"* ]]; then
        return 0;
    fi;
    return 1
}
tc-ninja_magic_to_arch ()
{
    function _tc_echo_kernel_alias ()
    {
        [[ ${type} == "kern" ]] && echo $1 || echo $2
    };
    local type=$1;
    local host=$2;
    [[ -z ${host} ]] && host=${CTARGET:-${CHOST}};
    case ${host} in
        arm64*)
            echo arm64
        ;;
        aarch64*)
            echo arm64
        ;;
        alpha*)
            echo alpha
        ;;
        arc*)
            echo arc
        ;;
        arm*)
            echo arm
        ;;
        avr*)
            _tc_echo_kernel_alias avr32 avr
        ;;
        bfin*)
            _tc_echo_kernel_alias blackfin bfin
        ;;
        c6x*)
            echo c6x
        ;;
        cris*)
            echo cris
        ;;
        frv*)
            echo frv
        ;;
        hexagon*)
            echo hexagon
        ;;
        hppa*)
            _tc_echo_kernel_alias parisc hppa
        ;;
        i?86*)
            echo x86
        ;;
        ia64*)
            echo ia64
        ;;
        loongarch*)
            _tc_echo_kernel_alias loongarch loong
        ;;
        m68*)
            echo m68k
        ;;
        metag*)
            echo metag
        ;;
        microblaze*)
            echo microblaze
        ;;
        mips*)
            echo mips
        ;;
        nios2*)
            echo nios2
        ;;
        nios*)
            echo nios
        ;;
        or1k* | or32*)
            echo openrisc
        ;;
        powerpc*)
            if [[ ${type} == "kern" ]]; then
                echo powerpc;
            else
                if [[ ${host} == powerpc64* ]]; then
                    echo ppc64;
                else
                    echo ppc;
                fi;
            fi
        ;;
        riscv*)
            echo riscv
        ;;
        s390*)
            echo s390
        ;;
        score*)
            echo score
        ;;
        sh64*)
            _tc_echo_kernel_alias sh64 sh
        ;;
        sh*)
            echo sh
        ;;
        sparc64*)
            _tc_echo_kernel_alias sparc64 sparc
        ;;
        sparc*)
            [[ ${PROFILE_ARCH} == "sparc64" ]] && _tc_echo_kernel_alias sparc64 sparc || echo sparc
        ;;
        tile*)
            echo tile
        ;;
        vax*)
            echo vax
        ;;
        x86_64*)
            if [[ ${type} == "kern" ]]; then
                echo x86;
            else
                echo amd64;
            fi
        ;;
        xtensa*)
            echo xtensa
        ;;
        *)
            echo unknown
        ;;
    esac
}
tc-stack-grows-down ()
{
    case ${ARCH} in
        hppa | metag)
            return 1
        ;;
    esac;
    return 0
}
tc-tuple-is-softfloat ()
{
    local CTARGET=${CTARGET:-${CHOST}};
    case ${CTARGET//_/-} in
        bfin* | h8300*)
            echo "only"
        ;;
        *-softfloat-*)
            echo "yes"
        ;;
        *-softfp-*)
            echo "softfp"
        ;;
        arm*-hardfloat-* | arm*eabihf)
            echo "no"
        ;;
        *-newlib | *-elf | *-eabi)
            echo "no"
        ;;
        arm64-apple-darwin*)
            echo "no"
        ;;
        arm*)
            echo "yes"
        ;;
        *)
            echo "no"
        ;;
    esac
}
unpack_7z ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local p7z=$(find_unpackable_file "$1");
    unpack_banner "${p7z}";
    local cmd7z="7z";
    if command -v 7zz > /dev/null 2>&1; then
        cmd7z="7zz";
    fi;
    local output;
    output="$($cmd7z x -y "${p7z}")";
    if [ $? -ne 0 ]; then
        echo "${output}" 1>&2;
        die "unpacking ${p7z} failed (arch=unpack_7z)";
    fi
}
unpack_banner ()
{
    echo ">>> Unpacking ${1##*/} to ${PWD}"
}
unpack_cpio ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local cpio_cmd=(cpio --make-directories --extract --preserve-modification-time);
    if [[ $1 == "-" ]]; then
        unpack_banner "stdin";
        "${cpio_cmd[@]}";
    else
        local cpio=$(find_unpackable_file "$1");
        unpack_banner "${cpio}";
        "${cpio_cmd[@]}" < "${cpio}";
    fi
}
unpack_deb ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local deb=$(find_unpackable_file "$1");
    unpack_banner "${deb}";
    {
        if [[ -n ${EPREFIX} ]]; then
            {
                read;
                [[ ${REPLY} = "!<arch>" ]] || die "${deb} does not seem to be a deb archive";
                local f timestamp uid gid mode size magic;
                while read f timestamp uid gid mode size magic; do
                    [[ -n ${f} && -n ${size} ]] || continue;
                    f=${f%/};
                    if [[ ${f} = "data.tar"* ]]; then
                        local decomp=$(_unpacker_get_decompressor "${f}");
                        head -c "${size}" | ${decomp:-cat};
                        assert "unpacking ${f} from ${deb} failed";
                        break;
                    else
                        head -c "${size}" > /dev/null;
                    fi;
                done
            } < "${deb}";
        else
            local f=$($(tc-getBUILD_AR) t "${deb}" | grep ^data.tar
assert "data not found in ${deb}");
            local decomp=$(_unpacker_get_decompressor "${f}");
            $(tc-getBUILD_AR) p "${deb}" "${f}" | ${decomp:-cat};
            assert "unpacking ${f} from ${deb} failed";
        fi
    } | tar --no-same-owner -xf -;
    assert "unpacking ${deb} failed"
}
unpack_gpkg ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local gpkg=$(find_unpackable_file "$1");
    unpack_banner "${gpkg}";
    local l images=();
    while read -r l; do
        case ${l} in
            */image.tar*.sig)
            ;;
            */image.tar*)
                images+=("${l}")
            ;;
        esac;
    done < <(tar -tf "${gpkg}" || die "unable to list ${gpkg}");
    if [[ ${#images[@]} -eq 0 ]]; then
        die "No image.tar found in ${gpkg}";
    else
        if [[ ${#images[@]} -gt 1 ]]; then
            die "More than one image.tar found in ${gpkg}";
        fi;
    fi;
    local decomp=$(_unpacker_get_decompressor "${images[0]}");
    local dirname=${images[0]%/*};
    mkdir -p "${dirname}" || die;
    tar -xOf "${gpkg}" "${images[0]}" | ${decomp:-cat} | tar --no-same-owner -C "${dirname}" -xf -;
    assert "Unpacking ${gpkg} failed"
}
unpack_lha ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local lha=$(find_unpackable_file "$1");
    unpack_banner "${lha}";
    lha xfq "${lha}" || die "unpacking ${lha} failed (arch=unpack_lha)"
}
unpack_makeself ()
{
    local src_input=${1:-${A}};
    local src=$(find_unpackable_file "${src_input}");
    local skip=$2;
    local exe=$3;
    [[ -z ${src} ]] && die "Could not locate source for '${src_input}'";
    unpack_banner "${src}";
    if [[ -z ${skip} ]]; then
        local ver=$(grep -m1 -a '#.*Makeself' "${src}" | awk '{print $NF}');
        local skip=0;
        exe=tail;
        case ${ver} in
            1.5.* | 1.6.0-nv*)
                skip=$(grep -a ^skip= "${src}" | cut -d= -f2)
            ;;
            2.0 | 2.0.1)
                skip=$(grep -a ^' 'tail "${src}" | awk '{print $2}' | cut -b2-)
            ;;
            2.1.1)
                skip=$(grep -a ^offset= "${src}" | awk '{print $2}' | cut -b2-);
                (( skip++ ))
            ;;
            2.1.2)
                skip=$(grep -a ^offset= "${src}" | awk '{print $3}' | head -n 1);
                (( skip++ ))
            ;;
            2.1.3)
                skip=`grep -a ^offset= "${src}" | awk '{print $3}'`;
                (( skip++ ))
            ;;
            2.1.4 | 2.1.5 | 2.1.6 | 2.2.0 | 2.3.0 | 2.4.0)
                skip=$(grep -a offset=.*head.*wc "${src}" | awk '{print $3}' | head -n 1);
                skip=$(head -n ${skip} "${src}" | wc -c);
                exe="dd"
            ;;
            2.4.5)
                skip=$(sed -n -e '/^skip=/{s:skip="\(.*\)":\1:p;q}' "${src}");
                skip=$(head -n "${skip}" "${src}" | wc -c);
                exe="dd"
            ;;
            *)
                eerror "I'm sorry, but I was unable to support the Makeself file.";
                eerror "The version I detected was '${ver}'.";
                eerror "Please file a bug about the file ${src##*/} at";
                eerror "https://bugs.gentoo.org/ so that support can be added.";
                die "makeself version '${ver}' not supported"
            ;;
        esac;
        debug-print "Detected Makeself version ${ver} ... using ${skip} as offset";
    fi;
    case ${exe} in
        tail)
            exe=(tail -n +${skip} "${src}")
        ;;
        dd)
            exe=(dd ibs=${skip} skip=1 if="${src}")
        ;;
        *)
            die "makeself can't handle exe '${exe}'"
        ;;
    esac;
    local decomp= filetype suffix;
    filetype=$("${exe[@]}" 2> /dev/null | head -c 512 | file -S -b -) || die;
    case ${filetype} in
        *tar\ archive*)
            decomp=cat
        ;;
        bzip2*)
            suffix=bz2
        ;;
        gzip*)
            suffix=gz
        ;;
        compress*)
            suffix=z
        ;;
        XZ*)
            suffix=xz
        ;;
        Zstandard*)
            suffix=zst
        ;;
        lzop*)
            suffix=lzo
        ;;
        LZ4*)
            suffix=lz4
        ;;
        "ASCII text"*)
            decomp='base64 -d'
        ;;
        *)
            die "Unknown filetype \"${filetype}\", for makeself ${src##*/} ('${ver}' +${skip})"
        ;;
    esac;
    [[ -z ${decomp} ]] && decomp=$(_unpacker_get_decompressor ".${suffix}");
    "${exe[@]}" | ${decomp} | tar --no-same-owner -xf -;
    assert "failure unpacking (${filetype}) makeself ${src##*/} ('${ver}' +${skip})"
}
unpack_pdv ()
{
    local src=$(find_unpackable_file "$1");
    local sizeoff_t=$2;
    [[ -z ${src} ]] && die "Could not locate source for '$1'";
    [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :(";
    unpack_banner "${src}";
    local metaskip=$(tail -c ${sizeoff_t} "${src}" | hexdump -e \"%i\");
    local tailskip=$(tail -c $((${sizeoff_t}*2)) "${src}" | head -c ${sizeoff_t} | hexdump -e \"%i\");
    local metafile="${T}/${FUNCNAME}.meta";
    tail -c +$((${metaskip}+1)) "${src}" > "${metafile}";
    local datafile=$(tail -c +$((${metaskip}+1)) "${src}" | strings | head -n 1);
    datafile=$(basename "${datafile}");
    local tmpfile="${T}/${FUNCNAME}";
    tail -c +$((${tailskip}+1)) ${src} 2> /dev/null | head -c 512 > "${tmpfile}";
    local iscompressed=$(file -S -b "${tmpfile}");
    if [[ ${iscompressed:0:8} == "compress" ]]; then
        iscompressed=1;
        mv "${tmpfile}"{,.Z};
        gunzip "${tmpfile}";
    else
        iscompressed=0;
    fi;
    local istar=$(file -S -b "${tmpfile}");
    if [[ ${istar:0:9} == "POSIX tar" ]]; then
        istar=1;
    else
        istar=0;
    fi;
    if [ ${iscompressed} -eq 1 ]; then
        if [ ${istar} -eq 1 ]; then
            tail -c +$((${tailskip}+1)) "${src}" 2> /dev/null | head -c $((${metaskip}-${tailskip})) | tar -xzf -;
        else
            tail -c +$((${tailskip}+1)) "${src}" 2> /dev/null | head -c $((${metaskip}-${tailskip})) | gzip -dc > ${datafile};
        fi;
    else
        if [ ${istar} -eq 1 ]; then
            tail -c +$((${tailskip}+1)) "${src}" 2> /dev/null | head -c $((${metaskip}-${tailskip})) | tar --no-same-owner -xf -;
        else
            tail -c +$((${tailskip}+1)) "${src}" 2> /dev/null | head -c $((${metaskip}-${tailskip})) > ${datafile};
        fi;
    fi;
    true
}
unpack_rar ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local rar=$(find_unpackable_file "$1");
    unpack_banner "${rar}";
    unrar x -idq -o+ "${rar}" || die "unpacking ${rar} failed (arch=unpack_rar)"
}
unpack_zip ()
{
    [[ $# -eq 1 ]] || die "Usage: ${FUNCNAME} <file>";
    local zip=$(find_unpackable_file "$1");
    unpack_banner "${zip}";
    unzip -qo "${zip}";
    [[ $? -le 1 ]] || die "unpacking ${zip} failed (arch=unpack_zip)"
}
unpacker ()
{
    local a;
    [[ $# -eq 0 ]] && set -- ${A};
    for a in "$@";
    do
        _unpacker "${a}";
    done
}
unpacker_src_unpack ()
{
    unpacker
}
unpacker_src_uri_depends ()
{
    local uri;
    local -A deps;
    if [[ $# -eq 0 ]]; then
        set -f;
        set -- ${SRC_URI};
        set +f;
    fi;
    for uri in "$@";
    do
        case ${uri,,} in
            *.cpio.* | *.cpio)
                deps[cpio]="app-alternatives/cpio"
            ;;
            *.rar)
                deps[rar]="app-arch/unrar"
            ;;
            *.7z)
                deps[7z]="
|| (
app-arch/7zip
app-arch/p7zip
)
"
            ;;
            *.xz)
                deps[xz]="app-arch/xz-utils"
            ;;
            *.zip)
                deps[zip]="app-arch/unzip"
            ;;
            *.lz)
                deps[lz]="
|| (
>=app-arch/xz-utils-5.4.0
app-arch/plzip
app-arch/pdlzip
app-arch/lzip
)
"
            ;;
            *.zst)
                deps[zst]="app-arch/zstd"
            ;;
            *.lha | *.lzh)
                deps[lhah]="app-arch/lha"
            ;;
            *.lz4)
                deps[lz4]="app-arch/lz4"
            ;;
            *.lzo)
                deps[lzo]="app-arch/lzop"
            ;;
        esac;
    done;
    echo "${deps[*]}"
}
Filename: /var/tmp/portage/sys-kernel/gentoo-kernel-bin-6.12.34/temp/environment. Size: 82kb. View raw, , hex, or download this file.

This paste expires on 2025-07-06 20:20:17.134616. Pasted through v1-api.