From d7897508516c05e7ffea5b96053ec80c7771d777 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 17 Oct 2013 23:38:34 -0600 Subject: [PATCH] Refactor the handling of static-related build flags This is as discussed with @shykes on IRC --- hack/make.sh | 2 +- hack/make/binary | 3 +-- hack/make/test | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hack/make.sh b/hack/make.sh index 903df4a502..dd2a96945c 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -45,7 +45,7 @@ if [ -n "$(git status --porcelain)" ]; then fi # Use these flags when compiling the tests and final binary -LDFLAGS='-X main.GITCOMMIT "'$GITCOMMIT'" -X main.VERSION "'$VERSION'" -w -linkmode external -extldflags "-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files"' +LDFLAGS='-X main.GITCOMMIT "'$GITCOMMIT'" -X main.VERSION "'$VERSION'" -w' BUILDFLAGS='-tags netgo' bundle() { diff --git a/hack/make/binary b/hack/make/binary index 4c2c248975..4bc0effc43 100644 --- a/hack/make/binary +++ b/hack/make/binary @@ -2,6 +2,5 @@ DEST=$1 -go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS" $BUILDFLAGS ./docker - +go build -o $DEST/docker-$VERSION -ldflags "$LDFLAGS -linkmode external -extldflags \"-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files\"" $BUILDFLAGS ./docker echo "Created binary: $DEST/docker-$VERSION" diff --git a/hack/make/test b/hack/make/test index 090e2782c1..eab131f71d 100644 --- a/hack/make/test +++ b/hack/make/test @@ -17,7 +17,7 @@ bundle_test() { set -x cd $test_dir go test -i - go test -v -ldflags "$LDFLAGS" $BUILDFLAGS $TESTFLAGS + go test -v -ldflags "$LDFLAGS -linkmode external -extldflags \"-lpthread -static -Wl,--unresolved-symbols=ignore-in-object-files\"" $BUILDFLAGS $TESTFLAGS ) done } 2>&1 | tee $DEST/test.log }