mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-24 18:20:25 +01:00
Add Docker build for Linux
Adds support for building Linux binaries inside a docker container in order to target an older version of GLIBC. Updates GitHub Actions workflow to use it. As a result the minimum version of GLIBC that Linux users need to have installed on their system is 2.17 which was released in 2012.
This commit is contained in:
parent
7864289e82
commit
8d3d8e4233
6 changed files with 111 additions and 27 deletions
80
.github/workflows/main.yml
vendored
80
.github/workflows/main.yml
vendored
|
@ -17,18 +17,59 @@ env:
|
||||||
GODOT_CACHE_VERSION: 1
|
GODOT_CACHE_VERSION: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_docker:
|
||||||
name: 'Build'
|
name: 'Build Docker (linux, ${{ matrix.target }}, ${{ matrix.bits }})'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
target: [ release, debug ]
|
||||||
|
bits: [ 64, 32 ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Cache submodules
|
||||||
|
uses: ./.github/actions/cache-submodules
|
||||||
|
id: cache-submodules
|
||||||
|
with:
|
||||||
|
platform: linux
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
bits: ${{ matrix.bits }}
|
||||||
|
- name: Pull docker images
|
||||||
|
run: docker-compose pull
|
||||||
|
working-directory: addons/godot_xterm/native
|
||||||
|
- name: Cache docker image layers
|
||||||
|
uses: satackey/action-docker-layer-caching@v0.0.11
|
||||||
|
continue-on-error: true
|
||||||
|
- name: Build godot-cpp bindings
|
||||||
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||||
|
working-directory: addons/godot_xterm/native
|
||||||
|
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} godot-cpp-linux
|
||||||
|
- name: Build libuv
|
||||||
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||||
|
working-directory: addons/godot_xterm/native
|
||||||
|
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} libuv-linux
|
||||||
|
- name: Build libgodot-xterm
|
||||||
|
working-directory: addons/godot_xterm/native
|
||||||
|
run: UID_GID="$(id -u):$(id -g)" docker-compose run -e TARGET=${{ matrix.target }} -e BITS=${{ matrix.bits }} libgodot-xterm-linux
|
||||||
|
- name: Upload binaries
|
||||||
|
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
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ linux, javascript, osx, windows ]
|
platform: [ javascript, osx, windows ]
|
||||||
target: [ release, debug ]
|
target: [ release, debug ]
|
||||||
bits: [ 64, 32 ]
|
bits: [ 64, 32 ]
|
||||||
include:
|
include:
|
||||||
- platform: linux
|
|
||||||
os: ubuntu-latest
|
|
||||||
- platform: javascript
|
- platform: javascript
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- platform: osx
|
- platform: osx
|
||||||
|
@ -59,40 +100,31 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: addons/godot_xterm/native/.emcache
|
path: addons/godot_xterm/native/.emcache
|
||||||
key: emsdk-cache-${{ matrix.target }}-v${{ env.EMSCRIPTEN_CACHE_VERSION }}
|
key: emsdk-cache-${{ matrix.target }}-v${{ env.EMSCRIPTEN_CACHE_VERSION }}
|
||||||
|
|
||||||
# Ubuntu-specific steps.
|
|
||||||
- name: Install ubuntu build dependencies
|
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y scons gcc-multilib g++-multilib
|
|
||||||
|
|
||||||
# JavaScript-specific steps.
|
|
||||||
- name: Install javascript build dependencies
|
- name: Install javascript build dependencies
|
||||||
if: ${{ matrix.platform == 'javascript' }}
|
if: ${{ matrix.platform == 'javascript' }}
|
||||||
uses: mymindstorm/setup-emsdk@v11
|
uses: mymindstorm/setup-emsdk@v11
|
||||||
with:
|
with:
|
||||||
version: 3.1.5
|
version: 3.1.5
|
||||||
actions-cache-folder: emsdk-cache-${{ matrix.target }}
|
actions-cache-folder: emsdk-cache-${{ matrix.target }}
|
||||||
|
- name: Install additional javascript build dependencies
|
||||||
# MacOS-specific steps.
|
if: ${{ matrix.platform == 'javascript' }}
|
||||||
|
run: sudo apt-get update && sudo apt-get install -y scons gcc-multilib g++-multilib
|
||||||
- name: Install additional macos build dependencies
|
- name: Install additional macos build dependencies
|
||||||
if: ${{ matrix.os == 'macos-latest' }}
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
run: brew install scons
|
run: brew install scons
|
||||||
|
|
||||||
# Windows-specific steps.
|
|
||||||
- name: Install additional windows build dependencies
|
- name: Install additional windows build dependencies
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
run: python -m pip install scons
|
run: python -m pip install scons
|
||||||
- uses: ilammy/msvc-dev-cmd@v1.9.0
|
- name: Setup MSVC command prompt
|
||||||
|
uses: ilammy/msvc-dev-cmd@v1.9.0
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
with:
|
with:
|
||||||
arch: win${{ matrix.bits }}
|
arch: win${{ matrix.bits }}
|
||||||
|
|
||||||
- name: Build godot-cpp bindings
|
- name: Build godot-cpp bindings
|
||||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
cd addons/godot_xterm/native/thirdparty/godot-cpp
|
cd addons/godot_xterm/native/thirdparty/godot-cpp
|
||||||
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} generate_bindings=yes -j2
|
||||||
|
|
||||||
- name: Setup cmake
|
- name: Setup cmake
|
||||||
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
||||||
uses: jwlawson/actions-setup-cmake@v1.9
|
uses: jwlawson/actions-setup-cmake@v1.9
|
||||||
|
@ -125,23 +157,19 @@ jobs:
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
cmake --build build --config $TARGET
|
cmake --build build --config $TARGET
|
||||||
|
|
||||||
- name: Build libgodot-xterm
|
- name: Build libgodot-xterm
|
||||||
run: |
|
run: |
|
||||||
cd addons/godot_xterm/native
|
cd addons/godot_xterm/native
|
||||||
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
|
scons platform=${{ matrix.platform }} target=${{ matrix.target }} bits=${{ matrix.bits }} -j2
|
||||||
|
- name: Upload binaries
|
||||||
- name: Upload build artifacts
|
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
# GDNative HTML5 export templates aren't provided so we must build them
|
# GDNative HTML5 export templates aren't provided so we must build them
|
||||||
export_template:
|
export_template:
|
||||||
name: 'Export Template'
|
name: 'Export Template'
|
||||||
|
@ -198,7 +226,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
|
||||||
|
@ -233,7 +261,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
|
||||||
|
|
|
@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
`libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively
|
`libgodot-xterm.osx.64.dylib` is now a universal binary that runs natively
|
||||||
on both x86_64 and arm64.
|
on both x86_64 and arm64.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Linux binaries now support systems with older GLIBC versions. By building the
|
||||||
|
binaries inside a docker container with an older GLIBC version, the minimum
|
||||||
|
required GLIBC version is now 2.17 which was released in 2012.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- The `kill()` method of unix PTY node can now be called without error as the underlying
|
- The `kill()` method of unix PTY node can now be called without error as the underlying
|
||||||
`pipe.close()` method of the gdnative library is now registered.
|
`pipe.close()` method of the gdnative library is now registered.
|
||||||
|
|
1
addons/godot_xterm/native/.dockerignore
Normal file
1
addons/godot_xterm/native/.dockerignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
*
|
|
@ -282,7 +282,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',
|
||||||
|
|
|
@ -12,3 +12,46 @@ 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)
|
||||||
|
godot-cpp-linux:
|
||||||
|
user: ${UID_GID}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: linux.Dockerfile
|
||||||
|
volumes:
|
||||||
|
- ./thirdparty/godot-cpp:/godot-cpp
|
||||||
|
working_dir: /godot-cpp
|
||||||
|
libuv-linux:
|
||||||
|
user: ${UID_GID}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: linux.Dockerfile
|
||||||
|
volumes:
|
||||||
|
- ./thirdparty/libuv:/libuv
|
||||||
|
working_dir: /libuv
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
target=$${TARGET:-release}
|
||||||
|
bits=$${BITS:-'64'}
|
||||||
|
mkdir build 2>/dev/null ;
|
||||||
|
args="-DCMAKE_BUILD_TYPE=$$target \
|
||||||
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
|
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE"
|
||||||
|
if [[ $$bits -eq 32 ]]; then
|
||||||
|
args="$$args -DCMAKE_SYSTEM_PROCESSOR=i686 -DCMAKE_C_FLAGS=-m32";
|
||||||
|
else
|
||||||
|
args="$$args -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_C_FLAGS=";
|
||||||
|
fi
|
||||||
|
pushd build
|
||||||
|
cmake .. $$args
|
||||||
|
popd
|
||||||
|
cmake --build build
|
||||||
|
libgodot-xterm-linux:
|
||||||
|
user: ${UID_GID}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: linux.Dockerfile
|
||||||
|
volumes:
|
||||||
|
- .:/godot-xterm
|
||||||
|
working_dir: /godot-xterm
|
||||||
|
|
7
addons/godot_xterm/native/linux.Dockerfile
Normal file
7
addons/godot_xterm/native/linux.Dockerfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Uses an old version of Ubuntu in order to target an old version of GLIBC so users
|
||||||
|
# with older versions of GLIBC installed on their systems can use the library.
|
||||||
|
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
|
||||||
|
CMD scons platform=linux generate_bindings=yes target=${TARGET:-release} bits=${BITS:-64} -j$(nproc)
|
Loading…
Reference in a new issue