mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-15 06:40:24 +01: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
58
.github/workflows/main.yml
vendored
58
.github/workflows/main.yml
vendored
|
@ -19,8 +19,56 @@ env:
|
||||||
LIBUV_CACHE_VERSION: 1
|
LIBUV_CACHE_VERSION: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_docker:
|
||||||
name: 'Build'
|
name: 'Build Docker'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [ release, debug ]
|
||||||
|
bits: [ 64, 32 ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Get godot-cpp submodule commit hash
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||||
|
run: |
|
||||||
|
echo ::set-env name=GODOT_CPP_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/godot-cpp -l | cut -d\ -f3)
|
||||||
|
- name: Cache godot-cpp bindings
|
||||||
|
uses: actions/cache@v2
|
||||||
|
id: cache
|
||||||
|
env:
|
||||||
|
cache-name: cache-godot-cpp
|
||||||
|
with:
|
||||||
|
path: addons/godot_xterm/native/thirdparty/godot-cpp
|
||||||
|
key: godot-cpp-${{ matrix.platform }}-${{ matrix.target }}-${{ matrix.bits }}-${{ env.GODOT_CPP_COMMIT_HASH }}-v${{ env.GODOT_CPP_CACHE_VERSION }}
|
||||||
|
- name: Get libuv submodule commit hash
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
|
||||||
|
run: |
|
||||||
|
echo ::set-env name=LIBUV_COMMIT_HASH::$(git ls-tree HEAD addons/godot_xterm/native/thirdparty/libuv -l | cut -d\ -f3)
|
||||||
|
|
||||||
|
# Build inside docker container in order to target older GLIBC versions.
|
||||||
|
- name: Run build script
|
||||||
|
run: |
|
||||||
|
cd addons/godot_xterm/native
|
||||||
|
/bin/bash ./build.sh --target ${{ matrix.target }} --bits ${{ matrix.bits }} --docker
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: libgodot-xterm-${{ matrix.target }}
|
||||||
|
path: |
|
||||||
|
addons/godot_xterm/native/bin/*.so
|
||||||
|
|
||||||
|
|
||||||
|
build_native:
|
||||||
|
name: 'Build Native'
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -154,10 +202,10 @@ jobs:
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
if: ${{ matrix.platform != 'linux' }}
|
||||||
with:
|
with:
|
||||||
name: libgodot-xterm-${{ matrix.target }}
|
name: libgodot-xterm-${{ matrix.target }}
|
||||||
path: |
|
path: |
|
||||||
addons/godot_xterm/native/bin/*.so
|
|
||||||
addons/godot_xterm/native/bin/*.wasm
|
addons/godot_xterm/native/bin/*.wasm
|
||||||
addons/godot_xterm/native/bin/*.dylib
|
addons/godot_xterm/native/bin/*.dylib
|
||||||
addons/godot_xterm/native/bin/*.dll
|
addons/godot_xterm/native/bin/*.dll
|
||||||
|
@ -219,7 +267,7 @@ jobs:
|
||||||
|
|
||||||
html5_export:
|
html5_export:
|
||||||
name: 'HTML5 Export'
|
name: 'HTML5 Export'
|
||||||
needs: [ build, export_template ]
|
needs: [ build_docker, build_native, export_template ]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -254,7 +302,7 @@ jobs:
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: 'Test'
|
name: 'Test'
|
||||||
needs: [ install_plugins, build ]
|
needs: [ install_plugins, build_docker, build_native ]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
|
@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- `--docker` option to `build.sh` script, in order to build Linux binaries inside a docker container with an older GLIBC version.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- GitHub Actions workflow to build Linux debug/release binaries inside docker container in order to target older GLIBC versions.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Registered `pipe.close()` method, so `kill()` can be called when using unix PTY node.
|
- Registered `pipe.close()` method, so `kill()` can be called when using unix PTY node.
|
||||||
|
|
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:
|
else:
|
||||||
#sources.append('src/node_pty/win/conpty.cc')
|
#sources.append('src/node_pty/win/conpty.cc')
|
||||||
env.Append(LIBS=[
|
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',
|
'Advapi32.lib',
|
||||||
'Iphlpapi.lib',
|
'Iphlpapi.lib',
|
||||||
'user32.lib',
|
'user32.lib',
|
||||||
|
|
|
@ -11,26 +11,43 @@ while [[ $# -gt 0 ]]; do
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-b|--bits)
|
||||||
|
bits="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--disable-pty)
|
--disable-pty)
|
||||||
disable_pty="yes"
|
disable_pty="yes"
|
||||||
shift
|
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
|
exit 128
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Set defaults.
|
# Set defaults.
|
||||||
target=${target:-debug}
|
target=${target:-debug}
|
||||||
|
bits=${bits:-64}
|
||||||
disable_pty=${disable_pty:-no}
|
disable_pty=${disable_pty:-no}
|
||||||
nproc=$(nproc || sysctl -n hw.ncpu)
|
nproc=$(nproc || sysctl -n hw.ncpu)
|
||||||
|
|
||||||
|
# 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 )"
|
||||||
|
|
||||||
|
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.
|
# 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
|
||||||
|
@ -39,7 +56,6 @@ if command -v nix-shell && [ $NIX_PATH ] && [ -z $IN_NIX_SHELL ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Update git submodules.
|
# Update git submodules.
|
||||||
updateSubmodules() {
|
updateSubmodules() {
|
||||||
eval $1=$2 # E.g LIBUV_DIR=${NATIVE_DIR}/thirdparty/libuv
|
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 LIBTSM_DIR ${NATIVE_DIR}/thirdparty/libtsm
|
||||||
updateSubmodules GODOT_CPP_DIR ${NATIVE_DIR}/thirdparty/godot-cpp
|
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}
|
||||||
echo "scons generate_bindings=yes target=$target -j$nproc"
|
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.
|
# Build libuv as a static library.
|
||||||
cd ${LIBUV_DIR}
|
cd ${LIBUV_DIR}
|
||||||
mkdir build || true
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
args="-DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
args="-DCMAKE_BUILD_TYPE=$target -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
||||||
if [ "$target" == "release" ]; then
|
if [ "$target" == "release" ]; then
|
||||||
|
@ -70,13 +85,14 @@ if [ "$target" == "release" ]; then
|
||||||
else
|
else
|
||||||
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
|
args="$args -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebugDLL"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$bits" -eq 32 ]]; then args="$args -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_C_FLAGS=-m32"; fi
|
||||||
cmake .. $args
|
cmake .. $args
|
||||||
cd ..
|
cd ..
|
||||||
cmake --build build --config $target -j$nproc
|
cmake --build build --config $target
|
||||||
|
|
||||||
# Build libgodot-xterm.
|
# Build libgodot-xterm.
|
||||||
cd ${NATIVE_DIR}
|
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.
|
# Use Docker to build libgodot-xterm javascript.
|
||||||
if [ -x "$(command -v docker-compose)" ]; then
|
if [ -x "$(command -v docker-compose)" ]; then
|
||||||
|
|
|
@ -12,3 +12,14 @@ services:
|
||||||
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
||||||
cd /src
|
cd /src
|
||||||
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
|
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…
Reference in a new issue