From 1ae953775f57efcce1fbc324ee981a8a4cf4795a Mon Sep 17 00:00:00 2001 From: Chen Yufei Date: Fri, 17 May 2013 13:18:20 +0800 Subject: [PATCH] Enable CGO for OS X when building binary. --- script/build.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/build.sh b/script/build.sh index cd8077b..30305d7 100755 --- a/script/build.sh +++ b/script/build.sh @@ -5,8 +5,6 @@ cd "$( dirname "${BASH_SOURCE[0]}" )/.." version=`grep 'const version = ' ./shadowsocks/util.go | sed -e 's/.*= //' | sed -e 's/"//g'` echo "creating shadowsocks binary version $version" -export CGO_ENABLED=0 - ROOT=`pwd` bindir=$ROOT/bin mkdir -p $bindir @@ -16,6 +14,13 @@ build() { local GOOS local GOARCH + if [[ $1 == "darwin" ]]; then + # Enable CGO for OS X so change network location will not cause problem. + export CGO_ENABLED=1 + else + export CGO_ENABLED=0 + fi + prog=shadowsocks-$4 pushd cmd/$prog name=$prog-$3-$version