mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-25 10:40:25 +01:00
Update build script
- Add flags for target and disable_pty - Only run docker-compose commands if docker-compose installed
This commit is contained in:
parent
0973aad7e6
commit
88e5320a83
2 changed files with 38 additions and 9 deletions
|
@ -1,6 +1,32 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Parse args.
|
||||||
|
args=$@
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
case $key in
|
||||||
|
-t|--target)
|
||||||
|
target="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--disable-pty)
|
||||||
|
disable_pty="yes"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: ./build.sh [-t|--target <release|debug>] [--disable_pty]";
|
||||||
|
exit 128
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
# Set defaults.
|
||||||
|
target=${target:-debug}
|
||||||
|
disable_pty=${disable_pty:-no}
|
||||||
|
nproc=$(nproc || sysctl -n hw.ncpu)
|
||||||
|
|
||||||
|
|
||||||
#GODOT_DIR Get the absolute path to the directory this script is in.
|
#GODOT_DIR Get the absolute path to the directory this script is in.
|
||||||
NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
|
@ -9,7 +35,7 @@ NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
# Run script inside a nix shell if it is available.
|
# Run script inside a nix shell if it is available.
|
||||||
if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
||||||
cd ${NATIVE_DIR}
|
cd ${NATIVE_DIR}
|
||||||
nix-shell --pure --run "NIX_PATH=${NIX_PATH} ./build.sh $1"
|
nix-shell --pure --run "NIX_PATH=${NIX_PATH} ./build.sh $args"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -31,20 +57,23 @@ updateSubmodules GODOT_CPP_DIR ${NATIVE_DIR}/thirdparty/godot-cpp
|
||||||
|
|
||||||
# Build godot-cpp bindings.
|
# Build godot-cpp bindings.
|
||||||
cd ${GODOT_CPP_DIR}
|
cd ${GODOT_CPP_DIR}
|
||||||
scons generate_bindings=yes target=debug -j$(nproc)
|
echo "scons generate_bindings=yes target=$target -j$nproc"
|
||||||
|
scons generate_bindings=yes target=$target -j$nproc
|
||||||
|
|
||||||
# Build libuv as a static library.
|
# Build libuv as a static library.
|
||||||
cd ${LIBUV_DIR}
|
cd ${LIBUV_DIR}
|
||||||
mkdir build || true
|
mkdir build || true
|
||||||
cd build
|
cd build
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=debug -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
|
cmake .. -DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
|
||||||
cd ..
|
cd ..
|
||||||
cmake --build build -j$(nproc)
|
cmake --build build --config $target -j$nproc
|
||||||
|
|
||||||
# Build libgodot-xterm.
|
# Build libgodot-xterm.
|
||||||
cd ${NATIVE_DIR}
|
cd ${NATIVE_DIR}
|
||||||
scons target=debug -j$(nproc)
|
scons target=$target disable_pty=$disable_pty -j$nproc
|
||||||
|
|
||||||
# Use Docker to build libgodot-xterm javascript.
|
# Use Docker to build libgodot-xterm javascript.
|
||||||
UID_GID="0:0" docker-compose build javascript
|
if [ -x "$(command -v docker-compose)" ]; then
|
||||||
UID_GID="$(id -u):$(id -g)" docker-compose run javascript
|
UID_GID="0:0" TARGET=$target docker-compose build javascript
|
||||||
|
UID_GID="$(id -u):$(id -g)" TARGET=$target docker-compose run javascript
|
||||||
|
fi
|
||||||
|
|
|
@ -9,6 +9,6 @@ services:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
cd /src/thirdparty/godot-cpp
|
cd /src/thirdparty/godot-cpp
|
||||||
scons platform=javascript target=debug -j$$(nproc)
|
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
||||||
cd /src
|
cd /src
|
||||||
scons platform=javascript target=debug -j$$(nproc)
|
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
||||||
|
|
Loading…
Reference in a new issue