Bladeren bron

Merge pull request #44853 from crazy-max/rm-install-suffix

hack: remove -installsuffix build flag
Sebastiaan van Stijn 2 jaren geleden
bovenliggende
commit
abdf23c6c0
5 gewijzigde bestanden met toevoegingen van 14 en 31 verwijderingen
  1. 2 13
      hack/make.sh
  2. 4 9
      hack/make/.binary
  3. 6 7
      hack/make/.go-autogen
  4. 1 1
      hack/make/dynbinary-daemon
  5. 1 1
      hack/make/dynbinary-proxy

+ 2 - 13
hack/make.sh

@@ -108,19 +108,8 @@ if [ -z "$DOCKER_DEBUG" ]; then
 	LDFLAGS='-w'
 	LDFLAGS='-w'
 fi
 fi
 
 
-LDFLAGS_STATIC=''
-EXTLDFLAGS_STATIC='-static'
-# ORIG_BUILDFLAGS is necessary for the cross target which cannot always build
-# with options like -race.
-ORIG_BUILDFLAGS=(-tags "netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo)
-# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
-
-BUILDFLAGS=(${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}")
-
-LDFLAGS_STATIC_DOCKER="
-	$LDFLAGS_STATIC
-	-extldflags \"$EXTLDFLAGS_STATIC\"
-"
+BUILDFLAGS=(${BUILDFLAGS} -tags "netgo osusergo static_build $DOCKER_BUILDTAGS")
+LDFLAGS_STATIC="-extldflags -static"
 
 
 if [ "$(uname -s)" = 'FreeBSD' ]; then
 if [ "$(uname -s)" = 'FreeBSD' ]; then
 	# Tell cgo the compiler is Clang, not GCC
 	# Tell cgo the compiler is Clang, not GCC

+ 4 - 9
hack/make/.binary

@@ -63,15 +63,10 @@ source "${MAKEDIR}/.go-autogen"
 	fi
 	fi
 
 
 	echo "Building $([ "$DOCKER_STATIC" = "1" ] && echo "static" || echo "dynamic") $DEST/$BINARY_FULLNAME ($PLATFORM_NAME)..."
 	echo "Building $([ "$DOCKER_STATIC" = "1" ] && echo "static" || echo "dynamic") $DEST/$BINARY_FULLNAME ($PLATFORM_NAME)..."
-	go build \
-		-o "$DEST/$BINARY_FULLNAME" \
-		"${BUILDFLAGS[@]}" \
-		-ldflags "
-		$LDFLAGS
-		$LDFLAGS_STATIC_DOCKER
-		$DOCKER_LDFLAGS
-	" \
-		${GO_PACKAGE}
+	if [ -n "$DOCKER_DEBUG" ]; then
+		set -x
+	fi
+	go build -o "$DEST/$BINARY_FULLNAME" "${BUILDFLAGS[@]}" -ldflags "$LDFLAGS $LDFLAGS_STATIC $DOCKER_LDFLAGS" ${GO_PACKAGE}
 )
 )
 
 
 echo "Created binary: $DEST/$BINARY_FULLNAME"
 echo "Created binary: $DEST/$BINARY_FULLNAME"

+ 6 - 7
hack/make/.go-autogen

@@ -1,13 +1,12 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
 LDFLAGS="${LDFLAGS} \
 LDFLAGS="${LDFLAGS} \
-	-X \"github.com/docker/docker/dockerversion.Version=${VERSION}\" \
-	-X \"github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT}\" \
-	-X \"github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME}\" \
-	-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \
-	-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \
-	-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" \
-"
+-X \"github.com/docker/docker/dockerversion.Version=${VERSION}\" \
+-X \"github.com/docker/docker/dockerversion.GitCommit=${GITCOMMIT}\" \
+-X \"github.com/docker/docker/dockerversion.BuildTime=${BUILDTIME}\" \
+-X \"github.com/docker/docker/dockerversion.PlatformName=${PLATFORM}\" \
+-X \"github.com/docker/docker/dockerversion.ProductName=${PRODUCT}\" \
+-X \"github.com/docker/docker/dockerversion.DefaultProductLicense=${DEFAULT_PRODUCT_LICENSE}\" "
 
 
 # Compile the Windows resources into the sources
 # Compile the Windows resources into the sources
 if [ "$(go env GOOS)" = "windows" ]; then
 if [ "$(go env GOOS)" = "windows" ]; then

+ 1 - 1
hack/make/dynbinary-daemon

@@ -4,7 +4,7 @@ set -e
 [ -z "$KEEPDEST" ] && rm -rf "$DEST"
 [ -z "$KEEPDEST" ] && rm -rf "$DEST"
 
 
 (
 (
-	export LDFLAGS_STATIC_DOCKER=''
+	export LDFLAGS_STATIC=''
 	export BUILDFLAGS=("${BUILDFLAGS[@]/netgo /}")        # disable netgo, since we don't need it for a dynamic binary
 	export BUILDFLAGS=("${BUILDFLAGS[@]/netgo /}")        # disable netgo, since we don't need it for a dynamic binary
 	export BUILDFLAGS=("${BUILDFLAGS[@]/osusergo /}")     # ditto for osusergo
 	export BUILDFLAGS=("${BUILDFLAGS[@]/osusergo /}")     # ditto for osusergo
 	export BUILDFLAGS=("${BUILDFLAGS[@]/static_build /}") # we're not building a "static" binary here
 	export BUILDFLAGS=("${BUILDFLAGS[@]/static_build /}") # we're not building a "static" binary here

+ 1 - 1
hack/make/dynbinary-proxy

@@ -3,7 +3,7 @@
 set -e
 set -e
 
 
 (
 (
-	export LDFLAGS_STATIC_DOCKER=''
+	export LDFLAGS_STATIC=''
 	export BUILDFLAGS=("${BUILDFLAGS[@]/netgo /}")        # disable netgo, since we don't need it for a dynamic binary
 	export BUILDFLAGS=("${BUILDFLAGS[@]/netgo /}")        # disable netgo, since we don't need it for a dynamic binary
 	export BUILDFLAGS=("${BUILDFLAGS[@]/osusergo /}")     # ditto for osusergo
 	export BUILDFLAGS=("${BUILDFLAGS[@]/osusergo /}")     # ditto for osusergo
 	export BUILDFLAGS=("${BUILDFLAGS[@]/static_build /}") # we're not building a "static" binary here
 	export BUILDFLAGS=("${BUILDFLAGS[@]/static_build /}") # we're not building a "static" binary here