浏览代码

Refactor the handling of static-related build flags

This is as discussed with @shykes on IRC
Tianon Gravi 11 年之前
父节点
当前提交
d789750851
共有 3 个文件被更改,包括 3 次插入4 次删除
  1. 1 1
      hack/make.sh
  2. 1 2
      hack/make/binary
  3. 1 1
      hack/make/test

+ 1 - 1
hack/make.sh

@@ -45,7 +45,7 @@ if [ -n "$(git status --porcelain)" ]; then
 fi
 fi
 
 
 # Use these flags when compiling the tests and final binary
 # 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'
 BUILDFLAGS='-tags netgo'
 
 
 bundle() {
 bundle() {

+ 1 - 2
hack/make/binary

@@ -2,6 +2,5 @@
 
 
 DEST=$1
 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"
 echo "Created binary: $DEST/docker-$VERSION"

+ 1 - 1
hack/make/test

@@ -17,7 +17,7 @@ bundle_test() {
 			set -x
 			set -x
 			cd $test_dir
 			cd $test_dir
 			go test -i
 			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
 		)  done
 	} 2>&1 | tee $DEST/test.log
 	} 2>&1 | tee $DEST/test.log
 }
 }