diff options
Diffstat (limited to 'misc/cgo/testso/test.bash')
-rwxr-xr-x | misc/cgo/testso/test.bash | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/misc/cgo/testso/test.bash b/misc/cgo/testso/test.bash index 5f113d216..f4061c68e 100755 --- a/misc/cgo/testso/test.bash +++ b/misc/cgo/testso/test.bash @@ -1,10 +1,22 @@ -#!/bin/sh +#!/usr/bin/env bash # Copyright 2011 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. set -e -$(go env CC) $(go env GOGCCFLAGS) -shared -o libcgosotest.so cgoso_c.c + +args= +dyld_envvar=LD_LIBRARY_PATH +ext=so +if [ "$(uname)" == "Darwin" ]; then + args="-undefined suppress -flat_namespace" + dyld_envvar=DYLD_LIBRARY_PATH + ext=dylib +fi + +dylib=libcgosotest.$ext +$(go env CC) $(go env GOGCCFLAGS) -shared $args -o $dylib cgoso_c.c go build main.go -LD_LIBRARY_PATH=. ./main -rm -f libcgosotest.so main + +eval "$dyld_envvar"=. ./main +rm -rf $dylib main *.dSYM |