Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build script for iOS (arm64) without CI #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions build_ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

mkdir /tmp/arm64
curl -L "https://mau.dev/tulir/mautrix-imessage/-/jobs/artifacts/master/download?job=build%20ios%20arm64" -o /tmp/arm64/mautrix-imessage-arm64.zip
unzip /tmp/arm64/mautrix-imessage-arm64.zip -d /tmp/arm64
cp /tmp/arm64/mautrix-imessage-ios-arm64/libolm.3.dylib /tmp/arm64/mautrix-imessage-ios-arm64/libolm.dylib

export CGO_ENABLED=1
export GOARCH=arm64
export GOOS=ios
export IPHONEOS_DEPLOYMENT_TARGET="7.0"
export SDK=iphoneos
export ARCH=arm64
export SDK_PATH=$(xcrun -sdk $SDK -show-sdk-path)
export CLANG=$(xcrun -sdk $SDK -find clang)
export LIBRARY_PATH=/tmp/arm64/mautrix-imessage-ios-arm64
export CPATH=/opt/homebrew/include
export PATH=/opt/homebrew/bin:$PATH
export CC=$(pwd)/clangwrap.sh
export CXX=$CC
export GO_LDFLAGS="-X main.Tag=1.0.0 -X main.Commit=`git rev-parse --short HEAD` -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"

mkdir -p mautrix-imessage-ios-arm64
go build -tags ios -ldflags "$GO_LDFLAGS" -o mautrix-imessage-ios-arm64/mautrix-imessage
install_name_tool -change build/libolm.dylib.3.2.4 @executable_path/libolm.3.dylib mautrix-imessage-ios-arm64/mautrix-imessage
ldid -S mautrix-imessage-ios-arm64/mautrix-imessage
cp /tmp/arm64/mautrix-imessage-ios-arm64/libolm.dylib mautrix-imessage-ios-arm64/libolm.3.dylib
ldid -S mautrix-imessage-ios-arm64/libolm.3.dylib

rm -rf /tmp/arm64