Created
November 13, 2023 21:45
-
-
Save dkosmari/2c4b4b3b72e5e125354230ef21901487 to your computer and use it in GitHub Desktop.
Dockerfile for cross-compilation of SFML from Fedora, using mingw32.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Usage (this will create an image named "test"): | |
### docker build -t test | |
### docker run -it test | |
FROM fedora:latest | |
RUN dnf update -y | |
RUN dnf install -y cmake | |
RUN dnf install -y mingw32-gcc-c++ mingw32-libstdc++ | |
RUN dnf install -y \ | |
mingw32-flac \ | |
mingw32-freetype \ | |
mingw32-libvorbis \ | |
mingw32-openal-soft | |
### Do everything after this as "user", not as "root". | |
RUN dnf install -y passwd shadow-utils | |
RUN adduser -u 1000 user | |
RUN passwd -d user | |
USER user | |
WORKDIR /home/user | |
RUN mkdir src | |
WORKDIR src | |
### Grab SFML sources | |
RUN dnf install -y wget | |
RUN wget -q https://github.com/SFML/SFML/archive/refs/tags/2.6.1.tar.gz -O SFML-2.6.1.tar.gz | |
RUN tar xf SFML-2.6.1.tar.gz | |
#ADD SFML-2.6.1-sources.zip . | |
#RUN unzip SFML-2.6.1-sources.zip | |
### Cross-compile it. | |
WORKDIR SFML-2.6.1 | |
RUN mkdir build | |
WORKDIR build | |
ENV MINGW_ROOT=/usr/i686-w64-mingw32/sys-root/mingw | |
RUN cmake \ | |
-DCMAKE_TOOLCHAIN_FILE=/usr/share/mingw/toolchain-mingw32.cmake \ | |
-DBUILD_SHARED_LIBS=ON \ | |
-DCMAKE_INSTALL_PREFIX=${MINGW_ROOT} \ | |
-DCMAKE_VERBOSE_MAKEFILE=ON \ | |
-DSFML_INSTALL_PKGCONFIG_FILES=TRUE \ | |
-DCMAKE_INSTALL_LIBDIR=lib \ | |
.. | |
RUN make | |
USER root | |
RUN make install | |
USER user | |
# delete build dir | |
#WORKDIR .. | |
#RUN rm -rf build | |
WORKDIR /home/user | |
CMD /bin/bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment