From 925949d54ad88a595c8470b2e22b9cad10d98dfa Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 30 Oct 2025 22:26:51 +0100 Subject: [PATCH] Refactor dependency build scripts initialization Rename "common" to "_init" because it not only exposes common functions but also initializes environment variables. Call _init in a single line in all dependency build scripts. --- app/deps/{common => _init} | 7 +++---- app/deps/adb_linux.sh | 4 +--- app/deps/adb_macos.sh | 4 +--- app/deps/adb_windows.sh | 4 +--- app/deps/dav1d.sh | 4 +--- app/deps/ffmpeg.sh | 4 +--- app/deps/libusb.sh | 4 +--- app/deps/sdl.sh | 4 +--- 8 files changed, 10 insertions(+), 25 deletions(-) rename app/deps/{common => _init} (92%) diff --git a/app/deps/common b/app/deps/_init similarity index 92% rename from app/deps/common rename to app/deps/_init index daaa96c0..4612d9fe 100644 --- a/app/deps/common +++ b/app/deps/_init @@ -1,10 +1,9 @@ -#!/usr/bin/env bash # This file is intended to be sourced by other scripts, not executed process_args() { if [[ $# != 3 ]] then - # : win32 or win64 + # : linux, macos, win32 or win64 # : native or cross # : static or shared echo "Syntax: $0 " >&2 @@ -12,8 +11,8 @@ process_args() { fi HOST="$1" - BUILD_TYPE="$2" # native or cross - LINK_TYPE="$3" # static or shared + BUILD_TYPE="$2" + LINK_TYPE="$3" DIRNAME="$HOST-$BUILD_TYPE-$LINK_TYPE" if [[ "$BUILD_TYPE" != native && "$BUILD_TYPE" != cross ]] diff --git a/app/deps/adb_linux.sh b/app/deps/adb_linux.sh index a3e339ec..c284dd24 100755 --- a/app/deps/adb_linux.sh +++ b/app/deps/adb_linux.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init "$@" VERSION=36.0.0 FILENAME=platform-tools_r$VERSION-linux.zip diff --git a/app/deps/adb_macos.sh b/app/deps/adb_macos.sh index 6880fb93..e580e571 100755 --- a/app/deps/adb_macos.sh +++ b/app/deps/adb_macos.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init "$@" VERSION=36.0.0 FILENAME=platform-tools_r$VERSION-darwin.zip diff --git a/app/deps/adb_windows.sh b/app/deps/adb_windows.sh index b9bd05dc..da95bb81 100755 --- a/app/deps/adb_windows.sh +++ b/app/deps/adb_windows.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init "$@" VERSION=36.0.0 FILENAME=platform-tools_r$VERSION-win.zip diff --git a/app/deps/dav1d.sh b/app/deps/dav1d.sh index 3069b6fe..89956636 100755 --- a/app/deps/dav1d.sh +++ b/app/deps/dav1d.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" VERSION=1.5.0 diff --git a/app/deps/ffmpeg.sh b/app/deps/ffmpeg.sh index fb8b9a25..a879669d 100755 --- a/app/deps/ffmpeg.sh +++ b/app/deps/ffmpeg.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" VERSION=7.1.1 diff --git a/app/deps/libusb.sh b/app/deps/libusb.sh index 887a2a77..d1dd4cbf 100755 --- a/app/deps/libusb.sh +++ b/app/deps/libusb.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" VERSION=1.0.29 diff --git a/app/deps/sdl.sh b/app/deps/sdl.sh index e04deb0d..d382c183 100755 --- a/app/deps/sdl.sh +++ b/app/deps/sdl.sh @@ -1,8 +1,6 @@ #!/usr/bin/env bash set -ex -DEPS_DIR=$(dirname ${BASH_SOURCE[0]}) -cd "$DEPS_DIR" -. common +. $(dirname ${BASH_SOURCE[0]})/_init process_args "$@" VERSION=2.32.8