bug 1370506, always merge for l10n repacks, with internally set merge dir, r?glandium draft
authorAxel Hecht <axel@pike.org>
Fri, 16 Jun 2017 15:21:16 +0200
changeset 619226 0ef7e009b8d70d61aa1b3cccca08906adc679524
parent 619225 dd8fc6946317c8cec8c26e33bfbcc0fd06f3787d
child 619227 5e503563a2f89b3caa1412944f42f49c9ca7463b
push id71621
push useraxel@mozilla.com
push dateTue, 01 Aug 2017 19:49:47 +0000
reviewersglandium
bugs1370506
milestone56.0a1
bug 1370506, always merge for l10n repacks, with internally set merge dir, r?glandium To not merge the en-US language pack, the merge-% steps are in a conditional function that disables that for en-US. Using a function here as that's easier than a shell if in the merge rule, and Makefile conditionals don't get evaluated late enough. To liberate the l10n builds from settings in the automation, we move the patch logic from LOCALE_MERGEDIR to REAL_LOCALE_MERGEDIR. To determine strongly when we're in a repack or building a langpack, the trick here is to export IS_LANGUAGE_REPACK in l10n.mk, and only set that to true in the entry-point rules. Now, we can use that value in config.mk to define the l10n-specific rules. I did the same thing for langpack-%, which allows us to disable the crashreporter files for language packs, for example. With that, make installers-de just works, if you have localizations checked out. For a while, we might run l10n-merge twice in automation, but it's really not optional, so let's just make sure we run it. MozReview-Commit-ID: 3nr33CKxkBQ
browser/installer/windows/Makefile.in
browser/locales/Makefile.in
config/config.mk
mobile/android/locales/Makefile.in
toolkit/locales/Makefile.in
toolkit/locales/l10n.mk
--- a/browser/installer/windows/Makefile.in
+++ b/browser/installer/windows/Makefile.in
@@ -28,19 +28,19 @@ BRANDING_FILES = \
 	firefox64.ico \
 	wizHeader.bmp \
 	wizHeaderRTL.bmp \
 	wizWatermark.bmp \
 	$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
-ifdef LOCALE_MERGEDIR
+ifdef IS_LANGUAGE_REPACK
 PPL_LOCALE_ARGS = \
-  --l10n-dir=$(LOCALE_MERGEDIR)/browser/installer \
+  --l10n-dir=$(REAL_LOCALE_MERGEDIR)/browser/installer \
   --l10n-dir=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer \
   --l10n-dir=$(topsrcdir)/browser/locales/en-US/installer \
   $(NULL)
 else
 PPL_LOCALE_ARGS=$(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer
 endif
 
 OVERRIDE_DEFAULT_GOAL := installer
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -82,16 +82,17 @@ searchplugins:: $(list-json)
 
 $(DIST)/branding:
 	$(NSINSTALL) -D $@
 
 DEFINES += -DBOOKMARKS_INCLUDE_DIR=$(dir $(call MERGE_FILE,profile/bookmarks.inc))
 
 libs-%: AB_CD=$*
 libs-%:
+	$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
 ifndef RELEASE_OR_BETA
 	@$(MAKE) -C ../extensions/formautofill/locales AB_CD=$* XPI_NAME=locale-$*
 endif
 	@$(MAKE) -C ../extensions/onboarding/locales AB_CD=$* XPI_NAME=locale-$*
@@ -104,17 +105,19 @@ ifneq '$(or $(MOZ_DEV_EDITION),$(NIGHTLY
 endif
 	@$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) -C ../../devtools/client/locales AB_CD=$* XPI_NAME=locale-$* XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
 	@$(MAKE) -B searchplugins AB_CD=$* XPI_NAME=locale-$*
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
 
 chrome-%: AB_CD=$*
+chrome-%: IS_LANGUAGE_REPACK=1
 chrome-%:
+	$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
 	@$(MAKE) -C ../../toolkit/locales chrome-$*
 	@$(MAKE) -C ../../services/sync/locales chrome AB_CD=$*
 	@$(MAKE) -C ../../extensions/spellcheck/locales chrome AB_CD=$*
 ifndef RELEASE_OR_BETA
 	@$(MAKE) -C ../extensions/formautofill/locales chrome AB_CD=$*
 endif
 	@$(MAKE) -C ../extensions/pocket/locale chrome AB_CD=$*
 ifndef RELEASE_OR_BETA
@@ -152,16 +155,17 @@ endif
 
 
 langpack: langpack-$(AB_CD)
 
 # This is a generic target that will make a langpack, repack ZIP (+tarball)
 # builds, and repack an installer if applicable. It is called from the
 # tinderbox scripts. Alter it with caution.
 
+installers-%: IS_LANGUAGE_REPACK=1
 installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
 	@echo 'repackaging done'
 
 ifdef MOZ_UPDATER
 # Note that we want updater.ini to be in the top directory, not the browser/
 # subdirectory, because that's where the updater is installed and runs.
 libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
 ifeq ($(OS_ARCH),WINNT)
@@ -172,44 +176,38 @@ ifeq ($(OS_ARCH),WINNT)
 else
 	cat $< | \
 	  sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
 	  sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
 	  $(FINAL_TARGET)/../updater.ini
 endif
 endif
 
+ifndef IS_LANGPACK
 ifdef MOZ_CRASHREPORTER
 libs:: $(call MERGE_FILE,crashreporter/crashreporter-override.ini)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
 endif
+endif
 
 ident:
 	@printf 'fx_revision '
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
 	    $(STAGEDIST)/application.ini App SourceStamp
 	@printf 'buildid '
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
 	    $(STAGEDIST)/application.ini App BuildID
 
-merge-%: AB_CD=$*
-merge-%:
-ifdef LOCALE_MERGEDIR
-	$(RM) -rf $(LOCALE_MERGEDIR)
-	$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
-endif
-	@echo
-
 # test target, depends on make package
 # try to repack x-test, with just toolkit/defines.inc being there
 l10n-check:: INNER_UNMAKE_PACKAGE=true
 l10n-check::
 	$(RM) -rf x-test
 	$(NSINSTALL) -D x-test/toolkit
 	echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
 	@# ZIP_IN='$(ZIP_IN)' will pass down the *current* value of ZIP_IN, and
 	@# we do the same for WIN32_INSTALLER_IN, which are based on MOZ_SIMPLE_PACKAGE_NAME
 	@# not being reset, overwriting the value they would get with MOZ_SIMPLE_PACKAGE_NAME
 	@# reset.
-	$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir' \
+	$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' \
 	    ZIP_IN='$(ZIP_IN)' WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)' MOZ_SIMPLE_PACKAGE_NAME=
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(MOZ_PKG_DIR)$(_RESPATH)
 	cd $(DIST)/l10n-stage && test $$(cat $(MOZ_PKG_DIR)$(_RESPATH)/update.locale) = x-test
--- a/config/config.mk
+++ b/config/config.mk
@@ -476,45 +476,43 @@ sysinstall_cmd = install_cmd
 # MOZ_UI_LOCALE directly, but use an intermediate variable that can be
 # overridden by the command line. (Besides, AB_CD is prettier).
 AB_CD = $(MOZ_UI_LOCALE)
 # Many locales directories want this definition.
 ACDEFINES += -DAB_CD=$(AB_CD)
 
 ifndef L10NBASEDIR
   L10NBASEDIR = $(error L10NBASEDIR not defined by configure)
-else
-  IS_LANGUAGE_REPACK = 1
 endif
 
 EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(or $(realpath $(L10NBASEDIR)),$(abspath $(L10NBASEDIR)))/$(AB_CD)/$(subst /locales,,$(1)))
 
 ifdef relativesrcdir
 LOCALE_SRCDIR ?= $(call EXPAND_LOCALE_SRCDIR,$(relativesrcdir))
 endif
 
 ifdef relativesrcdir
 MAKE_JARS_FLAGS += --relativesrcdir=$(relativesrcdir)
 ifneq (en-US,$(AB_CD))
