package/pkg-golang: enable trimpath option for reproducible builds
authorChristian Stewart <christian@paral.in>
Sat, 7 Dec 2019 19:57:07 +0000 (11:57 -0800)
committerPeter Korsgaard <peter@korsgaard.com>
Sun, 8 Dec 2019 07:40:48 +0000 (08:40 +0100)
The -trimpath option (introduced in go 1.13) removes absolute build paths
from the target binary.  This results in more consistent / reproducible
builds across different systems with varying paths to Buildroot.

Signed-off-by: Christian Stewart <christian@paral.in>
[Peter: mention that this is a go 1.13+ feature]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/pkg-golang.mk

index e47de17aba65cff8629b89d3242061dd9204783f..2494ce028cf5cecac1adf05c84ad7cee3bbec6e9 100644 (file)
@@ -61,6 +61,7 @@ $(2)_WORKSPACE ?= _gopath
 $(2)_BUILD_OPTS += \
        -ldflags "$$($(2)_LDFLAGS)" \
        -tags "$$($(2)_TAGS)" \
+       -trimpath \
        -p $(PARALLEL_JOBS)
 
 # Target packages need the Go compiler on the host.