pkgbase: Add a new variable PKG_TIMESTAMP

libarchive uses the SOURCE_DATE_EPOCH env variable to set the date of file
in an archive, this is useful for reproducibility.
Add a variable name PKG_TIMESTAMP that take a epoch time and set SOURCE_DATE_EPOCH
to this. By default it is the current time so no changes here.
This commit is contained in:
Emmanuel Vadot 2020-08-06 16:13:54 +00:00
parent 1931aa942f
commit d0327929ab

View File

@ -545,6 +545,13 @@ PKG_VERSION= ${_REVISION}${EXTRA_REVISION}
.endif
.endif # !defined(PKG_VERSION)
.if !defined(PKG_TIMESTAMP)
TIMEEPOCHNOW= %s
SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime}
.else
SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP}
.endif
.if !defined(_MKSHOWCONFIG)
_CPUTYPE!= MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAKE} -f /dev/null \
-m ${.CURDIR}/share/mk MK_AUTO_OBJ=no -V CPUTYPE
@ -1831,6 +1838,7 @@ create-packages-kernel: _pkgbootstrap _repodir .PHONY
${MAKE} -f Makefile.inc1 \
DESTDIR=${KSTAGEDIR} \
PKG_VERSION=${PKG_VERSION} DISTDIR=kernel \
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
create-kernel-packages
create-packages: .PHONY create-packages-world create-packages-kernel
@ -1847,6 +1855,7 @@ create-world-packages: _pkgbootstrap .PHONY
done > ${WSTAGEDIR}/packages.mk
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 create-world-packages-jobs \
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
.MAKE.JOB.PREFIX=
.if make(create-world-packages-jobs)