summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-03-28 23:49:00 +0800
committerGitHub <[email protected]>2025-03-28 23:49:00 +0800
commit99500a74caf5e12aa66f73a19fa8bc41fc171e2c (patch)
tree4db07fdd2f8fc8090184d79e78c59e7b80f1dae7
parent7c9b18cea01deca88ffd5a0834a65f6dc0cda7fc (diff)
parent5197454e610718e457437a1a66090058d056b71e (diff)
Merge pull request #6265 from Doekin/srcenv
srcenv.profile: additional detection of xmake binary in `core/build`
-rwxr-xr-xscripts/srcenv.profile28
1 files changed, 25 insertions, 3 deletions
diff --git a/scripts/srcenv.profile b/scripts/srcenv.profile
index f2f4e5a26..13f4da112 100755
--- a/scripts/srcenv.profile
+++ b/scripts/srcenv.profile
@@ -1,8 +1,30 @@
# cd projectdir
+xmake_binaries=(
+ "build/xmake"
+ "build/xmake.exe"
+ "core/build/xmake"
+ "core/build/xmake.exe"
+)
+
export XMAKE_PROGRAM_DIR=`pwd`/xmake
-alias xmake=`pwd`/build/xmake
-export XMAKE_PROGRAM_FILE=`pwd`/build/xmake
+xmake_found=0
+for xmake_binary in "${xmake_binaries[@]}"; do
+ if [[ -x "$xmake_binary" ]] && ("$xmake_binary" --version); then
+ xmake_found=1
+ break
+ fi
+done
+
+if [ $xmake_found -eq 0 ]; then
+ unset xmake_binaries xmake_binary xmake_found
+ echo "Error: Cannot find a working xmake executable"
+ return 1
+fi
+
+alias xmake=`pwd`/$xmake_binary
+export XMAKE_PROGRAM_FILE=`pwd`/$xmake_binary
alias xrepo=`pwd`/scripts/xrepo.sh
-xmake --version
+
+unset xmake_binaries xmake_binary xmake_found
xmake l xmake.programdir
xmake l xmake.programfile