Skip to content

Commit 3f1be2a

Browse files
committed
scripts/bootstrap-prefix: set CPU_FLAGS_* when we can
Signed-off-by: Fabian Groffen <[email protected]>
1 parent ad71d59 commit 3f1be2a

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

scripts/bootstrap-prefix.sh

+41
Original file line numberDiff line numberDiff line change
@@ -3289,6 +3289,47 @@ EOF
32893289

32903290
[[ ${STOP_BOOTSTRAP_AFTER} == stage3 ]] && exit 0
32913291

3292+
# do some sanity USE-flag enabling based on CPU, use cpuid2cpuflags
3293+
# if keyworded for this arg, else see if there's fallbacks to be
3294+
# made
3295+
mkdir -p "${EPREFIX}/etc/portage/package.use"
3296+
if emerge -1v cpuid2cpuflags ; then
3297+
hash -r
3298+
echo "*/* $(cpuid2cpuflags)" \
3299+
> "${EPREFIX}/etc/portage/package.use/00cpu-flags"
3300+
else
3301+
case "${CHOST}" in
3302+
arm64-*darwin*)
3303+
# https://github.com/RustCrypto/utils/issues/378
3304+
local flags=( "aes" "sha1" "sha2" )
3305+
local line
3306+
sysctl hw.optional | while read -r line ; do
3307+
line=${line#hw.optional.}
3308+
[[ ${line%%*: } == "1" ]] || continue
3309+
line=${line%: *}
3310+
case "${line}" in
3311+
"neon")
3312+
flags+=( "${line}" )
3313+
;;
3314+
"armv8_"*)
3315+
line=${line#armv8_}
3316+
case "${line}" in
3317+
"crc32")
3318+
flags+=( "${line}" )
3319+
;;
3320+
"2_sha"*)
3321+
flags+=( "${line#2_}" )
3322+
;;
3323+
esac
3324+
;;
3325+
esac
3326+
done
3327+
echo "*/* CPU_FLAGS_ARM: ${flags}" \
3328+
> "${EPREFIX}/etc/portage/package.use/00cpu-flags"
3329+
;;
3330+
esac
3331+
fi
3332+
32923333
local cmd="emerge -v --deep --update --changed-use @world"
32933334
if [[ -e ${EPREFIX}/var/cache/edb/mtimedb ]] && \
32943335
grep -q resume "${EPREFIX}"/var/cache/edb/mtimedb ;

0 commit comments

Comments
 (0)