Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -2003,6 +2003,13 @@ 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 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} @@ -2014,6 +2021,7 @@ LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \ CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \ MANPREFIX="${MANPREFIX}" +PKG_ENV+= SOURCE_DATE_EPOCH=${TIMESTAMP} # 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