Add docker image to build binaries

This commit is contained in:
Bart van Strien 2017-08-30 17:00:57 +02:00
parent 25000898b0
commit d597f306a8
3 changed files with 132 additions and 0 deletions

View file

@ -36,6 +36,20 @@ easily distribute a flatpak file. Useful.
NOTE: Once again driver issues (blame nvidia) prevent me from testing this
myself. If you get it working, let me know!
## docker ##
`docker` does not build docker images. Instead it builds a docker image so you
can build portable packages yourself!
To build the container, you need to download the relevant SDL2 and LuaJIT
source packages (and possibly update the references in the Dockerfile).
To use the container, run it as an application, mounting this repo as
/build/love-linux-builder. You can optionally mount love source at /build/love,
and if no source is provided it clones the repo and checks out the specified
version. Note that the container requires exactly one argument: the version.
This can be an arbitrary string, but for cloning to work it needs to be a tag,
branch or commit.
[snap]: http://snapcraft.io/
[AppImage]: http://appimage.org/
[AppImageKit]: https://github.com/probonopd/AppImageKit

22
docker/Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM debian:wheezy
# Install all sdl, love (build) deps and love-linux-builder deps
RUN apt-get update && apt-get install -y build-essential libgl1-mesa-glx libgles2-mesa-dev libxrandr-dev libdbus-1-dev libxi-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev libibus-1.0-dev libasound2-dev libpulse-dev libwayland-dev libfreetype6-dev libopenal-dev libmodplug-dev libvorbis-dev libtheora-dev libphysfs-dev libmpg123-dev squashfs-tools curl mercurial libfuse2 autotools-dev automake libtool pkg-config
# Now build sdl
ADD SDL2-2.0.5.tar.gz /tmp/
RUN cd /tmp/SDL2-2.0.5 && ./configure --prefix=/usr && make all install
# And build luajit
ADD LuaJIT-2.0.5.tar.gz /tmp/
RUN cd /tmp/LuaJIT-2.0.5 && make all install
# Add the build script
ADD build.sh /build/
# Add the volumes, the first the love-linux-builder (mandatory), the second the love source (optional)
RUN mkdir -p /build/love-linux-builder /build/love
VOLUME /build/love-linux-builder /build/love
# Finally, set the build script as entrypoint
ENTRYPOINT ["/build/build.sh"]

96
docker/build.sh Executable file
View file

@ -0,0 +1,96 @@
#!/bin/bash
if [ $# -lt 1 ]; then
echo "Usage: $0 <version>"
exit 0
fi
VERSION="$1"
#ARCH="$(uname -m)"
ARCH="amd64"
cd /build/love-linux-builder
msg() {
printf "\033[1m· %s\033[0m\n" "$1"
}
buildlove() {
pushd ../love
if ! test -d ./src; then
msg "Source not found, checking out from repo"
hg clone https://bitbucket.org/rude/love .
hg update "${VERSION}"
fi
if ! test -f ./configure; then
msg "Running automagic"
./platform/unix/automagic
fi
msg "Running configure"
./configure --prefix=/usr
msg "Running make"
make all install
popd
}
buildtarball() {
pushd tarball
./build.sh
tar czf "love-${VERSION}-${ARCH}.tar.gz" dest
popd
}
buildsnap() {
pushd snap
./build.sh "${VERSION}"
popd
}
buildappimage() {
pushd appimage
./build.sh "${VERSION}"
msg "AppImage may require running a priviliged container, sadly"
popd
}
buildflatpak() {
pushd flatpak
./build.sh "${VERSION}"
msg "Flatpak is not supported at the moment (oops)"
popd
}
if ! test -f "love-${VERSION}-${ARCH}.tar.gz"; then
msg "Building love"
buildlove
buildtarball
else
msg "Binaries found, skipping love build"
fi
msg "Building snap"
buildsnap
msg "Building appimage"
buildappimage
msg "Building flatpak"
buildflatpak