From b6fd6767fa0411e9e35ace49727092bbfe6524cf Mon Sep 17 00:00:00 2001 From: cube Date: Sun, 14 Jun 2026 14:09:47 +0200 Subject: [PATCH 01/55] Try to fix #676 after #616. Does not fully work yet. --- ShellScripts/Linux/download_github.sh | 109 ++++++++++++++++++++ ShellScripts/Linux/install_packages_root.sh | 5 + ShellScripts/common/get_version.sh | 11 +- 3 files changed, 120 insertions(+), 5 deletions(-) create mode 100755 ShellScripts/Linux/download_github.sh diff --git a/ShellScripts/Linux/download_github.sh b/ShellScripts/Linux/download_github.sh new file mode 100755 index 000000000..4934b3d01 --- /dev/null +++ b/ShellScripts/Linux/download_github.sh @@ -0,0 +1,109 @@ +#!/bin/bash +# +# This script downloads the latest release of a project on github. +# The name of the downloaded file is emitted on stdout. +# +# Run with these parameters: +# -o, --owner The project owner +# -r, --repository The repository name +# -f, --filter Additional filter to select from provided artifacts +# -O, --outputdir Destination directory for download +# + +# Exit immediately if a command exits with a non-zero status +set -e + +# Default value +OUTPUTDIR=. + +# parse command line +POSITIONAL_ARGS=() +while [[ $# -gt 0 ]]; do + case $1 in + -o|--owner) + OWNER="$2" + shift # past argument + shift # past value + ;; + -r|--repository) + REPOSITORY="$2" + shift # past argument + shift # past value + ;; + -f|--filter) + FILTER="$2" + shift # past argument + shift # past value + ;; + -O|--outputdir) + OUTPUTDIR="$2" + shift # past argument + shift # past value + ;; + -*|--*) + echo "Unknown option $1" + exit 1 + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +if [ "" == "${OWNER}" ] +then + echo ERROR: OWNER not set. Use --owner + exit 1 +fi +if [ "" == "${REPOSITORY}" ] +then + echo ERROR: REPOSITORY not set. Use --repository + exit 1 +fi + +# --- CONFIGURATION --- +# Replace with the target repository (Format: owner/repo) +REPO="${OWNER}/${REPOSITORY}" + +echo "Fetching latest release info for ${REPO}..." >&2 +API_URL="https://api.github.com/repos/${REPO}/releases/latest" +RELEASE_JSON=$(curl -s "${API_URL}") + +# Check if the repository was found/has releases +if echo "${RELEASE_JSON}" | grep -q "Not Found"; then + echo "Error: Repository not found or has no public releases at ${API_URL}" + exit 1 +fi + +# Extract the download URL +# If 'jq' is installed, we use it (cleaner). Otherwise, we fallback to 'grep/sed'. +if command -v jq &> /dev/null; then + if [ -n "${FILTER}" ]; then + DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | jq -r ".assets[] | select(.name | contains(\"${FILTER}\")) | .browser_download_url" | head -n 1) + else + DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | jq -r '.assets[0].browser_download_url') + fi +else + # Fallback using grep/sed if jq isn't available + if [ -n "${FILTER}" ]; then + DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | grep "browser_download_url" | grep "${FILTER}" | head -n 1 | cut -d '"' -f 4) + else + DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | grep "browser_download_url" | head -n 1 | cut -d '"' -f 4) + fi +fi + +# Check if a URL was actually found +if [ -z "${DOWNLOAD_URL}" ] || [ "${DOWNLOAD_URL}" == "null" ]; then + echo "Error: Could not find a matching download URL." + exit 1 +fi + +# Extract filename from the URL +FILENAME=$(basename "${DOWNLOAD_URL}") + +echo "Downloading latest release: ${FILENAME}..." >&2 +curl -L -O --output-dir "${OUTPUTDIR}" "${DOWNLOAD_URL}" + +echo "Download finished" >&2 +echo "${OUTPUTDIR}/${FILENAME}" diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 7f7230574..8b8e13c42 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -14,6 +14,11 @@ run_script() { local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" + # install gitversion + GITVERSION_TGZ=$(./download_github.sh --owner GitTools --repository GitVersion --filter linux-x --outputdir ${SCRIPT_DIR}) + tar xfz ${GITVERSION_TGZ} --directory ${SCRIPT_DIR} + chmod +xr ${SCRIPT_DIR}/gitversion + source ./install_package_fn.sh if ! install_package base-devel; then diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index da7d67261..6d5d843bf 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -4,6 +4,7 @@ # Output goes into the OOLITE_VERSION.txt file and to stdout. # +GITVERSION=./gitversion SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" > /dev/null @@ -25,17 +26,17 @@ if [[ -z "${SEMVER}" ]] || [[ -z "${PROJECTNAME}" ]] then # Variables not passed in. Calculate the classic way. - VERSION=$(cat ../src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2) - VER_MAJ=$(echo "$VERSION" | cut -d. -f1) - VER_MIN=$(echo "$VERSION" | cut -d. -f2) - VER_REV=$(echo "$VERSION" | cut -d. -f3) + VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(./gitversion /showvariable UncommittedChanges)) + VER_MAJ=$(${GITVERSION} /showvariable Major) + VER_MIN=$(${GITVERSION} /showvariable Minor) + VER_REV=$(${GITVERSION} /showvariable Patch) if [[ "" == "$VER_REV" ]]; then VER_REV="0" fi VER_GITREV=$(git rev-list --count HEAD) VER_GITHASH=$(git rev-parse --short=7 HEAD) - VER_FULL="$VER_MAJ.$VER_MIN.$VER_REV.$VER_GITREV-$VER_DATE-$VER_GITHASH" + VER_FULL="${VERSION}" BUILDTIME=$(date "+%Y.%m.%d %H:%M") else # Variables passed in. Make use of them. From 591ab9a635dc91e454c6bbcd196114556d298f7f Mon Sep 17 00:00:00 2001 From: cube Date: Sun, 14 Jun 2026 20:17:18 +0200 Subject: [PATCH 02/55] store gitversion in /usr/local/bin --- ShellScripts/Linux/install_packages_root.sh | 3 +++ ShellScripts/common/get_version.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 8b8e13c42..9a406bcd2 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -1,6 +1,7 @@ #!/bin/bash # This script must be run as root (for example with sudo). +set -e run_script() { @@ -18,6 +19,8 @@ run_script() { GITVERSION_TGZ=$(./download_github.sh --owner GitTools --repository GitVersion --filter linux-x --outputdir ${SCRIPT_DIR}) tar xfz ${GITVERSION_TGZ} --directory ${SCRIPT_DIR} chmod +xr ${SCRIPT_DIR}/gitversion + mv ${SCRIPT_DIR}/gitversion /usr/local/bin/gitversion + rm -f ${GITVERSION_TGZ} source ./install_package_fn.sh diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index 6d5d843bf..3d4895307 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -4,7 +4,7 @@ # Output goes into the OOLITE_VERSION.txt file and to stdout. # -GITVERSION=./gitversion +GITVERSION=/usr/local/bin/gitversion SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" > /dev/null @@ -26,7 +26,7 @@ if [[ -z "${SEMVER}" ]] || [[ -z "${PROJECTNAME}" ]] then # Variables not passed in. Calculate the classic way. - VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(./gitversion /showvariable UncommittedChanges)) + VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) VER_MAJ=$(${GITVERSION} /showvariable Major) VER_MIN=$(${GITVERSION} /showvariable Minor) VER_REV=$(${GITVERSION} /showvariable Patch) From c676e2a361fdde9ef3c6af93db08ca98b97c1a8e Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 07:57:49 +0200 Subject: [PATCH 03/55] differentiate OoliteProject vs other builders --- .github/workflows/build-all.yaml | 16 ++++++++-------- ShellScripts/common/get_version.sh | 2 +- installers/flatpak/create_flatpak.sh | 4 ++-- meson.build | 4 ++++ src/SDL/MyOpenGLView.m | 4 ++-- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 04bf2f95f..771b11905 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest outputs: SEMVER: ${{ steps.version_generator.outputs.SEMVER }} - PROJECTNAME: ${{ steps.version_generator.outputs.PROJECTNAME }} + BUILDER: ${{ steps.version_generator.outputs.BUILDER }} GitVersion_Major: ${{ steps.version_generator.outputs.GitVersion_Major }} GitVersion_Minor: ${{ steps.version_generator.outputs.GitVersion_Minor }} GitVersion_Patch: ${{ steps.version_generator.outputs.GitVersion_Patch }} @@ -32,9 +32,9 @@ jobs: - name: Check for Fork run: | if [ "${{ github.repository }}" == "OoliteProject/oolite" ]; then - echo "PROJECTNAME=oolite" >> $GITHUB_ENV + echo "BUILDER=OoliteProject" >> $GITHUB_ENV else - echo "PROJECTNAME=OoliteFork" >> $GITHUB_ENV + echo "BUILDER=unknown" >> $GITHUB_ENV fi - name: Determine Oolite Version @@ -53,7 +53,7 @@ jobs: echo "GitVersion_Minor=$GitVersion_Minor" >> "$GITHUB_OUTPUT" echo "GitVersion_Patch=$GitVersion_Patch" >> "$GITHUB_OUTPUT" echo "GitVersion_VersionSourceDistance=$GitVersion_VersionSourceDistance" >> "$GITHUB_OUTPUT" - echo "PROJECTNAME=$PROJECTNAME" >> "$GITHUB_OUTPUT" + echo "BUILDER=$BUILDER" >> "$GITHUB_OUTPUT" printenv | sort echo "head.repo.full_name = -${{github.event.pull_request.head.repo.full_name}}-" echo "base.repo.full_name = -${{github.event.pull_request.base.repo.full_name}}-" @@ -104,7 +104,7 @@ jobs: - name: Build Oolite env: SEMVER: ${{ needs.common.outputs.SEMVER }} - PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }} + BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer @@ -130,7 +130,7 @@ jobs: - name: Build flatpak env: SEMVER: ${{ needs.common.outputs.SEMVER }} - PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }} + BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/installers/flatpak/create_flatpak.sh - name: Archive installer @@ -186,7 +186,7 @@ jobs: VER_GITREV: ${{ needs.common.outputs.GitVersion_VersionSourceDistance }} SEMVER: ${{ needs.common.outputs.SEMVER }} VER_NSIS: ${{ needs.common.outputs.GitVersion_Major }}.${{ needs.common.outputs.GitVersion_Minor }}.${{ needs.common.outputs.GitVersion_Patch }}.${{ needs.common.outputs.GitVersion_VersionSourceDistance }} - PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }} + BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer @@ -221,7 +221,7 @@ jobs: id: version env: SEMVER: ${{ needs.common.outputs.SEMVER }} - PROJECTNAME: ${{ needs.common.outputs.PROJECTNAME }} + BUILDER: ${{ needs.common.outputs.BUILDER }} run: | set -x cd oolite diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index 3d4895307..1e2e2228c 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -22,7 +22,7 @@ APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d") # Convert to YYMMDD format (e.g., 260313) VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d") -if [[ -z "${SEMVER}" ]] || [[ -z "${PROJECTNAME}" ]] +if [[ -z "${SEMVER}" ]] || [[ -z "${BUILDER}" ]] then # Variables not passed in. Calculate the classic way. diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 94fed54d5..9b4647cd1 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -25,8 +25,8 @@ run_script() { local MANIFEST="space.oolite.Oolite.yaml" - if [ -n "${SEMVER}" ] && [ -n "${PROJECTNAME}" ]; then - ENV_BLOCK="env:\n SEMVER: \"$SEMVER\"\n PROJECTNAME: \"$PROJECTNAME\"\n VERSION: \"$SEMVER\"" + if [ -n "${SEMVER}" ] && [ -n "${BUILDER}" ]; then + ENV_BLOCK="env:\n SEMVER: \"$SEMVER\"\n BUILDER: \"$BUILDER\"\n VERSION: \"$SEMVER\"" # Swap the comment sed -i "s|#[[:space:]]*CI builds add an env block here|$ENV_BLOCK|g" "$MANIFEST" || return 1 fi diff --git a/meson.build b/meson.build index 6adcd604b..bcde0ff9a 100644 --- a/meson.build +++ b/meson.build @@ -23,6 +23,10 @@ add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), language: c_family, ) +add_project_arguments( + '-DOO_BUILDER="${BUILDER}"', + language: c_family, +) is_debug = (get_option('optimization') == '0' or get_option('debug')) if is_debug diff --git a/src/SDL/MyOpenGLView.m b/src/SDL/MyOpenGLView.m index c6cb2de0b..c83080457 100644 --- a/src/SDL/MyOpenGLView.m +++ b/src/SDL/MyOpenGLView.m @@ -145,9 +145,9 @@ - (NSMutableDictionary *) getNativeSize - (NSString*) getWindowCaption { #ifdef BUILD_DATE - NSString *caption = [NSString stringWithFormat:@"Oolite v%@ - %s", @OO_VERSION_FULL, BUILD_DATE]; + NSString *caption = [NSString stringWithFormat:@"Oolite v%@ by %@ - %s", @OO_VERSION_FULL, @OO_BUILDER, BUILD_DATE]; #else - NSString *caption = [NSString stringWithFormat:@"Oolite v%@ - %s", @OO_VERSION_FULL, __DATE__]; + NSString *caption = [NSString stringWithFormat:@"Oolite v%@ by %@ - %s", @OO_VERSION_FULL, @OO_BUILDER, __DATE__]; #endif return [[caption retain] autorelease]; } From 464fb7a968e6bc45a30066938a4c13c1b647c0ce Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 21:27:52 +0200 Subject: [PATCH 04/55] allow variables to be expanded --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index bcde0ff9a..2f3845d6f 100644 --- a/meson.build +++ b/meson.build @@ -24,7 +24,7 @@ add_project_arguments( language: c_family, ) add_project_arguments( - '-DOO_BUILDER="${BUILDER}"', + "-DOO_BUILDER='${BUILDER}'", language: c_family, ) From e59a0ffcd106c9a720ffe64cf990cb6ae30cd3dc Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 21:54:46 +0200 Subject: [PATCH 05/55] allow variables to be expanded --- meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2f3845d6f..4334ba0ac 100644 --- a/meson.build +++ b/meson.build @@ -23,8 +23,9 @@ add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), language: c_family, ) +builder = 'unknown' add_project_arguments( - "-DOO_BUILDER='${BUILDER}'", + '-DOO_BUILDER="@0@"'.format(builder), language: c_family, ) From b26c7e07d48227a9c8aa49a7d01baba3f2ceb3ba Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 22:18:56 +0200 Subject: [PATCH 06/55] allow variables to be expanded --- src/Core/OOLogHeader.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Core/OOLogHeader.m b/src/Core/OOLogHeader.m index bd3a0a162..c2522d6b0 100644 --- a/src/Core/OOLogHeader.m +++ b/src/Core/OOLogHeader.m @@ -168,7 +168,7 @@ void OOPrintLogHeader(void) #endif if (versionString == nil) versionString = @""; - NSMutableString *miscString = [NSMutableString stringWithFormat:@"Opening log for Oolite %@ (" CPU_TYPE_STRING RELEASE_VARIANT_STRING ") under %@ at %@.\n", versionString, systemString, [NSDate date]]; + NSMutableString *miscString = [NSMutableString stringWithFormat:@"Opening log for Oolite %@ by %@ (" CPU_TYPE_STRING RELEASE_VARIANT_STRING ") under %@ at %@.\n", versionString, @OO_BUILDER, systemString, [NSDate date]]; [miscString appendString:AdditionalLogHeaderInfo()]; From 81585126583ca0a89cd9d46bede62207539d38e1 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 22:22:55 +0200 Subject: [PATCH 07/55] allow variables to be expanded --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4334ba0ac..b0c4ef8bb 100644 --- a/meson.build +++ b/meson.build @@ -1,3 +1,5 @@ +os_mod = import('os') + project( 'oolite', ['c', 'cpp', 'objc'], @@ -23,7 +25,7 @@ add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), language: c_family, ) -builder = 'unknown' +builder = os_mod.get_env('BUILDER', default: 'unknown') add_project_arguments( '-DOO_BUILDER="@0@"'.format(builder), language: c_family, From d8688a7ab80c34f8502aaaebc5cb0d84aa055e9b Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 22:41:21 +0200 Subject: [PATCH 08/55] allow variables to be expanded --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index b0c4ef8bb..09b3c42da 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,3 @@ -os_mod = import('os') - project( 'oolite', ['c', 'cpp', 'objc'], @@ -17,6 +15,8 @@ project( ], ) +os_mod = import('os') + host_os = host_machine.system() c_family = ['c', 'cpp', 'objc'] From 5db644988e31da050c9758197fdc316f4ad44bb8 Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 22:54:05 +0200 Subject: [PATCH 09/55] allow variables to be expanded --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 09b3c42da..763f43111 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,7 @@ add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), language: c_family, ) -builder = os_mod.get_env('BUILDER', default: 'unknown') +builder = run_command('bash','-c','echo ${BUILDER:-unknown}') add_project_arguments( '-DOO_BUILDER="@0@"'.format(builder), language: c_family, From 30aa74b570f9f46757b7e05b8c1fcf2e4121aa4e Mon Sep 17 00:00:00 2001 From: cube Date: Tue, 16 Jun 2026 22:58:56 +0200 Subject: [PATCH 10/55] allow variables to be expanded --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index 763f43111..493e50efc 100644 --- a/meson.build +++ b/meson.build @@ -15,8 +15,6 @@ project( ], ) -os_mod = import('os') - host_os = host_machine.system() c_family = ['c', 'cpp', 'objc'] From cc383fde64fceff14324dacdd1cee917d5ff0764 Mon Sep 17 00:00:00 2001 From: oocube Date: Wed, 17 Jun 2026 07:37:22 +0200 Subject: [PATCH 11/55] allow variables to be expanded --- meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 493e50efc..992c4b198 100644 --- a/meson.build +++ b/meson.build @@ -23,7 +23,9 @@ add_project_arguments( '-DOO_VERSION_FULL="@0@"'.format(version_string), language: c_family, ) -builder = run_command('bash','-c','echo ${BUILDER:-unknown}') + +env_mod = import('env') +builder = env_mod.get('BUILDER', 'unknown') add_project_arguments( '-DOO_BUILDER="@0@"'.format(builder), language: c_family, From 3ff757f277231afa0b421fba3ad69abe9d695465 Mon Sep 17 00:00:00 2001 From: oocube Date: Wed, 17 Jun 2026 20:27:57 +0200 Subject: [PATCH 12/55] use meson build option --- Makefile | 6 +++--- meson.build | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 54c74d32b..bbdedaaee 100755 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ help: ## Show this help message # Macro for Meson workflow define meson_build meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) - meson compile -C build/meson_$(2) - meson install -C build/meson_$(2) + meson compile -C build/meson_$(2) -Dbuilder=${BUILDER} + meson install -C build/meson_$(2) -Dbuilder=${BUILDER} endef # Helper macro for syncing OXP files cleanly @@ -94,4 +94,4 @@ pkg-win-deployment: release-deployment ## Package a Windows NSIS deployment inst .PHONY: pkg-win-snapshot pkg-win-snapshot: release-snapshot ## Package a Windows NSIS snapshot installer - installers/win32/create_nsis.sh meson_snapshot/oolite.app "dev" \ No newline at end of file + installers/win32/create_nsis.sh meson_snapshot/oolite.app "dev" diff --git a/meson.build b/meson.build index 992c4b198..ccf598ceb 100644 --- a/meson.build +++ b/meson.build @@ -14,6 +14,7 @@ project( 'optimization=2', ], ) +option('builder', type: 'string', value: 'unknown', description: 'The one who compiles the code and builds the package') host_os = host_machine.system() c_family = ['c', 'cpp', 'objc'] @@ -24,8 +25,7 @@ add_project_arguments( language: c_family, ) -env_mod = import('env') -builder = env_mod.get('BUILDER', 'unknown') +builder = get_option('builder') add_project_arguments( '-DOO_BUILDER="@0@"'.format(builder), language: c_family, From a136002521024466716859712cb760b1d2ca9960 Mon Sep 17 00:00:00 2001 From: oocube Date: Wed, 17 Jun 2026 20:40:09 +0200 Subject: [PATCH 13/55] use meson build option --- meson.build | 1 - meson.options | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index ccf598ceb..41f278357 100644 --- a/meson.build +++ b/meson.build @@ -14,7 +14,6 @@ project( 'optimization=2', ], ) -option('builder', type: 'string', value: 'unknown', description: 'The one who compiles the code and builds the package') host_os = host_machine.system() c_family = ['c', 'cpp', 'objc'] diff --git a/meson.options b/meson.options index fe9e654bc..0bbd6ac26 100644 --- a/meson.options +++ b/meson.options @@ -2,6 +2,10 @@ # Oolite Build Options # ============================================================================== +# Oolite Packaging options +option('builder', type: 'string', value: 'unknown', + description: 'The one who compiles the code and builds the package') + # Core Engine Features option('no_shaders', type: 'boolean', value: false, description: 'Disable shader support entirely') @@ -42,4 +46,4 @@ option('strip_bin', type: 'boolean', value: false, description: 'Enable strippin # Windows Specific Customizations option('pdb', type: 'boolean', value: false, - description: 'Windows Clang builds only: Generate native .pdb debug symbol files') \ No newline at end of file + description: 'Windows Clang builds only: Generate native .pdb debug symbol files') From ce69cb918e7feb2529b6c8141c6e5d9f6c28045c Mon Sep 17 00:00:00 2001 From: oocube Date: Wed, 17 Jun 2026 20:57:45 +0200 Subject: [PATCH 14/55] use meson build option --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bbdedaaee..d94796118 100755 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ help: ## Show this help message # Macro for Meson workflow define meson_build - meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) + meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) -Dbuilder=${BUILDER} meson compile -C build/meson_$(2) -Dbuilder=${BUILDER} meson install -C build/meson_$(2) -Dbuilder=${BUILDER} endef From 868470fb04f5a9f27dbc6838cfcc9f2f52f56c6b Mon Sep 17 00:00:00 2001 From: oocube Date: Wed, 17 Jun 2026 21:32:38 +0200 Subject: [PATCH 15/55] use meson build option --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d94796118..4963dc230 100755 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ help: ## Show this help message # Macro for Meson workflow define meson_build meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) -Dbuilder=${BUILDER} - meson compile -C build/meson_$(2) -Dbuilder=${BUILDER} - meson install -C build/meson_$(2) -Dbuilder=${BUILDER} + meson compile -C build/meson_$(2) + meson install -C build/meson_$(2) endef # Helper macro for syncing OXP files cleanly From 424c2ed2209a758a9ab33208f627d7a08de4528b Mon Sep 17 00:00:00 2001 From: oocube Date: Thu, 18 Jun 2026 07:14:58 +0200 Subject: [PATCH 16/55] use meson build option --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4963dc230..72c7fa520 100755 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ help: ## Show this help message # Macro for Meson workflow define meson_build - meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) -Dbuilder=${BUILDER} + meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure -Dbuilder=${BUILDER} 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) -Dbuilder=${BUILDER} meson compile -C build/meson_$(2) meson install -C build/meson_$(2) endef From a8b5d6c7d5fcaecab617302e32bd6398acad65b5 Mon Sep 17 00:00:00 2001 From: oocube Date: Thu, 18 Jun 2026 07:22:05 +0200 Subject: [PATCH 17/55] use meson build option --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 72c7fa520..da3a00404 100755 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ SHELL := /bin/bash .SHELLFLAGS := -eu -o pipefail -c NATIVE_FILE ?= clang.ini +BUILDER ?= unknown # Modern, self-documenting help target. # It parses the '##' comments next to targets automatically. From 056fc3fe3959558400f0164b66f9b2b565b0a2e6 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 16:57:30 +1200 Subject: [PATCH 18/55] Make function for github download and use it --- Makefile | 2 +- ShellScripts/Linux/download_github.sh | 109 -------------------- ShellScripts/Linux/download_github_fn.sh | 52 ++++++++++ ShellScripts/Linux/install_packages_root.sh | 14 ++- 4 files changed, 62 insertions(+), 115 deletions(-) delete mode 100755 ShellScripts/Linux/download_github.sh create mode 100755 ShellScripts/Linux/download_github_fn.sh diff --git a/Makefile b/Makefile index da3a00404..78d4df0ce 100755 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ help: ## Show this help message # Macro for Meson workflow define meson_build - meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) --reconfigure -Dbuilder=${BUILDER} 2>/dev/null || meson setup build/meson_$(2) $(1) --native-file $(NATIVE_FILE) -Dbuilder=${BUILDER} + meson setup build/meson_$(2) $(1) -Dbuilder=${BUILDER} --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) -Dbuilder=${BUILDER} --native-file $(NATIVE_FILE) meson compile -C build/meson_$(2) meson install -C build/meson_$(2) endef diff --git a/ShellScripts/Linux/download_github.sh b/ShellScripts/Linux/download_github.sh deleted file mode 100755 index 4934b3d01..000000000 --- a/ShellScripts/Linux/download_github.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -# -# This script downloads the latest release of a project on github. -# The name of the downloaded file is emitted on stdout. -# -# Run with these parameters: -# -o, --owner The project owner -# -r, --repository The repository name -# -f, --filter Additional filter to select from provided artifacts -# -O, --outputdir Destination directory for download -# - -# Exit immediately if a command exits with a non-zero status -set -e - -# Default value -OUTPUTDIR=. - -# parse command line -POSITIONAL_ARGS=() -while [[ $# -gt 0 ]]; do - case $1 in - -o|--owner) - OWNER="$2" - shift # past argument - shift # past value - ;; - -r|--repository) - REPOSITORY="$2" - shift # past argument - shift # past value - ;; - -f|--filter) - FILTER="$2" - shift # past argument - shift # past value - ;; - -O|--outputdir) - OUTPUTDIR="$2" - shift # past argument - shift # past value - ;; - -*|--*) - echo "Unknown option $1" - exit 1 - ;; - *) - POSITIONAL_ARGS+=("$1") # save positional arg - shift # past argument - ;; - esac -done - -if [ "" == "${OWNER}" ] -then - echo ERROR: OWNER not set. Use --owner - exit 1 -fi -if [ "" == "${REPOSITORY}" ] -then - echo ERROR: REPOSITORY not set. Use --repository - exit 1 -fi - -# --- CONFIGURATION --- -# Replace with the target repository (Format: owner/repo) -REPO="${OWNER}/${REPOSITORY}" - -echo "Fetching latest release info for ${REPO}..." >&2 -API_URL="https://api.github.com/repos/${REPO}/releases/latest" -RELEASE_JSON=$(curl -s "${API_URL}") - -# Check if the repository was found/has releases -if echo "${RELEASE_JSON}" | grep -q "Not Found"; then - echo "Error: Repository not found or has no public releases at ${API_URL}" - exit 1 -fi - -# Extract the download URL -# If 'jq' is installed, we use it (cleaner). Otherwise, we fallback to 'grep/sed'. -if command -v jq &> /dev/null; then - if [ -n "${FILTER}" ]; then - DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | jq -r ".assets[] | select(.name | contains(\"${FILTER}\")) | .browser_download_url" | head -n 1) - else - DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | jq -r '.assets[0].browser_download_url') - fi -else - # Fallback using grep/sed if jq isn't available - if [ -n "${FILTER}" ]; then - DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | grep "browser_download_url" | grep "${FILTER}" | head -n 1 | cut -d '"' -f 4) - else - DOWNLOAD_URL=$(echo "${RELEASE_JSON}" | grep "browser_download_url" | head -n 1 | cut -d '"' -f 4) - fi -fi - -# Check if a URL was actually found -if [ -z "${DOWNLOAD_URL}" ] || [ "${DOWNLOAD_URL}" == "null" ]; then - echo "Error: Could not find a matching download URL." - exit 1 -fi - -# Extract filename from the URL -FILENAME=$(basename "${DOWNLOAD_URL}") - -echo "Downloading latest release: ${FILENAME}..." >&2 -curl -L -O --output-dir "${OUTPUTDIR}" "${DOWNLOAD_URL}" - -echo "Download finished" >&2 -echo "${OUTPUTDIR}/${FILENAME}" diff --git a/ShellScripts/Linux/download_github_fn.sh b/ShellScripts/Linux/download_github_fn.sh new file mode 100755 index 000000000..a6c6295a3 --- /dev/null +++ b/ShellScripts/Linux/download_github_fn.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +download_latest_release() { + local -n downloaded_file="$1" + local owner="$2" + local repository="$3" + local filter="$4" + local outputdir="${5:-.}" # Default to current directory if not provided + + local repo="${owner}/${repository}" + local api_url="https://api.github.com/repos/${repo}/releases/latest" + + echo "Fetching latest release info for ${repo}..." >&2 + local release_json=$(curl -s "${api_url}") + + # Check if the repository was found/has releases + if echo "${release_json}" | grep -q "Not Found"; then + echo "❌ Error: Repository not found or has no public releases at ${api_url}" >&2 + return 1 + fi + + # Extract the download URL + local download_url + if command -v jq &> /dev/null; then + if [[ -n "${filter}" ]]; then + download_url=$(echo "${release_json}" | jq -r ".assets[] | select(.name | contains(\"${filter}\")) | .browser_download_url" | head -n 1) + else + download_url=$(echo "${release_json}" | jq -r '.assets[0].browser_download_url') + fi + else + # Fallback using grep/sed if jq isn't available + if [[ -n "${filter}" ]]; then + download_url=$(echo "${release_json}" | grep "browser_download_url" | grep "${filter}" | head -n 1 | cut -d '"' -f 4) + else + download_url=$(echo "${release_json}" | grep "browser_download_url" | head -n 1 | cut -d '"' -f 4) + fi + fi + + # Check if a URL was actually found + if [[ -z "${download_url}" || "${download_url}" == "null" ]]; then + echo "Error: Could not find a matching download URL." >&2 + return 1 + fi + + # Extract filename from the URL + local filename=$(basename "${download_url}") + + echo "Downloading latest release: ${filename}..." >&2 + curl -L -O --output-dir "${outputdir}" "${download_url}" + + downloaded_file="${outputdir}/${filename}" +} \ No newline at end of file diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 9a406bcd2..fd8e5098a 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -15,12 +15,16 @@ run_script() { local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" + source download_github_fn.sh + # install gitversion - GITVERSION_TGZ=$(./download_github.sh --owner GitTools --repository GitVersion --filter linux-x --outputdir ${SCRIPT_DIR}) - tar xfz ${GITVERSION_TGZ} --directory ${SCRIPT_DIR} - chmod +xr ${SCRIPT_DIR}/gitversion - mv ${SCRIPT_DIR}/gitversion /usr/local/bin/gitversion - rm -f ${GITVERSION_TGZ} + local outputdir="../../build" + download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" + + tar xfz ${gitversion_tgz} --directory "$outputdir" + chmod +xr "$outputdir/gitversion" + mv "$outputdir/gitversion" /usr/local/bin/gitversion + rm -f ${gitversion_tgz} source ./install_package_fn.sh From 92727c0e2d329a833aa23e763665b3a27e235df3 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 17:03:56 +1200 Subject: [PATCH 19/55] Build folder probably not created yet --- ShellScripts/Linux/install_packages_root.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index fd8e5098a..2e3e47c08 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -19,6 +19,8 @@ run_script() { # install gitversion local outputdir="../../build" + mkdir -p "$outputdir" + download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" From fcc9fcd7260926cf5ba4b8da9c0ec3d1227546d6 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 17:33:23 +1200 Subject: [PATCH 20/55] Add function to get git remote and update mkmanifest.sh to a function --- ShellScripts/Linux/install_packages_root.sh | 2 - ShellScripts/common/generate_manifest_fn.sh | 47 +++++++++++++++++++++ ShellScripts/common/get_gitremote_fn.sh | 32 ++++++++++++++ ShellScripts/common/mkmanifest.sh | 34 --------------- ShellScripts/common/post_build.sh | 3 +- 5 files changed, 81 insertions(+), 37 deletions(-) create mode 100755 ShellScripts/common/generate_manifest_fn.sh create mode 100644 ShellScripts/common/get_gitremote_fn.sh delete mode 100755 ShellScripts/common/mkmanifest.sh diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 2e3e47c08..07e2980aa 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -20,9 +20,7 @@ run_script() { # install gitversion local outputdir="../../build" mkdir -p "$outputdir" - download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" - tar xfz ${gitversion_tgz} --directory "$outputdir" chmod +xr "$outputdir/gitversion" mv "$outputdir/gitversion" /usr/local/bin/gitversion diff --git a/ShellScripts/common/generate_manifest_fn.sh b/ShellScripts/common/generate_manifest_fn.sh new file mode 100755 index 000000000..c741324bd --- /dev/null +++ b/ShellScripts/common/generate_manifest_fn.sh @@ -0,0 +1,47 @@ +generate_manifest() { + local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + pushd "$script_dir" > /dev/null + + local manifest_output="$1" + + # Locate the xcconfig file + local oolite_version_file="../../src/Cocoa/oolite-version.xcconfig" + + if [[ ! -f "$oolite_version_file" ]]; then + echo "Error: $oolite_version_file not found." >&2 + popd > /dev/null + return 1 + fi + + # Extract definition of $OOLITE_VERSION from the xcconfig + source "$oolite_version_file" + + source get_gitremote_fn.sh git_remote + + # Redirect the entire block output into the manifest_output file + { + echo "{" + echo " title = \"Oolite core\";" + echo " identifier = \"org.oolite.oolite\";" + echo " " + echo " version = \"$VER_FULL\";" + echo " git_remote_url = \"$git_remote\";" + echo " git_commit_hash = \"$(git rev-parse HEAD)\";" + + if [[ "$DEPLOYMENT_RELEASE_CONFIGURATION" == "yes" ]]; then + echo " debug_functionality_support = no;" + else + echo " debug_functionality_support = yes;" + fi + + echo " required_oolite_version = \"$OOLITE_VERSION\";" + echo " " + echo " license = \"GPL 2+ / CC-BY-NC-SA 3.0 - see LICENSE.md for details\";" + echo " author = \"Giles Williams, Jens Ayton and contributors\";" + echo " information_url = \"https://oolite.space/\";" + echo "}" + } > "$manifest_output" + + # Restore the original directory + popd > /dev/null +} \ No newline at end of file diff --git a/ShellScripts/common/get_gitremote_fn.sh b/ShellScripts/common/get_gitremote_fn.sh new file mode 100644 index 000000000..932a7d8b5 --- /dev/null +++ b/ShellScripts/common/get_gitremote_fn.sh @@ -0,0 +1,32 @@ +get_gitremote() { + # Accept a variable name as the first argument to use as a nameref return + local -n final_url=$1 + + local raw_url resolved_git_dir upstream_url + + # 1. Get the immediate remote URL + raw_url=$(git config --get remote.origin.url) + + # 2. Check if the URL is actually a local directory path + if [[ -d "$raw_url" ]]; then + # Dynamically find the correct git directory without subshells + if [[ -d "$raw_url/.git" ]]; then + resolved_git_dir="$raw_url/.git" + else + resolved_git_dir="$raw_url" + fi + + # Query the resolved git directory for the original remote + upstream_url=$(git --git-dir="$resolved_git_dir" config --get remote.origin.url 2>/dev/null) + + # If we successfully found an upstream URL, use it. + if [[ -n "$upstream_url" ]]; then + final_url="$upstream_url" + else + final_url="UNKNOWN" + fi + else + # It's already a standard web URL (GitHub, GitLab, etc.) + final_url="$raw_url" + fi +} \ No newline at end of file diff --git a/ShellScripts/common/mkmanifest.sh b/ShellScripts/common/mkmanifest.sh deleted file mode 100755 index f40d22970..000000000 --- a/ShellScripts/common/mkmanifest.sh +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh - -OOLITE_VERSION_FILE="src/Cocoa/oolite-version.xcconfig" - - -if [ $# -ge 1 ]; then - cd $1 - if [ $? ]; then - exit $? - fi -fi - - -# Extract definition of $OOLITE_VERSION from the xcconfig -. $OOLITE_VERSION_FILE - -echo "{" -echo " title = \"Oolite core\";" -echo " identifier = \"org.oolite.oolite\";" -echo " " -echo " version = \"$VER_FULL\";" -echo " git_remote_url = \"$(git config --get remote.origin.url)\";" -echo " git_commit_hash = \"$(git rev-parse HEAD)\";" -if [ "$DEPLOYMENT_RELEASE_CONFIGURATION" = "yes" ]; then - echo " debug_functionality_support = no;" -else - echo " debug_functionality_support = yes;" -fi -echo " required_oolite_version = \"$OOLITE_VERSION\";" -echo " " -echo " license = \"GPL 2+ / CC-BY-NC-SA 3.0 - see LICENSE.md for details\";" -echo " author = \"Giles Williams, Jens Ayton and contributors\";" -echo " information_url = \"https://oolite.space/\";" -echo "}" diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 1e14bc510..785540ca9 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -11,7 +11,8 @@ run_script() { PROGDIR="$(dirname "$PROGPATH")" mkdir -p "$PROGDIR/Resources" - ShellScripts/common/mkmanifest.sh > "$PROGDIR/Resources/manifest.plist" + source "generate_manifest_fn.sh" + generate_manifest "$PROGDIR/Resources/manifest.plist" cp -fu src/Cocoa/Info-Oolite.plist "$PROGDIR/Resources/Info-gnustep.plist" From 4738e6f23951cd2602d88e4e068c5656090cf88e Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 18:06:53 +1200 Subject: [PATCH 21/55] Fix manifest generation --- ShellScripts/common/generate_manifest_fn.sh | 15 ++++----------- ShellScripts/common/post_build.sh | 2 +- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ShellScripts/common/generate_manifest_fn.sh b/ShellScripts/common/generate_manifest_fn.sh index c741324bd..528267c4e 100755 --- a/ShellScripts/common/generate_manifest_fn.sh +++ b/ShellScripts/common/generate_manifest_fn.sh @@ -1,11 +1,6 @@ generate_manifest() { - local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) - pushd "$script_dir" > /dev/null - - local manifest_output="$1" - # Locate the xcconfig file - local oolite_version_file="../../src/Cocoa/oolite-version.xcconfig" + local oolite_version_file="src/Cocoa/oolite-version.xcconfig" if [[ ! -f "$oolite_version_file" ]]; then echo "Error: $oolite_version_file not found." >&2 @@ -16,7 +11,8 @@ generate_manifest() { # Extract definition of $OOLITE_VERSION from the xcconfig source "$oolite_version_file" - source get_gitremote_fn.sh git_remote + source ShellScripts/common/get_gitremote_fn.sh + get_gitremote git_remote # Redirect the entire block output into the manifest_output file { @@ -40,8 +36,5 @@ generate_manifest() { echo " author = \"Giles Williams, Jens Ayton and contributors\";" echo " information_url = \"https://oolite.space/\";" echo "}" - } > "$manifest_output" - - # Restore the original directory - popd > /dev/null + } > "$1" } \ No newline at end of file diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 785540ca9..60ee40f2e 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -5,13 +5,13 @@ run_script() { local SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" > /dev/null + source "generate_manifest_fn.sh" cd ../.. set -x PROGDIR="$(dirname "$PROGPATH")" mkdir -p "$PROGDIR/Resources" - source "generate_manifest_fn.sh" generate_manifest "$PROGDIR/Resources/manifest.plist" cp -fu src/Cocoa/Info-Oolite.plist "$PROGDIR/Resources/Info-gnustep.plist" From b24dc3129c2aa2913b26e3d743c5a36ffa8e80e6 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 18:07:17 +1200 Subject: [PATCH 22/55] Fix cleaning in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 78d4df0ce..96e43455f 100755 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ test: release-snapshot ## Run test suite .PHONY: clean clean: ## Remove all generated build artifacts - $(RM) -rf build/meson_* + rm -rf build/meson_* .PHONY: all all: release release-deployment release-snapshot debug ## Build all standard development targets From a00b88ca2ee51c1b2e31faa910c5999466529aca Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 18:09:00 +1200 Subject: [PATCH 23/55] Hopefully this will do it --- .github/workflows/build-all.yaml | 52 ------------------------------ ShellScripts/common/get_version.sh | 36 +++++++++++---------- 2 files changed, 19 insertions(+), 69 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 771b11905..5552e5135 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -9,57 +9,7 @@ concurrency: cancel-in-progress: true jobs: - common: - runs-on: ubuntu-latest - outputs: - SEMVER: ${{ steps.version_generator.outputs.SEMVER }} - BUILDER: ${{ steps.version_generator.outputs.BUILDER }} - GitVersion_Major: ${{ steps.version_generator.outputs.GitVersion_Major }} - GitVersion_Minor: ${{ steps.version_generator.outputs.GitVersion_Minor }} - GitVersion_Patch: ${{ steps.version_generator.outputs.GitVersion_Patch }} - GitVersion_VersionSourceDistance: ${{ steps.version_generator.outputs.GitVersion_VersionSourceDistance }} - steps: - - name: Checkout project - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v4 - with: - versionSpec: '6' - - - name: Check for Fork - run: | - if [ "${{ github.repository }}" == "OoliteProject/oolite" ]; then - echo "BUILDER=OoliteProject" >> $GITHUB_ENV - else - echo "BUILDER=unknown" >> $GITHUB_ENV - fi - - - name: Determine Oolite Version - id: version_step - uses: gittools/actions/gitversion/execute@v4 - with: - overrideConfig: | - semantic-version-format=Loose - next-version=1.93.1 - - - name: Print and register result - id: version_generator - run: | - echo "SEMVER=$GitVersion_SemVer" >> "$GITHUB_OUTPUT" - echo "GitVersion_Major=$GitVersion_Major" >> "$GITHUB_OUTPUT" - echo "GitVersion_Minor=$GitVersion_Minor" >> "$GITHUB_OUTPUT" - echo "GitVersion_Patch=$GitVersion_Patch" >> "$GITHUB_OUTPUT" - echo "GitVersion_VersionSourceDistance=$GitVersion_VersionSourceDistance" >> "$GITHUB_OUTPUT" - echo "BUILDER=$BUILDER" >> "$GITHUB_OUTPUT" - printenv | sort - echo "head.repo.full_name = -${{github.event.pull_request.head.repo.full_name}}-" - echo "base.repo.full_name = -${{github.event.pull_request.base.repo.full_name}}-" - build-linux: - needs: [common] runs-on: ubuntu-latest container: image: archlinux:latest @@ -116,7 +66,6 @@ jobs: retention-days: 5 build-flatpak: - needs: [common] runs-on: ubuntu-latest container: image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08 @@ -142,7 +91,6 @@ jobs: retention-days: 5 build-windows: - needs: [common] runs-on: windows-latest strategy: matrix: diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index 1e2e2228c..fbf96b2e6 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -22,28 +22,30 @@ APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d") # Convert to YYMMDD format (e.g., 260313) VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d") -if [[ -z "${SEMVER}" ]] || [[ -z "${BUILDER}" ]] -then - # Variables not passed in. Calculate the classic way. - - VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) - VER_MAJ=$(${GITVERSION} /showvariable Major) - VER_MIN=$(${GITVERSION} /showvariable Minor) - VER_REV=$(${GITVERSION} /showvariable Patch) - if [[ "" == "$VER_REV" ]]; then - VER_REV="0" +# Check if the GITHUB_REPOSITORY environment variable is set and not empty +if [[ -n "$GITHUB_REPOSITORY" ]]; then + if [[ "$GITHUB_REPOSITORY" == "OoliteProject/oolite" ]]; then + BUILDER="OoliteProject" + else + BUILDER="unknown" fi - - VER_GITREV=$(git rev-list --count HEAD) - VER_GITHASH=$(git rev-parse --short=7 HEAD) - VER_FULL="${VERSION}" - BUILDTIME=$(date "+%Y.%m.%d %H:%M") else - # Variables passed in. Make use of them. + BUILDER="unknown" +fi - VER_FULL="${SEMVER}" +VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) +VER_MAJ=$(${GITVERSION} /showvariable Major) +VER_MIN=$(${GITVERSION} /showvariable Minor) +VER_REV=$(${GITVERSION} /showvariable Patch) +if [[ "" == "$VER_REV" ]]; then + VER_REV="0" fi +VER_GITREV=$(git rev-list --count HEAD) +VER_GITHASH=$(git rev-parse --short=7 HEAD) +VER_FULL="${VERSION}" +BUILDTIME=$(date "+%Y.%m.%d %H:%M") + echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt echo "$VER_FULL" From a2e4f309dc2958a52aef637b8dcdc38d683177ef Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 18:12:31 +1200 Subject: [PATCH 24/55] Missed usages of common --- .github/workflows/build-all.yaml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 5552e5135..dba599325 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -52,9 +52,6 @@ jobs: echo "/usr/local/lib" | tee -a /etc/ld.so.conf ldconfig - name: Build Oolite - env: - SEMVER: ${{ needs.common.outputs.SEMVER }} - BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer @@ -77,9 +74,6 @@ jobs: path: oolite fetch-depth: 0 - name: Build flatpak - env: - SEMVER: ${{ needs.common.outputs.SEMVER }} - BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/installers/flatpak/create_flatpak.sh - name: Archive installer @@ -128,13 +122,6 @@ jobs: shell: msys2 {0} env: msystem: UCRT64 - VER_MAJ: ${{ needs.common.outputs.GitVersion_Major }} - VER_MIN: ${{ needs.common.outputs.GitVersion_Minor }} - VER_REV: ${{ needs.common.outputs.GitVersion_Patch }} - VER_GITREV: ${{ needs.common.outputs.GitVersion_VersionSourceDistance }} - SEMVER: ${{ needs.common.outputs.SEMVER }} - VER_NSIS: ${{ needs.common.outputs.GitVersion_Major }}.${{ needs.common.outputs.GitVersion_Minor }}.${{ needs.common.outputs.GitVersion_Patch }}.${{ needs.common.outputs.GitVersion_VersionSourceDistance }} - BUILDER: ${{ needs.common.outputs.BUILDER }} run: | oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer @@ -146,7 +133,7 @@ jobs: retention-days: 5 release: - needs: [build-linux, build-flatpak, build-windows, common] + needs: [build-linux, build-flatpak, build-windows] runs-on: ubuntu-22.04 # Only run for internal requests (so not for PRs from forks) if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name @@ -167,9 +154,6 @@ jobs: fetch-depth: 0 - name: Calculate version number and set OOLITE_VERSION id: version - env: - SEMVER: ${{ needs.common.outputs.SEMVER }} - BUILDER: ${{ needs.common.outputs.BUILDER }} run: | set -x cd oolite From f1f4a96861c5411ba5ef980f98e9acc1c5b3a9c6 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 19:15:44 +1200 Subject: [PATCH 25/55] Correct way is pass github_repository as meson option --- Makefile | 2 +- ShellScripts/common/get_version.sh | 11 ----------- meson.build | 7 ++++++- meson.options | 10 ++++++---- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 96e43455f..40ccb5606 100755 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ help: ## Show this help message # Macro for Meson workflow define meson_build - meson setup build/meson_$(2) $(1) -Dbuilder=${BUILDER} --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) -Dbuilder=${BUILDER} --native-file $(NATIVE_FILE) + meson setup build/meson_$(2) $(1) -Dgithub_repository=${GITHUB_REPOSITORY} --native-file $(NATIVE_FILE) --reconfigure 2>/dev/null || meson setup build/meson_$(2) $(1) -Dgithub_repository=${GITHUB_REPOSITORY} --native-file $(NATIVE_FILE) meson compile -C build/meson_$(2) meson install -C build/meson_$(2) endef diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index fbf96b2e6..e973ebfdf 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -22,17 +22,6 @@ APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d") # Convert to YYMMDD format (e.g., 260313) VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d") -# Check if the GITHUB_REPOSITORY environment variable is set and not empty -if [[ -n "$GITHUB_REPOSITORY" ]]; then - if [[ "$GITHUB_REPOSITORY" == "OoliteProject/oolite" ]]; then - BUILDER="OoliteProject" - else - BUILDER="unknown" - fi -else - BUILDER="unknown" -fi - VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) VER_MAJ=$(${GITVERSION} /showvariable Major) VER_MIN=$(${GITVERSION} /showvariable Minor) diff --git a/meson.build b/meson.build index 41f278357..59715a8c6 100644 --- a/meson.build +++ b/meson.build @@ -24,7 +24,12 @@ add_project_arguments( language: c_family, ) -builder = get_option('builder') +github_repository = get_option('github_repository') +if github_repository == 'OoliteProject/oolite' + builder = 'OoliteProject' +else + builder = 'unknown' +endif add_project_arguments( '-DOO_BUILDER="@0@"'.format(builder), language: c_family, diff --git a/meson.options b/meson.options index 0bbd6ac26..7ff139544 100644 --- a/meson.options +++ b/meson.options @@ -2,10 +2,6 @@ # Oolite Build Options # ============================================================================== -# Oolite Packaging options -option('builder', type: 'string', value: 'unknown', - description: 'The one who compiles the code and builds the package') - # Core Engine Features option('no_shaders', type: 'boolean', value: false, description: 'Disable shader support entirely') @@ -47,3 +43,9 @@ option('strip_bin', type: 'boolean', value: false, description: 'Enable strippin # Windows Specific Customizations option('pdb', type: 'boolean', value: false, description: 'Windows Clang builds only: Generate native .pdb debug symbol files') + +# GitHub repository variable from CI if available +option('github_repository', type: 'string', value: '', + description: 'GitHub repository variable from CI if available') + + From dd7a6c2a74b1402a11371b0de4659b726d75a753 Mon Sep 17 00:00:00 2001 From: mcarans Date: Sat, 20 Jun 2026 19:30:49 +1200 Subject: [PATCH 26/55] try to fix NSIS version --- ShellScripts/common/get_version.sh | 6 +++--- installers/win32/create_nsis.sh | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index e973ebfdf..4145a8042 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -22,17 +22,17 @@ APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d") # Convert to YYMMDD format (e.g., 260313) VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d") -VERSION=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) +VER_FULL=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) VER_MAJ=$(${GITVERSION} /showvariable Major) VER_MIN=$(${GITVERSION} /showvariable Minor) VER_REV=$(${GITVERSION} /showvariable Patch) +VER_DIST=$(${GITVERSION} /showvariable VersionSourceDistance) if [[ "" == "$VER_REV" ]]; then VER_REV="0" fi - +VER_NSIS="$VER_MAJ.$VER_MIN.$VER_REV.$VER_DIST" VER_GITREV=$(git rev-list --count HEAD) VER_GITHASH=$(git rev-parse --short=7 HEAD) -VER_FULL="${VERSION}" BUILDTIME=$(date "+%Y.%m.%d %H:%M") echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt diff --git a/installers/win32/create_nsis.sh b/installers/win32/create_nsis.sh index 01b700879..d8f802543 100644 --- a/installers/win32/create_nsis.sh +++ b/installers/win32/create_nsis.sh @@ -42,11 +42,6 @@ run_script() { return 1 fi - if [[ -z "${VER_NSIS}" ]] - then - export VER_NSIS=$VER_FULL; - fi - local OOLITE_DIR="../$1" OOLITE_DIR="${OOLITE_DIR//\//\\}" # Passing arguments cause problems with some versions of NSIS. @@ -60,7 +55,7 @@ run_script() { echo "!define VER_GITREV ${VER_GITREV}" >> OoliteVersions.nsh echo "!define VER_GITHASH ${VER_GITHASH}" >> OoliteVersions.nsh echo "!define VERSION ${VER_NSIS}" >> OoliteVersions.nsh - echo "!define SEMVER ${SEMVER}" >> OoliteVersions.nsh + echo "!define SEMVER ${VER_FULL}" >> OoliteVersions.nsh echo "!define BUILDTIME \"${BUILDTIME}\"" >> OoliteVersions.nsh echo "!define BUILDHOST_IS64BIT 1" >> OoliteVersions.nsh From 4821f9f347818d4b1f70322e5920fcfa5e329b5b Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 09:49:58 +1200 Subject: [PATCH 27/55] AppImage fix Flatpak working locally with correct version in game but wrong version in package manager --- ShellScripts/common/generate_manifest_fn.sh | 2 +- ShellScripts/common/get_version.sh | 56 ++++++++++++++------- ShellScripts/common/post_build.sh | 1 - installers/flatpak/create_flatpak.sh | 10 ++-- installers/win32/create_nsis.sh | 8 +-- 5 files changed, 42 insertions(+), 35 deletions(-) diff --git a/ShellScripts/common/generate_manifest_fn.sh b/ShellScripts/common/generate_manifest_fn.sh index 528267c4e..b176f2499 100755 --- a/ShellScripts/common/generate_manifest_fn.sh +++ b/ShellScripts/common/generate_manifest_fn.sh @@ -22,7 +22,7 @@ generate_manifest() { echo " " echo " version = \"$VER_FULL\";" echo " git_remote_url = \"$git_remote\";" - echo " git_commit_hash = \"$(git rev-parse HEAD)\";" + echo " git_commit_hash = \"$VER_GITHASH\";" if [[ "$DEPLOYMENT_RELEASE_CONFIGURATION" == "yes" ]]; then echo " debug_functionality_support = no;" diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index 4145a8042..d26190a63 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -12,30 +12,48 @@ mkdir -p ../../build cd ../../build # Timestamp of last commit/push -TIMESTAMP=$(git log -1 --format=%ct) - +if [[ -z "${GETVERSION_TIMESTAMP}" ]]; then + # Run timestamp exactly once and export it for any subsequent child scripts + export GETVERSION_TIMESTAMP=$(git log -1 --format=%ct) +fi # Date conversions use UTC for consistency # Convert to __DATE__ format (e.g., Feb 20 2026) -CPP_DATE=$(date -u -d "@$TIMESTAMP" +"%b %e %Y") +CPP_DATE=$(date -u -d "@$GETVERSION_TIMESTAMP" +"%b %e %Y") # Convert to YYYY-MM-DD -APP_DATE=$(date -u -d "@$TIMESTAMP" +"%Y-%m-%d") +APP_DATE=$(date -u -d "@$GETVERSION_TIMESTAMP" +"%Y-%m-%d") # Convert to YYMMDD format (e.g., 260313) -VER_DATE=$(date -u -d "@$TIMESTAMP" +"%y%m%d") - -VER_FULL=$(${GITVERSION} /showvariable SemVer)$(git diff --quiet || echo "+dirty."$(${GITVERSION} /showvariable UncommittedChanges)) -VER_MAJ=$(${GITVERSION} /showvariable Major) -VER_MIN=$(${GITVERSION} /showvariable Minor) -VER_REV=$(${GITVERSION} /showvariable Patch) -VER_DIST=$(${GITVERSION} /showvariable VersionSourceDistance) -if [[ "" == "$VER_REV" ]]; then - VER_REV="0" +VER_DATE=$(date -u -d "@$GETVERSION_TIMESTAMP" +"%y%m%d") +# Convert to YYYY.MM.DD HH:MM format (e.g., 2026.06.21 07:56) +BUILDTIME=$(date -u -d "@$GETVERSION_TIMESTAMP" "+%Y.%m.%d %H:%M") + +if [[ -z "${GITVERSION_JSON}" ]]; then + # Run GitVersion exactly once and export it for any subsequent child scripts + export GITVERSION_JSON=$(${GITVERSION}) fi -VER_NSIS="$VER_MAJ.$VER_MIN.$VER_REV.$VER_DIST" -VER_GITREV=$(git rev-list --count HEAD) -VER_GITHASH=$(git rev-parse --short=7 HEAD) -BUILDTIME=$(date "+%Y.%m.%d %H:%M") -echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt -echo "$VER_FULL" +if [[ -z "${VER_FULL}" ]]; then + VER_MAJ=$(echo "$GITVERSION_JSON" | jq -r '.Major') + VER_MIN=$(echo "$GITVERSION_JSON" | jq -r '.Minor') + VER_REV=$(echo "$GITVERSION_JSON" | jq -r '.Patch') + if [[ "" == "$VER_REV" ]]; then + VER_REV="0" + fi + VER_DIST=$(echo "$GITVERSION_JSON" | jq -r '.VersionSourceDistance') + VER_SEMVER=$(echo "$GITVERSION_JSON" | jq -r '.SemVer') + VER_UNCOMMITTED=$(echo "$GITVERSION_JSON" | jq -r '.UncommittedChanges') + + if git diff --quiet; then + VER_FULL=$VER_SEMVER + else + VER_FULL="${VER_SEMVER}+dirty.${VER_UNCOMMITTED}" + fi + VER_NSIS="$VER_MAJ.$VER_MIN.$VER_REV.$VER_DIST" + VER_GITREV=$(git rev-list --count HEAD) + VER_GITHASH=$(git rev-parse --short=7 HEAD) + + echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt +fi + +echo "$VER_FULL" popd > /dev/null diff --git a/ShellScripts/common/post_build.sh b/ShellScripts/common/post_build.sh index 132519a60..eed95d57d 100755 --- a/ShellScripts/common/post_build.sh +++ b/ShellScripts/common/post_build.sh @@ -25,7 +25,6 @@ run_script() { return 1 fi cp -fu "$ORIGPROGPATH" "$progpath" - ShellScripts/common/mkmanifest.sh > "$PROGDIR/Resources/manifest.plist" cp -fu src/Cocoa/Info-Oolite.plist "$PROGDIR/Resources/Info-gnustep.plist" # Voice Data diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 170eec2c4..b661f31c6 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -25,13 +25,9 @@ run_script() { local manifest="space.oolite.Oolite.yaml" - if [ -n "${SEMVER}" ] && [ -n "${BUILDER}" ]; then - ENV_BLOCK="env:\n SEMVER: \"$SEMVER\"\n BUILDER: \"$BUILDER\"\n VERSION: \"$SEMVER\"" - if [ -n "${SEMVER}" ] && [ -n "${PROJECTNAME}" ]; then - local env_block="env:\n SEMVER: \"$SEMVER\"\n PROJECTNAME: \"$PROJECTNAME\"\n VERSION: \"$SEMVER\"" - # Swap the comment - sed -i "s|#[[:space:]]*CI builds add an env block here|$env_block|g" "$manifest" || return 1 - fi + local env_block="env:\n VER_FULL: \"$VER_FULL\"\n BUILDER: \"$BUILDER\"" + # Swap the comment + sed -i "s|#[[:space:]]*CI builds add an env block here|$env_block|g" "$manifest" || return 1 # check manifest local lint_exceptions=$(mktemp /tmp/oolite-lint-XXXXXX.json) diff --git a/installers/win32/create_nsis.sh b/installers/win32/create_nsis.sh index 0f21b1294..d4a74e8be 100644 --- a/installers/win32/create_nsis.sh +++ b/installers/win32/create_nsis.sh @@ -42,15 +42,9 @@ run_script() { return 1 fi - local OOLITE_DIR="../$1" - OOLITE_DIR="${OOLITE_DIR//\//\\}" - if [[ -z "${VER_NSIS}" ]] - then - export VER_NSIS=$VER_FULL; - fi - local oolite_dir="../$1" oolite_dir="${oolite_dir//\//\\}" + # Passing arguments cause problems with some versions of NSIS. # Because of this, we generate them into a separate file and include them. echo "; Version Definitions for Oolite" > OoliteVersions.nsh From 39876c83a791c5be392693ba5b8f429b4bc3b058 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 13:52:46 +1200 Subject: [PATCH 28/55] Install jq --- ShellScripts/Linux/download_github_fn.sh | 15 +++------------ ShellScripts/Linux/install_package_fn.sh | 4 +++- ShellScripts/Linux/install_packages_root.sh | 3 +++ ShellScripts/Windows/install_deps.sh | 1 + 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ShellScripts/Linux/download_github_fn.sh b/ShellScripts/Linux/download_github_fn.sh index a6c6295a3..9cd7cf92b 100755 --- a/ShellScripts/Linux/download_github_fn.sh +++ b/ShellScripts/Linux/download_github_fn.sh @@ -21,19 +21,10 @@ download_latest_release() { # Extract the download URL local download_url - if command -v jq &> /dev/null; then - if [[ -n "${filter}" ]]; then - download_url=$(echo "${release_json}" | jq -r ".assets[] | select(.name | contains(\"${filter}\")) | .browser_download_url" | head -n 1) - else - download_url=$(echo "${release_json}" | jq -r '.assets[0].browser_download_url') - fi + if [[ -n "${filter}" ]]; then + download_url=$(echo "${release_json}" | jq -r ".assets[] | select(.name | contains(\"${filter}\")) | .browser_download_url" | head -n 1) else - # Fallback using grep/sed if jq isn't available - if [[ -n "${filter}" ]]; then - download_url=$(echo "${release_json}" | grep "browser_download_url" | grep "${filter}" | head -n 1 | cut -d '"' -f 4) - else - download_url=$(echo "${release_json}" | grep "browser_download_url" | head -n 1 | cut -d '"' -f 4) - fi + download_url=$(echo "${release_json}" | jq -r '.assets[0].browser_download_url') fi # Check if a URL was actually found diff --git a/ShellScripts/Linux/install_package_fn.sh b/ShellScripts/Linux/install_package_fn.sh index af9a570f3..8e76b779d 100644 --- a/ShellScripts/Linux/install_package_fn.sh +++ b/ShellScripts/Linux/install_package_fn.sh @@ -23,6 +23,8 @@ install_package() { "cmake") pkg_name="cmake" ;; + "jq") pkg_name="jq" ;; + "meson") case "$CURRENT_DISTRO" in debian) pkg_name="meson ninja-build" ;; @@ -121,7 +123,7 @@ install_package() { arch) pkg_name="glu" ;; esac ;; - "sdl3") + "sdl3") case "$CURRENT_DISTRO" in debian) pkg_name="libsdl3-dev" ;; redhat) pkg_name="SDL3-devel" ;; diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index 91927da6a..ba60e5a9a 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -37,6 +37,9 @@ run_script() { if ! install_package cmake; then return 1 fi + if ! install_package jq; then + return 1 + fi if ! install_package meson; then return 1 fi diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 1767adc82..68f6e9688 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -42,6 +42,7 @@ run_script() { pacman -S dos2unix --noconfirm pacman -S pactoys --noconfirm pacboy -S binutils --noconfirm + pacboy -S jq --noconfirm pacboy -S python-pip --noconfirm pacman -S make --noconfirm pacboy -S meson --noconfirm From cb70b1422bbdd323566c8b1ba8195264e8062df5 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 13:58:16 +1200 Subject: [PATCH 29/55] Install gitversion after jq --- ShellScripts/Linux/install_packages_root.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index ba60e5a9a..d9f291225 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -17,15 +17,6 @@ run_script() { source download_github_fn.sh - # install gitversion - local outputdir="../../build" - mkdir -p "$outputdir" - download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" - tar xfz ${gitversion_tgz} --directory "$outputdir" - chmod +xr "$outputdir/gitversion" - mv "$outputdir/gitversion" /usr/local/bin/gitversion - rm -f ${gitversion_tgz} - source ./install_package_fn.sh if ! install_package base-devel; then @@ -108,6 +99,15 @@ run_script() { return 1 fi + # install gitversion + local outputdir="../../build" + mkdir -p "$outputdir" + download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" + tar xfz ${gitversion_tgz} --directory "$outputdir" + chmod +xr "$outputdir/gitversion" + mv "$outputdir/gitversion" /usr/local/bin/gitversion + rm -f ${gitversion_tgz} + popd } From 46e9e460c73ce17c69898e915764a50b1f74ea08 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 14:54:03 +1200 Subject: [PATCH 30/55] Install gitversion on Windows --- ShellScripts/Linux/install_freedesktop_fn.sh | 2 +- ShellScripts/Linux/install_packages_root.sh | 5 ++--- ShellScripts/Windows/install_deps.sh | 10 ++++++++++ ShellScripts/{Linux => common}/download_github_fn.sh | 0 4 files changed, 13 insertions(+), 4 deletions(-) rename ShellScripts/{Linux => common}/download_github_fn.sh (100%) diff --git a/ShellScripts/Linux/install_freedesktop_fn.sh b/ShellScripts/Linux/install_freedesktop_fn.sh index 8b2901a9c..b3a66a81c 100644 --- a/ShellScripts/Linux/install_freedesktop_fn.sh +++ b/ShellScripts/Linux/install_freedesktop_fn.sh @@ -54,7 +54,7 @@ install_freedesktop() { local app_metainfo="$appshr/metainfo/space.oolite.Oolite.$4.xml" install -D ../../installers/FreeDesktop/space.oolite.Oolite.metainfo.xml.template "$app_metainfo" || { echo "$err_msg metainfo template" >&2; return 1; } - sed -i "s/@VER@/${VERSION}/g" "$app_metainfo" + sed -i "s/@VER@/${VER_FULL}/g" "$app_metainfo" sed -i "s/@DATE@/${APP_DATE}/g" "$app_metainfo" echo =========================================== diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index d9f291225..af4a2d68a 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -11,11 +11,10 @@ run_script() { return 1 fi - local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$script_dir" - source download_github_fn.sh + source ../common/download_github_fn.sh source ./install_package_fn.sh @@ -104,7 +103,7 @@ run_script() { mkdir -p "$outputdir" download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" - chmod +xr "$outputdir/gitversion" + chmod +x "$outputdir/gitversion" mv "$outputdir/gitversion" /usr/local/bin/gitversion rm -f ${gitversion_tgz} diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 68f6e9688..1ebaed738 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -35,6 +35,8 @@ run_script() { local script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$script_dir" + source ../common/download_github_fn.sh + local oolite_deps_url="https://api.github.com/repos/OoliteProject/oolite_windeps_build/releases/latest" pacman -Syu --noconfirm @@ -57,6 +59,14 @@ run_script() { pacboy -S sdl3 --noconfirm cd ../../build + # install gitversion + local outputdir="./" + download_latest_release gitversion_zip "GitTools" "GitVersion" "win-x" "$outputdir" + unzip -o ${gitversion_zip} -d "$outputdir" + chmod +x "$outputdir/gitversion.exe" + mv "$outputdir/gitversion.exe" "$MINGW_PREFIX/bin/gitversion.exe" + rm -f ${gitversion_zip} + mkdir -p packages cd packages curl -s "$oolite_deps_url" | \ diff --git a/ShellScripts/Linux/download_github_fn.sh b/ShellScripts/common/download_github_fn.sh similarity index 100% rename from ShellScripts/Linux/download_github_fn.sh rename to ShellScripts/common/download_github_fn.sh From ba98a1e43f86e4e9826484dbc03c78897972e9bd Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 15:41:29 +1200 Subject: [PATCH 31/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- ShellScripts/Linux/install_packages_root.sh | 2 +- ShellScripts/Windows/install_deps.sh | 2 +- installers/flatpak/create_flatpak.sh | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ShellScripts/Linux/install_packages_root.sh b/ShellScripts/Linux/install_packages_root.sh index af4a2d68a..5d3672c79 100755 --- a/ShellScripts/Linux/install_packages_root.sh +++ b/ShellScripts/Linux/install_packages_root.sh @@ -101,7 +101,7 @@ run_script() { # install gitversion local outputdir="../../build" mkdir -p "$outputdir" - download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x" "$outputdir" + download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" chmod +x "$outputdir/gitversion" mv "$outputdir/gitversion" /usr/local/bin/gitversion diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 1ebaed738..d8c8d2c2f 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -61,7 +61,7 @@ run_script() { cd ../../build # install gitversion local outputdir="./" - download_latest_release gitversion_zip "GitTools" "GitVersion" "win-x" "$outputdir" + download_latest_release gitversion_zip "GitTools" "GitVersion" "win-x64" "$outputdir" unzip -o ${gitversion_zip} -d "$outputdir" chmod +x "$outputdir/gitversion.exe" mv "$outputdir/gitversion.exe" "$MINGW_PREFIX/bin/gitversion.exe" diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index b661f31c6..96c501f54 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -15,6 +15,16 @@ run_script() { mkdir -p build cd build + if ! command -v gitversion &> /dev/null; then + echo "Installing gitversion..." + local outputdir="./" + download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" + tar xfz ${gitversion_tgz} --directory "$outputdir" + chmod +x "$outputdir/gitversion" + mv "$outputdir/gitversion" /usr/local/bin/gitversion + rm -f ${gitversion_tgz} + fi + cp ../installers/flatpak/space.oolite.Oolite.* ./ mkdir -p shared-modules/glu From 1e42f45771c07f1fa295b0938f4bfa6ec02323a0 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 15:42:38 +1200 Subject: [PATCH 32/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- installers/flatpak/create_flatpak.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 96c501f54..731994c68 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -17,6 +17,7 @@ run_script() { cd build if ! command -v gitversion &> /dev/null; then echo "Installing gitversion..." + source ../ShellScripts/common/download_github_fn.sh local outputdir="./" download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" From fe5e446a31ef32474405a9b2ca2b6686fb5f1bc7 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 15:43:34 +1200 Subject: [PATCH 33/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- installers/flatpak/create_flatpak.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 731994c68..a21b226fc 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -8,9 +8,6 @@ run_script() { pushd "$script_dir" cd ../.. - # Deleting these prevents odd linking errors - rm -rf oolite.app - rm -rf obj.spk source ShellScripts/common/get_version.sh mkdir -p build From defd510f017ea845dacd10b84591659082e7eba8 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 15:59:17 +1200 Subject: [PATCH 34/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- installers/flatpak/create_flatpak.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index a21b226fc..12a968d70 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -8,8 +8,6 @@ run_script() { pushd "$script_dir" cd ../.. - source ShellScripts/common/get_version.sh - mkdir -p build cd build if ! command -v gitversion &> /dev/null; then @@ -22,6 +20,7 @@ run_script() { mv "$outputdir/gitversion" /usr/local/bin/gitversion rm -f ${gitversion_tgz} fi + source ../ShellScripts/common/get_version.sh cp ../installers/flatpak/space.oolite.Oolite.* ./ From dd950393e78f4075a591b3aea8f23f1fa7ff5b52 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:01:24 +1200 Subject: [PATCH 35/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- ShellScripts/Windows/install_deps.sh | 2 +- installers/flatpak/create_flatpak.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index d8c8d2c2f..b5c6d8501 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -60,7 +60,7 @@ run_script() { cd ../../build # install gitversion - local outputdir="./" + local outputdir="." download_latest_release gitversion_zip "GitTools" "GitVersion" "win-x64" "$outputdir" unzip -o ${gitversion_zip} -d "$outputdir" chmod +x "$outputdir/gitversion.exe" diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 12a968d70..09af08316 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -13,7 +13,7 @@ run_script() { if ! command -v gitversion &> /dev/null; then echo "Installing gitversion..." source ../ShellScripts/common/download_github_fn.sh - local outputdir="./" + local outputdir="." download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" chmod +x "$outputdir/gitversion" From bf8e691e95fd3fe9a827945b649e243c7c139a6e Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:17:58 +1200 Subject: [PATCH 36/55] Install gitversion if not installed when creating flatpak (in host not sandbox) --- installers/flatpak/create_flatpak.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 09af08316..770f74e5c 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -17,6 +17,7 @@ run_script() { download_latest_release gitversion_tgz "GitTools" "GitVersion" "linux-x64" "$outputdir" tar xfz ${gitversion_tgz} --directory "$outputdir" chmod +x "$outputdir/gitversion" + mkdir -p /usr/local/bin mv "$outputdir/gitversion" /usr/local/bin/gitversion rm -f ${gitversion_tgz} fi From 7a8c7c06d3b63f41e04802d7907b82d13f293bca Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:19:22 +1200 Subject: [PATCH 37/55] install unzip for Windows --- ShellScripts/Windows/install_deps.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index b5c6d8501..7aab7ce8e 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -45,6 +45,7 @@ run_script() { pacman -S pactoys --noconfirm pacboy -S binutils --noconfirm pacboy -S jq --noconfirm + pacboy -S unzip --noconfirm pacboy -S python-pip --noconfirm pacman -S make --noconfirm pacboy -S meson --noconfirm From 0ed4f6a9c5ba007933c3924c4796803e5c723e4a Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:43:31 +1200 Subject: [PATCH 38/55] Pass GITHUB_REPOSITORY to flatpak --- installers/flatpak/create_flatpak.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installers/flatpak/create_flatpak.sh b/installers/flatpak/create_flatpak.sh index 770f74e5c..0ded5d34b 100755 --- a/installers/flatpak/create_flatpak.sh +++ b/installers/flatpak/create_flatpak.sh @@ -33,7 +33,7 @@ run_script() { local manifest="space.oolite.Oolite.yaml" - local env_block="env:\n VER_FULL: \"$VER_FULL\"\n BUILDER: \"$BUILDER\"" + local env_block="env:\n VER_FULL: \"$VER_FULL\"\n GITHUB_REPOSITORY: \"$GITHUB_REPOSITORY\"" # Swap the comment sed -i "s|#[[:space:]]*CI builds add an env block here|$env_block|g" "$manifest" || return 1 From e350f63d8fb756dc9fdde87e3ac80c59b9b1835c Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:48:27 +1200 Subject: [PATCH 39/55] Fix unzip install Windows --- ShellScripts/Windows/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 7aab7ce8e..a433bbf75 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -45,7 +45,7 @@ run_script() { pacman -S pactoys --noconfirm pacboy -S binutils --noconfirm pacboy -S jq --noconfirm - pacboy -S unzip --noconfirm + pacman -S unzip --noconfirm pacboy -S python-pip --noconfirm pacman -S make --noconfirm pacboy -S meson --noconfirm From 20ff7b36ce077530dedc81915ce629905b32b2bb Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 16:49:34 +1200 Subject: [PATCH 40/55] Wrong make --- ShellScripts/Windows/install_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index a433bbf75..464393a92 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -47,7 +47,7 @@ run_script() { pacboy -S jq --noconfirm pacman -S unzip --noconfirm pacboy -S python-pip --noconfirm - pacman -S make --noconfirm + pacboy -S make --noconfirm pacboy -S meson --noconfirm pacboy -S ninja --noconfirm pacboy -S nsis --noconfirm From 0a5b27f3b3f1178fdd13dd7edcb7f69b6587b0b5 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 17:16:55 +1200 Subject: [PATCH 41/55] Add make alias --- ShellScripts/Windows/install_deps.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index 464393a92..e28f1f4c1 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -114,6 +114,13 @@ run_script() { pacman -Q > installed-packages-gcc.txt fi + if ! grep -q "# MinGW make alias" ~/.bashrc; then + cat >> ~/.bashrc <<'EOF' +# MinGW make alias +alias make="mingw32-make" +EOF + fi + if ! grep -q "# Custom history settings" ~/.bashrc; then cat >> ~/.bashrc <<'EOF' # Custom history settings From 77dd0722c843e1bff7a5bafbd96cb40304575ba1 Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 17:27:05 +1200 Subject: [PATCH 42/55] Revert make changes --- ShellScripts/Windows/install_deps.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index e28f1f4c1..a433bbf75 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -47,7 +47,7 @@ run_script() { pacboy -S jq --noconfirm pacman -S unzip --noconfirm pacboy -S python-pip --noconfirm - pacboy -S make --noconfirm + pacman -S make --noconfirm pacboy -S meson --noconfirm pacboy -S ninja --noconfirm pacboy -S nsis --noconfirm @@ -114,13 +114,6 @@ run_script() { pacman -Q > installed-packages-gcc.txt fi - if ! grep -q "# MinGW make alias" ~/.bashrc; then - cat >> ~/.bashrc <<'EOF' -# MinGW make alias -alias make="mingw32-make" -EOF - fi - if ! grep -q "# Custom history settings" ~/.bashrc; then cat >> ~/.bashrc <<'EOF' # Custom history settings From d0302d87f75d7d99f5cf34d20fdf1680b5a8a06e Mon Sep 17 00:00:00 2001 From: mcarans Date: Mon, 22 Jun 2026 17:40:34 +1200 Subject: [PATCH 43/55] Run gitversion not /usr/loca/bin/gitversion (it should be found) --- ShellScripts/common/get_version.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index d26190a63..04fad2a54 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -4,7 +4,6 @@ # Output goes into the OOLITE_VERSION.txt file and to stdout. # -GITVERSION=/usr/local/bin/gitversion SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) pushd "$SCRIPT_DIR" > /dev/null @@ -28,7 +27,7 @@ BUILDTIME=$(date -u -d "@$GETVERSION_TIMESTAMP" "+%Y.%m.%d %H:%M") if [[ -z "${GITVERSION_JSON}" ]]; then # Run GitVersion exactly once and export it for any subsequent child scripts - export GITVERSION_JSON=$(${GITVERSION}) + export GITVERSION_JSON=$(gitversion) fi if [[ -z "${VER_FULL}" ]]; then From fd684f5dba6b950da608063961907c281f9bc9f6 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 09:16:29 +1200 Subject: [PATCH 44/55] Try building without oolite subfolder --- .github/workflows/build-all.yaml | 66 +++++++++++++++------------- ShellScripts/Windows/install_deps.sh | 4 +- 2 files changed, 37 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index dba599325..298c27123 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -38,28 +38,27 @@ jobs: - name: Checkout Oolite uses: actions/checkout@v6 with: - path: oolite fetch-depth: 0 - name: Install packages run: | - oolite/ShellScripts/Linux/install_packages_root.sh + ShellScripts/Linux/install_packages_root.sh - name: Build GNUstep run: | - oolite/ShellScripts/Linux/build_gnustep.sh system + ShellScripts/Linux/build_gnustep.sh system - name: Install Mozilla static library run: | - oolite/ShellScripts/Linux/install_mozilla_js.sh system + ShellScripts/Linux/install_mozilla_js.sh system echo "/usr/local/lib" | tee -a /etc/ld.so.conf ldconfig - name: Build Oolite run: | - oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} + ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer uses: actions/upload-artifact@v6 with: name: oolite-linux-${{matrix.flavour}} path: | - oolite/build/oolite*.AppImage + build/oolite*.AppImage retention-days: 5 build-flatpak: @@ -71,17 +70,16 @@ jobs: - name: Checkout Oolite uses: actions/checkout@v6 with: - path: oolite fetch-depth: 0 - name: Build flatpak run: | - oolite/installers/flatpak/create_flatpak.sh + installers/flatpak/create_flatpak.sh - name: Archive installer uses: actions/upload-artifact@v6 with: name: oolite-flatpak path: | - oolite/build/space.oolite.Oolite*.flatpak + build/space.oolite.Oolite*.flatpak retention-days: 5 build-windows: @@ -103,33 +101,25 @@ jobs: - name: Checkout Oolite uses: actions/checkout@v6 with: - path: oolite fetch-depth: 0 - - name: Download latest release assets - uses: robinraju/release-downloader@v1 - with: - repository: OoliteProject/oolite_windeps_build - latest: true - fileName: "*" - out-file-path: oolite/build/packages - name: Install packages shell: msys2 {0} env: msystem: UCRT64 run: | - oolite/ShellScripts/Windows/install_deps.sh clang + ShellScripts/Windows/install_deps.sh clang - name: Build Oolite shell: msys2 {0} env: msystem: UCRT64 run: | - oolite/ShellScripts/common/build_oolite.sh ${{matrix.flavour}} + ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - name: Archive installer uses: actions/upload-artifact@v6 with: name: oolite-windows-${{matrix.flavour}} path: | - oolite/build/OoliteInstall*.exe + build/OoliteInstall*.exe retention-days: 5 release: @@ -147,20 +137,34 @@ jobs: uses: actions/download-artifact@v7 with: path: artifacts - - name: Checkout Oolite - uses: actions/checkout@v6 - with: - path: oolite - fetch-depth: 0 - name: Calculate version number and set OOLITE_VERSION id: version run: | - set -x - cd oolite - # Build version string, - # taking into account that we may have just two digits - source ShellScripts/common/get_version.sh - cat build/OOLITE_VERSION.txt >> "$GITHUB_OUTPUT" + set -x + # 1. Check that there are exactly 7 files recursively in the artifacts directory + FILE_COUNT=$(find artifacts -type f | wc -l) + echo "Total files found: $FILE_COUNT" + if [ "$FILE_COUNT" -ne 7 ]; then + echo "❌ Expected exactly 7 files, but found $FILE_COUNT." >&2 + exit 1 + fi + # 2. Get the path of the first available AppImage + APPIMAGE_PATH=$(find artifacts -type f -name "*.AppImage" | head -n 1) + if [[ -z "$APPIMAGE_PATH" ]]; then + echo "❌ No AppImages found in the downloaded artifacts!" >&2 + exit 1 + fi + echo "Found AppImage: $APPIMAGE_PATH" + # 3. Run with packageinfo and extract the string inside quotes + chmod +x "$APPIMAGE_PATH" + VERSION_STR=$("$APPIMAGE_PATH" packageinfo | awk -F'"' '/version =/ {print $2}') + if [[ -z "$VERSION_STR" ]]; then + echo "❌ Failed to extract version string from packageinfo output!" >&2 + exit 1 + fi + echo "Extracted Version: $VERSION_STR" + # 4. Output the extracted version for subsequent steps + echo "OOLITE_VERSION=$VERSION_STR" >> "$GITHUB_OUTPUT" - name: Remove old prereleases if: github.ref == 'refs/heads/master' || endsWith(github.ref, 'maintenance') uses: s00d/delete-older-releases@0.2.1 diff --git a/ShellScripts/Windows/install_deps.sh b/ShellScripts/Windows/install_deps.sh index a433bbf75..ce6669d84 100755 --- a/ShellScripts/Windows/install_deps.sh +++ b/ShellScripts/Windows/install_deps.sh @@ -10,7 +10,7 @@ install() { echo "Installing $1 package" local fullname - if [ -z "$2" ]; then + if [[ -z "$2" ]]; then fullname=$1 else fullname="${1}_${2}" @@ -20,7 +20,7 @@ install() { local filename=$(ls $packagename 2>/dev/null) # package file eg. mingw-w64-x86_64-libobjc2-2.3-3-any.pkg.tar.zst - if [ -z "$filename" ]; then + if [[ -z "$filename" ]]; then echo "❌ No file matching $packagename found!" >&2 return 1 fi From da337a5b06672e10bb09077c0b60f559a077fc2a Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 09:32:59 +1200 Subject: [PATCH 45/55] Try installing patchelf --- ShellScripts/Linux/install_package_fn.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ShellScripts/Linux/install_package_fn.sh b/ShellScripts/Linux/install_package_fn.sh index 8e76b779d..affdaa29e 100644 --- a/ShellScripts/Linux/install_package_fn.sh +++ b/ShellScripts/Linux/install_package_fn.sh @@ -139,9 +139,9 @@ install_package() { "appimage") case "$CURRENT_DISTRO" in - debian) pkg_name="file fuse3" ;; - redhat) pkg_name="file fuse3 desktop-file-utils which zsync" ;; - arch) pkg_name="file fuse3 desktop-file-utils zsync" ;; + debian) pkg_name="file fuse3 patchelf" ;; + redhat) pkg_name="file fuse3 desktop-file-utils patchelf which zsync" ;; + arch) pkg_name="file fuse3 desktop-file-utils patchelf zsync" ;; esac ;; "flatpak") pkg_name="flatpak flatpak-builder" ;; From 90cf2a373ed5635667b6771e17c1bbdb9dc1ec33 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 09:46:42 +1200 Subject: [PATCH 46/55] There are 8 files not 7 --- .github/workflows/build-all.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 298c27123..05f38d22e 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -141,11 +141,11 @@ jobs: id: version run: | set -x - # 1. Check that there are exactly 7 files recursively in the artifacts directory + # 1. Check that there are exactly 8 files recursively in the artifacts directory FILE_COUNT=$(find artifacts -type f | wc -l) echo "Total files found: $FILE_COUNT" - if [ "$FILE_COUNT" -ne 7 ]; then - echo "❌ Expected exactly 7 files, but found $FILE_COUNT." >&2 + if [ "$FILE_COUNT" -ne 8 ]; then + echo "❌ Expected exactly 8 files, but found $FILE_COUNT." >&2 exit 1 fi # 2. Get the path of the first available AppImage From 24ea41c390e23ba642b81fa66dffbe4420a09b14 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 09:47:10 +1200 Subject: [PATCH 47/55] There are 8 files not 7 --- .github/workflows/build-all.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 05f38d22e..d0394d077 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -144,7 +144,7 @@ jobs: # 1. Check that there are exactly 8 files recursively in the artifacts directory FILE_COUNT=$(find artifacts -type f | wc -l) echo "Total files found: $FILE_COUNT" - if [ "$FILE_COUNT" -ne 8 ]; then + if [[ "$FILE_COUNT" -ne 8 ]]; then echo "❌ Expected exactly 8 files, but found $FILE_COUNT." >&2 exit 1 fi From 9e7142520a72e86c52c3acbf0d239df2c2737d35 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 10:10:23 +1200 Subject: [PATCH 48/55] Extract one version --- .github/workflows/build-all.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index d0394d077..d4132f9ad 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -157,7 +157,7 @@ jobs: echo "Found AppImage: $APPIMAGE_PATH" # 3. Run with packageinfo and extract the string inside quotes chmod +x "$APPIMAGE_PATH" - VERSION_STR=$("$APPIMAGE_PATH" packageinfo | awk -F'"' '/version =/ {print $2}') + VERSION_STR=$("$APPIMAGE_PATH" packageinfo | awk -F'"' '/^[[:space:]]*version =/ {print $2; exit}') if [[ -z "$VERSION_STR" ]]; then echo "❌ Failed to extract version string from packageinfo output!" >&2 exit 1 From 3edcee292f032de63eba84030a5c013e019de44b Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 10:35:51 +1200 Subject: [PATCH 49/55] See if this helps flatpak --- .github/workflows/build-all.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index d4132f9ad..bb36ae986 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -67,6 +67,11 @@ jobs: image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08 options: --privileged steps: + - name: Pre-setup ownership + run: | + # This must run before the checkout action if the action tries to do git commands + mkdir -p "$GITHUB_WORKSPACE" + git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Checkout Oolite uses: actions/checkout@v6 with: From 86d4f8b92ff89b98527dcf82882b2e2212788851 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 11:19:53 +1200 Subject: [PATCH 50/55] Output untracked files --- .github/workflows/build-all.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index bb36ae986..d361ebe37 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -113,12 +113,14 @@ jobs: msystem: UCRT64 run: | ShellScripts/Windows/install_deps.sh clang + git status --ignored=matching - name: Build Oolite shell: msys2 {0} env: msystem: UCRT64 run: | ShellScripts/common/build_oolite.sh ${{matrix.flavour}} + git status --ignored=matching - name: Archive installer uses: actions/upload-artifact@v6 with: From ebf6ba9f5cd6f2bf040df75cc9b4752e7d12cdbe Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 11:48:15 +1200 Subject: [PATCH 51/55] Maybe it's a git line ending issue --- .github/workflows/build-all.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index d361ebe37..2d01b7c3a 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -98,6 +98,10 @@ jobs: # run: | # Get-ChildItem Env: | Sort Name + - name: Configure Git Line Endings + run: | + git config --global core.autocrlf false + git config --global core.eol lf - name: Set up MSYS2 uses: msys2/setup-msys2@v2 with: @@ -112,6 +116,7 @@ jobs: env: msystem: UCRT64 run: | + git status --ignored=matching ShellScripts/Windows/install_deps.sh clang git status --ignored=matching - name: Build Oolite @@ -120,7 +125,6 @@ jobs: msystem: UCRT64 run: | ShellScripts/common/build_oolite.sh ${{matrix.flavour}} - git status --ignored=matching - name: Archive installer uses: actions/upload-artifact@v6 with: From 26b2dc536f25f7936c9fbed8ba1e7f9d47f78387 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 11:58:20 +1200 Subject: [PATCH 52/55] Maybe it's a git line ending issue --- .github/workflows/build-all.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 2d01b7c3a..1d5c5f9cb 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -116,7 +116,6 @@ jobs: env: msystem: UCRT64 run: | - git status --ignored=matching ShellScripts/Windows/install_deps.sh clang git status --ignored=matching - name: Build Oolite From ad9db5603a21b9be3ff57a22a07001c453bec093 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 12:13:23 +1200 Subject: [PATCH 53/55] Remove untracked file check --- .github/workflows/build-all.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-all.yaml b/.github/workflows/build-all.yaml index 1d5c5f9cb..aee2e9f3d 100644 --- a/.github/workflows/build-all.yaml +++ b/.github/workflows/build-all.yaml @@ -117,7 +117,6 @@ jobs: msystem: UCRT64 run: | ShellScripts/Windows/install_deps.sh clang - git status --ignored=matching - name: Build Oolite shell: msys2 {0} env: From 2f5a5629141b30d42596403ccdf2fe86a23a60c0 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 16:22:57 +1200 Subject: [PATCH 54/55] Check for gitversion Remove unneeded OOLITE_VERSION.txt Make error messages consistent --- ShellScripts/common/download_github_fn.sh | 4 ++-- ShellScripts/common/generate_manifest_fn.sh | 2 +- ShellScripts/common/get_version.sh | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ShellScripts/common/download_github_fn.sh b/ShellScripts/common/download_github_fn.sh index 9cd7cf92b..6b0b95ecd 100755 --- a/ShellScripts/common/download_github_fn.sh +++ b/ShellScripts/common/download_github_fn.sh @@ -15,7 +15,7 @@ download_latest_release() { # Check if the repository was found/has releases if echo "${release_json}" | grep -q "Not Found"; then - echo "❌ Error: Repository not found or has no public releases at ${api_url}" >&2 + echo "❌ Repository not found or has no public releases at ${api_url}!" >&2 return 1 fi @@ -29,7 +29,7 @@ download_latest_release() { # Check if a URL was actually found if [[ -z "${download_url}" || "${download_url}" == "null" ]]; then - echo "Error: Could not find a matching download URL." >&2 + echo "❌ Could not find a matching download URL!" >&2 return 1 fi diff --git a/ShellScripts/common/generate_manifest_fn.sh b/ShellScripts/common/generate_manifest_fn.sh index b176f2499..2fe7a426a 100755 --- a/ShellScripts/common/generate_manifest_fn.sh +++ b/ShellScripts/common/generate_manifest_fn.sh @@ -3,7 +3,7 @@ generate_manifest() { local oolite_version_file="src/Cocoa/oolite-version.xcconfig" if [[ ! -f "$oolite_version_file" ]]; then - echo "Error: $oolite_version_file not found." >&2 + echo "❌ $oolite_version_file not found!" >&2 popd > /dev/null return 1 fi diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index 04fad2a54..aaf9ba72f 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -1,7 +1,6 @@ #!/bin/bash # -# Calculates the Oolite version number if not passed via env variables. -# Output goes into the OOLITE_VERSION.txt file and to stdout. +# Calculates the Oolite version number if not passed via env variables. Output goes to stdout. # SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd) @@ -27,6 +26,10 @@ BUILDTIME=$(date -u -d "@$GETVERSION_TIMESTAMP" "+%Y.%m.%d %H:%M") if [[ -z "${GITVERSION_JSON}" ]]; then # Run GitVersion exactly once and export it for any subsequent child scripts + if ! command -v gitversion &> /dev/null; then + echo "❌ gitversion binary not found!" >&2 + exit 1 + fi export GITVERSION_JSON=$(gitversion) fi @@ -50,8 +53,6 @@ if [[ -z "${VER_FULL}" ]]; then VER_NSIS="$VER_MAJ.$VER_MIN.$VER_REV.$VER_DIST" VER_GITREV=$(git rev-list --count HEAD) VER_GITHASH=$(git rev-parse --short=7 HEAD) - - echo "OOLITE_VERSION=$VER_FULL" > OOLITE_VERSION.txt fi echo "$VER_FULL" From 366ae8fbe5d86ddee0752cb58f990d1e00353859 Mon Sep 17 00:00:00 2001 From: mcarans Date: Tue, 23 Jun 2026 16:44:31 +1200 Subject: [PATCH 55/55] Fix flatpak build --- ShellScripts/common/get_version.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ShellScripts/common/get_version.sh b/ShellScripts/common/get_version.sh index aaf9ba72f..66f241dac 100755 --- a/ShellScripts/common/get_version.sh +++ b/ShellScripts/common/get_version.sh @@ -24,16 +24,15 @@ VER_DATE=$(date -u -d "@$GETVERSION_TIMESTAMP" +"%y%m%d") # Convert to YYYY.MM.DD HH:MM format (e.g., 2026.06.21 07:56) BUILDTIME=$(date -u -d "@$GETVERSION_TIMESTAMP" "+%Y.%m.%d %H:%M") -if [[ -z "${GITVERSION_JSON}" ]]; then - # Run GitVersion exactly once and export it for any subsequent child scripts - if ! command -v gitversion &> /dev/null; then - echo "❌ gitversion binary not found!" >&2 - exit 1 - fi - export GITVERSION_JSON=$(gitversion) -fi - if [[ -z "${VER_FULL}" ]]; then + if [[ -z "${GITVERSION_JSON}" ]]; then + # Run GitVersion exactly once and export it for any subsequent child scripts + if ! command -v gitversion &> /dev/null; then + echo "❌ gitversion binary not found!" >&2 + exit 1 + fi + export GITVERSION_JSON=$(gitversion) + fi VER_MAJ=$(echo "$GITVERSION_JSON" | jq -r '.Major') VER_MIN=$(echo "$GITVERSION_JSON" | jq -r '.Minor') VER_REV=$(echo "$GITVERSION_JSON" | jq -r '.Patch')