mirror of
https://github.com/lihop/godot-xterm.git
synced 2025-05-09 13:45:31 +02:00
Add option to build inside docker container
This allows us to target older versions of GLIBC.
This commit is contained in:
parent
ded2ced89b
commit
6b512bd525
7 changed files with 100 additions and 15 deletions
1
addons/godot_xterm/native/.dockerignore
Normal file
1
addons/godot_xterm/native/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
|||
*
|
4
addons/godot_xterm/native/Dockerfile
Normal file
4
addons/godot_xterm/native/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM kroggen/ubuntu-16.04-gcc
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y python3 python3-pip gcc-multilib g++-multilib
|
||||
RUN pip3 install scons
|
|
@ -277,7 +277,7 @@ else:
|
|||
else:
|
||||
#sources.append('src/node_pty/win/conpty.cc')
|
||||
env.Append(LIBS=[
|
||||
env.File(f'thirdparty/libuv/build/{env["target"].capitalize()}/uv_a.lib'),
|
||||
env.File('thirdparty/libuv/build/{}/uv_a.lib'.format(env["target"].capitalize())),
|
||||
'Advapi32.lib',
|
||||
'Iphlpapi.lib',
|
||||
'user32.lib',
|
||||
|
|
|
@ -11,26 +11,43 @@ while [[ $# -gt 0 ]]; do
|
|||
shift
|
||||
shift
|
||||
;;
|
||||
-b|--bits)
|
||||
bits="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--disable-pty)
|
||||
disable_pty="yes"
|
||||
shift
|
||||
;;
|
||||
--docker)
|
||||
docker="yes"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ./build.sh [-t|--target <release|debug>] [--disable_pty]";
|
||||
echo "Usage: ./build.sh [-t|--target <release|debug>] [-b|--bits <32|64>] [--disable_pty] [--docker]";
|
||||
exit 128
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Set defaults.
|
||||
target=${target:-debug}
|
||||
bits=${bits:-64}
|
||||
disable_pty=${disable_pty:-no}
|
||||
nproc=$(nproc || sysctl -n hw.ncpu)
|
||||
|
||||
|
||||
#GODOT_DIR Get the absolute path to the directory this script is in.
|
||||
# Get the absolute path to the directory this script is in.
|
||||
NATIVE_DIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||
|
||||
if [ -n "$docker" ]; then
|
||||
# Run build script inside docker container.
|
||||
cd ${NATIVE_DIR}
|
||||
UID_GID="0:0" TARGET=$target BITS=$bits docker-compose build linux
|
||||
UID_GID="$(id -u):$(id -g)" TARGET=$target BITS=$bits docker-compose run linux
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run script inside a nix shell if it is available.
|
||||
if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
||||
|
@ -39,7 +56,6 @@ if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Update git submodules.
|
||||
updateSubmodules() {
|
||||
eval $1=$2 # E.g LIBUV_DIR=${NATIVE_DIR}/thirdparty/libuv
|
||||
|
@ -54,15 +70,14 @@ updateSubmodules LIBUV_DIR ${NATIVE_DIR}/thirdparty/libuv
|
|||
updateSubmodules LIBTSM_DIR ${NATIVE_DIR}/thirdparty/libtsm
|
||||
updateSubmodules GODOT_CPP_DIR ${NATIVE_DIR}/thirdparty/godot-cpp
|
||||
|
||||
|
||||
# Build godot-cpp bindings.
|
||||
cd ${GODOT_CPP_DIR}
|
||||
echo "scons generate_bindings=yes target=$target -j$nproc"
|
||||
scons generate_bindings=yes target=$target -j$nproc
|
||||
scons generate_bindings=yes target=$target bits=$bits -j$nproc
|
||||
|
||||
# Build libuv as a static library.
|
||||
cd ${LIBUV_DIR}
|
||||
mkdir build || true
|
||||
mkdir -p build
|
||||
cd build
|
||||
args="-DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
||||
if [ "$target" == "release" ]; then
|
||||
|
@ -70,13 +85,14 @@ if [ "$target" == "release" ]; then
|
|||
else
|
||||
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
|
||||
fi
|
||||
if [[ "$bits" -eq 32 ]]; then args="$args -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_C_FLAGS=-m32"; fi
|
||||
cmake .. $args
|
||||
cd ..
|
||||
cmake --build build --config $target -j$nproc
|
||||
cmake --build build --config $target
|
||||
|
||||
# Build libgodot-xterm.
|
||||
cd ${NATIVE_DIR}
|
||||
scons target=$target disable_pty=$disable_pty -j$nproc
|
||||
scons target=$target bits=$bits disable_pty=$disable_pty -j$nproc
|
||||
|
||||
# Use Docker to build libgodot-xterm javascript.
|
||||
if [ -x "$(command -v docker-compose)" ]; then
|
||||
|
|
|
@ -12,3 +12,14 @@ services:
|
|||
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
||||
cd /src
|
||||
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
||||
linux:
|
||||
build: .
|
||||
user: ${UID_GID}
|
||||
volumes:
|
||||
- .:/src
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
cd /src
|
||||
/bin/bash ./build.sh --target ${TARGET} --bits ${BITS}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue