build: Add EXTRA_LDFLAGS environment variable handling (fixes #5999) (#6000)

Allow extending LDFLAGS by setting EXTRA_LDFLAGS to be able to pass
-extldflags=-zrelro -ldflags=-extldflags=-znow for Arch Linux packaging
to get full relro.
This commit is contained in:
jelle van der Waa 2019-09-07 20:21:09 +02:00 committed by Jakob Borg
parent 88482b29ee
commit 9a9bcff3e9

View File

@ -801,6 +801,9 @@ func ldflags() string {
fmt.Fprintf(b, " -X github.com/syncthing/syncthing/lib/build.Stamp%c%d", sep, buildStamp())
fmt.Fprintf(b, " -X github.com/syncthing/syncthing/lib/build.User%c%s", sep, buildUser())
fmt.Fprintf(b, " -X github.com/syncthing/syncthing/lib/build.Host%c%s", sep, buildHost())
if v := os.Getenv("EXTRA_LDFLAGS"); v != "" {
fmt.Fprintf(b, " %s", v);
}
return b.String()
}