From 013f2ad42247bb35fb50b00c9db406926d051231 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 14:35:18 +0100 Subject: [PATCH 01/33] add mac --- .github/workflows/build-prototype.yml | 92 ++++++++++++++- linux.mk | 160 +++++++++++++++++++++++--- 2 files changed, 233 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index 9bae832274..afc4dc5323 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -6,7 +6,7 @@ on: jobs: build-prototype: - name: "Build Prototype" + name: "Build Prototype Windows x86" runs-on: ubuntu-24.04 steps: @@ -39,3 +39,93 @@ jobs: with: name: ${{ env.ZIP_NAME }} path: pkg/** + + build-prototype-linux: + name: "Build Prototype Linux x86_64" + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update system + run: | + set -eux + sudo apt update + sudo apt install -y \ + build-essential \ + pkg-config \ + curl \ + libavcodec-dev \ + libavformat-dev \ + libavutil-dev \ + libopenal-dev \ + libluajit-5.1-dev \ + libminizip-dev \ + libnatpmp-dev \ + libspng-dev \ + libsdl2-dev \ + libsdl2-image-dev \ + libsdl2-mixer-dev \ + libsdl2-net-dev \ + libswresample-dev \ + libminiupnpc-dev \ + zlib1g-dev + + - name: Build + run: | + set -eux + BUILD_NUMBER=$(git rev-list --count origin/master) + GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) + PACKAGE_SUFFIX=Prototype_$(git rev-parse --short=7 "$GITHUB_SHA") + make BUILD_NUMBER=$BUILD_NUMBER VER_SUFFIX=$PACKAGE_SUFFIX -f linux.mk + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: keeperfx-linux + path: bin/keeperfx + + build-prototype-macos: + name: "Build Prototype macOS arm64" + runs-on: macos-14 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Update system + run: | + set -eux + brew update + brew install \ + cmake \ + pkg-config \ + sdl2 \ + sdl2_image \ + sdl2_mixer \ + sdl2_net \ + ffmpeg \ + openal-soft \ + luajit \ + spng \ + minizip \ + zlib \ + miniupnpc \ + libnatpmp + + - name: Build + run: | + set -eux + BUILD_NUMBER=$(git rev-list --count origin/master) + GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) + PACKAGE_SUFFIX=Prototype_$(git rev-parse --short=7 "$GITHUB_SHA") + make BUILD_NUMBER=$BUILD_NUMBER VER_SUFFIX=$PACKAGE_SUFFIX PLATFORM=mac ARCH=arm64 -f linux.mk + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: keeperfx-macos + path: bin/keeperfx diff --git a/linux.mk b/linux.mk index 9541e2fa0b..0a5b250995 100644 --- a/linux.mk +++ b/linux.mk @@ -9,6 +9,69 @@ STRIP ?= strip ECHO ?= echo MV ?= mv -f +PLATFORM ?= $(shell uname -s) +ARCH ?= $(shell uname -m) + +ifeq ($(PLATFORM),Linux) +PLATFORM := linux +endif +ifeq ($(PLATFORM),Darwin) +PLATFORM := mac +endif +ifeq ($(PLATFORM),macos) +PLATFORM := mac +endif + +ifeq ($(ARCH),amd64) +ARCH := x86_64 +endif +ifeq ($(ARCH),aarch64) +ARCH := arm64 +endif + +DEPS_ASTRONOMY_TAG ?= 20250418 +DEPS_CENTIJSON_TAG ?= 20250418 +DEPS_ENET6_TAG ?= 20260213 +DEPS_ASTRONOMY_REPO ?= https://github.com/cosinekitty/astronomy.git +DEPS_CENTIJSON_REPO ?= https://github.com/mity/centijson.git +DEPS_ENET6_REPO ?= https://github.com/SirLynix/enet6.git +DEPS_ASTRONOMY_REF ?= +DEPS_CENTIJSON_REF ?= +DEPS_ENET6_REF ?= +DEPS_CLONE_DEPTH ?= 1 +DEPS_BUILD_DIR ?= deps/_build +DEPS_SUFFIX ?= +DEPS_DOWNLOAD ?= 1 + +ifeq ($(PLATFORM),linux) +DEPS_SUFFIX ?= lin64 +endif +ifeq ($(PLATFORM),mac) +DEPS_DOWNLOAD ?= 0 +endif + +ifeq ($(PLATFORM),linux) + ifeq ($(ARCH),x86_64) + ARCH_CFLAGS := -march=x86-64 + else ifeq ($(ARCH),arm64) + ARCH_CFLAGS := -march=armv8-a + else + $(error Unsupported ARCH for linux: $(ARCH)) + endif + ARCH_LDFLAGS := +else ifeq ($(PLATFORM),mac) + ifeq ($(ARCH),x86_64) + ARCH_CFLAGS := -arch x86_64 + else ifeq ($(ARCH),arm64) + ARCH_CFLAGS := -arch arm64 + else + $(error Unsupported ARCH for mac: $(ARCH)) + endif + ARCH_LDFLAGS := $(ARCH_CFLAGS) +else + $(error Unsupported PLATFORM: $(PLATFORM)) +endif + KFX_SOURCES = \ src/actionpt.c \ src/api.c \ @@ -283,12 +346,13 @@ KFX_INCLUDES = \ -Ideps/enet6/include \ $(shell pkg-config --cflags-only-I luajit) -KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 -march=x86-64 $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare -KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 -march=x86-64 $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare +KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare -fsigned-char +KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare -fsigned-char KFX_LDFLAGS += \ -g \ -Wall -Wextra -Werror \ + $(ARCH_LDFLAGS) \ -Ldeps/astronomy -lastronomy \ -Ldeps/centijson -ljson \ -Ldeps/enet6 -lenet6 \ @@ -316,7 +380,7 @@ TOML_OBJECTS = $(patsubst deps/centitoml/%.c,obj/centitoml/%.o,$(TOML_SOURCES)) TOML_INCLUDES = \ -Ideps/centijson/include -TOML_CFLAGS += -O3 -march=x86-64 $(TOML_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter +TOML_CFLAGS += -O3 $(ARCH_CFLAGS) $(TOML_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter ifeq ($(ENABLE_LTO), 1) KFX_CFLAGS += -flto @@ -356,23 +420,83 @@ src/moonphase.c: deps/astronomy/include/astronomy.h deps/centitoml/toml_api.c: deps/centijson/include/json.h deps/centitoml/toml_conv.c: deps/centijson/include/json.h -deps/astronomy-lin64.tar.gz: - curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20250418/astronomy-lin64.tar.gz" - -deps/astronomy/include/astronomy.h: deps/astronomy-lin64.tar.gz | deps/astronomy - tar xzmf $< -C deps/astronomy - -deps/centijson-lin64.tar.gz: - curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20250418/centijson-lin64.tar.gz" - -deps/centijson/include/json.h: deps/centijson-lin64.tar.gz | deps/centijson - tar xzmf $< -C deps/centijson +deps/astronomy/include/astronomy.h: | deps/astronomy + @set -eux; \ + if [ -f "$@" ]; then exit 0; fi; \ + if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ + if [ ! -f "deps/astronomy-$(DEPS_SUFFIX).tar.gz" ]; then \ + curl -Lfso "deps/astronomy-$(DEPS_SUFFIX).tar.gz" \ + "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_ASTRONOMY_TAG)/astronomy-$(DEPS_SUFFIX).tar.gz"; \ + fi; \ + if [ -f "deps/astronomy-$(DEPS_SUFFIX).tar.gz" ]; then \ + tar xzmf "deps/astronomy-$(DEPS_SUFFIX).tar.gz" -C deps/astronomy; \ + exit 0; \ + fi; \ + fi; \ + rm -rf "$(DEPS_BUILD_DIR)/astronomy"; \ + $(MKDIR) "$(DEPS_BUILD_DIR)"; \ + git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_ASTRONOMY_REPO)" "$(DEPS_BUILD_DIR)/astronomy"; \ + if [ -n "$(DEPS_ASTRONOMY_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/astronomy" checkout "$(DEPS_ASTRONOMY_REF)"; fi; \ + cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ + cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ + $(MKDIR) deps/astronomy/include; \ + header_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.h | head -n 1); \ + lib_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name libastronomy.a | head -n 1); \ + if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "astronomy build output not found"; exit 1; fi; \ + cp "$$header_path" deps/astronomy/include/; \ + cp "$$lib_path" deps/astronomy/libastronomy.a -deps/enet6-lin64.tar.gz: - curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/20260213/enet6-lin64.tar.gz" +deps/centijson/include/json.h: | deps/centijson + @set -eux; \ + if [ -f "$@" ]; then exit 0; fi; \ + if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ + if [ ! -f "deps/centijson-$(DEPS_SUFFIX).tar.gz" ]; then \ + curl -Lfso "deps/centijson-$(DEPS_SUFFIX).tar.gz" \ + "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_CENTIJSON_TAG)/centijson-$(DEPS_SUFFIX).tar.gz"; \ + fi; \ + if [ -f "deps/centijson-$(DEPS_SUFFIX).tar.gz" ]; then \ + tar xzmf "deps/centijson-$(DEPS_SUFFIX).tar.gz" -C deps/centijson; \ + exit 0; \ + fi; \ + fi; \ + rm -rf "$(DEPS_BUILD_DIR)/centijson"; \ + $(MKDIR) "$(DEPS_BUILD_DIR)"; \ + git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_CENTIJSON_REPO)" "$(DEPS_BUILD_DIR)/centijson"; \ + if [ -n "$(DEPS_CENTIJSON_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/centijson" checkout "$(DEPS_CENTIJSON_REF)"; fi; \ + cmake -S "$(DEPS_BUILD_DIR)/centijson" -B "$(DEPS_BUILD_DIR)/centijson/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ + cmake --build "$(DEPS_BUILD_DIR)/centijson/build"; \ + $(MKDIR) deps/centijson/include; \ + header_path=$$(find "$(DEPS_BUILD_DIR)/centijson" -name json.h | head -n 1); \ + lib_path=$$(find "$(DEPS_BUILD_DIR)/centijson" \( -name libjson.a -o -name libcentijson.a \) | head -n 1); \ + if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "centijson build output not found"; exit 1; fi; \ + cp "$$header_path" deps/centijson/include/; \ + cp "$$lib_path" deps/centijson/libjson.a -deps/enet6/include/enet6/enet.h: deps/enet6-lin64.tar.gz | deps/enet6 - tar xzmf $< -C deps/enet6 +deps/enet6/include/enet6/enet.h: | deps/enet6 + @set -eux; \ + if [ -f "$@" ]; then exit 0; fi; \ + if [ "$(DEPS_DOWNLOAD)" = "1" ] && [ -n "$(DEPS_SUFFIX)" ]; then \ + if [ ! -f "deps/enet6-$(DEPS_SUFFIX).tar.gz" ]; then \ + curl -Lfso "deps/enet6-$(DEPS_SUFFIX).tar.gz" \ + "https://github.com/dkfans/kfx-deps/releases/download/$(DEPS_ENET6_TAG)/enet6-$(DEPS_SUFFIX).tar.gz"; \ + fi; \ + if [ -f "deps/enet6-$(DEPS_SUFFIX).tar.gz" ]; then \ + tar xzmf "deps/enet6-$(DEPS_SUFFIX).tar.gz" -C deps/enet6; \ + exit 0; \ + fi; \ + fi; \ + rm -rf "$(DEPS_BUILD_DIR)/enet6"; \ + $(MKDIR) "$(DEPS_BUILD_DIR)"; \ + git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_ENET6_REPO)" "$(DEPS_BUILD_DIR)/enet6"; \ + if [ -n "$(DEPS_ENET6_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/enet6" checkout "$(DEPS_ENET6_REF)"; fi; \ + cmake -S "$(DEPS_BUILD_DIR)/enet6" -B "$(DEPS_BUILD_DIR)/enet6/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ + cmake --build "$(DEPS_BUILD_DIR)/enet6/build"; \ + $(MKDIR) deps/enet6/include/enet6; \ + header_path=$$(find "$(DEPS_BUILD_DIR)/enet6" -path "*/enet6/enet.h" | head -n 1); \ + lib_path=$$(find "$(DEPS_BUILD_DIR)/enet6" \( -name libenet6.a -o -name libenet.a \) | head -n 1); \ + if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "enet6 build output not found"; exit 1; fi; \ + cp "$$header_path" deps/enet6/include/enet6/; \ + cp "$$lib_path" deps/enet6/libenet6.a src/ver_defs.h: version.mk $(ECHO) "#define VER_MAJOR $(VER_MAJOR)" > $@.swp From 8909f7fda89ec238ffa36b5144b86ca955018812 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 14:39:12 +0100 Subject: [PATCH 02/33] . --- .github/workflows/build-prototype.yml | 2 +- linux.mk | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index afc4dc5323..fa8e61aff3 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -110,7 +110,7 @@ jobs: ffmpeg \ openal-soft \ luajit \ - spng \ + libspng \ minizip \ zlib \ miniupnpc \ diff --git a/linux.mk b/linux.mk index 0a5b250995..5af13029d4 100644 --- a/linux.mk +++ b/linux.mk @@ -466,10 +466,11 @@ deps/centijson/include/json.h: | deps/centijson cmake -S "$(DEPS_BUILD_DIR)/centijson" -B "$(DEPS_BUILD_DIR)/centijson/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/centijson/build"; \ $(MKDIR) deps/centijson/include; \ - header_path=$$(find "$(DEPS_BUILD_DIR)/centijson" -name json.h | head -n 1); \ + header_path=$$(find "$(DEPS_BUILD_DIR)/centijson" \( -name value.h -o -name json.h \) | head -n 1); \ + header_dir=$$(dirname "$$header_path"); \ lib_path=$$(find "$(DEPS_BUILD_DIR)/centijson" \( -name libjson.a -o -name libcentijson.a \) | head -n 1); \ if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "centijson build output not found"; exit 1; fi; \ - cp "$$header_path" deps/centijson/include/; \ + cp "$$header_dir"/*.h deps/centijson/include/; \ cp "$$lib_path" deps/centijson/libjson.a deps/enet6/include/enet6/enet.h: | deps/enet6 From 302feeff18f25b4a717013191b0b610e27e3679e Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 15:04:30 +0100 Subject: [PATCH 03/33] Update linux.mk --- linux.mk | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/linux.mk b/linux.mk index 5af13029d4..01e1adfad1 100644 --- a/linux.mk +++ b/linux.mk @@ -437,8 +437,16 @@ deps/astronomy/include/astronomy.h: | deps/astronomy $(MKDIR) "$(DEPS_BUILD_DIR)"; \ git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_ASTRONOMY_REPO)" "$(DEPS_BUILD_DIR)/astronomy"; \ if [ -n "$(DEPS_ASTRONOMY_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/astronomy" checkout "$(DEPS_ASTRONOMY_REF)"; fi; \ - cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ - cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ + if [ -f "$(DEPS_BUILD_DIR)/astronomy/CMakeLists.txt" ]; then \ + cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ + cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ + else \ + astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.c | head -n 1); \ + if [ -z "$$astro_src" ]; then echo "astronomy.c not found"; exit 1; fi; \ + $(MKDIR) "$(DEPS_BUILD_DIR)/astronomy/build"; \ + $(CC) -O3 -c "$$astro_src" -o "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ + ar rcs "$(DEPS_BUILD_DIR)/astronomy/build/libastronomy.a" "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ + fi; \ $(MKDIR) deps/astronomy/include; \ header_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.h | head -n 1); \ lib_path=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name libastronomy.a | head -n 1); \ @@ -463,6 +471,9 @@ deps/centijson/include/json.h: | deps/centijson $(MKDIR) "$(DEPS_BUILD_DIR)"; \ git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_CENTIJSON_REPO)" "$(DEPS_BUILD_DIR)/centijson"; \ if [ -n "$(DEPS_CENTIJSON_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/centijson" checkout "$(DEPS_CENTIJSON_REF)"; fi; \ + if [ "$(PLATFORM)" = "mac" ]; then \ + perl -pi -e 's@#include @#include @' "$$(find "$(DEPS_BUILD_DIR)/centijson" -name json.c | head -n 1)"; \ + fi; \ cmake -S "$(DEPS_BUILD_DIR)/centijson" -B "$(DEPS_BUILD_DIR)/centijson/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/centijson/build"; \ $(MKDIR) deps/centijson/include; \ From 8ebe9a61d96123fd177ae6f76c5bf8624096b593 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 15:25:52 +0100 Subject: [PATCH 04/33] Update linux.mk --- linux.mk | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/linux.mk b/linux.mk index 01e1adfad1..7cee23636c 100644 --- a/linux.mk +++ b/linux.mk @@ -441,10 +441,13 @@ deps/astronomy/include/astronomy.h: | deps/astronomy cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ else \ - astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.c | head -n 1); \ + astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.c" | head -n 1); \ + if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.c | head -n 1); fi; \ if [ -z "$$astro_src" ]; then echo "astronomy.c not found"; exit 1; fi; \ + astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.h -exec dirname {} \; | head -n 1); \ + if [ -z "$$astro_inc" ]; then echo "astronomy.h not found"; exit 1; fi; \ $(MKDIR) "$(DEPS_BUILD_DIR)/astronomy/build"; \ - $(CC) -O3 -c "$$astro_src" -o "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ + $(CC) -O3 -I"$$astro_inc" -c "$$astro_src" -o "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ ar rcs "$(DEPS_BUILD_DIR)/astronomy/build/libastronomy.a" "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ fi; \ $(MKDIR) deps/astronomy/include; \ @@ -472,7 +475,7 @@ deps/centijson/include/json.h: | deps/centijson git clone --depth "$(DEPS_CLONE_DEPTH)" "$(DEPS_CENTIJSON_REPO)" "$(DEPS_BUILD_DIR)/centijson"; \ if [ -n "$(DEPS_CENTIJSON_REF)" ]; then git -C "$(DEPS_BUILD_DIR)/centijson" checkout "$(DEPS_CENTIJSON_REF)"; fi; \ if [ "$(PLATFORM)" = "mac" ]; then \ - perl -pi -e 's@#include @#include @' "$$(find "$(DEPS_BUILD_DIR)/centijson" -name json.c | head -n 1)"; \ + find "$(DEPS_BUILD_DIR)/centijson" -name "*.c" -print0 | xargs -0 perl -pi -e 's@#include @#include @'; \ fi; \ cmake -S "$(DEPS_BUILD_DIR)/centijson" -B "$(DEPS_BUILD_DIR)/centijson/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/centijson/build"; \ From 0c69cab3b5ca1cb07647967f4ac91c7b5e665b7b Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 15:32:25 +0100 Subject: [PATCH 05/33] Update linux.mk --- linux.mk | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/linux.mk b/linux.mk index 7cee23636c..b3404c0706 100644 --- a/linux.mk +++ b/linux.mk @@ -72,6 +72,11 @@ else $(error Unsupported PLATFORM: $(PLATFORM)) endif +WARN_NO_FORMAT_TRUNCATION := +ifeq ($(PLATFORM),linux) +WARN_NO_FORMAT_TRUNCATION := -Wno-format-truncation +endif + KFX_SOURCES = \ src/actionpt.c \ src/api.c \ @@ -346,8 +351,8 @@ KFX_INCLUDES = \ -Ideps/enet6/include \ $(shell pkg-config --cflags-only-I luajit) -KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare -fsigned-char -KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas -Wno-format-truncation -Wno-sign-compare -fsigned-char +KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char +KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char KFX_LDFLAGS += \ -g \ @@ -441,10 +446,11 @@ deps/astronomy/include/astronomy.h: | deps/astronomy cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ else \ - astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.c" | head -n 1); \ - if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.c | head -n 1); fi; \ + astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.c" | head -n 1); \ + if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.c" | head -n 1); fi; \ if [ -z "$$astro_src" ]; then echo "astronomy.c not found"; exit 1; fi; \ - astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -name astronomy.h -exec dirname {} \; | head -n 1); \ + astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.h" -exec dirname {} \; | head -n 1); \ + if [ -z "$$astro_inc" ]; then astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.h" -exec dirname {} \; | head -n 1); fi; \ if [ -z "$$astro_inc" ]; then echo "astronomy.h not found"; exit 1; fi; \ $(MKDIR) "$(DEPS_BUILD_DIR)/astronomy/build"; \ $(CC) -O3 -I"$$astro_inc" -c "$$astro_src" -o "$(DEPS_BUILD_DIR)/astronomy/build/astronomy.o"; \ From 26ded90970edccf1544c48d3a4146bcccf7b5a4c Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 15:40:19 +0100 Subject: [PATCH 06/33] Update linux.mk --- linux.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/linux.mk b/linux.mk index b3404c0706..376db79fce 100644 --- a/linux.mk +++ b/linux.mk @@ -349,6 +349,18 @@ KFX_INCLUDES = \ -Ideps/centitoml \ -Ideps/astronomy/include \ -Ideps/enet6/include \ + $(shell pkg-config --cflags-only-I sdl2) \ + $(shell pkg-config --cflags-only-I SDL2_image) \ + $(shell pkg-config --cflags-only-I SDL2_mixer) \ + $(shell pkg-config --cflags-only-I SDL2_net) \ + $(shell pkg-config --cflags-only-I libavformat) \ + $(shell pkg-config --cflags-only-I libavcodec) \ + $(shell pkg-config --cflags-only-I libswresample) \ + $(shell pkg-config --cflags-only-I libavutil) \ + $(shell pkg-config --cflags-only-I openal) \ + $(shell pkg-config --cflags-only-I spng) \ + $(shell pkg-config --cflags-only-I minizip) \ + $(shell pkg-config --cflags-only-I zlib) \ $(shell pkg-config --cflags-only-I luajit) KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char @@ -446,10 +458,12 @@ deps/astronomy/include/astronomy.h: | deps/astronomy cmake -S "$(DEPS_BUILD_DIR)/astronomy" -B "$(DEPS_BUILD_DIR)/astronomy/build" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release; \ cmake --build "$(DEPS_BUILD_DIR)/astronomy/build"; \ else \ - astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.c" | head -n 1); \ + astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/c/astronomy.c" | head -n 1); \ + if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.c" | head -n 1); fi; \ if [ -z "$$astro_src" ]; then astro_src=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.c" | head -n 1); fi; \ if [ -z "$$astro_src" ]; then echo "astronomy.c not found"; exit 1; fi; \ - astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.h" -exec dirname {} \; | head -n 1); \ + astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/c/astronomy.h" -exec dirname {} \; | head -n 1); \ + if [ -z "$$astro_inc" ]; then astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/source/astronomy.h" -exec dirname {} \; | head -n 1); fi; \ if [ -z "$$astro_inc" ]; then astro_inc=$$(find "$(DEPS_BUILD_DIR)/astronomy" -path "*/src/astronomy.h" -exec dirname {} \; | head -n 1); fi; \ if [ -z "$$astro_inc" ]; then echo "astronomy.h not found"; exit 1; fi; \ $(MKDIR) "$(DEPS_BUILD_DIR)/astronomy/build"; \ From 154ac6de884814e031da16ab054f91f1afc16e8c Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:02:00 +0100 Subject: [PATCH 07/33] clang --- src/ariadne.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ariadne.c b/src/ariadne.c index c7d8290ecb..a3f38bd24a 100644 --- a/src/ariadne.c +++ b/src/ariadne.c @@ -1614,9 +1614,7 @@ TbBool triangle_check_and_add_navitree_bak(long ttri) ERRORLOG("invalid triangle received"); return false; } - long n; long nskipped; - n = 0; nskipped = 0; long i; long k; @@ -1644,7 +1642,6 @@ TbBool triangle_check_and_add_navitree_bak(long ttri) } } } - n++; } if (nskipped != 0) { NAVIDBG(6,"navigate heap full, %ld points ignored",nskipped); From af2168f7269602f9e5c6f375902459cfaaf659a9 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:02:51 +0100 Subject: [PATCH 08/33] Update linux.mk --- linux.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux.mk b/linux.mk index 376db79fce..a5b6770459 100644 --- a/linux.mk +++ b/linux.mk @@ -530,7 +530,8 @@ deps/enet6/include/enet6/enet.h: | deps/enet6 header_path=$$(find "$(DEPS_BUILD_DIR)/enet6" -path "*/enet6/enet.h" | head -n 1); \ lib_path=$$(find "$(DEPS_BUILD_DIR)/enet6" \( -name libenet6.a -o -name libenet.a \) | head -n 1); \ if [ -z "$$header_path" ] || [ -z "$$lib_path" ]; then echo "enet6 build output not found"; exit 1; fi; \ - cp "$$header_path" deps/enet6/include/enet6/; \ + header_dir=$$(dirname "$$header_path"); \ + cp "$$header_dir"/*.h deps/enet6/include/enet6/; \ cp "$$lib_path" deps/enet6/libenet6.a src/ver_defs.h: version.mk From 5567c667d69250833f3bff369e76fc8f0e52044d Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:10:47 +0100 Subject: [PATCH 09/33] Update bflib_cpu.c --- src/bflib_cpu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bflib_cpu.c b/src/bflib_cpu.c index 5c7c865809..82ed68b18e 100644 --- a/src/bflib_cpu.c +++ b/src/bflib_cpu.c @@ -28,26 +28,24 @@ extern "C" { #endif /******************************************************************************/ +#if defined(__i386__) || defined(__x86_64__) /** Issue a single request to CPUID. * Fits 'intel features', for instance note that even if only "eax" and "edx" * are of interest, other registers will be modified by the operation, * so we need to tell the compiler about it. */ static inline void cpuid(int code, uint32_t *a, uint32_t *d) { - #if defined(__i386__) || defined(__x86_64__) asm volatile("cpuid":"=a"(*a),"=d"(*d):"0"(code):"ecx","ebx"); - #endif } /** Issue a complete request, storing general registers output in an array. */ static inline void cpuid_string(int code, void * destination) { - #if defined(__i386__) || defined(__x86_64__) uint32_t * where = (uint32_t *) destination; asm volatile("cpuid":"=a"(*where),"=b"(*(where+1)), "=c"(*(where+2)),"=d"(*(where+3)):"0"(code)); - #endif } +#endif /******************************************************************************/ void cpu_detect(struct CPU_INFO *cpu) From be450a19397a58d42d36a70fa9680be64ab93686 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:15:30 +0100 Subject: [PATCH 10/33] Update config.c --- src/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config.c b/src/config.c index 9c174aa912..9be0550370 100644 --- a/src/config.c +++ b/src/config.c @@ -21,6 +21,7 @@ #include #include +#include #include "globals.h" #include "bflib_basics.h" #include "bflib_math.h" @@ -44,6 +45,10 @@ #include "vidmode.h" #include "post_inc.h" +#ifndef strnicmp +#define strnicmp strncasecmp +#endif + #ifdef __cplusplus extern "C" { #endif From 24a5c867127944e0bfdc150b89bda536f1181fb0 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:38:58 +0100 Subject: [PATCH 11/33] no Werror --- linux.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux.mk b/linux.mk index a5b6770459..aa6b4230e6 100644 --- a/linux.mk +++ b/linux.mk @@ -363,8 +363,8 @@ KFX_INCLUDES = \ $(shell pkg-config --cflags-only-I zlib) \ $(shell pkg-config --cflags-only-I luajit) -KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char -KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char +KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char +KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char KFX_LDFLAGS += \ -g \ From d0fa16cb2f4a3c07f1c19f6a2e00c03e842b84be Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:45:21 +0100 Subject: [PATCH 12/33] Update pre_inc.h --- src/pre_inc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pre_inc.h b/src/pre_inc.h index 30c5f26c38..28b25e8b11 100644 --- a/src/pre_inc.h +++ b/src/pre_inc.h @@ -9,4 +9,10 @@ #include "pre_file.h" #endif +#include + +#ifndef strnicmp +#define strnicmp strncasecmp +#endif + #endif //GIT_PRE_INC_H From 4f593176495a8be67bfd3a66f02ddab40b23dbe2 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 16:45:30 +0100 Subject: [PATCH 13/33] Update config.c --- src/config.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/config.c b/src/config.c index 9be0550370..abdc9ba35c 100644 --- a/src/config.c +++ b/src/config.c @@ -21,7 +21,6 @@ #include #include -#include #include "globals.h" #include "bflib_basics.h" #include "bflib_math.h" @@ -45,9 +44,6 @@ #include "vidmode.h" #include "post_inc.h" -#ifndef strnicmp -#define strnicmp strncasecmp -#endif #ifdef __cplusplus extern "C" { From b9d10e9c89fc3ff8af057db136f7c0c0c23a4c0c Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:04:03 +0100 Subject: [PATCH 14/33] brackets --- src/lvl_script_lib.c | 3 +++ src/thing_stats.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/lvl_script_lib.c b/src/lvl_script_lib.c index d0eab84ea4..7808b8c80d 100644 --- a/src/lvl_script_lib.c +++ b/src/lvl_script_lib.c @@ -120,6 +120,7 @@ struct Thing *script_process_new_object(ThingModel tngmodel, MapSubtlCoord stl_x thing->valuable.gold_stored = arg; break; default: + { struct ObjectConfigStats* objst = get_object_model_stats(tngmodel); if (objst->genre == OCtg_GoldHoard) { @@ -129,6 +130,8 @@ struct Thing *script_process_new_object(ThingModel tngmodel, MapSubtlCoord stl_x } check_and_asimilate_thing_by_room(thing); } + break; + } } return thing; } diff --git a/src/thing_stats.c b/src/thing_stats.c index fc2c2c467a..7063753b5f 100644 --- a/src/thing_stats.c +++ b/src/thing_stats.c @@ -895,20 +895,30 @@ HitPoints get_thing_max_health(const struct Thing *thing) switch (thing->class_id) { case TCls_Creature: + { struct CreatureControl* cctrl = creature_control_get_from_thing(thing); return cctrl->max_health; + } case TCls_Object: + { struct ObjectConfigStats* objst = get_object_model_stats(thing->model); return objst->health; + } case TCls_Door: + { struct DoorConfigStats* doorst = get_door_model_stats(thing->model); return doorst->health; + } case TCls_Shot: + { struct ShotConfigStats* shotst = get_shot_model_stats(thing->model); return shotst->health; + } case TCls_Trap: + { struct TrapConfigStats* trapst = get_trap_model_stats(thing->model); return trapst->health; + } case TCls_EffectElem: case TCls_EffectGen: default: From c99fabc8e3fa519c24cb8bdb9ee3af396231e1d6 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:14:02 +0100 Subject: [PATCH 15/33] not just linux is posix --- src/bflib_crash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bflib_crash.c b/src/bflib_crash.c index 00317721a7..ff221a3850 100644 --- a/src/bflib_crash.c +++ b/src/bflib_crash.c @@ -50,7 +50,7 @@ static const char* sigstr(int s) case SIGFPE : return "Floating-point exception (ANSI)"; case SIGSEGV : return "Segmentation violation (ANSI)"; case SIGTERM : return "Termination (ANSI)"; -#if defined(__linux__) +#if !defined(_WIN32) case SIGHUP : return "Hangup (POSIX)"; case SIGQUIT : return "Quit (POSIX)"; case SIGTRAP : return "Trace trap (POSIX)"; @@ -334,7 +334,7 @@ void LbErrorParachuteInstall(void) signal(SIGFPE,ctrl_handler); signal(SIGSEGV,ctrl_handler); signal(SIGTERM,ctrl_handler); -#if defined(__linux__) +#if !defined(_WIN32) signal(SIGHUP,ctrl_handler); signal(SIGQUIT,ctrl_handler); signal(SIGSYS,ctrl_handler); From 4b805a244892a7cd80d063ca5e5be43655773070 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:14:04 +0100 Subject: [PATCH 16/33] Update linux.mk --- linux.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux.mk b/linux.mk index aa6b4230e6..35210454e8 100644 --- a/linux.mk +++ b/linux.mk @@ -77,6 +77,8 @@ ifeq ($(PLATFORM),linux) WARN_NO_FORMAT_TRUNCATION := -Wno-format-truncation endif +CXX_STD ?= -std=c++11 + KFX_SOURCES = \ src/actionpt.c \ src/api.c \ @@ -364,7 +366,7 @@ KFX_INCLUDES = \ $(shell pkg-config --cflags-only-I luajit) KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char -KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char +KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(CXX_STD) $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char KFX_LDFLAGS += \ -g \ From 56915746d6b58f24d8230b9c8c3c8c617d0772e2 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:18:22 +0100 Subject: [PATCH 17/33] Update bflib_crash.c --- src/bflib_crash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bflib_crash.c b/src/bflib_crash.c index ff221a3850..d9148a8896 100644 --- a/src/bflib_crash.c +++ b/src/bflib_crash.c @@ -50,7 +50,7 @@ static const char* sigstr(int s) case SIGFPE : return "Floating-point exception (ANSI)"; case SIGSEGV : return "Segmentation violation (ANSI)"; case SIGTERM : return "Termination (ANSI)"; -#if !defined(_WIN32) +#ifndef _WIN32 case SIGHUP : return "Hangup (POSIX)"; case SIGQUIT : return "Quit (POSIX)"; case SIGTRAP : return "Trace trap (POSIX)"; @@ -74,8 +74,12 @@ static const char* sigstr(int s) case SIGWINCH : return "Window size change (4.3 BSD, Sun)"; case SIGIO : return "I/O now possible (4.2 BSD)"; case SIGSYS : return "Bad system call"; +#ifdef SIGSTKFLT case SIGSTKFLT : return "Stack fault"; +#endif +#ifdef SIGPWR case SIGPWR : return "Power failure restart (System V)"; +#endif #else case SIGBREAK : return "Ctrl-Break (Win32)"; #endif From afe52e18a589d0af4717cbb9d0c0a13c03d88310 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:21:59 +0100 Subject: [PATCH 18/33] Update bflib_vidraw.h --- src/bflib_vidraw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bflib_vidraw.h b/src/bflib_vidraw.h index 5859266f72..bb57755e13 100644 --- a/src/bflib_vidraw.h +++ b/src/bflib_vidraw.h @@ -29,8 +29,8 @@ extern "C" { #define MAX_SUPPORTED_SPRITE_DIM 256 #define NUM_DRAWITEMS 238 -#define SPRITE_SCALING_XSTEPS max(MAX_SUPPORTED_SPRITE_DIM,MAX_SUPPORTED_SCREEN_WIDTH) -#define SPRITE_SCALING_YSTEPS max(MAX_SUPPORTED_SPRITE_DIM,MAX_SUPPORTED_SCREEN_HEIGHT) +#define SPRITE_SCALING_XSTEPS ((MAX_SUPPORTED_SPRITE_DIM) > (MAX_SUPPORTED_SCREEN_WIDTH) ? (MAX_SUPPORTED_SPRITE_DIM) : (MAX_SUPPORTED_SCREEN_WIDTH)) +#define SPRITE_SCALING_YSTEPS ((MAX_SUPPORTED_SPRITE_DIM) > (MAX_SUPPORTED_SCREEN_HEIGHT) ? (MAX_SUPPORTED_SPRITE_DIM) : (MAX_SUPPORTED_SCREEN_HEIGHT)) /******************************************************************************/ #pragma pack(1) From 24a5957cefb77f44c2d66b14d5d7aab8b4d026f3 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:26:27 +0100 Subject: [PATCH 19/33] Update linux.mk --- linux.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/linux.mk b/linux.mk index 35210454e8..b515b313a4 100644 --- a/linux.mk +++ b/linux.mk @@ -360,6 +360,7 @@ KFX_INCLUDES = \ $(shell pkg-config --cflags-only-I libswresample) \ $(shell pkg-config --cflags-only-I libavutil) \ $(shell pkg-config --cflags-only-I openal) \ + $(shell pkg-config --cflags-only-I openal-soft) \ $(shell pkg-config --cflags-only-I spng) \ $(shell pkg-config --cflags-only-I minizip) \ $(shell pkg-config --cflags-only-I zlib) \ From a34f3a2ec09ad80564ddcb068fc039d5799db34b Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:29:27 +0100 Subject: [PATCH 20/33] Update linux.mk --- linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux.mk b/linux.mk index b515b313a4..30b7ab9344 100644 --- a/linux.mk +++ b/linux.mk @@ -77,7 +77,7 @@ ifeq ($(PLATFORM),linux) WARN_NO_FORMAT_TRUNCATION := -Wno-format-truncation endif -CXX_STD ?= -std=c++11 +CXX_STD ?= -std=c++17 KFX_SOURCES = \ src/actionpt.c \ From 25f335a9dca258f2182e2fdd5343a6e7ebb094e8 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:35:11 +0100 Subject: [PATCH 21/33] Update linux.mk --- linux.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux.mk b/linux.mk index 30b7ab9344..14683b80b4 100644 --- a/linux.mk +++ b/linux.mk @@ -366,6 +366,12 @@ KFX_INCLUDES = \ $(shell pkg-config --cflags-only-I zlib) \ $(shell pkg-config --cflags-only-I luajit) +ifeq ($(PLATFORM),mac) +KFX_INCLUDES += \ + -I/opt/homebrew/opt/openal-soft/include \ + -I/usr/local/opt/openal-soft/include +endif + KFX_CFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-absolute-value -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char KFX_CXXFLAGS += -g -DDEBUG -DBFDEBUG_LEVEL=0 -O3 $(CXX_STD) $(ARCH_CFLAGS) $(KFX_INCLUDES) -Wall -Wextra -Wno-unused-parameter -Wno-unknown-pragmas $(WARN_NO_FORMAT_TRUNCATION) -Wno-sign-compare -fsigned-char From 565582b9ba18569c0961376dcd55ba3a3e07036f Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 17:40:02 +0100 Subject: [PATCH 22/33] Update linux.mk --- linux.mk | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/linux.mk b/linux.mk index 14683b80b4..a098b03cda 100644 --- a/linux.mk +++ b/linux.mk @@ -382,22 +382,30 @@ KFX_LDFLAGS += \ -Ldeps/astronomy -lastronomy \ -Ldeps/centijson -ljson \ -Ldeps/enet6 -lenet6 \ - $(shell pkg-config --libs-only-l sdl2) \ - $(shell pkg-config --libs-only-l SDL2_mixer) \ - $(shell pkg-config --libs-only-l SDL2_net) \ - $(shell pkg-config --libs-only-l SDL2_image) \ - $(shell pkg-config --libs-only-l libavformat) \ - $(shell pkg-config --libs-only-l libavcodec) \ - $(shell pkg-config --libs-only-l libswresample) \ - $(shell pkg-config --libs-only-l libavutil) \ - $(shell pkg-config --libs-only-l openal) \ - $(shell pkg-config --libs-only-l luajit) \ - $(shell pkg-config --libs-only-l spng) \ - $(shell pkg-config --libs-only-l minizip) \ - $(shell pkg-config --libs-only-l zlib) \ + $(shell pkg-config --libs sdl2) \ + $(shell pkg-config --libs SDL2_mixer) \ + $(shell pkg-config --libs SDL2_net) \ + $(shell pkg-config --libs SDL2_image) \ + $(shell pkg-config --libs libavformat) \ + $(shell pkg-config --libs libavcodec) \ + $(shell pkg-config --libs libswresample) \ + $(shell pkg-config --libs libavutil) \ + $(shell pkg-config --libs openal) \ + $(shell pkg-config --libs openal-soft) \ + $(shell pkg-config --libs luajit) \ + $(shell pkg-config --libs spng) \ + $(shell pkg-config --libs minizip) \ + $(shell pkg-config --libs zlib) \ -lminiupnpc \ -lnatpmp +ifeq ($(PLATFORM),mac) +KFX_LDFLAGS += \ + -L/opt/homebrew/opt/openal-soft/lib \ + -L/usr/local/opt/openal-soft/lib \ + -lopenal +endif + TOML_SOURCES = \ deps/centitoml/toml_api.c From a04369469cb49d2794cdee8f70020cfc7a042706 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 19:15:27 +0100 Subject: [PATCH 23/33] gcc --- .github/workflows/build-prototype.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index fa8e61aff3..3bb92b34c6 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -102,6 +102,7 @@ jobs: brew update brew install \ cmake \ + gcc \ pkg-config \ sdl2 \ sdl2_image \ @@ -119,10 +120,11 @@ jobs: - name: Build run: | set -eux + GCC_MAJOR=$(brew list --versions gcc | awk '{print $2}' | cut -d. -f1) BUILD_NUMBER=$(git rev-list --count origin/master) GITHUB_SHA=$(cat $GITHUB_EVENT_PATH | jq -r .pull_request.head.sha) PACKAGE_SUFFIX=Prototype_$(git rev-parse --short=7 "$GITHUB_SHA") - make BUILD_NUMBER=$BUILD_NUMBER VER_SUFFIX=$PACKAGE_SUFFIX PLATFORM=mac ARCH=arm64 -f linux.mk + make BUILD_NUMBER=$BUILD_NUMBER VER_SUFFIX=$PACKAGE_SUFFIX PLATFORM=mac ARCH=arm64 CC=gcc-$GCC_MAJOR CXX=g++-$GCC_MAJOR -f linux.mk - name: Upload artifact uses: actions/upload-artifact@v4 From c154cc1c7734419b23f7930a583179e0e2c47e6c Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 19:25:27 +0100 Subject: [PATCH 24/33] remove packing on some stuff --- src/bflib_filelst.h | 4 ---- src/bflib_guibtns.h | 3 --- src/config.h | 5 ----- 3 files changed, 12 deletions(-) diff --git a/src/bflib_filelst.h b/src/bflib_filelst.h index 9365e806c7..2410f3b2f7 100644 --- a/src/bflib_filelst.h +++ b/src/bflib_filelst.h @@ -26,8 +26,6 @@ extern "C" { #endif /******************************************************************************/ -#pragma pack(1) - struct TbLoadFiles; typedef const char * ModifyDataLoadFnameFunc(const char *); @@ -51,8 +49,6 @@ struct TbLoadFilesV2 { LoadFilesGetSizeFunc GetSizeFunc; LoadFilesUnpackFunc UnpackFunc; }; - -#pragma pack() /******************************************************************************/ const char * defaultModifyDataLoadFilename(const char *); ModifyDataLoadFnameFunc *LbDataLoadSetModifyFilenameFunction(ModifyDataLoadFnameFunc *newfunc); diff --git a/src/bflib_guibtns.h b/src/bflib_guibtns.h index 6ed4bec6f8..3442b32f6b 100644 --- a/src/bflib_guibtns.h +++ b/src/bflib_guibtns.h @@ -29,8 +29,6 @@ extern "C" { #endif /******************************************************************************/ -#pragma pack(1) - struct GuiButton; struct GuiMenu; struct GuiBox; @@ -217,7 +215,6 @@ struct EventTypeInfo { // Exported variables extern char backup_input_field[INPUT_FIELD_LEN]; extern struct GuiButton *input_button; -#pragma pack() /******************************************************************************/ extern TbCharCount input_field_pos; /******************************************************************************/ diff --git a/src/config.h b/src/config.h index 1d3c09d328..f3c38def31 100644 --- a/src/config.h +++ b/src/config.h @@ -115,9 +115,6 @@ enum TbConfigLoadFlags { CnfLd_IgnoreErrors = 0x04, /**< Do not log error message on failures (still, return with error). */ }; -#pragma pack(1) - - /******************************************************************************/ enum confCommandResults @@ -235,8 +232,6 @@ struct ConfigFileData{ /******************************************************************************/ extern char keeper_runtime_directory[152]; - -#pragma pack() /******************************************************************************/ extern unsigned long text_line_number; /******************************************************************************/ From cad551d643535eea5689d45e8954edb04a52c6e7 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 19:34:34 +0100 Subject: [PATCH 25/33] less packing still --- src/bflib_network.h | 5 +++-- src/bflib_sprite.h | 3 --- src/front_lvlstats.h | 3 --- src/frontend.h | 1 - src/gui_topmsg.h | 2 -- src/player_computer.h | 5 ----- src/player_instances.h | 5 ----- 7 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/bflib_network.h b/src/bflib_network.h index b62dc54e26..3d3c0f09de 100644 --- a/src/bflib_network.h +++ b/src/bflib_network.h @@ -35,7 +35,6 @@ extern "C" { #define TIMEOUT_LOBBY_EXCHANGE 3000 #define TIMEOUT_GAMEPLAY_MISSING_PACKET 8000 /******************************************************************************/ -#pragma pack(1) // New Declarations Here ====================================================== @@ -164,6 +163,8 @@ extern const struct NetSP tcpSP; // New Declarations End Here ================================================== +#pragma pack(push, 1) + struct TbNetworkSessionNameEntry; typedef long (*Net_Callback_Func)(void); @@ -245,7 +246,7 @@ long service_flags; /******************************************************************************/ -#pragma pack() +#pragma pack(pop) /******************************************************************************/ void LbNetwork_SetServerPort(int port); void LbNetwork_InitSessionsFromCmdLine(const char * str); diff --git a/src/bflib_sprite.h b/src/bflib_sprite.h index 202f0b3c7b..37bd66314c 100644 --- a/src/bflib_sprite.h +++ b/src/bflib_sprite.h @@ -27,8 +27,6 @@ extern "C" { #endif /******************************************************************************/ -#pragma pack(1) - /** * Type which contains buffer of a sprite, with RLE-encoded alpha channel. */ @@ -65,7 +63,6 @@ struct TiledSprite { unsigned char y_num; unsigned short spr_idx[10][10]; }; -#pragma pack() struct TbSpriteSheet * create_spritesheet(void); struct TbSpriteSheet * load_spritesheet(const char * data_fname, const char * index_fname); diff --git a/src/front_lvlstats.h b/src/front_lvlstats.h index cdf3d6cf88..84273bf485 100644 --- a/src/front_lvlstats.h +++ b/src/front_lvlstats.h @@ -28,8 +28,6 @@ extern "C" { #endif /******************************************************************************/ -#pragma pack(1) - typedef long (*StatGetValueCallback)(void *ptr); struct StatsData { // sizeof = 12 @@ -38,7 +36,6 @@ struct StatsData { // sizeof = 12 void *get_arg; }; -#pragma pack() /******************************************************************************/ void frontstats_draw_main_stats(struct GuiButton *gbtn); void frontstats_draw_scrolling_stats(struct GuiButton *gbtn); diff --git a/src/frontend.h b/src/frontend.h index 9754ace26c..12af27096f 100644 --- a/src/frontend.h +++ b/src/frontend.h @@ -41,7 +41,6 @@ extern "C" { // After that much milliseconds in main menu, demo is started #define MNU_DEMO_IDLE_TIME 30000 /******************************************************************************/ -#pragma pack(1) enum DemoItem_Kind { DIK_PlaySmkVideo, diff --git a/src/gui_topmsg.h b/src/gui_topmsg.h index 73a2da7ad8..68770f154c 100644 --- a/src/gui_topmsg.h +++ b/src/gui_topmsg.h @@ -27,7 +27,6 @@ extern "C" { #endif /******************************************************************************/ -#pragma pack(1) enum ErrorStatisticEntries { ESE_NoFreeThings = 0, @@ -48,7 +47,6 @@ struct ErrorStatistics { const char *msg; }; -#pragma pack() /******************************************************************************/ void erstats_clear(void); long erstat_inc(int stat_num); diff --git a/src/player_computer.h b/src/player_computer.h index ad5d93eadd..73e62a43a3 100644 --- a/src/player_computer.h +++ b/src/player_computer.h @@ -244,8 +244,6 @@ enum computer_process_func_list #define INVALID_COMPUTER_PROCESS NULL #define INVALID_COMPUTER_TASK &game.computer_task[0] /******************************************************************************/ -#pragma pack(1) - struct Computer2; struct ComputerProcess; struct ComputerCheck; @@ -460,9 +458,6 @@ struct ExpandRooms { /******************************************************************************/ -#pragma pack() -/******************************************************************************/ - /******************************************************************************/ extern struct ValidRooms valid_rooms_to_build[]; diff --git a/src/player_instances.h b/src/player_instances.h index ebfacd2ba9..0a62ed92dd 100644 --- a/src/player_instances.h +++ b/src/player_instances.h @@ -61,8 +61,6 @@ enum PlayerInstanceNum { PI_UnusedSlot18, }; /******************************************************************************/ -#pragma pack(1) - struct Thing; struct PlayerInfo; @@ -83,9 +81,6 @@ struct PlayerInstanceInfo { // sizeof = 44 #define PLAYER_INSTANCES_COUNT 19 #define PLAYER_INSTANCES_COUNT_OLD 17 -/******************************************************************************/ - -#pragma pack() /******************************************************************************/ extern struct PlayerInstanceInfo player_instance_info[PLAYER_INSTANCES_COUNT]; /******************************************************************************/ From 673ba50aa3acf81e79dbd8275d05b9806b1bf443 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 20:09:33 +0100 Subject: [PATCH 26/33] use .app --- .github/workflows/build-prototype.yml | 10 ++- tools/macos_bundle.sh | 89 +++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 tools/macos_bundle.sh diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index 3bb92b34c6..ff96d16cdb 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -126,8 +126,14 @@ jobs: PACKAGE_SUFFIX=Prototype_$(git rev-parse --short=7 "$GITHUB_SHA") make BUILD_NUMBER=$BUILD_NUMBER VER_SUFFIX=$PACKAGE_SUFFIX PLATFORM=mac ARCH=arm64 CC=gcc-$GCC_MAJOR CXX=g++-$GCC_MAJOR -f linux.mk + - name: Bundle app + run: | + set -eux + chmod +x tools/macos_bundle.sh + APP_NAME=KeeperFX.app OUTPUT_DIR=dist BIN_PATH=bin/keeperfx tools/macos_bundle.sh + - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: keeperfx-macos - path: bin/keeperfx + name: keeperfx-macos-app + path: dist/keeperfx.app diff --git a/tools/macos_bundle.sh b/tools/macos_bundle.sh new file mode 100644 index 0000000000..73b867de7b --- /dev/null +++ b/tools/macos_bundle.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash +set -euo pipefail + +APP_NAME="${APP_NAME:-KeeperFX.app}" +APP_BASENAME="${APP_NAME%.app}" +OUTPUT_DIR="${OUTPUT_DIR:-dist}" +BIN_PATH="${BIN_PATH:-bin/keeperfx}" + +APP_DIR="${OUTPUT_DIR}/${APP_NAME}" +MACOS_DIR="${APP_DIR}/Contents/MacOS" +RES_DIR="${APP_DIR}/Contents/Resources" +FW_DIR="${APP_DIR}/Contents/Frameworks" + +rm -rf "${APP_DIR}" +mkdir -p "${MACOS_DIR}" "${RES_DIR}" "${FW_DIR}" + +cp "${BIN_PATH}" "${MACOS_DIR}/keeperfx" +chmod +x "${MACOS_DIR}/keeperfx" + +cat > "${APP_DIR}/Contents/Info.plist" < + + + + CFBundleName + ${APP_BASENAME} + CFBundleIdentifier + org.keeperfx.${APP_BASENAME} + CFBundleVersion + 1.0 + CFBundleShortVersionString + 1.0 + CFBundleExecutable + keeperfx + CFBundlePackageType + APPL + LSMinimumSystemVersion + 12.0 + + +EOF + +install_name_tool -add_rpath "@executable_path/../Frameworks" "${MACOS_DIR}/keeperfx" 2>/dev/null || true + +declare -a queue +queue=("${MACOS_DIR}/keeperfx") + +declare -A seen + +while [ ${#queue[@]} -gt 0 ]; do + file="${queue[0]}" + queue=("${queue[@]:1}") + + if [ -n "${seen[${file}]:-}" ]; then + continue + fi + seen["${file}"]=1 + + deps=$(otool -L "${file}" | tail -n +2 | awk '{print $1}') + for dep in ${deps}; do + case "${dep}" in + /opt/homebrew/*|/usr/local/*) + libname=$(basename "${dep}") + target="${FW_DIR}/${libname}" + if [ ! -f "${target}" ]; then + cp "${dep}" "${target}" + chmod 644 "${target}" || true + queue+=("${target}") + fi + if [ "${file}" = "${MACOS_DIR}/keeperfx" ]; then + install_name_tool -change "${dep}" "@rpath/${libname}" "${file}" || true + else + install_name_tool -change "${dep}" "@loader_path/../Frameworks/${libname}" "${file}" || true + fi + ;; + esac + done + +done + +for dylib in "${FW_DIR}"/*.dylib; do + if [ -f "${dylib}" ]; then + libname=$(basename "${dylib}") + install_name_tool -id "@rpath/${libname}" "${dylib}" || true + install_name_tool -add_rpath "@loader_path/../Frameworks" "${dylib}" 2>/dev/null || true + fi +done + +echo "App bundle created at ${APP_DIR}" From b789030542400fd7600c6a7d52b37dbbb911ef80 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 20:15:28 +0100 Subject: [PATCH 27/33] Update macos_bundle.sh --- tools/macos_bundle.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/macos_bundle.sh b/tools/macos_bundle.sh index 73b867de7b..c3b105ff0d 100644 --- a/tools/macos_bundle.sh +++ b/tools/macos_bundle.sh @@ -45,16 +45,17 @@ install_name_tool -add_rpath "@executable_path/../Frameworks" "${MACOS_DIR}/keep declare -a queue queue=("${MACOS_DIR}/keeperfx") -declare -A seen +seen_file=$(mktemp) +trap 'rm -f "${seen_file}"' EXIT while [ ${#queue[@]} -gt 0 ]; do file="${queue[0]}" queue=("${queue[@]:1}") - if [ -n "${seen[${file}]:-}" ]; then + if grep -Fxq "${file}" "${seen_file}"; then continue fi - seen["${file}"]=1 + echo "${file}" >> "${seen_file}" deps=$(otool -L "${file}" | tail -n +2 | awk '{print $1}') for dep in ${deps}; do From 118427e8aba662e4d7e196fc1e03395c51858129 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sun, 15 Feb 2026 22:08:37 +0100 Subject: [PATCH 28/33] Update build-prototype.yml --- .github/workflows/build-prototype.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index ff96d16cdb..8c830ea2d4 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -132,8 +132,13 @@ jobs: chmod +x tools/macos_bundle.sh APP_NAME=KeeperFX.app OUTPUT_DIR=dist BIN_PATH=bin/keeperfx tools/macos_bundle.sh + - name: Package app + run: | + set -eux + ditto -c -k --keepParent dist/KeeperFX.app dist/KeeperFX.app.zip + - name: Upload artifact uses: actions/upload-artifact@v4 with: name: keeperfx-macos-app - path: dist/keeperfx.app + path: dist/KeeperFX.app.zip From 3f5f06411439ee1f7a6242f02cd2eab7a9cc8a73 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Sat, 21 Feb 2026 12:00:41 +0100 Subject: [PATCH 29/33] Update build-prototype.yml --- .github/workflows/build-prototype.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-prototype.yml b/.github/workflows/build-prototype.yml index 8355b64660..f08d458271 100644 --- a/.github/workflows/build-prototype.yml +++ b/.github/workflows/build-prototype.yml @@ -89,7 +89,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: keeperfx-linux + name: ${{ env.LINUX_ARTIFACT_NAME }} path: bin/keeperfx build-prototype-macos: From 7951e3928abdc77a13d7a1b6420451ec832b4d58 Mon Sep 17 00:00:00 2001 From: Pieter Vandecandelaere Date: Mon, 2 Mar 2026 13:51:05 +0100 Subject: [PATCH 30/33] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- linux.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux.mk b/linux.mk index a098b03cda..775b36830c 100644 --- a/linux.mk +++ b/linux.mk @@ -44,7 +44,12 @@ DEPS_SUFFIX ?= DEPS_DOWNLOAD ?= 1 ifeq ($(PLATFORM),linux) +ifeq ($(ARCH),x86_64) DEPS_SUFFIX ?= lin64 +else +# No prebuilt dependency archive defined for this architecture; disable downloads. +DEPS_DOWNLOAD ?= 0 +endif endif ifeq ($(PLATFORM),mac) DEPS_DOWNLOAD ?= 0 From b738d4ce14ba868d45fb8d979f851493fd276446 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Mon, 2 Mar 2026 14:17:22 +0100 Subject: [PATCH 31/33] _XOPEN_SOURCE --- src/bflib_crash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bflib_crash.c b/src/bflib_crash.c index 00545f3dae..5db65ad496 100644 --- a/src/bflib_crash.c +++ b/src/bflib_crash.c @@ -20,6 +20,9 @@ #if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif +#if defined(__APPLE__) && !defined(_XOPEN_SOURCE) +#define _XOPEN_SOURCE 700 +#endif #include "pre_inc.h" #include "bflib_crash.h" From ef678ab4faca7c6242fa7759512ade84fdc18eb3 Mon Sep 17 00:00:00 2001 From: qqluqq Date: Mon, 2 Mar 2026 14:23:56 +0100 Subject: [PATCH 32/33] Update bflib_crash.c --- src/bflib_crash.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bflib_crash.c b/src/bflib_crash.c index 5db65ad496..c5727b8195 100644 --- a/src/bflib_crash.c +++ b/src/bflib_crash.c @@ -20,9 +20,6 @@ #if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif -#if defined(__APPLE__) && !defined(_XOPEN_SOURCE) -#define _XOPEN_SOURCE 700 -#endif #include "pre_inc.h" #include "bflib_crash.h" @@ -42,7 +39,11 @@ #endif #if defined(BF_POSIX_CRASH) #include +#if defined(__APPLE__) +#include +#else #include +#endif #include #include #endif @@ -89,8 +90,12 @@ static const char* sigstr(int s) case SIGXFSZ : return "File size limit exceeded (4.2 BSD)"; case SIGVTALRM : return "Virtual alarm clock (4.2 BSD)"; case SIGPROF : return "Profiling alarm clock (4.2 BSD)"; +#ifdef SIGWINCH case SIGWINCH : return "Window size change (4.3 BSD, Sun)"; +#endif +#ifdef SIGIO case SIGIO : return "I/O now possible (4.2 BSD)"; +#endif #ifdef SIGSYS case SIGSYS : return "Bad system call"; #endif From b77aaddf037f68713768f509cdb809b66ee81b0c Mon Sep 17 00:00:00 2001 From: qqluqq Date: Mon, 2 Mar 2026 14:30:24 +0100 Subject: [PATCH 33/33] Update bflib_crash.c --- src/bflib_crash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bflib_crash.c b/src/bflib_crash.c index c5727b8195..1d4bed1f5d 100644 --- a/src/bflib_crash.c +++ b/src/bflib_crash.c @@ -17,6 +17,9 @@ * (at your option) any later version. */ /******************************************************************************/ +#if defined(__APPLE__) && !defined(_DARWIN_C_SOURCE) +#define _DARWIN_C_SOURCE 1 +#endif #if !defined(_GNU_SOURCE) #define _GNU_SOURCE #endif