From 769d77957166ec4bfb49053e1bc412edf5ee3b9f Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Mon, 7 Sep 2026 01:05:58 +0200 Subject: [PATCH] wip: packaging + scripts before archive into OpenKKnD --- include/ok_render.h | 20 +++++++++----- packaging/cmake/linux.cmake | 8 ++++++ packaging/cmake/macos.cmake | 9 +++++++ packaging/dragonfly/README.md | 4 +++ packaging/freebsd/Makefile | 11 ++++++++ packaging/linux-static/README.md | 12 +++++++++ packaging/openbsd/Makefile | 10 +++++++ packaging/pkgsrc/Makefile | 15 +++++++++++ packaging/windows-msi/README.md | 22 +++++++++++++++ scripts/bump-and-build.sh | 40 ++++++++++++++++++++++++++++ scripts/install-autobuild-launchd.sh | 33 +++++++++++++++++++++++ 11 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 packaging/cmake/linux.cmake create mode 100644 packaging/cmake/macos.cmake create mode 100644 packaging/dragonfly/README.md create mode 100644 packaging/freebsd/Makefile create mode 100644 packaging/linux-static/README.md create mode 100644 packaging/openbsd/Makefile create mode 100644 packaging/pkgsrc/Makefile create mode 100644 packaging/windows-msi/README.md create mode 100755 scripts/bump-and-build.sh create mode 100755 scripts/install-autobuild-launchd.sh diff --git a/include/ok_render.h b/include/ok_render.h index 410577a..e985d62 100644 --- a/include/ok_render.h +++ b/include/ok_render.h @@ -1,9 +1,15 @@ #ifndef OK_RENDER_H #define OK_RENDER_H -#include "ok_types.h" -#include -bool ok_render_init(int w, int h); -void ok_render_draw(const OkGame *g); -void ok_render_shutdown(void); -SDL_Window *ok_render_window(void); -#endif + +#include + +// Funktion zum Initialisieren des Render-Systems +void render_init(); + +// Funktion zum Zeichnen des aktuellen Spielzustands (vereinfacht) +void render_draw_state(void); + +// Funktion zum Beenden des Render-Systems +void render_shutdown(); + +#endif // OK_RENDER_H \ No newline at end of file diff --git a/packaging/cmake/linux.cmake b/packaging/cmake/linux.cmake new file mode 100644 index 0000000..dcc1cc3 --- /dev/null +++ b/packaging/cmake/linux.cmake @@ -0,0 +1,8 @@ +# Konfiguration für Linux (GCC/G++) +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Hier könnten spezifische Compiler-Flags für Linux hinzugefügt werden, z.B. für spezifische Bibliotheken +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c11") + +message(STATUS "Configured CMake for Linux (GCC)") \ No newline at end of file diff --git a/packaging/cmake/macos.cmake b/packaging/cmake/macos.cmake new file mode 100644 index 0000000..fb0e798 --- /dev/null +++ b/packaging/cmake/macos.cmake @@ -0,0 +1,9 @@ +# Konfiguration für macOS (Clang) +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Hier werden spezifische Compiler-Flags für macOS/Clang hinzugefügt. +# z.B. für bestimmte Apple-APIs oder spezifische Optimierungen. +# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c11 -mmacosx-version=13.0") + +message(STATUS "Configured CMake for macOS (Clang)") \ No newline at end of file diff --git a/packaging/dragonfly/README.md b/packaging/dragonfly/README.md new file mode 100644 index 0000000..9189d16 --- /dev/null +++ b/packaging/dragonfly/README.md @@ -0,0 +1,4 @@ +# DragonFly BSD + +Use the FreeBSD-style port under `../freebsd` as a starting point, or pkgsrc. +Document DPorts differences when a public distfile exists. diff --git a/packaging/freebsd/Makefile b/packaging/freebsd/Makefile new file mode 100644 index 0000000..c43b11e --- /dev/null +++ b/packaging/freebsd/Makefile @@ -0,0 +1,11 @@ +PORTNAME= openkknd +DISTVERSION= 0.1.0 +CATEGORIES= games +MAINTAINER= ports@FreeBSD.org +COMMENT= Original post-apoc RTS (portable C, SDL2) +LICENSE= MIT + +USES= cmake sdl +USE_SDL= sdl2 + +.include diff --git a/packaging/linux-static/README.md b/packaging/linux-static/README.md new file mode 100644 index 0000000..1f6be8a --- /dev/null +++ b/packaging/linux-static/README.md @@ -0,0 +1,12 @@ +# GNU/Linux static-ish build + +Prefer a mostly static binary when distro matrix is large: + +```bash +cmake -S . -B build-static -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_EXE_LINKER_FLAGS="-static-libgcc" +cmake --build build-static -j +``` + +Full static SDL2 is painful; document dynamic SDL2 `.so` + rpath as interim. +Ship AppImage later if needed. diff --git a/packaging/openbsd/Makefile b/packaging/openbsd/Makefile new file mode 100644 index 0000000..289c757 --- /dev/null +++ b/packaging/openbsd/Makefile @@ -0,0 +1,10 @@ +COMMENT = original post-apoc RTS (portable C, SDL2) +DISTNAME = openkknd-0.1.0 +CATEGORIES = games +HOMEPAGE = https://localhost/openkknd +# OpenBSD port skeleton — fill MASTER_SITES when released +PERMIT_PACKAGE = Yes +WANTLIB = c SDL2 +MODULES = devel/cmake +LIB_DEPENDS = devel/sdl2 +.include diff --git a/packaging/pkgsrc/Makefile b/packaging/pkgsrc/Makefile new file mode 100644 index 0000000..8d8d2f4 --- /dev/null +++ b/packaging/pkgsrc/Makefile @@ -0,0 +1,15 @@ +# $NetBSD$ +# OpenKKND — pkgsrc skeleton (NetBSD and pkgsrc on other OS) +DISTNAME= openkknd-0.1.0 +CATEGORIES= games +MASTER_SITES= # local / github later +MAINTAINER= pkgsrc-users@NetBSD.org +HOMEPAGE= https://localhost/openkknd +COMMENT= Original post-apoc RTS (portable C, SDL2) +LICENSE= mit + +USE_LANGUAGES= c11 +USE_CMAKE= yes +.include "../../devel/cmake/build.mk" +.include "../../devel/SDL2/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/packaging/windows-msi/README.md b/packaging/windows-msi/README.md new file mode 100644 index 0000000..383881e --- /dev/null +++ b/packaging/windows-msi/README.md @@ -0,0 +1,22 @@ +# Windows MSI (7 / 8 / 10) + +## Intent + +Ship `openkknd.exe` + SDL2 DLLs via **WiX** MSI. + +## Cross-build from macOS + +Not fully automated on firecuda yet. Options: + +1. CI on Windows runners (GitHub Actions) building with MSVC or MinGW + WiX. +2. MinGW-w64 cross toolchain + `makensis` / WiX on Linux CI. + +## Local script placeholder + +`build-msi.ps1` (to be added) should: + +- build Release with CMake + VS or MinGW +- harvest files with heat/candle/light +- produce `OpenKKND--win.msi` + +Target OS: Windows 7 SP1+, 8, 10 (avoid APIs newer than Win7 for the baseline binary). diff --git a/scripts/bump-and-build.sh b/scripts/bump-and-build.sh new file mode 100755 index 0000000..7c19f76 --- /dev/null +++ b/scripts/bump-and-build.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Bump patch version and release-build for this host. Run by LaunchAgent every 4h. +set -euo pipefail +export PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin" +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$ROOT" +mkdir -p logs dist +LOG="$ROOT/logs/build.log" +exec >>"$LOG" 2>&1 +echo "==== $(date -R) bump-and-build start ====" + +ver=$(tr -d "[:space:]" < VERSION) +IFS=. read -r maj min pat <<<"$ver" +pat=${pat:-0} +pat=$((pat + 1)) +new="${maj}.${min}.${pat}" +echo "$new" > VERSION +echo "version $ver -> $new" + +rm -rf build +cmake -S . -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build -j"$(sysctl -n hw.ncpu 2>/dev/null || echo 2)" +outdir="$ROOT/dist/$new" +mkdir -p "$outdir" +cp -f build/openkknd "$outdir/" +# record +{ + echo "version=$new" + echo "built=$(date -R)" + echo "host=$(hostname)" + echo "uname=$(uname -a)" + file "$outdir/openkknd" 2>/dev/null || true + ls -la "$outdir/openkknd" +} | tee "$outdir/BUILDINFO.txt" + +if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + git add VERSION + git commit -m "build: release $new (autobuild)" || true +fi +echo "==== $(date -R) done $new ====" diff --git a/scripts/install-autobuild-launchd.sh b/scripts/install-autobuild-launchd.sh new file mode 100755 index 0000000..8002c2b --- /dev/null +++ b/scripts/install-autobuild-launchd.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +PLIST="$HOME/Library/LaunchAgents/ch.openkknd.autobuild.plist" +mkdir -p "$HOME/Library/LaunchAgents" +cat > "$PLIST" << PL + + + + + Label + ch.openkknd.autobuild + ProgramArguments + + $ROOT/scripts/bump-and-build.sh + + StartInterval + 14400 + RunAtLoad + + StandardOutPath + $ROOT/logs/launchd.out.log + StandardErrorPath + $ROOT/logs/launchd.err.log + WorkingDirectory + $ROOT + + +PL +launchctl bootout "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true +launchctl bootstrap "gui/$(id -u)" "$PLIST" +launchctl enable "gui/$(id -u)/ch.openkknd.autobuild" 2>/dev/null || true +echo "Installed $PLIST (every 14400s = 4h)"