allow switching msys2 environment in packaging script (#335)

This commit is contained in:
Cyano Hao 2024-03-28 21:58:08 +08:00 committed by GitHub
parent 4673850c9c
commit e79b8d47ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 1 deletions

View File

@ -3,7 +3,14 @@
set -euxo pipefail
# Usage:
# packages/msys/build-x64.sh [-c|--clean] [-nd|--no-deps] [-t|--target-dir <dir>]
# packages/msys/build-mingw.sh [-m|--msystem <MSYSTEM>] [-c|--clean] [-nd|--no-deps] [-t|--target-dir <dir>]
# Options:
# -m, --msystem <MSYSTEM> switch to other MSYS2 environment
# (MINGW32, MINGW64, UCRT64, CLANG32, CLANG64)
# MUST be used before other options
# -c, --clean clean build and package directories
# -nd, --no-deps skip dependency check
# -t, --target-dir <dir> set target directory for the packages
source version.inc
[[ -n "${APP_VERSION_SUFFIX}" ]] && APP_VERSION="${APP_VERSION}${APP_VERSION_SUFFIX}"
@ -13,6 +20,21 @@ if [[ ! -v MSYSTEM ]]; then
exit 1
fi
if [[ $# -gt 1 && ($1 == "-m" || $1 == "--msystem") ]]; then
msystem=$2
shift 2
case "${msystem}" in
MINGW32|MINGW64|UCRT64|CLANG32|CLANG64)
export MSYSTEM="${msystem}"
exec /bin/bash --login "$0" "$@"
;;
*)
echo "Invalid MSYSTEM: ${msystem}"
exit 1
;;
esac
fi
case "${MSYSTEM}" in
MINGW32|CLANG32) # there is no UCRT32
NSIS_ARCH=x86