From f9a43c8c409e237ed34e38d27ad2d03c9f64745f Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Fri, 17 Jan 2025 18:27:30 +0100 Subject: [PATCH] Add support for fetch-only for libraries Used to prefetch all required tarballs to build pyrogenesis later without network access as is common for Linux package build and some other CI environments. Signed-off-by: Ralph Sennhauser --- libraries/build-source-libs.sh | 2 ++ libraries/source/cxxtest-4.4/build.sh | 13 ++++++++++-- libraries/source/fcollada/build.sh | 27 +++++++++++++++++++------ libraries/source/nvtt/build.sh | 27 +++++++++++++++++++------ libraries/source/premake-core/build.sh | 13 ++++++++++-- libraries/source/spidermonkey/build.sh | 13 ++++++++++-- libraries/source/spirv-reflect/build.sh | 13 ++++++++++-- 7 files changed, 88 insertions(+), 20 deletions(-) diff --git a/libraries/build-source-libs.sh b/libraries/build-source-libs.sh index 27119ae2bd..e62644f428 100755 --- a/libraries/build-source-libs.sh +++ b/libraries/build-source-libs.sh @@ -29,6 +29,7 @@ usage: options: --help - print this help + --fetch-only - only fetch sources --force-rebuild - rebuild all --without-nvtt - don't build nvtt --with-system-cxxtest - don't build cxxtest @@ -55,6 +56,7 @@ while [ "$#" -gt 0 ]; do print_help exit ;; + --fetch-only) build_sh_options="$build_sh_options --fetch-only" ;; --force-rebuild) build_sh_options="$build_sh_options --force-rebuild" ;; --without-nvtt) without_nvtt=true ;; --with-system-cxxtest) with_system_cxxtest=true ;; diff --git a/libraries/source/cxxtest-4.4/build.sh b/libraries/source/cxxtest-4.4/build.sh index a428a5fb3b..3243836ecb 100755 --- a/libraries/source/cxxtest-4.4/build.sh +++ b/libraries/source/cxxtest-4.4/build.sh @@ -6,9 +6,19 @@ cd "$(dirname "$0")" PV=4.4 LIB_VERSION=${PV}+wfg1 +fetch() +{ + curl -fLo "cxxtest-${PV}.tar.gz" \ + "https://github.com/CxxTest/cxxtest/releases/download/${PV}/cxxtest-${PV}.tar.gz" +} + echo "Building CxxTest..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -25,8 +35,7 @@ fi # fetch if [ ! -e "cxxtest-${PV}.tar.gz" ]; then - curl -fLo "cxxtest-${PV}.tar.gz" \ - "https://github.com/CxxTest/cxxtest/releases/download/${PV}/cxxtest-${PV}.tar.gz" + fetch fi # unpack diff --git a/libraries/source/fcollada/build.sh b/libraries/source/fcollada/build.sh index ce82807b3d..4ba98b9d2a 100755 --- a/libraries/source/fcollada/build.sh +++ b/libraries/source/fcollada/build.sh @@ -3,11 +3,24 @@ set -e cd "$(dirname "$0")" -LIB_VERSION=28209 +PV=28209 +LIB_VERSION=${PV} + +fetch() +{ + rm -Rf fcollada-${PV} + svn export https://svn.wildfiregames.com/public/source-libs/trunk/fcollada@${PV} fcollada-${PV} + tar cJf fcollada-${PV}.tar.xz fcollada-${PV} + rm -R fcollada-${PV} +} echo "Building FCollada..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -23,20 +36,22 @@ if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" fi # fetch -svn co "https://svn.wildfiregames.com/public/source-libs/trunk/fcollada@${LIB_VERSION}" fcollada-svn +if [ ! -e "fcollada-${PV}.tar.xz" ]; then + fetch +fi # unpack -rm -Rf fcollada-build -cp -R fcollada-svn fcollada-build +rm -Rf fcollada-${PV} +tar xf fcollada-${PV}.tar.xz # build ( - cd fcollada-build + cd fcollada-${PV} ./build.sh ) # install rm -Rf include lib -cp -R fcollada-build/include fcollada-build/lib . +cp -R fcollada-${PV}/include fcollada-${PV}/lib . echo "${LIB_VERSION}" >.already-built diff --git a/libraries/source/nvtt/build.sh b/libraries/source/nvtt/build.sh index 8149bdaa65..47299730fe 100755 --- a/libraries/source/nvtt/build.sh +++ b/libraries/source/nvtt/build.sh @@ -3,11 +3,24 @@ set -e cd "$(dirname "$0")" -LIB_VERSION=28209 +PV=28209 +LIB_VERSION=${PV} + +fetch() +{ + rm -Rf nvtt-${PV} + svn export https://svn.wildfiregames.com/public/source-libs/trunk/nvtt@${PV} nvtt-${PV} + tar cJf nvtt-${PV}.tar.xz nvtt-${PV} + rm -R nvtt-${PV} +} echo "Building NVTT..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -23,21 +36,23 @@ if [ -e .already-built ] && [ "$(cat .already-built || true)" = "${LIB_VERSION}" fi # fetch -svn co "https://svn.wildfiregames.com/public/source-libs/trunk/nvtt@${LIB_VERSION}" nvtt-svn +if [ ! -e "nvtt-${PV}.tar.xz" ]; then + fetch +fi # unpack -rm -Rf nvtt-build -cp -R nvtt-svn nvtt-build +rm -Rf nvtt-${PV} +tar xf nvtt-${PV}.tar.xz # build ( - cd nvtt-build + cd nvtt-${PV} mkdir bin lib ./build.sh ) # install rm -Rf bin include lib -cp -R nvtt-build/bin nvtt-build/include nvtt-build/lib . +cp -R nvtt-${PV}/bin nvtt-${PV}/include nvtt-${PV}/lib . echo "${LIB_VERSION}" >.already-built diff --git a/libraries/source/premake-core/build.sh b/libraries/source/premake-core/build.sh index be5971bd21..1433a57a50 100755 --- a/libraries/source/premake-core/build.sh +++ b/libraries/source/premake-core/build.sh @@ -10,9 +10,19 @@ cd "$(dirname "$0")" PV=5.0.0-beta3 LIB_VERSION=${PV}+wfg1 +fetch() +{ + curl -fLo "premake-core-${PV}.tar.gz" \ + "https://github.com/premake/premake-core/archive/refs/tags/v${PV}.tar.gz" +} + echo "Building Premake..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -29,8 +39,7 @@ fi # fetch if [ ! -e "premake-core-${PV}.tar.gz" ]; then - curl -fLo "premake-core-${PV}.tar.gz" \ - "https://github.com/premake/premake-core/archive/refs/tags/v${PV}.tar.gz" + fetch fi # unpack diff --git a/libraries/source/spidermonkey/build.sh b/libraries/source/spidermonkey/build.sh index 31ffa9ab0f..c0d2e36cd0 100755 --- a/libraries/source/spidermonkey/build.sh +++ b/libraries/source/spidermonkey/build.sh @@ -9,9 +9,19 @@ FOLDER="mozjs-115.16.1" LIB_VERSION="115.16.1+3" LIB_NAME="mozjs115" +fetch() +{ + curl -fLo "${FOLDER}.tar.xz" \ + "https://releases.wildfiregames.com/libs/${FOLDER}.tar.xz" +} + echo "Building SpiderMonkey..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -32,8 +42,7 @@ OS="${OS:=$(uname -s)}" # This tarball is built from https://ftp.mozilla.org/pub/firefox/releases/115.16.1esr/source/ # by running js/src/make-source-package.py if [ ! -e "${FOLDER}.tar.xz" ]; then - curl -fLo "${FOLDER}.tar.xz" \ - "https://releases.wildfiregames.com/libs/${FOLDER}.tar.xz" + fetch fi # unpack diff --git a/libraries/source/spirv-reflect/build.sh b/libraries/source/spirv-reflect/build.sh index 26884510d9..c5169b5bfc 100755 --- a/libraries/source/spirv-reflect/build.sh +++ b/libraries/source/spirv-reflect/build.sh @@ -6,9 +6,19 @@ cd "$(dirname "$0")" PV=1.3.290.0 LIB_VERSION=${PV} +fetch() +{ + curl -fLo "vulkan-sdk-${PV}.tar.gz" \ + "https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-${PV}.tar.gz" +} + echo "Building SPIRV-Reflect..." while [ "$#" -gt 0 ]; do case "$1" in + --fetch-only) + fetch + exit + ;; --force-rebuild) rm -f .already-built ;; *) echo "Unknown option: $1" @@ -25,8 +35,7 @@ fi # fetch if [ ! -e "vulkan-sdk-${PV}.tar.gz" ]; then - curl -fLo "vulkan-sdk-${PV}.tar.gz" \ - "https://github.com/KhronosGroup/SPIRV-Reflect/archive/refs/tags/vulkan-sdk-${PV}.tar.gz" + fetch fi # unpack