Skip to content

Commit

Permalink
update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex313031 committed Jan 11, 2024
1 parent 1376ea1 commit 86b0e7e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 18 deletions.
13 changes: 10 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@ export NINJA_STATUS="[%r processes, %f/%t @ %o/s | %e sec. ] " &&

cd ${CR_SRC_DIR} &&

# Needed to prevent api-ms-win-core-com-l1-1-0.dll error
rm -v out/thorium/dbghelp.dll &&
fixDbghelp () {
# Needed to prevent api-ms-win-core-com-l1-1-0.dll error
rm -f -v out/thorium/dbghelp.dll
}
case $1 in
--fix) fixDbghelp;
esac

autoninja -C out/thorium thorium chromedriver clear_key_cdm thorium_shell setup mini_installer -j$@ &&
autoninja -C out/thorium thorium chromedriver clear_key_cdm setup mini_installer -j$@ &&
# Disable content_shell for now
# thorium_shell

mv -v -f ${CR_SRC_DIR}/out/thorium/mini_installer.exe ${CR_SRC_DIR}/out/thorium/thorium_mini_installer.exe &&

Expand Down
50 changes: 35 additions & 15 deletions check_simd.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2023 Alex313031.
# Copyright (c) 2024 Alex313031.

program="Thorium Browser." # The program we are checking for.

Expand All @@ -19,11 +19,13 @@ try() { "$@" || die "${RED}Failed $*"; }

script_name=${0##*/}

clear &&

check_result() { # Message calls
local ret="$1"
local msg="$2"
[ "$ret" -ne 0 ] && { printf "${RED}FAIL:" && tput sgr0 && echo " $msg"; }
printf "${GRE}SUCCESS:" && tput sgr0 && echo " $msg"
[ "$ret" -ne 0 ] && { printf " ${RED}FAIL:" && tput sgr0 && echo " $msg"; }
printf " ${GRE}SUCCESS:" && tput sgr0 && echo " $msg"
}

get_cpuinfo() { # return details of the first CPU only
Expand All @@ -35,6 +37,22 @@ have_cpu_feature() {
get_cpuinfo | egrep -q "^flags.*\<$feature\>"
}

have_64bit_cpu() {
local feature="lm" # "Long mode"
local desc="64-bit x86 CPU"
local need="$desc ($feature)"
have_cpu_feature "$feature"
check_result "$?" "$need"
}

have_sse2_cpu_feature () {
local feature="sse2"
local desc="Streaming SIMD Extensions 2"
local need="$desc ($feature)"
have_cpu_feature "$feature"
check_result "$?" "$need"
}

have_sse3_cpu_feature () {
local feature="pni"
local desc="Streaming SIMD Extensions 3"
Expand All @@ -51,6 +69,14 @@ have_sse41_cpu_feature () {
check_result "$?" "$need"
}

have_sse42_cpu_feature () {
local feature="sse4_2"
local desc="Streaming SIMD Extensions 4.2"
local need="$desc ($feature)"
have_cpu_feature "$feature"
check_result "$?" "$need"
}

have_aes_cpu_feature () {
local feature="aes"
local desc="Advanced Encryption Standard Extensions"
Expand All @@ -75,29 +101,23 @@ have_avx2_cpu_feature () {
check_result "$?" "$need"
}

have_64bit_cpu() {
local feature="lm" # "Long mode"
local desc="64-bit x86 CPU"
local need="$desc ($feature)"
have_cpu_feature "$feature"
check_result "$?" "$need"
}

common_checks() {
have_64bit_cpu && have_sse3_cpu_feature && have_sse41_cpu_feature && \
have_aes_cpu_feature && have_avx_cpu_feature && have_avx2_cpu_feature
have_64bit_cpu && have_sse2_cpu_feature && have_sse3_cpu_feature && have_sse41_cpu_feature && \
have_sse42_cpu_feature && have_aes_cpu_feature && have_avx_cpu_feature && have_avx2_cpu_feature
}

check_host() {
printf "\n" &&
printf "${YEL}Checking if host is capable of building/running $program\n" && tput sgr0; echo
printf " ${YEL}Checking host CPU instruction extensions...${c0}\n"; echo
common_checks
printf "\n" &&
printf " ${YEL}If your CPU has AVX, you can build/run $program${c0}\n" && tput sgr0;
}

main() {
case "$1" in
host) check_host ;;
*) printf "${RED}ERROR: Invalid type specified: '$1'\n" 2>&1 && tput sgr0; exit 1 ;;
*) printf " ${RED}ERROR: Invalid type specified: '$1'\n" 2>&1 && tput sgr0; exit 1 ;;
esac
}

Expand Down

0 comments on commit 86b0e7e

Please sign in to comment.