Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -2051,6 +2051,14 @@ DISTINFO_FILE?= ${MASTERDIR}/distinfo +# Timestamp for package archive metadata, for reproducible builds, with a +# default for ports that do not override it via distinfo. +TIMESTAMP= 1500000000 +.if !make(*depends*) && empty(.MAKEFLAGS:M-V) && \ + empty(.MAKEFLAGS:MTIMESTAMP) && exists(${DISTINFO_FILE}) +TIMESTAMP!= ${AWK} -F' = ' -v ts=${TIMESTAMP} '/^TIMESTAMP/ { ts=$$2 } END { print ts}' ${DISTINFO_FILE} +.endif + MAKE_FLAGS?= -f MAKEFILE?= Makefile MAKE_CMD?= ${BSDMAKE} @@ -2062,6 +2070,9 @@ LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \ CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \ MANPREFIX="${MANPREFIX}" +.if empty(USES:Mpython*) +PKG_ENV+= SOURCE_DATE_EPOCH=${TIMESTAMP} +.endif # Add -fno-strict-aliasing to CFLAGS with optimization level -O2 or higher. # gcc 4.x enable strict aliasing optimization with -O2 which is known to break