Merge pull request #17 from farazdagi/develop

32 bit & 64 bit status-go for iOS #16
This commit is contained in:
Jarrad 2016-07-20 13:02:26 +02:00 committed by GitHub
commit f959259278
2 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,6 @@
.PHONY: statusgo all test xgo clean
.PHONY: statusgo-android statusgo-ios
GOBIN = build/bin GOBIN = build/bin
GO ?= latest GO ?= latest
@ -6,9 +9,23 @@ statusgo:
@echo "status go compilation done." @echo "status go compilation done."
@echo "Run \"build/bin/statusgo\" to view available commands" @echo "Run \"build/bin/statusgo\" to view available commands"
statusgo-cross: statusgo-android statusgo-ios
@echo "Full cross compilation done:"
@ls -ld $(GOBIN)/statusgo-*
statusgo-android: xgo statusgo-android: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar ./src build/env.sh $(GOBIN)/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/flags.sh) ./src
@echo "Android cross compilation done:" @echo "Android cross compilation done:"
statusgo-ios: xgo
build/env.sh $(GOBIN)/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-7.0/framework -v $(shell build/flags.sh) ./src
@echo "iOS framework cross compilation done:"
xgo: xgo:
build/env.sh go get github.com/karalabe/xgo build/env.sh go get github.com/karalabe/xgo
test:
build/env.sh go test ./...
clean:
rm -fr $(GOBIN)/*

22
build/flags.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
set -e
if [ ! -f "build/env.sh" ]; then
echo "$0 must be run from the root of the repository."
exit 2
fi
# Since Go 1.5, the separator char for link time assignments
# is '=' and using ' ' prints a warning. However, Go < 1.5 does
# not support using '='.
sep=$(go version | awk '{ if ($3 >= "go1.5" || index($3, "devel")) print "="; else print " "; }' -)
# set gitCommit when running from a Git checkout.
if [ -f ".git/HEAD" ]; then
echo "-ldflags '-X main.gitCommit$sep$(git rev-parse HEAD)'"
fi
if [ ! -z "$GO_OPENCL" ]; then
echo "-tags opencl"
fi