aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-08-22 20:23:16 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-24 17:00:39 +0200
commit8f8dee83035d30e4b82c370489ceabec687eb6ad (patch)
tree66de712f1886513d28e2dbb870a13db5c3ebb1b3 /Makefile
parent3ba8a3b7502491e3c657f8665415e4425279c66d (diff)
downloadaerc-8f8dee83035d30e4b82c370489ceabec687eb6ad.tar.gz
aerc: fix build when GOFLAGS contains spaces
Due to multiple levels of nested quoting, it is not possible to escape spaces and/or quotes from GOFLAGS and pass the value to go build -ldflags to set a compile time variable. Encode main.Flags in base64 and decode it when reading it. Fixes: d7e6dc3649ea ("aerc: add build info to version string") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile3
1 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 551fb1ed..e21c1e60 100644
--- a/Makefile
+++ b/Makefile
@@ -11,10 +11,11 @@ MANDIR?=$(PREFIX)/share/man
GO?=go
GOFLAGS?=
BUILD_OPTS?=-trimpath
+flags!=echo -- $(GOFLAGS) | base64 | tr -d '\n'
# ignore environment variable
GO_LDFLAGS:=
GO_LDFLAGS+=-X main.Version=$(VERSION)
-GO_LDFLAGS+=-X main.Flags=$(GOFLAGS)
+GO_LDFLAGS+=-X main.Flags=$(flags)
GO_LDFLAGS+=-X git.sr.ht/~rjarry/aerc/config.shareDir=$(SHAREDIR)
GO_LDFLAGS+=$(GO_EXTRA_LDFLAGS)