diff mbox series

[v2,1/1] package/pkg-golang: enable trimpath option for reproducible builds

Message ID 20191207195707.3798442-1-christian@paral.in
State Accepted
Headers show
Series [v2,1/1] package/pkg-golang: enable trimpath option for reproducible builds | expand

Commit Message

Christian Stewart Dec. 7, 2019, 7:57 p.m. UTC
The -trimpath option 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>
---

v1 -> v2:

 - Fixed indentation on trimpath

 package/pkg-golang.mk | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Korsgaard Dec. 8, 2019, 7:42 a.m. UTC | #1
>>>>> "Christian" == Christian Stewart <christian@paral.in> writes:

 > The -trimpath option 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>
 > ---

 > v1 -> v2:
 >  - Fixed indentation on trimpath

Committed after extending the commit message to clarify that this is a
new feature in go 1.13, so we shouldn't backport this to 2019.02.x.
diff mbox series

Patch

diff --git a/package/pkg-golang.mk b/package/pkg-golang.mk
index e47de17aba..2494ce028c 100644
--- a/package/pkg-golang.mk
+++ b/package/pkg-golang.mk
@@ -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.