From a6f4bc0e8adb840966f2ee0d63537cdb60d3cf8c Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 29 Jun 2022 09:37:57 +0200 Subject: [PATCH] [godot] More CI script refactoring. --- spine-godot/build/build-templates.sh | 35 +++++++++++++++------- spine-godot/build/build.sh | 43 ++++++++++++++++------------ spine-godot/build/setup.sh | 5 ++-- 3 files changed, 52 insertions(+), 31 deletions(-) mode change 100644 => 100755 spine-godot/build/setup.sh diff --git a/spine-godot/build/build-templates.sh b/spine-godot/build/build-templates.sh index 701519c6e..048f178dd 100755 --- a/spine-godot/build/build-templates.sh +++ b/spine-godot/build/build-templates.sh @@ -4,15 +4,29 @@ set -e dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" pushd $dir > /dev/null -if [ "$#" -eq 0 ] && [ ! -d ../godot ]; then - echo "No Godot clone found. Run ./build.sh first." +if [ ! "$#" -eq 1 ]; then + echo "Usage: ./build-templates.sh " + echo + echo "e.g.:" + echo " ./build-templates.sh windows" + echo " ./build-templates.sh linux" + echo " ./build-templates.sh macos" + echo " ./build-templates.sh ios" + echo " ./build-templates.sh android" + echo " ./build-templates.sh web" + echo exit 1 fi -version="3.4.5.rc" +if [ ! -d ../godot ]; then + echo "No Godot clone found. Run ./setup.sh first." + exit 1 +fi + +platform=${1%/} pushd ../godot -if [ `uname` == "Darwin" ]; then +if [ "$platform" = "macos" ]; then # --- macOS --- # generates osx.zip @@ -29,12 +43,11 @@ if [ `uname` == "Darwin" ]; then mkdir -p osx_template.app/Contents/MacOS cp godot.osx.opt.universal osx_template.app/Contents/MacOS/godot_osx_release.64 cp godot.osx.opt.debug.universal osx_template.app/Contents/MacOS/godot_osx_debug.64 - chmod +x osx_template.app/Contents/MacOS/godot_osx* - echo "$version" > version.txt + chmod +x osx_template.app/Contents/MacOS/godot_osx* rm -rf osx.zip - zip -q -9 -r osx.zip osx_template.app version.txt + zip -q -9 -r osx.zip osx_template.app popd - +elif [ "$platform" = "ios" ]; then # --- iOS -- # generates iphone.zip @@ -54,12 +67,14 @@ if [ `uname` == "Darwin" ]; then cp libgodot.iphone.opt.arm64.a ios_xcode/libgodot.iphone.release.xcframework/ios-arm64/libgodot.a cp libgodot.iphone.opt.simulator.a ios_xcode/libgodot.iphone.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a cp libgodot.iphone.opt.debug.arm64.a ios_xcode/libgodot.iphone.debug.xcframework/ios-arm64/libgodot.a - cp libgodot.iphone.opt.debug.simulator.a ios_xcode/libgodot.iphone.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a - echo "$version" > version.txt + cp libgodot.iphone.opt.debug.simulator.a ios_xcode/libgodot.iphone.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a rm -rf iphone.zip pushd ios_xcode zip -q -9 -r ../iphone.zip * popd popd +else + echo "Unknown platform: $platform" + exit 1 fi popd diff --git a/spine-godot/build/build.sh b/spine-godot/build/build.sh index dfa64a5bb..5a0482d50 100755 --- a/spine-godot/build/build.sh +++ b/spine-godot/build/build.sh @@ -4,19 +4,13 @@ set -e dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" pushd $dir > /dev/null -if [ ! "$#" -eq 0 ] && [ ! "$#" -eq 2 ]; then +if [ ! "$#" -eq 1 ]; then echo "Usage: ./build.sh " echo echo "e.g.:" echo " ./build.sh release_debug" echo " ./build.sh debug" echo - read version - exit 1 -fi - -if [ "$#" -eq 0 ]; then - echo "Please specify a target, either 'debug' or 'release_debug'" exit 1 fi @@ -25,21 +19,34 @@ if [ ! -d ../godot ]; then exit 1 fi -branch=${1%/} - -if [ "${2}" = "true" ]; then - target="target=debug" -else - target="" +target="target=${1%/}" +dev="false" +if [ -f "../godot/custom.py" ]; then + dev="true" fi - pushd ../godot -scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" -j16 -if [ `uname` == 'Darwin' ]; then +if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then + scons $target arch=x86_64 compiledb=yes custom_modules="../spine_godot" -j16 scons $target arch=arm64 compiledb=yes custom_modules="../spine_godot" -j16 - lipo -create bin/godot.osx.tools.x86_64 bin/godot.osx.tools.arm64 -output bin/godot.osx.tools.universal - strip -S -x bin/godot.osx.tools.universal + + pushd bin + cp -r ../misc/dist/osx_tools.app . + mv osx_tools.app Godot.app + mkdir -p Godot.app/Contents/MacOS + if [ "$target" = "debug" ]; then + lipo -create godot.osx.tools.x86_64 godot.osx.tools.arm64 -output godot.osx.tools.universal + strip -S -x godot.osx.tools.universal + cp godot.osx.tools.universal Godot.app/Contents/MacOS/Godot + else + lipo -create godot.osx.opt.tools.x86_64 godot.osx.opt.tools.arm64 -output godot.osx.tools.universal + strip -S -x godot.osx.opt.tools.universal + cp godot.osx.opt.tools.universal Godot.app/Contents/MacOS/Godot + fi + chmod +x Godot.app/Contents/MacOS/Godot + popd +else + scons $target compiledb=yes custom_modules="../spine_godot" -j16 fi popd diff --git a/spine-godot/build/setup.sh b/spine-godot/build/setup.sh old mode 100644 new mode 100755 index 94035e28a..e5aabd5af --- a/spine-godot/build/setup.sh +++ b/spine-godot/build/setup.sh @@ -4,14 +4,13 @@ set -e dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" pushd $dir > /dev/null -if [ ! "$#" -eq 0 ] && [ ! "$#" -eq 2 ]; then +if [ ! "$#" -eq 2 ]; then echo "Usage: ./setup.sh " echo echo "e.g.:" echo " ./setup.sh 3.4.4-stable true" echo " ./setup.sh master false" - echo - read version + echo exit 1 fi