Skip to content

Commit

Permalink
Set static build ID in Go linker flags
Browse files Browse the repository at this point in the history
This improves build reproducibility.

Fixes #57
  • Loading branch information
JeremyRand committed Nov 18, 2019
1 parent a062a1a commit 81f0dcd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion projects/certdehydrate-dane-rest-api/build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ mkdir -p $GOPATH/src/github.com/namecoin
tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
mv $GOPATH/src/github.com/namecoin/certdehydrate-dane-rest-api-[% c('version') %] $GOPATH/src/github.com/namecoin/certdehydrate-dane-rest-api

go install -ldflags '-s' github.com/namecoin/certdehydrate-dane-rest-api
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install -ldflags '-s -buildid=' github.com/namecoin/certdehydrate-dane-rest-api

#mkdir -p /var/tmp/build
#tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
Expand Down
3 changes: 2 additions & 1 deletion projects/dnssec-hsts-native/build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ mkdir -p $GOPATH/src/github.com/namecoin
tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
mv $GOPATH/src/github.com/namecoin/dnssec-hsts-native-[% c('version') %] $GOPATH/src/github.com/namecoin/dnssec-hsts-native

go install -ldflags '-s' github.com/namecoin/dnssec-hsts-native/src/dnssec_hsts
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install -ldflags '-s -buildid=' github.com/namecoin/dnssec-hsts-native/src/dnssec_hsts

#mkdir -p /var/tmp/build
#tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
Expand Down
6 changes: 4 additions & 2 deletions projects/ncdns/build
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ mv $GOPATH/src/github.com/namecoin/ncdns-[% c('version') %] $GOPATH/src/github.c
[% END %]

[% FOREACH inst IN c("var/go_lib_install") %]
go install $TAGS -ldflags '-s' [% inst %]
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install $TAGS -ldflags '-s -buildid=' [% inst %]
[% END %]

[% FOREACH inst IN c("var/optional_go_lib_install") %]
go install $TAGS -ldflags '-s' [% inst %]
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install $TAGS -ldflags '-s -buildid=' [% inst %]
[% END %]

#mkdir -p /var/tmp/build
Expand Down
3 changes: 2 additions & 1 deletion projects/ncp11/build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ mkdir -p $GOPATH/src/github.com/namecoin
tar -C $GOPATH/src/github.com/namecoin -xf [% project %]-[% c('version') %].tar.gz
mv $GOPATH/src/github.com/namecoin/ncp11-[% c('version') %] $GOPATH/src/github.com/namecoin/ncp11

go install -ldflags '-s' -buildmode c-shared github.com/namecoin/ncp11
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install -ldflags '-s -buildid=' -buildmode c-shared github.com/namecoin/ncp11

#mkdir -p /var/tmp/build
#tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
Expand Down
3 changes: 2 additions & 1 deletion projects/ncprop279/build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ mv $GOPATH/src/github.com/namecoin/ncprop279-[% c('version') %] $GOPATH/src/gith
TAGS="-tags no_namecoin_tls"
[% END %]

go install $TAGS -ldflags '-s' github.com/namecoin/ncprop279
# TODO: Remove static build ID after migrating to Go 1.13.3+
go install $TAGS -ldflags '-s -buildid=' github.com/namecoin/ncprop279

#mkdir -p /var/tmp/build
#tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
Expand Down

0 comments on commit 81f0dcd

Please sign in to comment.