Skip to content

Commit

Permalink
[fix](macOS) Fix build scripts for macOS
Browse files Browse the repository at this point in the history
- Replaced `nproc` with `sysctl -n hw.logicalcpu` to get CPU count on macOS.
- Avoided lowercase parameter expansion due to macOS default Bash version (3.2).
  • Loading branch information
0xderek committed Dec 23, 2024
1 parent 7209101 commit c557afd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ fi

eval set -- "${OPTS}"

PARALLEL="$(($(nproc) / 4 + 1))"
NUM_CORES=0
if [[ "$(uname -s)" == 'Darwin' ]]; then
NUM_CORES=$(sysctl -n hw.logicalcpu)
else
NUM_CORES=$(nproc)
fi

PARALLEL="$((${NUM_CORES} / 4 + 1))"
BUILD_FE=0
BUILD_BE=0
BUILD_CLOUD=0
Expand Down
4 changes: 3 additions & 1 deletion thirdparty/download-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ SPEC_ARCHIVES=(
)
while [[ $# -gt 0 ]]; do
GIVEN_LIB=$1
GIVEN_LIB_LOWER="$(echo ${GIVEN_LIB} | awk '{print tolower($0)}')"
SPEC_LIB=
for TP_ARCH in "${TP_ARCHIVES[@]}"; do
if [[ "${GIVEN_LIB,,}" = "${TP_ARCH,,}" ]]; then
TP_ARCH_LOWER="$(echo ${TP_ARCH} | awk '{print tolower($0)}')"
if [[ "${GIVEN_LIB_LOWER}" = "${TP_ARCH_LOWER}" ]]; then
SPEC_LIB=${TP_ARCH}
break
fi
Expand Down

0 comments on commit c557afd

Please sign in to comment.