github.com/c-darwin/mobile@v0.0.0-20160313183840-ff625c46f7c9/bind/objc/test.bash (about) 1 #!/usr/bin/env bash 2 3 # Copyright 2015 The Go Authors. All rights reserved. 4 # Use of this source code is governed by a BSD-style 5 # license that can be found in the LICENSE file. 6 7 # This is a script to compile and run SeqTest. 8 9 set -e 10 11 export GOARCH=amd64 12 export GOOS=darwin # TODO: arm, arm64. 13 export CGO_ENABLED=1 14 15 WORK=`mktemp -d /tmp/objctest.XXXXX` 16 function cleanup() { 17 rm -rf ${WORK} 18 } 19 trap cleanup EXIT 20 21 (cd testpkg; go generate) 22 23 go build -x -v -buildmode=c-archive -o=${WORK}/libgo.a test_main.go 24 cp ./seq.h ${WORK}/ 25 cp testpkg/objc_testpkg/GoTestpkg.* ${WORK}/ 26 cp ./SeqTest.m ${WORK}/ 27 28 ccargs="-Wl,-no_pie -framework Foundation -fobjc-arc" 29 $(go env CC) $(go env GOGCCFLAGS) $ccargs -o ${WORK}/a.out ${WORK}/libgo.a ${WORK}/GoTestpkg.m ${WORK}/SeqTest.m 30 31 ${WORK}/a.out