Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1970,6 +1970,10 @@ CHECKSUM_ALGORITHMS?= sha256 DISTINFO_FILE?= ${MASTERDIR}/distinfo +TIMESTAMP= 1449231300 +.if exists(${DISTINFO_FILE}) +TIMESTAMP!= ${AWK} -F= -v ts=${TIMESTAMP} '/^timestamp/ { ts=$$2 } END { print ts}' ${DISTINFO_FILE} +.endif MAKE_FLAGS?= -f MAKEFILE?= Makefile @@ -1981,7 +1985,9 @@ CPP="${CPP}" CPPFLAGS="${CPPFLAGS}" \ LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \ CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \ - MANPREFIX="${MANPREFIX}" + MANPREFIX="${MANPREFIX}" \ + SOURCE_DATE_EPOCH=${TIMESTAMP} +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 @@ -4195,7 +4201,11 @@ makesum: check-checksum-algorithms @cd ${.CURDIR} && ${MAKE} fetch NO_CHECKSUM=yes \ DISABLE_SIZE=yes - @if [ -f ${DISTINFO_FILE} ]; then ${CAT} /dev/null > ${DISTINFO_FILE}; fi + @if [ -f ${DISTINFO_FILE} ]; then \ + if ${GREP} -q "^timestamp" ${DISTINFO_FILE}; then \ + ${GREP} -v "^timestamp" ${DISTINFO_FILE} > ${DISTINFO_FILE}.sav; \ + fi ; \ + fi @( \ cd ${DISTDIR}; \ \ @@ -4206,11 +4216,19 @@ eval alg_executable=\$$$$alg; \ \ if [ $$alg_executable != "NO" ]; then \ - $$alg_executable $$file >> ${DISTINFO_FILE}; \ + $$alg_executable $$file >> ${DISTINFO_FILE}.new; \ fi; \ done; \ - ${ECHO_CMD} "SIZE ($$file) = `${STAT} -f \"%z\" $$file`" >> ${DISTINFO_FILE}; \ - done \ + ${ECHO_CMD} "SIZE ($$file) = `${STAT} -f \"%z\" $$file`" >> ${DISTINFO_FILE}.new; \ + done ; \ + if [ ! -f ${DISTINFO_FILE}.sav ] || ! cmp -s ${DISTINFO_FILE}.sav ${DISTINFO_FILE}.new ; then \ + ${ECHO_CMD} "timestamp=`date '+%s'`" > ${DISTINFO_FILE} ; \ + ${CAT} ${DISTINFO_FILE}.new >> ${DISTINFO_FILE} ; \ + fi ; \ + rm ${DISTINFO_FILE}.new ; \ + if [ -f ${DISTINFO_FILE}.sav ]; then \ + ${RM} ${DISTINFO_FILE}.sav ; \ + fi; \ ) .endif