cysamurai 2 months ago
parent e54ee18b58
commit 67f8b14ff6

@ -28,6 +28,7 @@ OUTPUT_ROOT="$REPO_ROOT/dist/linux-deb"
ARM64_PKGCONFIG_DIR="/usr/lib/aarch64-linux-gnu/pkgconfig" ARM64_PKGCONFIG_DIR="/usr/lib/aarch64-linux-gnu/pkgconfig"
X64_PKGCONFIG_DIR="/usr/lib/x86_64-linux-gnu/pkgconfig" X64_PKGCONFIG_DIR="/usr/lib/x86_64-linux-gnu/pkgconfig"
AVAILABLE_PROJECTS=() AVAILABLE_PROJECTS=()
POSITIONAL_ARGS=()
usage() { usage() {
cat <<EOF cat <<EOF
@ -56,6 +57,7 @@ process.exit(scripts["build:deb:x64"] && scripts["build:deb:arm64"] ? 0 : 1);
} }
parse_args() { parse_args() {
POSITIONAL_ARGS=()
while (($# > 0)); do while (($# > 0)); do
case "$1" in case "$1" in
--arch) --arch)
@ -102,7 +104,7 @@ parse_args() {
esac esac
if (($# > 0)); then if (($# > 0)); then
printf '%s\n' "$@" POSITIONAL_ARGS=("$@")
fi fi
} }
@ -266,8 +268,8 @@ select_projects() {
} }
main() { main() {
local -a positional to_build local -a to_build
mapfile -t positional < <(parse_args "$@") parse_args "$@"
mapfile -t AVAILABLE_PROJECTS < <(discover_projects) mapfile -t AVAILABLE_PROJECTS < <(discover_projects)
if (( ${#AVAILABLE_PROJECTS[@]} == 0 )); then if (( ${#AVAILABLE_PROJECTS[@]} == 0 )); then
echo "错误: 未发现可构建项目(需包含 build:deb:x64 与 build:deb:arm64 脚本)" >&2 echo "错误: 未发现可构建项目(需包含 build:deb:x64 与 build:deb:arm64 脚本)" >&2
@ -279,7 +281,7 @@ main() {
return return
fi fi
mapfile -t to_build < <(select_projects "${positional[@]}") mapfile -t to_build < <(select_projects "${POSITIONAL_ARGS[@]}")
mkdir -p "$OUTPUT_ROOT" mkdir -p "$OUTPUT_ROOT"
for p in "${to_build[@]}"; do for p in "${to_build[@]}"; do

Loading…
Cancel
Save