2
0
mirror of synced 2025-02-22 22:38:18 +00:00
mobile/bind/objc/test.bash

32 lines
778 B
Bash
Raw Normal View History

#!/usr/bin/env bash
# Copyright 2015 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# This is a script to compile and run SeqTest.
set -e
export GOARCH=amd64
export GOOS=darwin # TODO: arm, arm64.
export CGO_ENABLED=1
WORK=`mktemp -d /tmp/objctest.XXXXX`
function cleanup() {
rm -rf ${WORK}
}
trap cleanup EXIT
(cd testpkg; go generate)
go build -x -v -buildmode=c-archive -o=${WORK}/libgo.a test_main.go
cp ./seq.h ${WORK}/
cp testpkg/objc_testpkg/GoTestpkg.* ${WORK}/
cp ./SeqTest.m ${WORK}/
ccargs="-Wl,-no_pie -framework Foundation -fobjc-arc"
$(go env CC) $(go env GOGCCFLAGS) $ccargs -o ${WORK}/a.out ${WORK}/libgo.a ${WORK}/GoTestpkg.m ${WORK}/SeqTest.m
${WORK}/a.out