blob: 1536d2c4560ee16f0627038b53f77189c8e33034 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#! /bin/sh
# archlinux setup
# yay -S android-sdk jre8-openjdk-headless jdk17-openjdk
# archlinux-java set java-8-openjdk/jre
# sdkmanager "ndk;23.2.8568313"
# sdkmanager "cmake;3.18.1"
# sdkmanager "build-tools;33.0.2"
# sdkmanager "platforms;android-33"
# archlinux-java set java-17-openjdk
RED="\033[0;31m"
RESET="\033[0m"
SRC_DIR=godot-master
FORCE=0
CLEAN=0
ANDROID=0
VERSION=4
TEMPLATE_DIR=$HOME/.local/share/godot/export_templates
TEMPLATE_DIR=$TEMPLATE_DIR/$VERSION.x
platform=linuxbsd
target=editor
targets="template_release template_debug"
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
linux_tools="tools=yes colored=yes pulseaudio=no bits=64 warnings=no" #custom_modules=../modules
#export CXX=/usr/lib/ccache/bin/clang++
#export CC=/usr/lib/ccache/bin/clang
#export ANDROID_HOME=/opt/android-sdk
#export ANDROID_NDK_ROOT=/opt/android-ndk
for I in "$@"
do
case $I in
f)
FORCE=1
;;
a)
ANDROID=1
;;
c)
CLEAN=1
;;
esac
done
function build()
{
#[ -f custom.py ] && rm custom.py
rm ./bin/*
[ $CLEAN -eq 1 ] && scons --clean
# https://docs.huihoo.com/godotengine/godot-docs/godot/reference/compiling_for_x11.html
echo -e "build : ${RED}$platform$RESET target=$RED$target$RESET"
time scons platform=$platform target=$target $linux_flags $common_flags #warnings=no #custom_modules=../modules
if [ $ANDROID -eq 1 ]
then
#[ -f ../custom.py ] && cp ../custom.py .
[ ! -d $TEMPLATE_DIR ] && mkdir $TEMPLATE_DIR
# https://docs.huihoo.com/godotengine/godot-docs/godot/reference/compiling_for_android.html
[ $CLEAN -eq 1 ] && pushd platform/android/java && echo -e "${RED}gradlew clean$RESET" && ./gradlew --no-daemon cleanGodotTemplates && popd
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"
time scons platform=android target=$target $aarch=$arch tools=no disable_3d=true $common_flags
done
done
pushd platform/android/java
echo -e "${RED}gradlew build$RESET" && ./gradlew --no-daemon build
echo -e "${RED}gradlew generateGodotTemplates$RESET" && ./gradlew --no-daemon generateGodotTemplates
popd
cp bin/android* $TEMPLATE_DIR/
rm custom.py
fi
}
pushd $SRC_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 tools=no disable_3d=true
|