WIP: Build ios #39
|
@ -4,3 +4,4 @@ cwtch.aar
|
||||||
libCwtch.h
|
libCwtch.h
|
||||||
libCwtch.so
|
libCwtch.so
|
||||||
libCwtch.dll
|
libCwtch.dll
|
||||||
|
ios/
|
||||||
|
|
23
Makefile
23
Makefile
|
@ -1,3 +1,5 @@
|
||||||
|
IOS_OUT := ./ios
|
||||||
|
|
||||||
.PHONY: all clean linux android
|
.PHONY: all clean linux android
|
||||||
|
|
||||||
DEFAULT_GOAL: linux
|
DEFAULT_GOAL: linux
|
||||||
|
@ -24,3 +26,24 @@ libCwtch.dll: lib.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll
|
rm -f cwtch.aar cwtch_go.apk libCwtch.h libCwtch.so cwtch-sources.jar libCwtch.dll
|
||||||
|
|
||||||
|
ios-arm64:
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
GOOS=darwin \
|
||||||
|
GOARCH=arm64 \
|
||||||
|
SDK=iphoneos \
|
||||||
|
CGO_CFLAGS="-fembed-bitcode" \
|
||||||
|
CC=$(PWD)/clangwrap.sh \
|
||||||
|
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/arm64.a .
|
||||||
|
|
||||||
|
ios-x86_64:
|
||||||
|
CGO_ENABLED=1 \
|
||||||
|
GOOS=darwin \
|
||||||
|
GOARCH=amd64 \
|
||||||
|
SDK=iphonesimulator \
|
||||||
|
CC=$(PWD)/clangwrap.sh \
|
||||||
|
go build -buildmode=c-archive -tags ios -o $(IOS_OUT)/x86_64.a .
|
||||||
|
|
||||||
|
ios: ios-arm64 ios-x86_64
|
||||||
|
lipo $(IOS_OUT)/x86_64.a $(IOS_OUT)/arm64.a -create -output $(IOS_OUT)/cwtch.a
|
||||||
|
cp $(IOS_OUT)/arm64.h $(IOS_OUT)/cwtch.h
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# go/clangwrap.sh
|
||||||
|
|
||||||
|
SDK_PATH=`xcrun --sdk $SDK --show-sdk-path`
|
||||||
|
CLANG=`xcrun --sdk $SDK --find clang`
|
||||||
|
|
||||||
|
if [ "$GOARCH" == "amd64" ]; then
|
||||||
|
CARCH="x86_64"
|
||||||
|
elif [ "$GOARCH" == "arm64" ]; then
|
||||||
|
CARCH="arm64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec $CLANG -arch $CARCH -isysroot $SDK_PATH -mios-version-min=10.0 "$@"
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
sed -i "s/^package cwtch/\/\/package cwtch/" lib.go
|
perl -pi -e "s/^package cwtch/\/\/package cwtch/" lib.go
|
||||||
ineiti marked this conversation as resolved
|
|||||||
sed -i "s/^\/\/package main/package main/" lib.go
|
perl -pi -e "s/^\/\/package main/package main/" lib.go
|
||||||
sed -i "s/^\/\/func main()/func main()/" lib.go
|
perl -pi -e "s/^\/\/func main()/func main()/" lib.go
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
sed -i "s/^\/\/package cwtch/package cwtch/" lib.go
|
perl -pi -e "s/^\/\/package cwtch/package cwtch/" lib.go
|
||||||
sed -i "s/^package main/\/\/package main/" lib.go
|
perl -pi -e "s/^package main/\/\/package main/" lib.go
|
||||||
sed -i "s/^func main()/\/\/func main()/" lib.go
|
perl -pi -e "s/^func main()/\/\/func main()/" lib.go
|
||||||
|
|
Loading…
Reference in New Issue
nice, should be good!
but if you're doing this, should change switch-gomobile.sh to match :)