There is a docker image available that is based on Ubuntu being able to compile the engine.
The image can be used as a one-shot command to compile the engine and provide the artifacts by a docker volume but it can also be used as a development environment.
There are two ways to obtain the docker image.
Checkout the repository, change into the directory
docker-buildand build the image yourself using the command:
docker build -t springrts-build .. Additional arguments can be passed to configure the image creation process (see below).
The image is also available on Docker Hub. It will be auto-downloaded if you use it in regular docker commands like
docker run verybadsoldier/springrts-build:latest build. So you can replace the image name with
verybadsoldier/springrts-build:latestin all docker commands described below. The image on Docker Hub might not be updated at all times but we try to keep it up-to-date as good as possible.
When building the image the following arguments are available:
|mxe_version||02852a7b690aa411ce2a2089deea25a7292a33d6||Version of MXE to use. This can be a commit hash but also a tag or branch name|
|mxe_gcc||gcc11||Defines which gcc plugin to use in MXE|
|cmake_version||3.16.*||Defines a CMake version string to be used when installing CMake via |
|ccache_version||v4.5.1||Version of ccache to use. This can be a commit hash but also a tag or branch name|
To build branch
https://github.com/beyond-all-reason/spring (default values) run this command:
docker run -it springrts-build build
The output artifacts can be found in a volume linked to the container. Accessible e.g. via the Docker Desktop application.
To start a development environment:
docker run -it springrts-build dev
You will get a bash shell with the spring source code checked out ready to make modifications and compile by typing
cmake --build .:
---------------------------------------------- SpringRTS development environment has been set up successfully Source code directory: /spring Build directory: /spring/build ---------------------------------------------- <springdev> root@e0d3fbe4fffd:/spring/build$ _
The image is based on Ubuntu 18.04 so created Linux binaries are runnable on that version and later. Windows binaries are build using a MXE cross-compile environment.
The image utilizes
ccache to speedup consecutive compilation processes. It is recommended to reuse the cache data in different containers by configuring the ccache volume accordingly.
The image can be used with different commands that are described below:
shell(just open a bash shell)
The build process consists of multiple steps. Each step is represented by a shell script and they are run consecutively:
Both commands can be configured with these arguments:
|-b||BAR105||The branch to build from the spring project|
|-u||https://github.com/beyond-all-reason/spring||URL to a Spring Git repository|
|-a||https://github.com/beyond-all-reason||Prefix for the URLs used to clone auxiliary repos. The following URL will e.g. be cloned: https://github.com/beyond-all-reason/BARbarIAn|
|-d||0||Dummy mode: to not actually clone or compile but just produce zero-size artifacts|
|-c||<empty>||Configures gcc’s |
|-r||-O3 -g -DNDEBUG||CXX flags for RELWITHDEBINFO config|
|-f||<empty>||CXXFLAGS and CFLAGS flags for gcc|
|-s||1||Enable stripping of symbols from artifacts|
|-z||Enable generation ccache debug data in /ccache_dbg|
|-p||windows-64||Which target platform to setup build for (use “linux-64” or “windows-64”)|
The container can be started by passing
run as the first parameter to run the compilation process for one target platform and produce an archive package that will contain the runnable engine with all library dependencies.
The following directories contain output data and can be used as a volume to access the files:
/publish- This is the directory the build process will copy all produced artifacts into
/ccache- The image is using
ccacheto speed up the build process. To make use of the cache you have to run different build runs using the same cache data directory.
/ccache_dbg- Directory where ccache debug data will be placed
docker run -v D:\myspringbuild:/publish -it springrts-build
Build branch `gl4` from repository at `https://github.com/beyond-all-reason/spring`: docker run -it springrts-build build -u https://github.com/beyond-all-reason/spring -b gl4 -p linux-64
The image can also be used as a development environment. When starting the development mode then only the first three steps are executed:
So the source code will be cloned into the container and the build will be configured using CMake. You will find yourself inside the development shell ready to start the compilation process. In you started the container with a raw
/bin/bash shell (didn’t use
dev command) you can start the dev shell manually by running
dev.sh with the usual arguments.
When working in the development shell you can always start the step scripts manually if needed. But be aware that running e.g.
01_clone.sh will wipe the
/spring directory completely and create a clean checkout. So make sure to not lose your changes! As some of the steps will modify shell variables all scripts should be sourced (instead of started regularly), e.g.
In case you want to switch the configuration inside the development shell you you can run
. /scripts/00_setup.sh -p linux-64
Written by: verybadsoldier