nandi/vflutter_ffipublic Fork 0
4506a586d7400b00d732dcb97167be75ab41cab1
Commits
Clone
git clone https://git.rickub.com/nandi/vflutter_ffi.git
git clone ssh://git@rickub.com/nandi/vflutter_ffi.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

gen_ios_sources.sh · 37 lines · 1.3 KBBash Blame HistoryRaw
Initial commit: V -> Flutter FFI plugin ad0ccda nandi yesterday1#!/usr/bin/env bash
Replace V with Nim 472eb49 nandithebull 19h ago2# iOS/macOS cannot run `nim` from inside Xcode's sandbox, and App Store builds
3# want a static archive. So Nim's C output is generated ahead of time and
Initial commit: V -> Flutter FFI plugin ad0ccda nandi yesterday4# checked in; CocoaPods then compiles it like any other C source.
5#
Replace V with Nim 472eb49 nandithebull 19h ago6# Unlike a single-file C emitter, Nim writes one .c per module plus nimbase.h,
7# so the whole set is copied in and the stale ones cleared out first.
8#
9# Re-run this whenever src/nimflutter.nim changes.
Initial commit: V -> Flutter FFI plugin ad0ccda nandi yesterday10set -euo pipefail
11cd "$(dirname "$0")/.."
Replace V with Nim 472eb49 nandithebull 19h ago12
13nim_bin="${NIM:-nim}"
14command -v "$nim_bin" >/dev/null || {
15 echo "Nim compiler not on PATH (set NIM=/path/to/nim)"; exit 1; }
16nim_lib="$(dirname "$(dirname "$(command -v "$nim_bin")")")/lib"
17
18cache=build/nimcache_ios
19rm -rf "$cache"
20"$nim_bin" c --compileOnly --nimcache:"$cache" --mm:arc -d:danger \
21 --threads:on --noMain src/nimflutter.nim
22
23for dir in ios/Classes macos/Classes; do
24 rm -f "$dir"/*.c "$dir"/*.h
25 mkdir -p "$dir"
26 # Nim's filenames encode module paths with @ and @s; harmless for the
27 # compiler, but CocoaPods globs are happier with flat names.
28 i=0
29 for c in "$cache"/*.c; do
30 cp "$c" "$dir/nimflutter_$(printf '%02d' "$i").c"
31 i=$((i + 1))
32 done
33 cp "$nim_lib/nimbase.h" "$dir/nimbase.h"
34 cp src/nimflutter.h "$dir/nimflutter.h"
35done
36
37echo "regenerated ios/ + macos/ sources ($(ls ios/Classes/*.c | wc -l) C files)"