From 56108a08baca637d185f2dc6bac36c5a45a08722 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sat, 16 Apr 2022 04:55:04 +0800 Subject: [PATCH] golang: Fix conditionals not stripped Signed-off-by: Jeffery To (cherry picked from commit 86fd1ebbe44e5c0747b8429493257e9317eacb07) --- lang/golang/golang-host-build.mk | 8 ++++---- lang/golang/golang-package.mk | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lang/golang/golang-host-build.mk b/lang/golang/golang-host-build.mk index ee4f1ea31..4b9e29873 100644 --- a/lang/golang/golang-host-build.mk +++ b/lang/golang/golang-host-build.mk @@ -107,10 +107,10 @@ GO_HOST_CUSTOM_LDFLAGS= \ GO_HOST_INSTALL_ARGS= \ -v \ -ldflags "all=$(GO_HOST_DEFAULT_LDFLAGS)" \ - $(if $(filter $(GO_HOST_ENABLE_PIE),1),-buildmode pie) \ - $(if $(GO_HOST_GCFLAGS),-gcflags "$(GO_HOST_GCFLAGS)") \ - $(if $(GO_HOST_CUSTOM_LDFLAGS),-ldflags "$(GO_HOST_CUSTOM_LDFLAGS) $(GO_HOST_DEFAULT_LDFLAGS)") \ - $(if $(GO_HOST_TAGS),-tags "$(GO_HOST_TAGS)") + $(if $(GO_HOST_ENABLE_PIE),-buildmode pie) \ + $(if $(strip $(GO_HOST_GCFLAGS)),-gcflags "$(GO_HOST_GCFLAGS)") \ + $(if $(strip $(GO_HOST_CUSTOM_LDFLAGS)),-ldflags "$(GO_HOST_CUSTOM_LDFLAGS) $(GO_HOST_DEFAULT_LDFLAGS)") \ + $(if $(strip $(GO_HOST_TAGS)),-tags "$(GO_HOST_TAGS)") define GoHost/Host/Configure $(GO_GENERAL_BUILD_CONFIG_VARS) \ diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index fb13e55d7..20a993726 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -241,15 +241,15 @@ GO_PKG_INSTALL_ARGS= \ -buildvcs=false \ -trimpath \ -ldflags "all=$(GO_PKG_DEFAULT_LDFLAGS)" \ - $(if $(GO_PKG_DEFAULT_GCFLAGS),-gcflags "all=$(GO_PKG_DEFAULT_GCFLAGS)") \ - $(if $(GO_PKG_DEFAULT_ASMFLAGS),-asmflags "all=$(GO_PKG_DEFAULT_ASMFLAGS)") \ - $(if $(filter $(GO_PKG_ENABLE_PIE),1),-buildmode pie) \ + $(if $(strip $(GO_PKG_DEFAULT_GCFLAGS)),-gcflags "all=$(GO_PKG_DEFAULT_GCFLAGS)") \ + $(if $(strip $(GO_PKG_DEFAULT_ASMFLAGS)),-asmflags "all=$(GO_PKG_DEFAULT_ASMFLAGS)") \ + $(if $(GO_PKG_ENABLE_PIE),-buildmode pie) \ $(if $(filter $(GO_ARCH),arm),-installsuffix "v$(GO_ARM)") \ $(if $(filter $(GO_ARCH),mips mipsle),-installsuffix "$(GO_MIPS)") \ $(if $(filter $(GO_ARCH),mips64 mips64le),-installsuffix "$(GO_MIPS64)") \ - $(if $(GO_PKG_GCFLAGS),-gcflags "$(GO_PKG_GCFLAGS) $(GO_PKG_DEFAULT_GCFLAGS)") \ - $(if $(GO_PKG_CUSTOM_LDFLAGS),-ldflags "$(GO_PKG_CUSTOM_LDFLAGS) $(GO_PKG_DEFAULT_LDFLAGS)") \ - $(if $(GO_PKG_TAGS),-tags "$(GO_PKG_TAGS)") + $(if $(strip $(GO_PKG_GCFLAGS)),-gcflags "$(GO_PKG_GCFLAGS) $(GO_PKG_DEFAULT_GCFLAGS)") \ + $(if $(strip $(GO_PKG_CUSTOM_LDFLAGS)),-ldflags "$(GO_PKG_CUSTOM_LDFLAGS) $(GO_PKG_DEFAULT_LDFLAGS)") \ + $(if $(strip $(GO_PKG_TAGS)),-tags "$(GO_PKG_TAGS)") define GoPackage/Build/Configure $(GO_GENERAL_BUILD_CONFIG_VARS) \