1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00
audacity/scripts/ci/build.sh
Emily Mabrey e06af5bb29
Fix MacOS hdiutil CMake parallelization issue
* Make CMake builds better parallelized
* Update CI Build script parallelization
* Make `repeat_hdiutil.sh` take longer between repeats
* Make sure that bash is the latest version on CI builds.

Signed-off-by: Emily Mabrey <emabrey@tenacityaudio.org>
Reference-to: https://github.com/tenacityteam/tenacity/pull/391
2021-07-26 23:55:44 -04:00

45 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
((${BASH_VERSION%%.*} >= 4)) || { echo >&2 "$0: Error: Please upgrade Bash."; exit 1; }
set -euxo pipefail
if [[ "${OSTYPE}" == msys* ]]; then # Windows
cpus="${NUMBER_OF_PROCESSORS}"
elif [[ "${OSTYPE}" == darwin* ]]; then # macOS
cpus="$(sysctl -n hw.ncpu)"
else # Linux & others
cpus="$(nproc)"
fi
export CMAKE_BUILD_PARALLEL_LEVEL=$(( ${cpus} > 2 ? $((${cpus} - 2)) : ${cpus} ))
echo "Using ${CMAKE_BUILD_PARALLEL_LEVEL} processors for cmake build"
# Build Audacity
cmake --build build --config "${AUDACITY_BUILD_TYPE}"
BIN_OUTPUT_DIR=build/bin/${AUDACITY_BUILD_TYPE}
SYMBOLS_OUTPUT_DIR=debug
mkdir ${SYMBOLS_OUTPUT_DIR}
if [[ "${OSTYPE}" == msys* ]]; then # Windows
# copy PDBs to debug folder...
find ${BIN_OUTPUT_DIR} -name '*.pdb' | xargs -I % cp % ${SYMBOLS_OUTPUT_DIR}
# and remove debug symbol files from the file tree before archiving
find ${BIN_OUTPUT_DIR} -name '*.iobj' -o -name '*.ipdb' -o -name '*.pdb' -o -name '*.ilk' | xargs rm -f
elif [[ "${OSTYPE}" == darwin* ]]; then # macOS
find ${BIN_OUTPUT_DIR} -name '*.dSYM' | xargs -J % mv % ${SYMBOLS_OUTPUT_DIR}
else # Linux & others
chmod +x scripts/ci/linux/split_debug_symbols.sh
find ${BIN_OUTPUT_DIR} -type f -executable -o -name '*.so' | xargs -n 1 scripts/ci/linux/split_debug_symbols.sh
find ${BIN_OUTPUT_DIR} -name '*.debug' | xargs -I % mv % ${SYMBOLS_OUTPUT_DIR}
fi