|
Building allegro games with docker |
amarillion
Member #940
January 2001
|
I run a build server at home and recently I've been experimenting with Docker. Has anyone tried this? Docker makes it easy to bundle up a set of dependencies in a neat package. The idea is that instead of having to install allegro plus all the other dependencies of your game, all you need to do is install docker, and then run something like: docker run \ -v `pwd`:/data amarillion/alleg5-buildenv \ make In that command, docker pulls the image amarillion/alleg5-buildenv (which I prepared) from dockerhub, then maps the current directory to /data inside the container, and then runs the command make. As long as all the build tools and dependencies are packaged properly in the docker image, the build will work normally. The build artifacts will remain in the current directory as expected. No matter how complex your build dependencies, they only need to be dockerized once and become available to everybody. The source for building the docker image is on github: I've made the docker image public on dockerhub: Potential applications of this technology:
I'm working on an allegro4 image, to see if I can get some old games compiling that way. This is all a work in progress. Feedback is welcome. -- |
SiegeLord
Member #7,827
October 2006
|
That seems pretty sweet, although I'm concerned that I'd still have to provide regular build instructions for people that refuse to install docker . "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
amarillion
Member #940
January 2001
|
I don't expect this to storm the world and completely replace the need for build instructions. Also, this is mainly going to benefit Linux users. But it's definitely going to be some help if you can say - either follow these 12 steps to install dependencies and build my allegro project. Or install docker and now it's down to only 3 steps. -- |
Gideon Weems
Member #3,925
October 2003
|
amarillion said: Manage exotic build environments. Whether games are written in rust, D, pascal, java, all you need is docker. This should actually be a boon for TINS Heck yes, this should be a boon for TINS. There have been hack-athons in the past where none of the entries compiled as-is. Please make entrants using non-C/C++ Allegro bindings aware of this potential solution (though to be honest, even many C/C++ entries don't compile). |
Niunio
Member #1,975
March 2002
|
I think I should read this carefully and see how it works. I find it a bit confusing though. ----------------- |
amarillion
Member #940
January 2001
|
Ok, here is a very practical example of how this is working. Suppose you want to compile AMGC2, an old game using allegro 4 + other dependencies, on linux. Before, you had to set up
Which takes some effort, and could mess up your current installation of allegro 5. Now you can just use the docker image that I prepared, which contains all those dependencies in one place. You can compile it with: 1# Get amgc2 bundle
2wget http://members.allegro.cc/miran/archives/amgc2.tar.gz
3# Unpack it
4tar -zxvf amgc2.tar.gz
5cd amgc2
6# Run inside docker image: `make -C games/tetris`
7docker run \
8 -v `pwd`:/data \
9 -u `stat -c "%u:%g" .` \
10 amarillion/alleg4-plus-buildenv \
11 make -C games/tetris
12# Run inside docker image: `make -C src`.
13# I had to override LIBS setting of the makefile as it was missing -lX11.
14docker run \
15 -v `pwd`:/data \
16 -u `stat -c "%u:%g" .` \
17 amarillion/alleg4-plus-buildenv \
18 make -C src LIBS="-lmasking -lalfont -laldmb -ldumb -ldl `allegro-config --libs` -lX11"
19# Now you can run the game outside docker!
20./amgc2
Let me know if you can get this working too! It took me a while to come up with a good example, because most game sources I find do not compile very cleanly (especially my own ). Even for this example I had to tweak the compilation, overriding the LIBS variable. Nevertheless, I think this example illustrates the potential. So far I've prepared the following docker images: amarillion/alleg5-buildenv
amarillion/alleg5-plus-buildenv
amarillion/alleg4-buildenv
amarillion/alleg4-plus-buildenv
amarillion/android
-- |
Gideon Weems
Member #3,925
October 2003
|
|