2013-05-24 05:56:01 -06:00
|
|
|
#!/usr/bin/env bash
|
2012-03-07 08:15:20 -07:00
|
|
|
# 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
|
2013-05-21 10:32:03 -06:00
|
|
|
|
|
|
|
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
|
2012-03-08 10:13:41 -07:00
|
|
|
go build main.go
|
2013-05-21 10:32:03 -06:00
|
|
|
|
|
|
|
eval "$dyld_envvar"=. ./main
|
|
|
|
rm -rf $dylib main *.dSYM
|