github.com/bgentry/go@v0.0.0-20150121062915-6cf5a733d54d/misc/cgo/testso/test.bash (about)

     1  #!/usr/bin/env bash
     2  # Copyright 2011 The Go Authors.  All rights reserved.
     3  # Use of this source code is governed by a BSD-style
     4  # license that can be found in the LICENSE file.
     5  
     6  set -e
     7  
     8  if [ "$(uname -m)" == ppc64 -o "$(uname -m)" == ppc64le ]; then
     9  	# External linking not implemented on ppc64
    10  	echo "skipping test on ppc64 (issue #8912)"
    11  	exit
    12  fi
    13  
    14  args=
    15  dyld_envvar=LD_LIBRARY_PATH
    16  ext=so
    17  if [ "$(uname)" == "Darwin" ]; then
    18  	args="-undefined suppress -flat_namespace"
    19  	dyld_envvar=DYLD_LIBRARY_PATH
    20  	ext=dylib
    21  fi
    22  
    23  dylib=libcgosotest.$ext
    24  $(go env CC) $(go env GOGCCFLAGS) -shared $args -o $dylib cgoso_c.c
    25  go build main.go
    26  
    27  eval "$dyld_envvar"=. ./main
    28  rm -rf $dylib main *.dSYM