diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 649ac3bc..03c4af1a 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -73,6 +73,10 @@ jobs: path: build-linux-deps fail-on-cache-miss: true + - name: Install required packages + shell: bash + run: sudo chmod 777 build_linux_deps.sh && sudo ./build_linux_deps.sh -packages_only + - name: Clone third-party build helpers (build/linux) uses: actions/checkout@v4 with: diff --git a/build_linux_deps.sh b/build_linux_deps.sh index 0ec440b9..4abb43b6 100644 --- a/build_linux_deps.sh +++ b/build_linux_deps.sh @@ -27,13 +27,14 @@ third_party_common_dir="$third_party_dir/deps/common/src" mycmake="$third_party_deps_dir/cmake-3.27.7-linux-x86_64/bin/cmake" [[ -f "$mycmake" ]] || { - echo "[X] Couldn't find cmake" >&2 - exit 1 + echo "[X] Couldn't find cmake" >&2; + exit 1; } # < 0: deduce, > 1: force PARALLEL_THREADS_OVERRIDE=-1 VERBOSITY='' +INSTALL_PACKAGES_ONLY=0 for (( i=1; i<=$#; i++ )); do var="${!i}" @@ -47,6 +48,8 @@ for (( i=1; i<=$#; i++ )); do #echo "[?] Overriding parralel build jobs count with $PARALLEL_THREADS_OVERRIDE" elif [[ "$var" = "-verbose" ]]; then VERBOSITY='-v' + elif [[ "$var" = "-packages_only" ]]; then + INSTALL_PACKAGES_ONLY=1 else echo "[X] Invalid arg: $var" >&2 exit 1 @@ -54,6 +57,33 @@ for (( i=1; i<=$#; i++ )); do done +last_code=0 + + +############## required packages ############## +echo // installing required packages +apt update -y +last_code=$((last_code + $?)) +apt install coreutils -y # echo, printf, etc... +last_code=$((last_code + $?)) +apt install build-essential -y +last_code=$((last_code + $?)) +apt install gcc-multilib g++-multilib -y # needed for 32-bit builds +last_code=$((last_code + $?)) +apt install clang -y +last_code=$((last_code + $?)) +apt install binutils -y # (optional) contains the tool 'readelf' mainly, and other usefull binary stuff +last_code=$((last_code + $?)) +apt install tar -y # we need to extract packages +last_code=$((last_code + $?)) +#apt install cmake git wget unzip -y + +# exit early if we should install packages only, used by CI mainly +[[ "$INSTALL_PACKAGES_ONLY" -ne 0 ]] && exit $last_code + +echo ; echo + + # use 70% build_threads="$(( $(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 0) * 70 / 100 ))" [[ $PARALLEL_THREADS_OVERRIDE -gt 0 ]] && build_threads="$PARALLEL_THREADS_OVERRIDE" @@ -73,22 +103,6 @@ mkdir -p "$deps_dir" || { echo; echo -last_code=0 - - -############## required packages ############## -echo // installing required packages -apt update -y -apt install coreutils -y # echo, printf, etc... -apt install build-essential -y -apt install gcc-multilib g++-multilib -y # needed for 32-bit builds -apt install clang -y -apt install binutils -y # (optional) contains the tool 'readelf' mainly, and other usefull binary stuff -apt install tar -y # we need to extract packages -#apt install cmake git wget unzip -y - -echo ; echo - ############## copy CMAKE toolchains to the home directory echo // creating CMAKE toolchains in "$deps_dir"