Bug 1169158 - Avoid NSPR using dates it generates at build time. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 28 May 2015 16:47:19 +0900
changeset 246867 739e16f56c9035f978591c8410b461ed21baa6f7
parent 246866 8f567d651c1a281408fa7a92767ac5a7ea11cd2f
child 246868 486cd5d1caf746b69f62e80f22faf248707c6fd3
push id28843
push usercbook@mozilla.com
push dateWed, 03 Jun 2015 11:50:02 +0000
treeherdermozilla-central@6c612d7adbf5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1169158
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1169158 - Avoid NSPR using dates it generates at build time. r=gps
config/external/nspr/Makefile.in
--- a/config/external/nspr/Makefile.in
+++ b/config/external/nspr/Makefile.in
@@ -19,19 +19,31 @@ ifdef MOZ_FOLD_LIBS
 EXTRA_MAKE_FLAGS := SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
 
 # Work around libVersionPoint conflict between all three libraries.
 # See bug #838566.
 EXTRA_MAKE_FLAGS += XP_DEFINE=-DlibVersionPoint='libVersionPoint$$(LIBRARY_NAME)'
 else
 # nspr's make export compiles and links everything, but linking can't happen
 # during export on platforms where nspr is linked against mozcrt/mozglue.
-export:: EXTRA_MAKE_FLAGS := SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
+export:: EXTRA_MAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY= SHARED_LIB_PDB=
 endif
 
+MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
+
+# The NSPR build system uses build-time generated dates for public API
+# exposed data structures. Use the buildid as forced date, to avoid
+# having to deal with what changing NSPR itself might mean.
+
+# SH_DATE is a date with the format "%Y-%m-%d %T"
+EXTRA_MAKE_FLAGS += SH_DATE="$(shell $(PYTHON) -c 'd = "$(MOZ_BUILDID)"; print d[0:4]+"-"+d[4:6]+"-"+d[6:8]+" "+d[8:10]+":"+d[10:12]+":"+d[12:14]')"
+
+# SH_NOW is a date as a unix timestamp in ┬Áseconds
+EXTRA_MAKE_FLAGS += SH_NOW="$(shell $(PYTHON) -c 'import time, calendar; print calendar.timegm(time.strptime("$(MOZ_BUILDID)", "%Y%m%d%H%M%S"))')000000"
+
 clean distclean export::
 	$(MAKE) -C $(DEPTH)/nsprpub $@ $(EXTRA_MAKE_FLAGS)
 
 target::
 # nspr's libs and install rule re-export headers, and that can race with other
 # compilations, so use a separate directory here. The headers are exported
 # during export anyways.
 	$(MAKE) -C $(DEPTH)/nsprpub libs $(EXTRA_MAKE_FLAGS) dist_includedir=$(ABS_DIST)/nspr-include