wip: packaging + scripts before archive into OpenKKnD

This commit is contained in:
OpenClaw 2026-09-07 01:05:58 +02:00
parent 820813e24b
commit 769d779571
11 changed files with 177 additions and 7 deletions

View file

@ -1,9 +1,15 @@
#ifndef OK_RENDER_H
#define OK_RENDER_H
#include "ok_types.h"
#include <SDL.h>
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 <stdio.h>
// 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

View file

@ -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)")

View file

@ -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)")

View file

@ -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.

View file

@ -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 <bsd.port.mk>

View file

@ -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.

View file

@ -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 <bsd.port.mk>

15
packaging/pkgsrc/Makefile Normal file
View file

@ -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"

View file

@ -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-<version>-win.msi`
Target OS: Windows 7 SP1+, 8, 10 (avoid APIs newer than Win7 for the baseline binary).

40
scripts/bump-and-build.sh Executable file
View file

@ -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 ===="

View file

@ -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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>ch.openkknd.autobuild</string>
<key>ProgramArguments</key>
<array>
<string>$ROOT/scripts/bump-and-build.sh</string>
</array>
<key>StartInterval</key>
<integer>14400</integer>
<key>RunAtLoad</key>
<false/>
<key>StandardOutPath</key>
<string>$ROOT/logs/launchd.out.log</string>
<key>StandardErrorPath</key>
<string>$ROOT/logs/launchd.err.log</string>
<key>WorkingDirectory</key>
<string>$ROOT</string>
</dict>
</plist>
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)"