@@ -7,11 +7,6 @@ _ensure-protos:
77 exit 1 ; \
88 fi
99
10- _ ensure-ffi : _ensure-protos
11- @ if ! command -v llvm-strip > / dev/ null; then \
12- echo " llvm-strip not found, skipping." ; \
13- fi
14-
1510# Run all tests
1611test : _ensure-protos
1712 @ echo " Running tests..."
@@ -50,63 +45,8 @@ open-docs:
5045 @ echo " Opening documentation..."
5146 @ open target/ doc/ polycentric_core/ index.html
5247
53- # Build, strip, and deploy FFI static lib for a given target
54- _ build-ffi target dest : _ensure-ffi
55- #!/usr/bin/env bash
56- # Skip Apple targets on non-macOS
57- if [[ " {{target}}" == * apple* ]] && [[ " $( uname) " != " Darwin" ]]; then
58- echo " Skipping {{target}} (requires macOS)"
59- exit 0
60- fi
61- if ! rustup target list --installed | grep -q ' ^{{target}}$' ; then
62- echo " Skipping {{target}} (not installed — run 'rustup target add {{target}}' to enable)"
63- exit 0
64- fi
65- if ! cargo rustc --profile release-rs-core --target {{target}} --features ffi --no-default-features --crate-type staticlib 2>&1 ; then
66- echo " FAILED: {{target}}"
67- exit 1
68- fi
69- lib=" ../../target/{{target}}/release-rs-core/libpolycentric_core.a"
70- if command -v llvm-strip > /dev/null; then llvm-strip --strip-debug " $lib " ; fi
71- mkdir -p " {{dest}}"
72- cp " $lib " " {{dest}}/libpolycentric_core.a"
73- size=$( du -sh " {{dest}}/libpolycentric_core.a" | cut -f1 | xargs)
74- printf " %-30s %s\n" " {{target}}" " $size "
75-
76- ios-libs := " ../react-native/ios/libs"
77- android-libs := " ../react-native/android/libs"
78-
79- # Build FFI for real iOS devices (ARM64)
80- build-ffi-ios : (_build-ffi " aarch64-apple-ios" (ios-libs / " aarch64-apple-ios" ))
81- # Build FFI for iOS simulator on Apple Silicon Macs
82- build-ffi-ios-sim : (_build-ffi " aarch64-apple-ios-sim" (ios-libs / " aarch64-apple-ios-sim" ))
83- # Build FFI for iOS simulator on Intel Macs
84- build-ffi-ios-sim-x86 : (_build-ffi " x86_64-apple-ios" (ios-libs / " x86_64-apple-ios" ))
85- # Build FFI for Android ARM64
86- build-ffi-android-arm64 : (_build-ffi " aarch64-linux-android" (android-libs / " arm64-v8a" ))
87- # Build FFI for Android ARMv7
88- build-ffi-android-armv7 : (_build-ffi " armv7-linux-androideabi" (android-libs / " armeabi-v7a" ))
89- # Build FFI for Android x86
90- build-ffi-android-x86 : (_build-ffi " i686-linux-android" (android-libs / " x86" ))
91- # Build FFI for Android x86_64
92- build-ffi-android-x86_64 : (_build-ffi " x86_64-linux-android" (android-libs / " x86_64" ))
93-
94- _ clean-react-native-libs :
95- @ rm -rf {{ ios-libs}} {{ android-libs}}
96- # Build all Android targets
97- build-ffi-android-all : build-ffi-android-arm64 build-ffi-android-armv7 build-ffi-android-x86 build-ffi-android-x86_64
98-
99- # Build everything (sim + android), deploy to react-native
100- build-all : _clean-react-native-libs build-ffi-ios-sim build-ffi-android-all
101-
102- # Build everything (device + android), deploy to react-native
103- build-all-device : _clean-react-native-libs build-ffi-ios build-ffi-android-all
104-
105-
10648# Clean build artifacts
10749clean :
10850 @ echo " Cleaning build artifacts..."
10951 @ cargo clean
110- @ if [ -d pkg-web ]; then rm -rf pkg-web; echo " Removed pkg-web directory." ; fi
111- @ if [ -d pkg-node ]; then rm -rf pkg-node; echo " Removed pkg-node directory." ; fi
11252 @ echo " Build artifacts have been removed."
0 commit comments