Skip to content

Commit 18f434e

Browse files
committed
script/release.sh: make builds reproducible
What it takes is add an empty buildid, which, together with previously added strip invocation, results in reproducible build! NB: earlier versions of this patch also added the following: 1. non-random libseccomp install $prefix; 2. "objcopy --enable-deterministic-archives $prefix/lib/libseccomp.a" to strip ar dates and UIDs/GIDs; 3. "-B=0x00" to EXTRA_LDFLAGS to have non-variable NT_GNU_BUILD_ID. Apparently, all this is not needed with strip. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 61e201a commit 18f434e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

script/release.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function build_project() {
3333
local libseccomp_ver='2.5.1'
3434
local tarball="libseccomp-${libseccomp_ver}.tar.gz"
3535
local prefix
36-
local ldflags="-w -s"
3736
prefix="$(mktemp -d)"
3837
wget "https://github.com/seccomp/libseccomp/releases/download/v${libseccomp_ver}/${tarball}"{,.asc}
3938
tar xf "$tarball"
@@ -44,6 +43,11 @@ function build_project() {
4443
)
4544
mv "$tarball"{,.asc} "$builddir"
4645

46+
# For reproducible builds, add these to EXTRA_LDFLAGS:
47+
# -w to disable DWARF generation;
48+
# -s to disable symbol table;
49+
# -buildid= to remove variable build id.
50+
local ldflags="-w -s -buildid="
4751
# Add -a to go build flags to make sure it links against
4852
# the provided libseccomp, not the system one (otherwise
4953
# it can reuse cached pkg-config results).

0 commit comments

Comments
 (0)