Files
sh 236893e1ac ci: add kotlin and ios build workflow (#7710)
* ci: add kotlin and ios build workflow

* ci: compile desktop kotlin without native lib

* ci: build apps kotlin targets sequentially

* ci: use node 24 actions in apps workflow

* ci: build kotlin and ios apps in build workflow

* ci: skip core jobs for app-only pull requests

* ci: choose builds to run from changed paths
2026-10-23 09:15:01 +01:00

41 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
# Creates stub static libraries in apps/ios/Libraries/sim so that the iOS app
# links for the simulator without the Haskell core.
# Run from repo root on macOS.
set -eu
IOS_DIR=apps/ios
PBXPROJ=$IOS_DIR/SimpleX.xcodeproj/project.pbxproj
OUT_DIR=$IOS_DIR/Libraries/sim
ARCH=arm64
MIN_IOS=15.0
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
# The linker resolves symbols by name only, so the stub signatures are not checked.
sed -n 's/^extern [^(]*[ *]\([a-z_]*\)(.*/\1/p' "$IOS_DIR/SimpleXChat/SimpleX.h" "$IOS_DIR/SimpleXChat/hs_init.c" \
| sort -u | sed 's/.*/void &(void) {}/' > "$tmp/stubs.c"
if [ ! -s "$tmp/stubs.c" ]; then
echo "Error: no extern functions found in SimpleX.h and hs_init.c" >&2
exit 1
fi
xcrun --sdk iphonesimulator clang -arch "$ARCH" -mios-simulator-version-min="$MIN_IOS" -c "$tmp/stubs.c" -o "$tmp/stubs.o"
xcrun ar rcs "$tmp/libstubs.a" "$tmp/stubs.o"
libs=$(sed -n 's/.*isa = PBXFileReference; lastKnownFileType = archive\.ar; path = "\{0,1\}\(lib[^";]*\.a\)"\{0,1\};.*/\1/p' "$PBXPROJ")
if [ -z "$libs" ]; then
echo "Error: no static library references found in $PBXPROJ" >&2
exit 1
fi
mkdir -p "$OUT_DIR"
echo "$libs" | while IFS= read -r lib; do
cp "$tmp/libstubs.a" "$OUT_DIR/$lib"
echo "$OUT_DIR/$lib"
done