#! /bin/sh RED="\033[0;31m" RESET="\033[0m" TEMPLATE_DIR=$HOME/.local/share/godot/export_templates DIR=godot FORCE=0 CLEAN=0 ANDROID=1 OPTIMIZED=0 VERSION=4 for I in "$@" do case $I in f) FORCE=1 ;; a) ANDROID=0 ;; c) CLEAN=1 ;; o) OPTIMIZED=1 ;; 3) VERSION=$I TEMPLATE_DIR=$HOME/.local/share/godot/templates esac done TEMPLATE_DIR=$TEMPLATE_DIR/$VERSION.x if [ $VERSION == 4 ] then DIR=godot-master platform=linuxbsd target=editor targets="template_release template_debug" else platform=x11 target=release_debug targets="release debug" fi function build() { J=$(nproc) export CXX=/usr/lib/ccache/bin/clang++ export CC=/usr/lib/ccache/bin/clang [ -f custom.py ] && rm custom.py rm ./bin/* [ $CLEAN -eq 1 ] && scons platform=$platform --clean [ $OPTIMIZED -eq 1 ] && opt_flags="use_static_ccp=yes lto=full debug_symbols=no" common_flags="use_llvm=yes linker=lld debug_symbols=no lto=none use_static_cpp=no" # arch does not provide libatomic.a through gcc-libs # https://docs.godotengine.org/en/3.2/development/compiling/compiling_for_x11.html echo -e "build : ${RED}$platform$RESET target=$RED$target$RESET" time scons -j$J platform=$platform target=$target tools=yes colored=yes pulseaudio=no bits=64 $common_flags warnings=no #custom_modules=../modules if [ $ANDROID -eq 1 ] then cp ../custom.py . export ANDROID_HOME=/opt/android-sdk export ANDROID_NDK_ROOT=/opt/android-ndk [ ! -d $TEMPLATE_DIR ] && mkdir $TEMPLATE_DIR [ $CLEAN -eq 1 ] && scons platform=android --clean # https://docs.godotengine.org/en/3.2/development/compiling/compiling_for_android.html echo -e "${RED}gradlew clean$RESET" pushd platform/android/java && ./gradlew --no-daemon cleanGodotTemplates && popd ndk_platform=android-22 for target in $targets; do for arch in arm64v8 armv7; #x86_6 do if [ $VERSION == 3 ] then aarch="android_arch" else aarch="arch" fi echo -e "build : ${RED}android$RESET $aarch=$RED$arch$RESET target=$RED$target$RESET ndk_platform=$RED$ndk_platform$RESET" time scons -j$J platform=android target=$target $aarch=$arch ndk_platform=$ndk_platform tools=no disable_3d=true $common_flags done done echo -e "${RED}gradlew build$RESET" pushd platform/android/java && ./gradlew --no-daemon generateGodotTemplates && popd cp bin/android* $TEMPLATE_DIR/ rm custom.py fi } pushd $DIR if [ $CLEAN -eq 1 ] then find -name \*.o -delete find -name \*.gen.h -delete find -name \*.gen.cpp -delete fi HEAD_PREV=$(git log HEAD~1.. --pretty=format:'%H' | head -n1) echo -e "current HEAD : $RED$HEAD_PREV$RESET" git pull HEAD_NOW=$(git log HEAD~1.. --pretty=format:'%H' | head -n1) echo -e "updated HEAD : $RED$HEAD_NOW$RESET" if [ $FORCE = 1 ] || [ "$HEAD_PREV" != "$HEAD_NOW" ] then build git log $HEAD_PREV.. fi strip ./bin/godot.* ls -lh ./bin/ popd # https://godot-build-options-generator.github.io # scons -j4 platform=linuxbsd target=release_debug tools=yes pulseaudio=no bits=64 warnings=no #custom_modules=../modules # scons -j4 platform=android target=debug android_arch=arm64v8 ndk_platform=android-22 tools=no disable_3d=true