-ifdef LOCALE_MERGEDIR
-MAKE_JARS_FLAGS += --locale-mergedir=$(LOCALE_MERGEDIR)
+ifdef IS_LANGUAGE_REPACK
+MAKE_JARS_FLAGS += --locale-mergedir=$(REAL_LOCALE_MERGEDIR)
 endif
 ifdef IS_LANGUAGE_REPACK
 MAKE_JARS_FLAGS += --l10n-base=$(L10NBASEDIR)/$(AB_CD)
 endif
 else
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 endif # en-US
 else
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 endif # ! relativesrcdir
 
-ifdef LOCALE_MERGEDIR
+ifdef IS_LANGUAGE_REPACK
 MERGE_FILE = $(firstword \
-  $(wildcard $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
+  $(wildcard $(REAL_LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))/$(1)) \
   $(wildcard $(LOCALE_SRCDIR)/$(1)) \
   $(srcdir)/en-US/$(1) )
 else
 MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
 endif
 MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
 
 # These marcros are similar to MERGE_FILE, but no merging, and en-US first.
--- a/mobile/android/locales/Makefile.in
+++ b/mobile/android/locales/Makefile.in
@@ -26,36 +26,44 @@ include $(topsrcdir)/toolkit/locales/l10
 # values-*/strings.xml and raw-*/suggestedsites.json.
 # Those would be in the way of a single locale build, which this
 # target is for
 clobber-stage:
 	$(RM) -rf $(STAGEDIST)
 	$(RM) $(DEPTH)/mobile/android/base/res/values-*/strings.xml
 	$(RM) $(DEPTH)/mobile/android/base/res/raw-*/suggestedsites.json
 
+# merge if we're not en-US, using conditional function as we need
+# the current value of AB_CD
 libs-%: AB_CD=$*
 libs-%:
+	$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
 	@$(MAKE) -C $(DEPTH)/mobile/locales libs-$*
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref
 ifeq ($(OS_TARGET),Android)
 	@$(MAKE) -C $(DEPTH)/mobile/android/base/locales AB_CD=$* XPI_NAME=locale-$*
 endif
 
 # Tailored target to just add the chrome processing for multi-locale builds
+# merge if we're not en-US, using conditional function as we need
+# the current value of AB_CD
 chrome-%: AB_CD=$*
+chrome-%: IS_LANGUAGE_REPACK=1
 chrome-%:
+	$(if $(filter en-US,$(AB_CD)),, @$(MAKE) merge-$*)
 	@$(MAKE) -C $(DEPTH)/mobile/locales chrome-$*
 	@$(MAKE) chrome AB_CD=$*
 ifeq ($(OS_TARGET),Android)
 	@$(MAKE) -C $(DEPTH)/mobile/android/base/locales chrome-$*
 endif
 
 # This is a generic target that will make a langpack and repack tarball
 # builds. It is called from the tinderbox scripts. Alter it with caution.
 
+installers-%: IS_LANGUAGE_REPACK=1
 installers-%: clobber-stage repackage-zip-%
 	@echo 'repackaging done'
 
 # When we unpack fennec on MacOS X the platform.ini and application.ini are in slightly
 # different locations that on all other platforms
 ifeq (Darwin, $(OS_ARCH))
 GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/platform.ini'
 FENNEC_APPLICATION_INI_PATH='$(STAGEDIST)/application.ini'
@@ -66,16 +74,8 @@ endif
 
 ident:
 	@printf 'gecko_revision '
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(GECKO_PLATFORM_INI_PATH) Build SourceStamp
 	@printf 'fennec_revision '
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App SourceStamp
 	@printf 'buildid '
 	@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(FENNEC_APPLICATION_INI_PATH) App BuildID
