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:
Leroy Hopson 2022-06-01 10:26:03 +07:00
parent 3670856851
commit 3fdc9ef27e
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
6 changed files with 111 additions and 27 deletions

View file

@ -0,0 +1 @@
*

View file

@ -282,7 +282,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',

View file

@ -12,3 +12,46 @@ services:
scons platform=javascript target=$${TARGET:-debug} -j$$(nproc)
cd /src
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

View 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)