# Containerfile for Forts Clone build environment # Builds all C/C++ dependencies from source, installs to /usr/local. # Usage: # podman build -t forts-clone-dev . # podman run -it --rm -v $(pwd):/src:Z --userns=keep-id forts-clone-dev FROM docker.io/library/fedora:41 # ============================================================================= # All system packages in one layer # ============================================================================= RUN dnf -y update && dnf -y install \ gcc-c++ clang lld meson ninja-build cmake git gdb valgrind \ SDL3-devel lua-devel glm-devel \ mesa-libGL-devel mesa-libEGL-devel \ libX11-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel \ wayland-devel libdrm-devel libxkbcommon-devel libxkbcommon-x11-devel \ vulkan-loader-devel \ pkg-config python3 which \ && dnf clean all # ============================================================================= # bgfx -- cross-platform GPU rendering # ============================================================================= WORKDIR /tmp/bgfx_build RUN git clone --recursive --depth 1 https://github.com/bkaradzic/bgfx.cmake.git . \ && cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local \ -DBGFX_BUILD_TOOLS=OFF \ -DBGFX_BUILD_EXAMPLES=OFF \ -DBGFX_BUILD_TESTS=OFF \ && cmake --build build \ && cmake --install build \ && rm -rf /tmp/bgfx_build # ============================================================================= # Box2D v3 -- deterministic 2D physics engine # Built directly from source to avoid CMake FetchContent issues. # ============================================================================= WORKDIR /tmp/box2d_build RUN git clone --depth 1 --branch v3.1.1 https://github.com/erincatto/box2d.git . \ && mkdir -p /usr/local/include/box2d \ && cp -r include/box2d/*.h /usr/local/include/box2d/ \ && cp -r include/box2d/*.h /usr/local/include/ \ && gcc -c src/*.c -I include -I src -O2 -DBOX2D_ENABLE_ASSERT=0 \ && ar rcs libbox2d.a *.o \ && cp libbox2d.a /usr/local/lib/ \ && rm -rf /tmp/box2d_build # ============================================================================= # SoLoud -- game audio engine # Built directly from source (contrib CMake is fragile). # ============================================================================= RUN dnf -y install alsa-lib-devel pulseaudio-libs-devel && dnf clean all WORKDIR /tmp/soloud_build RUN git clone --depth 1 https://github.com/jarikomppa/soloud.git . \ && mkdir -p /usr/local/include/soloud \ && cp include/*.h /usr/local/include/soloud/ \ && g++ -c src/core/*.cpp src/audiosource/*/*.cpp src/filter/*.cpp \ src/backend/alsa/*.cpp src/c_api/*.cpp \ -I include -O2 -fPIC -DWITH_ALSA \ && ar rcs libsoloud.a *.o \ && cp libsoloud.a /usr/local/lib/ \ && rm -rf /tmp/soloud_build # ============================================================================= # ENet -- UDP networking library # ============================================================================= WORKDIR /tmp/enet_build RUN git clone --depth 1 --branch v1.3.18 https://github.com/lsalzman/enet.git . \ && cmake -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=/usr/local \ && cmake --build build \ && cmake --install build \ && rm -rf /tmp/enet_build # ============================================================================= # ============================================================================= # sol2 -- Lua C++ bindings (header-only) # ============================================================================= WORKDIR /tmp/sol2_build RUN git clone --depth 1 --branch v3.5.0 https://github.com/ThePhD/sol2.git . \ && cp -r include/sol /usr/local/include/ \ && rm -rf /tmp/sol2_build # ============================================================================= # EnTT -- ECS library (header-only) # ============================================================================= WORKDIR /tmp/entt_build RUN git clone --depth 1 --branch v3.14.0 https://github.com/skypjack/entt.git . \ && cp -r src/entt /usr/local/include/ \ && rm -rf /tmp/entt_build # ============================================================================= # Lua 5.4 -- built as a STATIC archive (liblua.a) so the game binary carries # Lua itself and needs no liblua .so at runtime. Fedora's shared soname # (liblua-5.4.so) differs from other distros (liblua5.4.so), which breaks # running the container-built binary on the host. Appended LAST so none of the # cached dependency layers above have to rebuild. # ============================================================================= WORKDIR /tmp/lua_build RUN python3 -c "import urllib.request; urllib.request.urlretrieve('https://www.lua.org/ftp/lua-5.4.7.tar.gz','lua.tar.gz')" \ && tar xf lua.tar.gz \ && cd lua-5.4.7/src \ && gcc -O2 -fPIC -DLUA_USE_LINUX -c $(ls *.c | grep -vE '^(lua|luac)\.c$') \ && ar rcs liblua.a *.o \ && install -m644 liblua.a /usr/local/lib/ \ && install -m644 lua.h luaconf.h lualib.h lauxlib.h /usr/local/include/ \ && printf 'extern "C" {\n#include "lua.h"\n#include "lualib.h"\n#include "lauxlib.h"\n}\n' \ > /usr/local/include/lua.hpp \ && rm -rf /tmp/lua_build # ============================================================================= # Ready # ============================================================================= WORKDIR /src CMD ["bash"]