2020-10-13 10:20:40 +02:00
|
|
|
#!/bin/sh
|
2020-09-17 11:23:01 +02:00
|
|
|
set -e
|
2020-07-13 06:14:30 +02:00
|
|
|
|
2020-11-05 09:42:00 +01:00
|
|
|
|
2021-06-15 08:54:35 +02:00
|
|
|
#GODOT_DIR Get the absolute path to the directory this script is in.
|
2020-10-13 10:20:40 +02:00
|
|
|
NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
2020-07-13 06:14:30 +02:00
|
|
|
|
2020-11-05 09:42:00 +01:00
|
|
|
|
2020-10-13 10:20:40 +02:00
|
|
|
# Run script inside a nix shell if it is available.
|
|
|
|
if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
|
|
|
cd ${NATIVE_DIR}
|
2020-11-06 06:57:25 +01:00
|
|
|
nix-shell --pure --run "NIX_PATH=${NIX_PATH} ./build.sh $1"
|
2020-10-13 10:20:40 +02:00
|
|
|
exit
|
2020-07-13 06:14:30 +02:00
|
|
|
fi
|
|
|
|
|
2020-11-05 09:42:00 +01:00
|
|
|
|
|
|
|
# Update git submodules.
|
2021-06-12 10:02:22 +02:00
|
|
|
LIBTSM_DIR=${NATIVE_DIR}/thirdparty/libtsm
|
2021-06-15 09:14:48 +02:00
|
|
|
if [ -z "$(ls -A -- "$LIBTSM_DIR")" ]; then
|
2020-10-13 10:20:40 +02:00
|
|
|
cd ${NATIVE_DIR}
|
|
|
|
git submodule update --init --recursive -- $LIBTSM_DIR
|
2020-07-13 06:14:30 +02:00
|
|
|
fi
|
2021-06-12 10:02:22 +02:00
|
|
|
GODOT_CPP_DIR=${NATIVE_DIR}/thirdparty/godot-cpp
|
2021-06-15 09:14:48 +02:00
|
|
|
if [ -z "$(ls -A -- "$GODOT_CPP_DIR")" ]; then
|
2020-10-13 10:20:40 +02:00
|
|
|
cd ${NATIVE_DIR}
|
|
|
|
git submodule update --init --recursive -- $GODOT_CPP_DIR
|
|
|
|
fi
|
|
|
|
|
2020-11-20 15:34:49 +01:00
|
|
|
# Build godot-cpp bindings.
|
|
|
|
cd ${GODOT_CPP_DIR}
|
2021-06-19 14:44:11 +02:00
|
|
|
scons generate_bindings=yes target=debug -j$(nproc)
|
2020-11-05 09:42:00 +01:00
|
|
|
|
|
|
|
# Build libgodot-xterm.
|
2020-10-13 10:20:40 +02:00
|
|
|
cd ${NATIVE_DIR}
|
2021-06-19 14:44:11 +02:00
|
|
|
scons target=debug -j$(nproc)
|
2021-06-07 08:53:43 +02:00
|
|
|
|
2021-06-15 08:54:35 +02:00
|
|
|
# Use Docker to build libgodot-xterm javascript.
|
|
|
|
UID_GID="0:0" docker-compose build javascript
|
|
|
|
UID_GID="$(id -u):$(id -g)" docker-compose run javascript
|