feat: sirmem v0.1.0 knowledge-graph memory CLI
ci / test (push) Failing after 3m39s
ci / release (push) Skipped

This commit is contained in:
2026-11-22 16:10:32 +01:00
commit 0fdcce7bf8
12 changed files with 1522 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# usage: scripts/build.sh <nim-os> <nim-cpu> <zig-target> <output>
# e.g. scripts/build.sh windows amd64 x86_64-windows-gnu dist/sirmem-windows-x86_64.exe
set -euo pipefail
cd "$(dirname "$0")/.."
os=$1 cpu=$2 target=$3 out=$4
mkdir -p "$(dirname "$out")"
export ZIG_TARGET=$target
# Notes from trial and error with zig 0.16: --opt:size breaks linking (empty undefined
# symbols); -d:useMalloc is needed on linux-musl; aarch64-linux needs --tlsEmulation:on
# (TLS relocs fail to link otherwise) but x86_64-linux fails *with* it.
extra=()
if [ "$os" = linux ] && [ "$cpu" = arm64 ]; then extra+=(--tlsEmulation:on); fi
# zig cc 0.16 sporadically fails to link aarch64-linux ("undefined symbol:" with an empty
# name, also seen as CacheCheckFailed); a retry succeeds, so retry up to 5 times.
for attempt in 1 2 3 4 5; do
rm -rf "nimcache/$target"
if nim c -d:release -d:strip -d:useMalloc --parallelBuild:1 --hints:off \
"${extra[@]}" --os:"$os" --cpu:"$cpu" \
--cc:clang --clang.exe:"$PWD/scripts/zigcc" --clang.linkerexe:"$PWD/scripts/zigcc" \
--nimcache:"nimcache/$target" -o:"$out" src/sirmem.nim ; then exit 0; fi
echo "build attempt $attempt failed, retrying" >&2
done
exit 1