From 5d810e50d2b682981dd1cdadd35f755037e0947b Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 29 Jun 2026 20:50:18 +0100 Subject: [PATCH] Single source of truth for library versions --- .github/workflows/build.yml | 62 +++++++++++++++++++++--------------- cmake/libraries/all.cmake | 9 ++++++ cmake/libraries/curl.cmake | 2 +- cmake/libraries/jpeg.cmake | 2 +- cmake/libraries/ogg.cmake | 2 +- cmake/libraries/openal.cmake | 2 +- cmake/libraries/opus.cmake | 4 +-- cmake/libraries/sdl.cmake | 2 +- cmake/libraries/vorbis.cmake | 2 +- cmake/libraries/zlib.cmake | 2 +- 10 files changed, 54 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56932421..89abc4bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,12 @@ name: Build on: [push, pull_request] jobs: - version: - name: Extract Version + versions: + name: Extract Versions runs-on: ubuntu-latest outputs: - version: ${{ steps.extract-version.outputs.result }} + base: ${{ steps.extract-version.outputs.base }} + sdl: ${{ steps.extract-library-versions.outputs.sdl }} steps: - uses: actions/checkout@v4 - name: CMake Configure @@ -15,12 +16,17 @@ jobs: cmake -S . -B build -G Ninja -DBUILD_CLIENT=NO VERSION=$(cat build/version.txt) echo "VERSION: ${VERSION}" - echo "result=${VERSION}" >> $GITHUB_OUTPUT + echo "base=${VERSION}" >> $GITHUB_OUTPUT + - name: Library Versions + id: extract-library-versions + run: | + . misc/lib-versions.sh + echo "sdl=${SDL_VERSION}" >> $GITHUB_OUTPUT linux: name: Linux runs-on: ubuntu-22.04 - needs: version + needs: versions steps: - uses: actions/checkout@v4 - name: Install Dependencies @@ -36,13 +42,13 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-linux-${{ needs.version.outputs.version }} + name: ${{ github.event.repository.name }}-linux-${{ needs.versions.outputs.base }} path: | build/Release/**/* windows-msvc: name: Windows MSVC runs-on: windows-2022 - needs: version + needs: versions steps: - uses: actions/checkout@v4 - name: Compile @@ -54,7 +60,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-windows-msvc-${{ needs.version.outputs.version }} + name: ${{ github.event.repository.name }}-windows-msvc-${{ needs.versions.outputs.base }} path: | build/Release/**/*.dll build/Release/**/*.exe @@ -62,7 +68,7 @@ jobs: windows-mingw: name: Windows MinGW runs-on: windows-2022 - needs: version + needs: versions steps: - uses: actions/checkout@v4 - name: Compile @@ -74,7 +80,7 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-windows-mingw-${{ needs.version.outputs.version }} + name: ${{ github.event.repository.name }}-windows-mingw-${{ needs.versions.outputs.base }} path: | build/Release/**/*.dll build/Release/**/*.exe @@ -82,7 +88,7 @@ jobs: macos: name: macOS runs-on: macos-15 - needs: version + needs: versions steps: - uses: actions/checkout@v4 - name: Import Code Signing Certificate @@ -125,13 +131,13 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-macOS-${{ needs.version.outputs.version }} + name: ${{ github.event.repository.name }}-macOS-${{ needs.versions.outputs.base }} path: | build/Release/**/* emscripten: name: Emscripten runs-on: ubuntu-22.04 - needs: version + needs: versions steps: - uses: actions/checkout@v4 - name: Install emsdk @@ -145,12 +151,13 @@ jobs: - name: Upload uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-emscripten-${{ needs.version.outputs.version }} + name: ${{ github.event.repository.name }}-emscripten-${{ needs.versions.outputs.base }} path: | build/Release/**/* linux-external-libraries: name: Linux (USE_INTERNAL_LIBS OFF) runs-on: ubuntu-22.04 + needs: versions steps: - uses: actions/checkout@v4 - name: Install Dependencies @@ -165,6 +172,7 @@ jobs: linux-32bit: name: Linux 32-bit runs-on: ubuntu-22.04 + needs: versions steps: - uses: actions/checkout@v4 - name: Install Dependencies @@ -179,6 +187,7 @@ jobs: freebsd: name: FreeBSD runs-on: ubuntu-latest + needs: versions steps: - uses: actions/checkout@v4 - name: Compile @@ -192,6 +201,7 @@ jobs: openbsd: name: OpenBSD runs-on: ubuntu-latest + needs: versions steps: - uses: actions/checkout@v4 - name: Compile @@ -207,7 +217,7 @@ jobs: if: github.event_name != 'pull_request' name: Check For Release Tag runs-on: ubuntu-latest - needs: version + needs: versions outputs: is-release: ${{ steps.is-release-test.outputs.result }} steps: @@ -222,8 +232,8 @@ jobs: echo "result=false" >> $GITHUB_OUTPUT else echo "GIT_TAG: ${GIT_TAG}"" - echo "needs.version.outputs.version: ${{ needs.version.outputs.version }}"" - if [[ "${GIT_TAG}" = "${{ needs.version.outputs.version }}" ]] + echo "needs.versions.outputs.base: ${{ needs.versions.outputs.base }}"" + if [[ "${GIT_TAG}" = "${{ needs.versions.outputs.base }}" ]] then echo "'${GIT_TAG}' is a release" echo "result=true" >> $GITHUB_OUTPUT @@ -238,7 +248,7 @@ jobs: if: github.event_name != 'pull_request' && needs.check-is-release.outputs.is-release == 'true' runs-on: ubuntu-latest needs: - - version + - versions - check-is-release - windows-msvc - macos @@ -249,21 +259,21 @@ jobs: - name: Prepare Release Artifacts run: | mkdir release-artifacts - mv ${{ github.event.repository.name }}-linux-${{ needs.version.outputs.version }}/${{ github.event.repository.name }}-${{ needs.version.outputs.version }}.deb \ + mv ${{ github.event.repository.name }}-linux-${{ needs.versions.outputs.base }}/${{ github.event.repository.name }}-${{ needs.versions.outputs.base }}.deb \ release-artifacts - zip -r9 release-artifacts/${{ github.event.repository.name }}-linux-${{ needs.version.outputs.version }}.zip \ - ${{ github.event.repository.name }}-linux-${{ needs.version.outputs.version }} - mv ${{ github.event.repository.name }}-windows-msvc-${{ needs.version.outputs.version }}/${{ github.event.repository.name }}-${{ needs.version.outputs.version }}.exe \ + zip -r9 release-artifacts/${{ github.event.repository.name }}-linux-${{ needs.versions.outputs.base }}.zip \ + ${{ github.event.repository.name }}-linux-${{ needs.versions.outputs.base }} + mv ${{ github.event.repository.name }}-windows-msvc-${{ needs.versions.outputs.base }}/${{ github.event.repository.name }}-${{ needs.versions.outputs.base }}.exe \ release-artifacts - mv ${{ github.event.repository.name }}-macOS-${{ needs.version.outputs.version }}/${{ github.event.repository.name }}-${{ needs.version.outputs.version }}.dmg \ + mv ${{ github.event.repository.name }}-macOS-${{ needs.versions.outputs.base }}/${{ github.event.repository.name }}-${{ needs.versions.outputs.base }}.dmg \ release-artifacts - zip -r9 release-artifacts/${{ github.event.repository.name }}-emscripten-${{ needs.version.outputs.version }}.zip \ - ${{ github.event.repository.name }}-emscripten-${{ needs.version.outputs.version }} + zip -r9 release-artifacts/${{ github.event.repository.name }}-emscripten-${{ needs.versions.outputs.base }}.zip \ + ${{ github.event.repository.name }}-emscripten-${{ needs.versions.outputs.base }} - name: Publish Release Artifacts uses: softprops/action-gh-release@v1 with: tag_name: ${{ github.ref }} - name: Release ${{ needs.version.outputs.version }} + name: Release ${{ needs.versions.outputs.base }} files: release-artifacts/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cmake/libraries/all.cmake b/cmake/libraries/all.cmake index 112c3489..2523e5d5 100644 --- a/cmake/libraries/all.cmake +++ b/cmake/libraries/all.cmake @@ -1,3 +1,12 @@ +# Import variables from misc/lib-versions.sh +file(STRINGS ${CMAKE_SOURCE_DIR}/misc/lib-versions.sh LIB_VERSIONS_CONTENT + REGEX "^[A-Z_]+=[^ ]+") +foreach(LINE ${LIB_VERSIONS_CONTENT}) + if(LINE MATCHES "^([A-Z_]+)=(.+)$") + set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) + endif() +endforeach() + include(libraries/curl) include(libraries/freetype) include(libraries/jpeg) diff --git a/cmake/libraries/curl.cmake b/cmake/libraries/curl.cmake index a9740284..4727966e 100644 --- a/cmake/libraries/curl.cmake +++ b/cmake/libraries/curl.cmake @@ -6,7 +6,7 @@ if(NOT BUILD_CLIENT) return() endif() -set(INTERNAL_CURL_DIR ${SOURCE_DIR}/thirdparty/curl-8.15.0) +set(INTERNAL_CURL_DIR ${SOURCE_DIR}/thirdparty/curl-${CURL_VERSION}) find_package(CURL QUIET) diff --git a/cmake/libraries/jpeg.cmake b/cmake/libraries/jpeg.cmake index c3c7256e..a98539e5 100644 --- a/cmake/libraries/jpeg.cmake +++ b/cmake/libraries/jpeg.cmake @@ -5,7 +5,7 @@ endif() include(utils/disable_warnings) include(utils/find_include_dirs) -set(INTERNAL_JPEG_DIR ${SOURCE_DIR}/thirdparty/jpeg-9f) +set(INTERNAL_JPEG_DIR ${SOURCE_DIR}/thirdparty/jpeg-${JPEG_VERSION}) if(USE_INTERNAL_JPEG) file(GLOB_RECURSE JPEG_SOURCES ${INTERNAL_JPEG_DIR}/j*.c) diff --git a/cmake/libraries/ogg.cmake b/cmake/libraries/ogg.cmake index d8c7f628..32daab72 100644 --- a/cmake/libraries/ogg.cmake +++ b/cmake/libraries/ogg.cmake @@ -8,7 +8,7 @@ endif() include(utils/disable_warnings) -set(INTERNAL_OGG_DIR ${SOURCE_DIR}/thirdparty/libogg-1.3.6) +set(INTERNAL_OGG_DIR ${SOURCE_DIR}/thirdparty/libogg-${OGG_VERSION}) if(USE_INTERNAL_OGG) file(GLOB_RECURSE OGG_SOURCES ${INTERNAL_OGG_DIR}/*.c) diff --git a/cmake/libraries/openal.cmake b/cmake/libraries/openal.cmake index 8ba5b172..5ebfd448 100644 --- a/cmake/libraries/openal.cmake +++ b/cmake/libraries/openal.cmake @@ -6,7 +6,7 @@ if(NOT BUILD_CLIENT) return() endif() -set(INTERNAL_OPENAL_DIR ${SOURCE_DIR}/thirdparty/openal-soft-1.24.3) +set(INTERNAL_OPENAL_DIR ${SOURCE_DIR}/thirdparty/openal-soft-${OPENAL_VERSION}) find_package(OpenAL QUIET) diff --git a/cmake/libraries/opus.cmake b/cmake/libraries/opus.cmake index 4e839a74..d4363478 100644 --- a/cmake/libraries/opus.cmake +++ b/cmake/libraries/opus.cmake @@ -9,8 +9,8 @@ endif() include(utils/disable_warnings) include(utils/find_include_dirs) -set(INTERNAL_OPUS_DIR ${SOURCE_DIR}/thirdparty/opus-1.5.2) -set(INTERNAL_OPUSFILE_DIR ${SOURCE_DIR}/thirdparty/opusfile-0.12) +set(INTERNAL_OPUS_DIR ${SOURCE_DIR}/thirdparty/opus-${OPUS_VERSION}) +set(INTERNAL_OPUSFILE_DIR ${SOURCE_DIR}/thirdparty/opusfile-${OPUSFILE_VERSION}) if(USE_INTERNAL_OPUS) file(GLOB_RECURSE OPUS_SOURCES ${INTERNAL_OPUS_DIR}/*.c) diff --git a/cmake/libraries/sdl.cmake b/cmake/libraries/sdl.cmake index 4cd0b299..dd946e20 100644 --- a/cmake/libraries/sdl.cmake +++ b/cmake/libraries/sdl.cmake @@ -9,7 +9,7 @@ if(EMSCRIPTEN) return() endif() -set(INTERNAL_SDL_DIR ${SOURCE_DIR}/thirdparty/SDL2-2.32.8) +set(INTERNAL_SDL_DIR ${SOURCE_DIR}/thirdparty/SDL2-${SDL_VERSION}) include(utils/arch) diff --git a/cmake/libraries/vorbis.cmake b/cmake/libraries/vorbis.cmake index 623a695b..04d5d4cb 100644 --- a/cmake/libraries/vorbis.cmake +++ b/cmake/libraries/vorbis.cmake @@ -8,7 +8,7 @@ endif() include(utils/disable_warnings) -set(INTERNAL_VORBIS_DIR ${SOURCE_DIR}/thirdparty/libvorbis-1.3.7) +set(INTERNAL_VORBIS_DIR ${SOURCE_DIR}/thirdparty/libvorbis-${VORBIS_VERSION}) if(USE_INTERNAL_VORBIS) file(GLOB_RECURSE VORBIS_SOURCES ${INTERNAL_VORBIS_DIR}/*.c) diff --git a/cmake/libraries/zlib.cmake b/cmake/libraries/zlib.cmake index bc79936a..31c10989 100644 --- a/cmake/libraries/zlib.cmake +++ b/cmake/libraries/zlib.cmake @@ -1,7 +1,7 @@ include(utils/disable_warnings) include(utils/find_include_dirs) -set(INTERNAL_ZLIB_DIR ${SOURCE_DIR}/thirdparty/zlib-1.3.1) +set(INTERNAL_ZLIB_DIR ${SOURCE_DIR}/thirdparty/zlib-${ZLIB_VERSION}) if(USE_INTERNAL_ZLIB) file(GLOB_RECURSE ZLIB_SOURCES ${INTERNAL_ZLIB_DIR}/*.c)