|
Docker build environment gets an upgrade! |
amarillion
Member #940
January 2001
|
Hey, For the past few years I've been maintaining docker build environments for allegro. These docker containers have all the dependencies needed to build a typical allegro game. With docker installed, a typical build would look like this: docker run \ -v `pwd`:/data \ amarillion/alleg5-buildenv \ make This will download the latest docker image amarillion/alleg5-buildenv, volume-mount the current directory inside this docker image, and run make. Apart from the linux variant, since the release of allegro 5.2.7, I've added a few variants, so now we have:
You can find all of these on dockerhub here: https://hub.docker.com/u/amarillion So what can you do with this? Quite a lot...
I'd really love some feedback. Would you use it? Have you tried it? Does it work for you? What would you like to see added? What sort of documentation would you need? See also the original announcement a few years back: https://www.allegro.cc/forums/thread/616906/ -- |
Mark Oates
Member #1,146
March 2001
|
amarillion said: Build a windows game from your linux machine. Using the mingw-w64 variant, you can have a working cross compilation toolchain up in a single command. No need to figure out how to cross-build all the dependencies of allegro, because I already did that for you! A-mazing. Quote: Would you use it? Absolutely. It'll take a while for me to get to it, but I've been trying to put something like this together myself for a long while. Right now, it's git push on mac, git pull on win, make, but I want it to all be completely automated, tests included. I'm looking forward to using this. My dream is to build this as a web service. -- |
Niunio
Member #1,975
March 2002
|
Nice. I wonder if I can do the same thing for Allegro.pas, but I'm always busy ----------------- |
Matthew Leverton
Supreme Loser
January 1999
|
Is this intended to build your own games? e.g. A directory containing:
Then run docker from that directory? |
amarillion
Member #940
January 2001
|
Matthew Leverton said: Is this intended to build your own games? e.g. A directory containing: Makefile (my makefile with instructions on how to build my game with -lallegro) main.c (my source code) Then run docker from that directory? Yes indeed, that's the primary use case. To make it clearer, I've created a minimal example, containing just a makefile, a single source file, and a script to collect DLLs. It should be possible to compile this example for windows and linux, using only docker. No need to set up any build tools or even allegro (You'd still want at least one toolchain during development, of course. But you don't need it here). So far I've only tested it on a linux host, but it should be possible on Mac/Windows hosts as well. You can find the example here: https://github.com/amarillion/allegro-buildenv-example Niunio said: I wonder if I can do the same thing for Allegro.pas, but I'm always busy If you can explain in a few simple bash commands how to set up Allegro.pas on Ubuntu (i.e. install Pascal, wget bindings, compile bindings), I can set you up with a simple Dockerfile. Then you can take it from there. Mark Oates said: My dream is to build this as a web service. That would be cool indeed. The Unity game engine provides a similar service, so it would be cool to be able to match that. I believe it should be possible to do this using the (free) CI pipelines provided by github / gitlab too, but I still have to try that. -- |
Matthew Leverton
Supreme Loser
January 1999
|
Two issues that could trip people up:
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Could I use this to cross compile from Windows 10 to OSX / Apple / iOS / Linux? That would be neat. >.><.< My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
amarillion
Member #940
January 2001
|
Matthew Leverton said: File permissions. I'm unable to use this without giving world write access to the current folder because docker is trying to write the file as user id 1000 (whatever that happens to be). I'm not a docker expert when it comes to running it as a tool like this, but I assume there's something else trivial that can be done to remedy this. Yes, this can be solved by specifying your uid, for example docker run \ -u `id -u`:`id -g` \ -v `pwd`:/data \ amarillion/alleg5-buildenv \ make I'll add a note to the documentation. Quote: The include uses local path (#include "allegro5/allegro.h") whereas I traditionally am used to building it from a system path (<allegro5/allegro.h>). I'm not sure, is this actually a problem? I copied the code from one of the allegro examples, I believe it should work either way. Edgar Reynaldo said: Could I use this to cross compile from Windows 10 to OSX / Apple / iOS / Linux? Linux, yes for sure. But OSX / Apple / iOS is a different problem altogether, I have no idea if this is possible. Probably not. Docker containers are basically tiny linux virtual machines(*). Compiling for windows relies on the pre-existing possibility to cross-compile for windows on linux hosts. Docker doesn't create this possibility out of thin air, it just makes it easier to set it up. *) On linux they're process groups that are walled-off from the rest of the system. On Mac / Windows, they really are implemented as a small virtual machine. -- |
GullRaDriel
Member #3,861
September 2003
|
I may be wrong but I think it is doable even for windows, as there are official windows docker images hosted by "Code is like shit - it only smells if it is not yours" |
amarillion
Member #940
January 2001
|
If I understand correctly, the windows base images only work on windows. It's really a very different technology, a case of microsoft having linux envy. It's not really much help for me. -- |
GullRaDriel
Member #3,861
September 2003
|
Yeah, after reading it you're right. As the docker image will have to use underlying host system calls, one need a windows host to run windows images. "Code is like shit - it only smells if it is not yours" |
amarillion
Member #940
January 2001
|
Yeah I just did a quick proof on my linux machine: docker run mcr.microsoft.com/windows/servercore:ltsc2019 ltsc2019: Pulling from windows/servercore docker: no matching manifest for linux/amd64 in the manifest list entries. See 'docker run --help'. Best to stick to linux, it's the greatest common divisor. As for cross-compiling mac from linux, there is a project called "darling", a bit like WINE but for Macs. Who knows, this could be useful here? https://stackoverflow.com/questions/39409082/cross-compiling-for-os-x-from-linux -- |
|