-
-merge-%: AB_CD=$*
-merge-%:
-ifdef LOCALE_MERGEDIR
-	$(RM) -rf $(LOCALE_MERGEDIR)
-	$(topsrcdir)/mach compare-locales --merge-dir $(LOCALE_MERGEDIR) $*
-endif
-	@echo
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -19,16 +19,18 @@ chrome-%:
 	@$(MAKE) -C $(DEPTH)/netwerk/locales/ chrome AB_CD=$*
 	@$(MAKE) -C $(DEPTH)/dom/locales/ chrome AB_CD=$*
 	@$(MAKE) -C $(DEPTH)/security/manager/locales/ chrome AB_CD=$*
 	@$(MAKE) chrome AB_CD=$*
 
 libs:: update.locale
 	sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
 
+ifndef IS_LANGPACK
 ifdef MOZ_CRASHREPORTER
 libs:: $(call MERGE_FILE,crashreporter/crashreporter.ini)
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/Resources
 else
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
 endif
 endif
+endif
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -51,16 +51,23 @@ ACDEFINES += \
 	-DMOZ_APP_ID='$(MOZ_APP_ID)' \
 	-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
 	-DMOZ_APP_MAXVERSION=$(MOZ_APP_MAXVERSION) \
 	-DLOCALE_SRCDIR=$(abspath $(LOCALE_SRCDIR)) \
 	-DPKG_BASENAME='$(PKG_BASENAME)' \
 	-DPKG_INST_BASENAME='$(PKG_INST_BASENAME)' \
 	$(NULL)
 
+# export some global defines for l10n repacks
+BASE_MERGE:=$(CURDIR)/merge-dir
+export REAL_LOCALE_MERGEDIR=$(BASE_MERGE)/$(AB_CD)
+# is an l10n repack step:
+export IS_LANGUAGE_REPACK
+# is a language pack:
+export IS_LANGPACK
 
 clobber-%: AB_CD=$*
 clobber-%:
 	$(RM) -rf $(DIST)/xpi-stage/locale-$*
 
 
 PACKAGER_NO_LIBS = 1
 
@@ -165,19 +172,26 @@ TK_DEFINES = $(firstword \
    $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc)
 
 # Dealing with app sub dirs: If DIST_SUBDIRS is defined it contains a
 # listing of app sub-dirs we should include in langpack xpis. If not,
 # check DIST_SUBDIR, and if that isn't present, just package the default
 # chrome directory.
 PKG_ZIP_DIRS = chrome $(or $(DIST_SUBDIRS),$(DIST_SUBDIR))
 
+merge-%: IS_LANGUAGE_REPACK=1
+merge-%:
+	$(RM) -rf $(REAL_LOCALE_MERGEDIR)
+	$(MOZILLA_DIR)/mach compare-locales --l10n-base $(L10NBASEDIR) --merge-dir $(REAL_LOCALE_MERGEDIR) $*
+
 langpack-%: LANGPACK_FILE=$(ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
 langpack-%: AB_CD=$*
 langpack-%: XPI_NAME=locale-$*
+langpack-%: IS_LANGUAGE_REPACK=1
+langpack-%: IS_LANGPACK=1
 langpack-%: libs-%
 	@echo 'Making langpack $(LANGPACK_FILE)'
 	$(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)
 	$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \
 	  -DTK_DEFINES=$(TK_DEFINES) -DAPP_DEFINES=$(APP_DEFINES) $(MOZILLA_DIR)/toolkit/locales/generic/install.rdf -o $(DIST)/xpi-stage/$(XPI_NAME)/install.rdf)
 	$(call py_action,zip,-C $(DIST)/xpi-stage/locale-$(AB_CD) $(LANGPACK_FILE) install.rdf $(PKG_ZIP_DIRS) chrome.manifest)
 
 # This variable is to allow the wget-en-US target to know which ftp server to download from