From 75395c6793c2fafeedcf7c3108b78e06329019dd Mon Sep 17 00:00:00 2001 From: Monirzadeh <25131576+Monirzadeh@users.noreply.github.com> Date: Thu, 30 May 2024 01:00:28 +0330 Subject: [PATCH] chore: check for avx2 processor feature when trying to run bun (#920) * check avx2 when use bun * change enviroment variable to just BUN * better massage Co-authored-by: Mario Rugiero * simpler method * add missing reverse if * patch with @fmartingr to check that in linux only --------- Co-authored-by: Mario Rugiero Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com> --- scripts/styles.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/styles.sh b/scripts/styles.sh index acd8dcee9..475d44c01 100755 --- a/scripts/styles.sh +++ b/scripts/styles.sh @@ -6,14 +6,26 @@ OUTPUT_STYLECSS=internal/view/assets/css/style.css INPUT_ARCHIVECSS=internal/view/assets/less/archive.less OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css +# Detect support of avx2 +BUN="bun" +case `uname -o` in + GNU/Linux) + # Detect support of avx2 in linux hosts + if ! grep -q avx2 /proc/cpuinfo; then + BUN="sde -chip-check-disable -- bun" + echo "Your CPU does not support avx2 so we use sde, for more information please look at https://github.com/oven-sh/bun/issues/762#issuecomment-1186505847" + fi + ;; +esac + # Use bun is installled if [ -x "$(command -v bun)" ]; then - bun install - bun x prettier internal/view/ --write - bun x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS - bun x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS - bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS - bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUN install + $BUN x prettier internal/view/ --write + $BUN x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS + $BUN x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS + $BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS + $BUN x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS exit 0 fi