Skip to content

Commit

Permalink
Add stead sdk docker file to build for steam.
Browse files Browse the repository at this point in the history
  • Loading branch information
juvinious committed Mar 5, 2024
1 parent 53fe8b4 commit b269563
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 0 deletions.
60 changes: 60 additions & 0 deletions docker/Dockerfile.steam
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Build: docker build -t paintown-steam-build -f docker/Dockerfile.steam .
# Access shell: docker run --rm -it --entrypoint /bin/bash paintown-steam-build
# Use sniper build (https://github.com/ValveSoftware/steam-runtime?tab=readme-ov-file#installation)
FROM registry.gitlab.steamos.cloud/steamrt/sniper/sdk:latest

RUN apt update && \
apt install -y sudo wget git ninja-build make python3-pip libsdl2-gfx-dev && \
apt remove -y meson

# Get latest meson
RUN pip install meson && \
ln -s /usr/local/bin/meson /usr/bin/meson

# Build dirs
RUN mkdir -p /build/cross/include/SDL2

COPY src /build/src
COPY meson.build /build
COPY misc/steam/steam.txt /build/steam.txt
COPY meson.options /build
COPY Makefile /build/Makefile

# Makefile for cross in case we need to do something different
RUN echo ".PHONY: all clean\n\
\n\
steam: build-steam\n\
\t(cd build-steam; meson configure -Dbuild_tests=false)\n\
\tmeson compile -C build-steam\n\
\n\
build-steam:\n\
\tmkdir build-steam\n\
\tmeson setup --cross-file steam.txt build-steam\n\
\n\
clean:\n\
\trm -fr build-steam" > /build/Makefile-steam

# Temp directory
RUN mkdir -p /build/.tmp

# SDL_gfx is not installed by default, we may need to statically link it if it doesn't work on steam deck or with steam natively
#RUN git clone https://github.com/ferzkopp/SDL2_gfx.git -- /build/.tmp/SDL_gfx
#RUN echo "sources = [\n\
# 'SDL2_framerate.c',\n\
# 'SDL2_gfxPrimitives.c',\n\
# 'SDL2_imageFilter.c',\n\
# 'SDL2_rotozoom.c',\n\
#]\n\
#\n\
#includes = include_directories('.')\n\
#\n\
#sdl_graphics_library = static_library('SDL2_gfx', sources,\n\
# include_directories: [includes],\n\
# dependencies: [sdl_dependency, zlib_dependency],\n\
#)\n" > /build/.tmp/SDL_gfx/meson.build
#RUN cp /build/.tmp/SDL_gfx/*.h /build/cross/include/SDL2

RUN cd /build && make

CMD [ "/bin/bash" ]

63 changes: 63 additions & 0 deletions misc/steam/steam.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[constants]
cross_root = 'cross'
common_args = ['-I..' / cross_root / 'include',
'-DDATA_PATH="data"',
'-DSTEAM'
]
#common_link_args = ['-L/usr/x86_64-w64-mingw32/lib', '-lz']

[binaries]
c = 'clang'
cpp = 'clang++'
ar = 'ar'
strip = 'strip'
#exe_wrapper = 'wine64'
pkg-config = 'pkg-config'
sdl2-config = 'sdl2-config'
cmake = 'cmake'

[properties]
#pkg_config_libdir = ['/usr/x86_64-w64-mingw32/lib/pkgconfig', cross_root / 'lib/pkgconfig']
pkg_config_libdir = []

[host_machine]
system = 'steamos'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[built-in options]
#pkg_config_path = cross_root / 'lib/pkg-config'
#c_include_path = cross_root / 'include'
#cpp_include_path = cross_root / 'include'
c_args = common_args
cpp_args = common_args
c_link_args = ['-static', '-lsfml-window-s', '-lsfml-system-s',]
cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++',]
#includedir = cross_root / 'include'
#libdir = cross_root / 'lib'
default_library='static'

[sdl2:built-in options]
default_library = 'static'
werror = false

[SDL2_image:built-in options]
default_library = 'static'
werror = false

[SDL2_ttf:built-in options]
default_library = 'static'
werror = false

[SDL2_mixer:built-in options]
default_library = 'static'
werror = false

[zlib:built-in options]
default_library = 'static'
werror = false

[yaml-cpp:built-in options]
default_library = 'static'
werror = false

0 comments on commit b269563

Please sign in to comment.