From 917b8bf5595023494456d8555a1f6b801b737bfc Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Wed, 25 Sep 2024 08:46:52 +0100 Subject: Update sample build scripts Recent binaries released on frippery.org use the time of the latest commit as the build time. This is achieved through the SOURCE_DATE_EPOCH environment variable, which is respected by the upstream BusyBox build system. The sample build scripts have been updated to do the same. This doesn't result in perfectly reproducible builds as the toolchains used don't all support SOURCE_DATE_EPOCH. Add some more details to the README file. --- examples/mswin-build/README | 19 ++++++++++++++++--- examples/mswin-build/mkprerelease | 6 ++++-- examples/mswin-build/mkrelease | 7 +++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/examples/mswin-build/README b/examples/mswin-build/README index 41cd6ebb2..e1d550d74 100644 --- a/examples/mswin-build/README +++ b/examples/mswin-build/README @@ -5,9 +5,22 @@ latter needs to be downloaded and installed from: https://github.com/mstorsjo/llvm-mingw -The release build performs some additional optimisation and is -slightly slower as a result. +The script should be run from the directory above a git repository +named busybox-w32. The builds are performed in the directories +named in the TARGETS variable in the scripts. Previous copies of +these directories are deleted. + +The scripts check out the master branch of the git repository. You +should edit the script if you wish to build from a different commit. + +The build time recorded in the executables is the time of the checked +out commit. This may not result in a perfectly reproducible build +but it's a step in that direction. + +The release build performs some additional optimisation and takes +slightly longer as a result. The busybox-w32 help message includes information about the build platform. Obtaining this information is very specific to the -platform used. +platform used: you may need to adjust this if building on something +other than Fedora. diff --git a/examples/mswin-build/mkprerelease b/examples/mswin-build/mkprerelease index 1bdf886d9..7562c8557 100755 --- a/examples/mswin-build/mkprerelease +++ b/examples/mswin-build/mkprerelease @@ -45,7 +45,8 @@ do cd $i git checkout master - make ${CONFIG} + SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ + make ${CONFIG} ) done @@ -70,7 +71,8 @@ do CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt) VERSION="$GCCV; $CRTV" fi - make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" MINGW_VER="$VERSION" + SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ + make -j $(nproc) EXTRAVERSION="-$(git describe --match=FRP | sed 's/FRP/PRE/')" MINGW_VER="$VERSION" ) done diff --git a/examples/mswin-build/mkrelease b/examples/mswin-build/mkrelease index 6dfd6c87e..2f59dce13 100755 --- a/examples/mswin-build/mkrelease +++ b/examples/mswin-build/mkrelease @@ -41,7 +41,9 @@ do fi cd $i - make ${CONFIG} + git checkout master + SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ + make ${CONFIG} # The clang/aarch64 build is not subject to optimisation. The # '-flto' option increased the size of the binary slightly (0.23%) @@ -89,7 +91,8 @@ do CRTV=$(rpm -q --qf '%{name} %{version}-%{release}\n' mingw${BITS}-crt) VERSION="$GCCV; $CRTV" fi - make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VERSION" + SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) TZ=UTC0 \ + make -j $(nproc) EXTRAVERSION="-`git describe --match=FRP`" MINGW_VER="$VERSION" ) done -- cgit v1.2.3-55-g6feb