build: cross-compile with Nix gcc toolchains instead of zig; drop macOS; v0.1.1
ci / release (push) Canceled after 47m21s
ci / release (push) Canceled after 47m21s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
Nim CLI (stdlib only, no nimble deps) for a file-based knowledge-graph memory.
|
||||
|
||||
## Tooling: devbox
|
||||
All tooling comes from devbox (nim, zig, git). Use `devbox shell` or
|
||||
All tooling comes from devbox (nim, git, file). Cross toolchains come from Nix (below). Use `devbox shell` or
|
||||
`devbox run <script>`. Fixing devbox.json / devbox.lock or running
|
||||
`devbox update` needs no permission.
|
||||
|
||||
@@ -11,19 +11,23 @@ All tooling comes from devbox (nim, zig, git). Use `devbox shell` or
|
||||
- `src/sirmem/core.nim`: all logic; every command is a `cmdXxx` proc returning its output, `dispatch` routes args.
|
||||
- `src/sirmem.nim`: thin main (`--dir`/`SIRMEM_DIR`, exit codes, stderr).
|
||||
- `tests/test_all.nim`: std/unittest; the CLI suite runs `bin/sirmem`, so build first.
|
||||
- `scripts/build.sh`, `scripts/zigcc`: cross-compile with `zig cc`.
|
||||
- `scripts/build.sh`: cross-compile with Nix-provided gcc toolchains.
|
||||
- `.gitea/workflows/release.yml`: CI (test on push, release on `v*` tag).
|
||||
|
||||
## Build / test
|
||||
- `devbox run build` -> `bin/sirmem`
|
||||
- `devbox run test` (builds the binary, then runs the tests)
|
||||
|
||||
## Cross-compile (zig cc)
|
||||
`scripts/build.sh <nim-os> <nim-cpu> <zig-target> <out>`, or `devbox run cross-all` -> `dist/`.
|
||||
Targets: linux amd64 `x86_64-linux-musl`, linux arm64 `aarch64-linux-musl`,
|
||||
macosx arm64 `aarch64-macos`, windows amd64 `x86_64-windows-gnu`.
|
||||
Known zig 0.16 quirks (documented in build.sh): do not use `--opt:size`; linux-musl needs
|
||||
`-d:useMalloc`; linux arm64 needs `--tlsEmulation:on` and links flakily, so the script retries.
|
||||
## Cross-compile (Nix cross gcc)
|
||||
`scripts/build.sh <linux-x86_64|linux-aarch64|windows-x86_64> [out]`, or `devbox run cross-all` -> `dist/`.
|
||||
Follows https://nim-lang.org/docs/nimc.html#crossminuscompilation: the script runs `nix shell nixpkgs#<pkg>.stdenv.cc`
|
||||
and sets `--os/--cpu` plus `--<cpu>.<os>.gcc.exe/.linkerexe/.path` (and plain `--gcc.*`, since the
|
||||
per-platform ones are ignored when target == host).
|
||||
- linux-x86_64: `pkgsCross.musl64`, static. linux-aarch64: `pkgsCross.aarch64-multiplatform-musl`, static.
|
||||
- windows-x86_64: `pkgsCross.mingwW64`, `-d:mingw`, static; needs `windows.mcfgthreads` on `-L` (gcc 15 threading lib).
|
||||
Supported targets: linux x86_64, linux aarch64, windows x86_64. **No macOS build** (dropped; no darwin toolchain).
|
||||
Quirk: nim.cfg pins the mingw `gcc.path` to /usr/bin, so the script overrides `.gcc.path`.
|
||||
The Nim version must be the devbox one (>= 2.2.12); older system nims fail to compile.
|
||||
|
||||
## Conventions
|
||||
- Errors: raise `SirmemError` (via `fail`); main prints `sirmem: error: ...`, exit 1. Warnings go to `Store.warnings` (stderr).
|
||||
|
||||
Reference in New Issue
Block a user