From 283fd2970aa52b036fc10a00db99cb086091bb4d Mon Sep 17 00:00:00 2001 From: Valere Date: Tue, 21 Apr 2026 15:34:01 +0200 Subject: [PATCH] devx: fix build sdk script options for macos --- docs/_developer_onboarding.md | 5 +++++ tools/sdk/build-rust-sdk | 21 ++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/_developer_onboarding.md b/docs/_developer_onboarding.md index a264bfec63..74020ead98 100644 --- a/docs/_developer_onboarding.md +++ b/docs/_developer_onboarding.md @@ -144,6 +144,11 @@ Prerequisites: export ANDROID_HOME=$HOME/android/sdk ``` +* On macos ensure gnu-getopt is installed + ``` + brew install gnu-getopt + ``` + You can then build the Rust SDK by running the script [`tools/sdk/build-rust-sdk`](../tools/sdk/build-rust-sdk). Type `./tools/sdk/build-rust-sdk --help` for help. diff --git a/tools/sdk/build-rust-sdk b/tools/sdk/build-rust-sdk index 2012af8741..eddff9f7e4 100755 --- a/tools/sdk/build-rust-sdk +++ b/tools/sdk/build-rust-sdk @@ -41,7 +41,14 @@ sdkArg="" ## Argument parsing -TEMP=$(getopt -o 'rs:b:at:h' --long 'remote,sdk:,branch:,build-app,target-arch:,help' -- "$@") +# Use GNU getopt (required for --long support on macOS) +if [[ "$OSTYPE" == "darwin"* ]]; then + GNU_GETOPT="$(brew --prefix gnu-getopt)/bin/getopt" +else + GNU_GETOPT="getopt" +fi + +TEMP=$("$GNU_GETOPT" -o 'rs:b:at:h' --long 'remote,sdk:,branch:,build-app,target-arch:,help' -- "$@") if [ $? -ne 0 ]; then echo 'Terminating...' >&2 @@ -53,32 +60,32 @@ unset TEMP while true; do case "$1" in - 'r'|'--remote') + '-r'|'--remote') buildLocal=1 shift continue ;; - 's'|'--sdk') + '-s'|'--sdk') sdkArg="$2" shift 2 continue ;; - 'b'|'--branch') + '-b'|'--branch') rustSdkBranch="$2" shift 2 continue ;; - 'a'|'--build-app') + '-a'|'--build-app') buildApp=0 shift continue ;; - 't'|'--target-arch') + '-t'|'--target-arch') target_arch="$2" shift 2 continue ;; - 'h'|'--help') + '-h'|'--help') cat << END SYNOPSIS