From d597f306a8dc625e8d4ee5d5bcd950a4430b9c46 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Wed, 30 Aug 2017 17:00:57 +0200 Subject: [PATCH] Add docker image to build binaries --- README.md | 14 +++++++ docker/Dockerfile | 22 +++++++++++ docker/build.sh | 96 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 docker/Dockerfile create mode 100755 docker/build.sh diff --git a/README.md b/README.md index a38de6b..a7fbd12 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..abd4763 --- /dev/null +++ b/docker/Dockerfile @@ -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"] diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000..3ec6ac1 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +if [ $# -lt 1 ]; then + echo "Usage: $0 " + 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