mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1246881 - Generate a header defining MOZ_BUILDID. r=mshal
This commit is contained in:
parent
8df73c7616
commit
a92afddeaa
@ -15,9 +15,11 @@ export TOPLEVEL_BUILD := 1
|
||||
|
||||
default::
|
||||
|
||||
ifndef TEST_MOZBUILD
|
||||
ifdef MOZ_BUILD_APP
|
||||
include $(topsrcdir)/$(MOZ_BUILD_APP)/build.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
@ -28,6 +30,10 @@ DIST_GARBAGE = config.cache config.log config.status* config-defs.h \
|
||||
netwerk/necko-config.h xpcom/xpcom-config.h xpcom/xpcom-private.h \
|
||||
.mozconfig.mk
|
||||
|
||||
ifndef MOZ_PROFILE_USE
|
||||
buildid.h: FORCE
|
||||
endif
|
||||
|
||||
ifdef JS_STANDALONE
|
||||
configure_dir = $(topsrcdir)/js/src
|
||||
else
|
||||
|
@ -9,11 +9,6 @@ include $(topsrcdir)/config/makefiles/makeutils.mk
|
||||
ifdef MOZ_APP_BASENAME
|
||||
APP_INI_DEPS = $(topsrcdir)/config/milestone.txt
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
APP_INI_DEPS += $(DEPTH)/config/buildid
|
||||
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template='{node}\n' 2>/dev/null))
|
||||
|
@ -15,6 +15,7 @@
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#endif
|
||||
#filter substitution
|
||||
#include @TOPOBJDIR@/buildid.h
|
||||
[App]
|
||||
Vendor=@MOZ_APP_VENDOR@
|
||||
Name=@MOZ_APP_BASENAME@
|
||||
|
@ -75,3 +75,5 @@ if CONFIG['MOZ_APP_BASENAME']:
|
||||
FINAL_TARGET_PP_FILES += ['application.ini']
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
|
||||
FINAL_TARGET_PP_FILES += ['update-settings.ini']
|
||||
|
||||
DEFINES['TOPOBJDIR'] = TOPOBJDIR
|
||||
|
30
build/variables.py
Normal file
30
build/variables.py
Normal file
@ -0,0 +1,30 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def buildid_header(output):
|
||||
buildid = os.environ.get('MOZ_BUILD_DATE')
|
||||
if buildid and len(buildid) != 14:
|
||||
print('Ignoring invalid MOZ_BUILD_DATE: %s' % buildid, file=sys.stderr)
|
||||
buildid = None
|
||||
if not buildid:
|
||||
buildid = datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
output.write("#define MOZ_BUILDID %s\n" % buildid)
|
||||
|
||||
|
||||
def main(args):
|
||||
if (len(args)):
|
||||
func = globals().get(args[0])
|
||||
if func:
|
||||
return func(sys.stdout, *args[1:])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv[1:]))
|
@ -238,7 +238,7 @@ profiledbuild::
|
||||
ifdef MOZ_UNIFY_BDATE
|
||||
ifndef MOZ_BUILD_DATE
|
||||
ifdef MOZ_BUILD_PROJECTS
|
||||
MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/toolkit/xre/make-platformini.py --print-buildid)
|
||||
MOZ_BUILD_DATE = $(shell $(PYTHON) $(TOPSRCDIR)/build/variables.py buildid_header | awk '{print $$3}')
|
||||
export MOZ_BUILD_DATE
|
||||
endif
|
||||
endif
|
||||
|
@ -80,7 +80,7 @@ $(TOPOBJDIR)/%: FORCE
|
||||
# corresponding install manifests are named correspondingly, with forward
|
||||
# slashes replaced with underscores, and prefixed with `install_`. That is,
|
||||
# the install manifest for `dist/bin` would be `install_dist_bin`.
|
||||
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/config/buildid
|
||||
$(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/buildid.h
|
||||
@# For now, force preprocessed files to be reprocessed every time.
|
||||
@# The overhead is not that big, and this avoids waiting for proper
|
||||
@# support for defines tracking in process_install_manifest.
|
||||
@ -91,7 +91,6 @@ $(addprefix install-,$(INSTALL_MANIFESTS)): install-%: $(TOPOBJDIR)/config/build
|
||||
$(TOPOBJDIR)/$* \
|
||||
-DAB_CD=en-US \
|
||||
-DBOOKMARKS_INCLUDE_DIR=$(TOPSRCDIR)/browser/locales/en-US/profile \
|
||||
-DMOZ_BUILDID=$(shell cat $(TOPOBJDIR)/config/buildid) \
|
||||
$(ACDEFINES) \
|
||||
install_$(subst /,_,$*)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
MOZ_BUILDID := $(shell awk '{print $$3}' $(DEPTH)/buildid.h)
|
||||
|
||||
# Set the appropriate version code, based on the existance of the
|
||||
# MOZ_APP_ANDROID_VERSION_CODE variable.
|
||||
|
@ -984,3 +984,5 @@ if CONFIG['MOZ_ANDROID_SEARCH_ACTIVITY']:
|
||||
]
|
||||
|
||||
FINAL_TARGET_PP_FILES += ['package-name.txt.in']
|
||||
|
||||
DEFINES['TOPOBJDIR'] = TOPOBJDIR
|
||||
|
@ -31,9 +31,16 @@ if not CONFIG['JS_STANDALONE']:
|
||||
'mozilla-config.h',
|
||||
]
|
||||
EXPORTS += [
|
||||
'!buildid.h',
|
||||
'!mozilla-config.h',
|
||||
]
|
||||
|
||||
GENERATED_FILES += [
|
||||
'buildid.h',
|
||||
]
|
||||
|
||||
GENERATED_FILES['buildid.h'].script = 'build/variables.py:buildid_header'
|
||||
|
||||
DIRS += [
|
||||
'build',
|
||||
'probes',
|
||||
|
@ -75,10 +75,10 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
|
||||
'''
|
||||
def hours_since_cutoff(buildid):
|
||||
# The ID is formatted like YYYYMMDDHHMMSS (using
|
||||
# datetime.now().strftime('%Y%m%d%H%M%S'); see
|
||||
# toolkit/xre/make-platformini.py). The inverse function is
|
||||
# time.strptime. N.B.: the time module expresses time as decimal
|
||||
# seconds since the epoch.
|
||||
# datetime.now().strftime('%Y%m%d%H%M%S'); see build/variables.py).
|
||||
# The inverse function is time.strptime.
|
||||
# N.B.: the time module expresses time as decimal seconds since the
|
||||
# epoch.
|
||||
fmt = '%Y%m%d%H%M%S'
|
||||
build = time.strptime(str(buildid), fmt)
|
||||
cutoff = time.strptime(str(V1_CUTOFF), fmt)
|
||||
|
@ -28,9 +28,13 @@ ifneq (,$(strip $(MOZ_SOURCE_STAMP)))
|
||||
|
||||
endif # MOZ_SOURCE_STAMP
|
||||
|
||||
MOZ_BUILDID := $(strip $(firstword $(shell cat $(DEPTH)/config/buildid 2>/dev/null)))
|
||||
MOZ_BUILDID := $(shell awk '{print $$3}' $(DEPTH)/buildid.h)
|
||||
$(call errorIfEmpty,GRE_MILESTONE MOZ_BUILDID)
|
||||
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
$(srcdir)/nsAppRunner.cpp: $(DEPTH)/config/buildid $(milestone_txt)
|
||||
# Note these dependencies are broken because the target is *not* the cpp file.
|
||||
# BUT, actually fixing it would make libxul rebuilt on every single incremental
|
||||
# build because of the automatic buildid change. This is why we can't actually
|
||||
# include buildid.h there, because it would add the dependency.
|
||||
$(srcdir)/nsAppRunner.cpp: $(DEPTH)/buildid.h $(milestone_txt)
|
||||
|
@ -1,51 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
from optparse import OptionParser
|
||||
from datetime import datetime
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
o = OptionParser()
|
||||
o.add_option("--buildid", dest="buildid")
|
||||
o.add_option("--print-buildid", action="store_true", dest="print_buildid")
|
||||
o.add_option("--print-timestamp", action="store_true", dest="print_timestamp")
|
||||
o.add_option("--sourcestamp", dest="sourcestamp")
|
||||
o.add_option("--sourcerepo", dest="sourcerepo")
|
||||
|
||||
(options, args) = o.parse_args()
|
||||
|
||||
if options.print_timestamp:
|
||||
print int(time.time())
|
||||
sys.exit(0)
|
||||
|
||||
if options.print_buildid:
|
||||
print datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
sys.exit(0)
|
||||
|
||||
if not options.buildid:
|
||||
print >>sys.stderr, "--buildid is required"
|
||||
sys.exit(1)
|
||||
|
||||
(milestoneFile,) = args
|
||||
for line in open(milestoneFile, 'r'):
|
||||
if line[0] == '#':
|
||||
continue
|
||||
|
||||
line = line.strip()
|
||||
if line == '':
|
||||
continue
|
||||
|
||||
milestone = line
|
||||
|
||||
print """[Build]
|
||||
BuildID=%s
|
||||
Milestone=%s""" % (options.buildid, milestone)
|
||||
if options.sourcestamp:
|
||||
print "SourceStamp=%s" % options.sourcestamp
|
||||
if options.sourcerepo:
|
||||
print "SourceRepository=%s" % options.sourcerepo
|
@ -180,6 +180,7 @@ CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
|
||||
if CONFIG['MOZ_WIDGET_GTK']:
|
||||
CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
|
||||
|
||||
DEFINES['TOPOBJDIR'] = TOPOBJDIR
|
||||
FINAL_TARGET_PP_FILES += [
|
||||
'platform.ini'
|
||||
]
|
||||
|
@ -253,6 +253,12 @@ static char **gQtOnlyArgv;
|
||||
#include <fontconfig/fontconfig.h>
|
||||
#endif
|
||||
#include "BinaryPath.h"
|
||||
#ifndef MOZ_BUILDID
|
||||
// See comment in Makefile.in why we want to avoid including buildid.h.
|
||||
// Still include it when MOZ_BUILDID is not set, which can happen with some
|
||||
// build backends.
|
||||
#include "buildid.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_LINKER
|
||||
extern "C" MFBT_API bool IsSignalHandlingBroken();
|
||||
|
@ -4,6 +4,7 @@
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#endif
|
||||
#filter substitution
|
||||
#include @TOPOBJDIR@/buildid.h
|
||||
[Build]
|
||||
BuildID=@MOZ_BUILDID@
|
||||
Milestone=@GRE_MILESTONE@
|
||||
|
@ -1,12 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Include rules.mk explicitly so we can use FINAL_TARGET. Also, the dependencies
|
||||
# for webapprt.ini need to be set after PP_TARGETS are expanded in rules.mk.
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
$(FINAL_TARGET)/webapprt.ini: $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
|
@ -5,10 +5,3 @@
|
||||
NSDISTMODE = copy
|
||||
|
||||
PROGRAMS_DEST = $(DIST)/bin
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
webapprt.$(OBJ_SUFFIX): $(DEPTH)/config/buildid
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "BinaryPath.h"
|
||||
#include "buildid.h"
|
||||
|
||||
const char kAPP_INI[] = "application.ini";
|
||||
const char kWEBAPP_INI[] = "webapp.ini";
|
||||
|
@ -7,10 +7,3 @@
|
||||
NSDISTMODE = copy
|
||||
|
||||
PROGRAMS_DEST = $(DIST)/bin
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
webapprt.$(OBJ_SUFFIX): $(DEPTH)/config/buildid
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsStringGlue.h"
|
||||
#include "mozilla/AppData.h"
|
||||
#include "buildid.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -57,3 +57,5 @@ JS_PREFERENCE_PP_FILES += [
|
||||
FINAL_TARGET_PP_FILES += [
|
||||
'webapprt.ini',
|
||||
]
|
||||
|
||||
DEFINES['TOPOBJDIR'] = TOPOBJDIR
|
||||
|
@ -5,6 +5,7 @@
|
||||
#endif
|
||||
|
||||
#filter substitution
|
||||
#include @TOPOBJDIR@/buildid.h
|
||||
|
||||
[App]
|
||||
ID=webapprt@mozilla.org
|
||||
|
@ -48,8 +48,3 @@ PROGRAMS_DEST = $(DIST)/bin
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
include $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/makensis.mk
|
||||
|
||||
MOZ_BUILDID := $(shell cat $(DEPTH)/config/buildid)
|
||||
DEFINES += -DMOZ_BUILDID=$(MOZ_BUILDID)
|
||||
|
||||
webapprt.$(OBJ_SUFFIX): $(DEPTH)/config/buildid
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/AppData.h"
|
||||
#include "buildid.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user