From 57c618b83aea11c978c4f616f300ed013f5f8cbe Mon Sep 17 00:00:00 2001 From: Aleksa Sarai Date: Wed, 21 Jun 2023 18:48:05 +1000 Subject: [PATCH] build: add GO_EXTRA_FLAGS argument This is useful for setting things like -buildmode=pie when packaging docker-buildx for distributions. Signed-off-by: Aleksa Sarai --- hack/build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hack/build b/hack/build index 22a06469..7c23dc10 100755 --- a/hack/build +++ b/hack/build @@ -9,8 +9,9 @@ set -e : "${CGO_ENABLED=0}" : "${GO_PKG=github.com/docker/buildx}" +: "${GO_EXTRA_FLAGS=}" : "${GO_LDFLAGS=-X ${GO_PKG}/version.Version=${VERSION} -X ${GO_PKG}/version.Revision=${REVISION} -X ${GO_PKG}/version.Package=${PACKAGE}}" : "${GO_EXTRA_LDFLAGS=}" set -x -CGO_ENABLED=$CGO_ENABLED go build -mod vendor -trimpath -ldflags "${GO_LDFLAGS} ${GO_EXTRA_LDFLAGS}" -o "${DESTDIR}/docker-buildx" ./cmd/buildx +CGO_ENABLED=$CGO_ENABLED go build -mod vendor -trimpath ${GO_EXTRA_FLAGS} -ldflags "${GO_LDFLAGS} ${GO_EXTRA_LDFLAGS}" -o "${DESTDIR}/docker-buildx" ./cmd/buildx