change build scripts to make reproducible builds possible

- makes SOURCE_DATE_EPOCH affect BUILDDATE and version string
- makes wpsbuild.pl output deterministic
- omits unnecessary extended metadata from zip files
- runs strip-nondeterminism on zip files if REPRODUCIBLE_ZIP is set

Change-Id: I1617e3f5233b2bc356fcfa6457be1a7785c303f9
This commit is contained in:
Skye 2026-08-07 22:27:45 +09:00 • committed by Solomon Peachy
parent 21e95258f2
commit 85c1ff8667
6 changed files with 18 additions and 4 deletions

View file

@ -259,7 +259,7 @@ GetOptions ( 'r|root=s' => \$ROOT,
# Thus we use the ":" for those for which we use a default value in case of ""
# and assign the default value afterwards
if ($ziptool eq '') {
$ziptool = "zip -r9";
$ziptool = "zip -r9 -X";
}
if ($output eq '') {
$output = "rockbox.zip"

4
tools/configure vendored
View file

@ -4915,7 +4915,11 @@ export BUILDDIR=${pwd}
export RBCODEC_BLD=${pwd}/lib/rbcodec
export VOICELANGUAGE=${voicelanguage}
export MEMORYSIZE=${memory}
ifeq (\$(SOURCE_DATE_EPOCH),)
export BUILDDATE:=\$(shell date -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
else
export BUILDDATE:=\$(shell date -d "@\$(SOURCE_DATE_EPOCH)" -u +'-DYEAR=%Y -DMONTH=%m -DDAY=%d')
endif
export MKFIRMWARE=${tool}
export BMP2RB_MONO=${bmp2rb_mono}
export BMP2RB_NATIVE=${bmp2rb_native}

View file

@ -351,6 +351,9 @@ $(BUILDDIR)/rockbox.zip: build
endif
$(call PRINTS,ZIP rockbox$(ZIPFILESUFFIX).zip)
$(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) --app=$(APPLICATION) -m \"$(MODELNAME)\" -i \"$(TARGET_ID)\" -o $(BUILDDIR)/rockbox$(ZIPFILESUFFIX).zip -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(BUILDZIPOPTS) $(TARGET) $(BINARY)
ifneq ($(REPRODUCIBLE_ZIP),)
$(SILENT)strip-nondeterminism $(BUILDDIR)/rockbox$(ZIPFILESUFFIX).zip
endif
mapzip:
$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip

View file

@ -50,7 +50,11 @@ if [ -z $VERSION ]; then
# Ok, we need to derive it from the Version Control system
VER=`gitversion $TOP`
fi
VERSION=$VER-`date -u +%y%m%d`
if [ -z $SOURCE_DATE_EPOCH ]; then
VERSION=$VER-`date -u +%y%m%d`
else
VERSION=$VER-`date -d @$SOURCE_DATE_EPOCH -u +%y%m%d`
fi
fi
echo $VERSION