diff options
author | Fabian Groffen <grobian@gentoo.org> | 2024-08-11 18:18:52 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2024-08-11 18:18:52 +0200 |
commit | 3f1be2af12937c77c962bb864a8254ffebedc15b (patch) | |
tree | 2c165b1f8a6e9dc2f33c002b17a6aff3acc94402 | |
parent | eclass/java-utils-2: sync with gx86 (diff) | |
download | prefix-3f1be2af12937c77c962bb864a8254ffebedc15b.tar.gz prefix-3f1be2af12937c77c962bb864a8254ffebedc15b.tar.bz2 prefix-3f1be2af12937c77c962bb864a8254ffebedc15b.zip |
scripts/bootstrap-prefix: set CPU_FLAGS_* when we can
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rwxr-xr-x | scripts/bootstrap-prefix.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index dfdff4c99e..a20af50355 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -3289,6 +3289,47 @@ EOF [[ ${STOP_BOOTSTRAP_AFTER} == stage3 ]] && exit 0 + # do some sanity USE-flag enabling based on CPU, use cpuid2cpuflags + # if keyworded for this arg, else see if there's fallbacks to be + # made + mkdir -p "${EPREFIX}/etc/portage/package.use" + if emerge -1v cpuid2cpuflags ; then + hash -r + echo "*/* $(cpuid2cpuflags)" \ + > "${EPREFIX}/etc/portage/package.use/00cpu-flags" + else + case "${CHOST}" in + arm64-*darwin*) + # https://github.com/RustCrypto/utils/issues/378 + local flags=( "aes" "sha1" "sha2" ) + local line + sysctl hw.optional | while read -r line ; do + line=${line#hw.optional.} + [[ ${line%%*: } == "1" ]] || continue + line=${line%: *} + case "${line}" in + "neon") + flags+=( "${line}" ) + ;; + "armv8_"*) + line=${line#armv8_} + case "${line}" in + "crc32") + flags+=( "${line}" ) + ;; + "2_sha"*) + flags+=( "${line#2_}" ) + ;; + esac + ;; + esac + done + echo "*/* CPU_FLAGS_ARM: ${flags}" \ + > "${EPREFIX}/etc/portage/package.use/00cpu-flags" + ;; + esac + fi + local cmd="emerge -v --deep --update --changed-use @world" if [[ -e ${EPREFIX}/var/cache/edb/mtimedb ]] && \ grep -q resume "${EPREFIX}"/var/cache/edb/mtimedb ; |