#!/usr/bin/env bash # Host build + smoke test. CI entry point; not used by Flutter itself. set -euo pipefail cd "$(dirname "$0")/.." nim_bin="${NIM:-nim}" command -v "$nim_bin" >/dev/null || { echo "Nim compiler not on PATH (set NIM=/path/to/nim)"; exit 1; } mkdir -p build # --mm:arc, not the default ORC: this library hands raw pointers to Dart and # frees them on request, so there are no cycles to collect and no reason to # pay for a cycle detector. -d:danger drops runtime checks the C ABI cannot # report anyway, and turns on the optimiser — without it the numeric kernels # run several times slower. # # --threads:on because Dart calls in from many isolates, each its own OS # thread; --noMain because the host program owns main(), not Nim. "$nim_bin" c --app:lib --mm:arc -d:danger --threads:on --noMain \ -o:build/libnimflutter.so src/nimflutter.nim echo "built: $(stat -c%s build/libnimflutter.so) bytes" nm -D --defined-only build/libnimflutter.so | grep ' nf_' || { echo "no nf_ exports!"; exit 1; }