Skip to content

Commit

Permalink
build: change uthash packaging
Browse files Browse the repository at this point in the history
Resolves #1856.
  • Loading branch information
rr- committed Nov 19, 2024
1 parent ec9fb8d commit a648707
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 36 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/data
/test
/build
7 changes: 6 additions & 1 deletion .github/workflows/job_build_tr1_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
FFMPEG_INSTALL_TMP_X86_64: /tmp/install_x86_64
CACHE_TMP_DIR: /tmp/opt_local/
CACHE_DST_DIR: /opt/local/
C_INCLUDE_PATH: /opt/local/include/uthash/:/opt/local/include/

jobs:
build:
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
id: restore-cache
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-tooling-${{ hashFiles('.github/workflows/build_macos.yml') }}
key: ${{ runner.os }}-tooling-${{ hashFiles('.github/workflows/job_build_tr1_macos.yml') }}
path: |
${{ env.CACHE_TMP_DIR }}
${{ env.FFMPEG_INSTALL_TMP_ARM64 }}
Expand Down Expand Up @@ -115,6 +116,10 @@ jobs:
if: steps.restore-cache.outputs.cache-hit != 'true'
run: sudo port -N install libsdl2 +universal

- name: "Build dependency: uthash (universal)"
if: steps.restore-cache.outputs.cache-hit != 'true'
run: sudo port -N install uthash +universal

- name: "Build dependency: ffmpeg (universal)"
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,5 @@ Release/
# libtrx artefacts
**/subprojects/packagecache/
**/subprojects/dwarfstack-*/
**/subprojects/uthash-*/
src/tr1/subprojects/dwarfstack.wrap
src/tr1/subprojects/uthash.wrap
src/tr2/subprojects/dwarfstack.wrap
src/tr2/subprojects/uthash.wrap
4 changes: 1 addition & 3 deletions src/libtrx/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ if host_machine.system() == 'darwin'
staticdeps = false
endif

uthash = subproject('uthash', default_options: ['warning_level=0'])

null_dep = dependency('', required: false)
dep_avcodec = dependency('libavcodec', static: staticdeps)
dep_avformat = dependency('libavformat', static: staticdeps)
Expand All @@ -43,6 +41,7 @@ dep_pcre2 = dependency('libpcre2-8', static: staticdeps)
dep_backtrace = c_compiler.find_library('backtrace', static: true, required: false)
dep_swscale = dependency('libswscale', static: staticdeps)
dep_swresample = dependency('libswresample', static: staticdeps)
c_compiler.check_header('uthash.h', required: true)

dep_zlib = null_dep
if not staticdeps
Expand Down Expand Up @@ -151,7 +150,6 @@ dependencies = [
dep_swscale,
dep_zlib,
dep_opengl,
uthash.get_variable('uthash_dep'),
]

if dep_backtrace.found() and host_machine.system() == 'linux'
Expand Down
11 changes: 0 additions & 11 deletions src/libtrx/subprojects/uthash.wrap

This file was deleted.

18 changes: 4 additions & 14 deletions tools/tr1/docker/game-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@ RUN cd SDL \



# UPX
FROM base AS upx

RUN mkdir /ext/
WORKDIR /ext/

RUN apt-get install -y wget xz-utils
RUN wget https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz
RUN tar -xvf upx-*.tar.xz
RUN ln -s upx-*/upx



# TR1X
FROM base

Expand All @@ -130,9 +117,12 @@ RUN apt-get install -y \
pyjson5 \
meson \
ninja
# Regular dependencies
RUN apt-get install -y \
upx \
uthash-dev

# manually built dependencies
COPY --from=upx /ext/upx /usr/local/bin/upx
COPY --from=libav /ext/ /ext/
COPY --from=sdl /ext/ /ext/
COPY --from=backtrace /ext/ /ext/
Expand Down
19 changes: 17 additions & 2 deletions tools/tr1/docker/game-win/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ RUN cd SDL \



# uthash
FROM mingw AS uthash

RUN mkdir /ext/
WORKDIR /tmp/

RUN apt-get install -y wget xz-utils
RUN wget https://github.com/troydhanson/uthash/archive/v2.3.0.tar.gz
RUN tar -xvf v2.3.0.tar.gz
RUN cp -rL uthash-2.3.0/* /ext/



# TR1X
FROM mingw

Expand All @@ -123,12 +136,11 @@ COPY --from=pcre2 /ext/ /ext/
COPY --from=zlib /ext/ /ext/
COPY --from=libav /ext/ /ext/
COPY --from=sdl /ext/ /ext/
COPY --from=uthash /ext/ /ext/

# system dependencies
# configure pkgconfig manually
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967969
ENV PKG_CONFIG_LIBDIR=/ext/lib/
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
RUN apt-get install -y \
mingw-w64-tools \
pkg-config \
Expand All @@ -139,5 +151,8 @@ RUN apt-get install -y \
meson \
ninja

ENV PKG_CONFIG_LIBDIR=/ext/lib/
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
ENV C_INCLUDE_PATH=/ext/include/
ENV PYTHONPATH=/app/tools/
ENTRYPOINT ["/app/tools/tr1/docker/game-win/entrypoint.sh"]
19 changes: 17 additions & 2 deletions tools/tr2/docker/game-win/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ RUN cd SDL \



# uthash
FROM mingw AS uthash

RUN mkdir /ext/
WORKDIR /tmp/

RUN apt-get install -y wget xz-utils
RUN wget https://github.com/troydhanson/uthash/archive/v2.3.0.tar.gz
RUN tar -xvf v2.3.0.tar.gz
RUN cp -rL uthash-2.3.0/* /ext/



# TR2X
FROM mingw

Expand All @@ -108,12 +121,11 @@ COPY --from=pcre2 /ext/ /ext/
COPY --from=zlib /ext/ /ext/
COPY --from=libav /ext/ /ext/
COPY --from=sdl /ext/ /ext/
COPY --from=uthash /ext/ /ext/

# system dependencies
# configure pkgconfig manually
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967969
ENV PKG_CONFIG_LIBDIR=/ext/lib/
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
RUN apt-get install -y \
mingw-w64-tools \
pkg-config \
Expand All @@ -124,5 +136,8 @@ RUN apt-get install -y \
meson \
ninja

ENV PKG_CONFIG_LIBDIR=/ext/lib/
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
ENV C_INCLUDE_PATH=/ext/include/
ENV PYTHONPATH=/app/tools/
ENTRYPOINT ["/app/tools/tr2/docker/game-win/entrypoint.sh"]

0 comments on commit a648707

Please sign in to comment.