diff --git a/Makefile.inc1 b/Makefile.inc1 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -603,6 +603,11 @@ SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} .endif +MTREE_DIST= mtree -c -i -p . +.if ${MK_REPRODUCIBLE_BUILD} == "yes" +MTREE_DIST+= -R time | awk '/^\/set / { $$(NF+1)="time=${SOURCE_DATE_EPOCH}.000000000" }; { print }' +.endif + PKG_NAME_PREFIX?= FreeBSD PKG_MAINTAINER?= re@FreeBSD.org PKG_WWW?= https://www.FreeBSD.org @@ -1569,7 +1574,8 @@ ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz .else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - ${TAR_CMD} cvf - --exclude usr/lib/debug . | \ + ${MTREE_DIST} > ${WORLDTMP}/package-${dist}.mtree; \ + ${TAR_CMD} cvf - --exclude usr/lib/debug @${WORLDTMP}/package-${dist}.mtree | \ ${XZ_CMD} > ${PACKAGEDIR}/${dist}.txz .endif .endfor @@ -1581,7 +1587,7 @@ ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz . else ${_+_}cd ${DESTDIR}/${DISTDIR}/${dist}; \ - ${TAR_CMD} cvLf - usr/lib/debug | \ + ${TAR_CMD} cvLf - --include usr/lib/debug @${WORLDTMP}/package-${dist}.mtree | \ ${XZ_CMD} > ${PACKAGEDIR}/${dist}-dbg.txz . endif .endfor @@ -1974,22 +1980,24 @@ .else .if !defined(NO_INSTALLKERNEL) cd ${DESTDIR}/${DISTDIR}/kernel; \ - ${TAR_CMD} cvf - --exclude '*.debug' . | \ + ${MTREE_DIST} > ${WORLDTMP}/package-kernel.mtree; \ + ${TAR_CMD} cvf - --exclude '*.debug' @${WORLDTMP}/package-kernel.mtree | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.txz .endif .if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel; \ - ${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \ + ${TAR_CMD} cvf - --include '*/*/*.debug' @${WORLDTMP}/package-kernel.mtree | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz .endif .if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes" .for _kernel in ${BUILDKERNELS:[2..-1]} cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - ${TAR_CMD} cvf - --exclude '*.debug' . | \ + ${MTREE_DIST} > ${WORLDTMP}/package-kernel.${_kernel}.mtree; \ + ${TAR_CMD} cvf - --exclude '*.debug' @${WORLDTMP}/package-kernel.${_kernel}.mtree | \ ${XZ_CMD} > ${PACKAGEDIR}/kernel.${_kernel}.txz .if ${MK_DEBUG_FILES} != "no" cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \ - ${TAR_CMD} cvf - --include '*/*/*.debug' $$(eval find .) | \ + ${TAR_CMD} cvf - --include '*/*/*.debug' @${WORLDTMP}/package-kernel.${_kernel}.mtree | \ ${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}-dbg.txz .endif .endfor