Bug 784848 - allow repacking l10n on win64 using mozconfigs, objdirs, and pre-built mar tools - r=Callek
authorChris Cooper <ccooper@deadsquid.com>
Wed, 06 Mar 2013 11:28:39 -0800
changeset 15089 b9245b4d66d1a50472be82a23929e3204acd9c62
parent 15088 949ebc4e6f47f23a79be8cee8d33f155e8dd5394
child 15090 9a11f1cc1da9f0b87861569a8bf9c69f9a362f5e
push idunknown
push userunknown
push dateunknown
reviewersCallek
bugs784848
Bug 784848 - allow repacking l10n on win64 using mozconfigs, objdirs, and pre-built mar tools - r=Callek
client.mk
config/config.mk
config/makefiles/autotargets.mk
configure.in
mail/config/mozconfigs/linux32/l10n-mozconfig
mail/config/mozconfigs/linux64/l10n-mozconfig
mail/config/mozconfigs/macosx-universal/l10n-mozconfig
mail/config/mozconfigs/win32/l10n-mozconfig
mail/locales/Makefile.in
--- a/client.mk
+++ b/client.mk
@@ -64,17 +64,16 @@ AUTOCONF ?= $(shell which autoconf-2.13 
 ifeq (,$(strip $(AUTOCONF)))
 AUTOCONF = $(shell which fink >/dev/null 2>&1 && echo `which fink`/../../lib/autoconf2.13/bin/autoconf)
 endif
 
 ifeq (,$(strip $(AUTOCONF)))
 AUTOCONF=$(error Couldn't find autoconf 2.13)
 endif
 
-MKDIR := mkdir
 SH := /bin/sh
 ifndef MAKE
 MAKE := gmake
 endif
 PERL ?= perl
 PYTHON ?= python
 
 CONFIG_GUESS_SCRIPT := $(wildcard $(TOPSRCDIR)/build/autoconf/config.guess)
@@ -144,16 +143,20 @@ CONFIGURES += $(TOPSRCDIR)/mozilla/confi
 CONFIGURES += $(TOPSRCDIR)/mozilla/js/src/configure
 
 #######################################################################
 # Rules
 
 # The default rule is build
 build::
 
+# Define mkdir
+include $(TOPSRCDIR)/config/makefiles/makeutils.mk
+include $(TOPSRCDIR)/config/makefiles/autotargets.mk
+
 # These targets are candidates for auto-running client.py
 
 ifeq (01,$(MAKELEVEL)$(if $(ALWAYS_RUN_CLIENT_PY),1,))
 
 build profiledbuild configure:: run_client_py
 	$(MAKE) -f $(TOPSRCDIR)/client.mk $@
 else
 
@@ -285,21 +288,23 @@ CONFIGURE_ENV_ARGS += \
 ifeq ($(TOPSRCDIR),$(OBJDIR))
   CONFIGURE = ./configure
 else
   CONFIGURE = $(TOPSRCDIR)/configure
 endif
 
 configure-files: $(CONFIGURES)
 
-configure:: configure-files
-ifdef MOZ_BUILD_PROJECTS
-	@if test ! -d $(MOZ_OBJDIR); then $(MKDIR) $(MOZ_OBJDIR); else true; fi
-endif
-	@if test ! -d $(OBJDIR); then $(MKDIR) $(OBJDIR); else true; fi
+configure-preqs = \
+  configure-files \
+  $(call mkdir_deps,$(OBJDIR)) \
+  $(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \
+  $(NULL)
+
+configure:: $(configure-preqs)
 	@echo cd $(OBJDIR);
 	@echo $(CONFIGURE) $(CONFIGURE_ARGS)
 	@cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
 	  || ( echo "*** Fix above errors and then restart with\
                \"$(MAKE) -f client.mk build\"" && exit 1 )
 	@touch $(OBJDIR)/Makefile
 
 ifneq (,$(MAKEFILE))
--- a/config/config.mk
+++ b/config/config.mk
@@ -58,16 +58,17 @@ CHECK_VARS := \
 
 # checks for internal spaces or trailing spaces in the variable
 # named by $x
 check-variable = $(if $(filter-out 0 1,$(words $($(x))z)),$(error Spaces are not allowed in $(x)))
 
 $(foreach x,$(CHECK_VARS),$(check-variable))
 
 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
+core_realpath = $(if $(realpath $(1)),$(realpath $(1)),$(call core_abspath,$(1)))
 
 RM = rm -f
 
 core_winabspath = $(firstword $(subst /, ,$(call core_abspath,$(1)))):$(subst $(space),,$(patsubst %,\\%,$(wordlist 2,$(words $(subst /, ,$(call core_abspath,$(1)))), $(strip $(subst /, ,$(call core_abspath,$(1)))))))
 
 # FINAL_TARGET specifies the location into which we copy end-user-shipped
 # build products (typelibs, components, chrome).
 #
@@ -312,26 +313,16 @@ TAR_CREATE_FLAGS = -cvhf
 ifeq ($(OS_ARCH),BSD_OS)
 TAR_CREATE_FLAGS = -cvLf
 endif
 
 ifeq ($(OS_ARCH),OS2)
 TAR_CREATE_FLAGS = -cvf
 endif
 
-ifdef LOCALE_MERGEDIR
-MERGE_FILE = $(firstword \
-  $(wildcard $(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)))
-
 #
 # Personal makefile customizations go in these optional make include files.
 #
 MY_CONFIG	:= $(DEPTH)/config/myconfig.mk
 MY_RULES	:= $(DEPTH)/config/myrules.mk
 
 #
 # Default command macros; can be overridden in <arch>.mk.
@@ -647,18 +638,18 @@ png2ico = $(PYTHON) $(MOZILLA_DIR)/confi
 AB_CD = $(MOZ_UI_LOCALE)
 
 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,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
-EXPAND_MOZLOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(MOZILLA_SRCDIR)/$(1)/en-US,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1)))
+EXPAND_LOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(topsrcdir)/$(1)/en-US,$(call core_realpath,$(L10NBASEDIR)/$(AB_CD)/$(subst /locales,,$(1))))
+EXPAND_MOZLOCALE_SRCDIR = $(if $(filter en-US,$(AB_CD)),$(MOZILLA_SRCDIR)/$(1)/en-US,$(call core_realpath,$(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))
@@ -670,16 +661,26 @@ MAKE_JARS_FLAGS += --l10n-base=$(L10NBAS
 endif
 else
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 endif # en-US
 else
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 endif # ! relativesrcdir
 
+ifdef LOCALE_MERGEDIR
+MERGE_FILE = $(firstword \
+  $(wildcard $(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)))
+
 ifeq (OS2,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(MOZILLA_SRCDIR)/build/os2/test_os2.cmd "$(DIST)"
 else
 ifneq (WINNT,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
 endif # ! WINNT
 endif # ! OS2
 
new file mode 100644
--- /dev/null
+++ b/config/makefiles/autotargets.mk
@@ -0,0 +1,94 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# 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/.
+#
+
+ifndef INCLUDED_AUTOTARGETS_MK #{
+
+# Conditional does not wrap the entire file so multiple
+# includes will be able to accumulate dependencies.
+
+###########################################################################
+#      AUTO_DEPS - A list of deps/targets drived from other macros.
+###########################################################################
+
+MKDIR ?= mkdir -p
+TOUCH ?= touch
+
+# declare for local use, rules.mk may not have been loaded
+space = $(NULL) $(NULL)
+
+# Deps will be considered intermediate when used as a pre-requisite for
+# wildcard targets.  Inhibit their removal, mkdir -p is a standalone op.
+.PRECIOUS: %/.mkdir.done
+
+#########################
+##---]  FUNCTIONS  [---##
+#########################
+
+# Squeeze can be overzealous, restore root for abspath
+getPathPrefix =$(if $(filter /%,$(1)),/)
+
+# Squeeze '//' from the path, easily created by string functions
+_slashSqueeze =$(foreach val,$(getargv),$(call getPathPrefix,$(val))$(subst $(space),/,$(strip $(subst /,$(space),$(val)))))
+
+# Squeeze extraneous directory slashes from the path
+#  o protect embedded spaces within the path
+#  o replace //+ sequences with /
+slash_strip = \
+  $(strip \
+    $(subst <--[**]-->,$(space),\
+	$(call _slashSqueeze,\
+    $(subst $(space),<--[**]-->,$(1))\
+  )))
+
+# Extract directory path from a dependency file.
+mkdir_stem =$(foreach val,$(getargv),$(subst /.mkdir.done,$(NULL),$(val)))
+
+## Generate timestamp file for threadsafe directory creation
+mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
+
+#######################
+##---]  TARGETS  [---##
+#######################
+
+%/.mkdir.done: # mkdir -p -p => mkdir -p
+	$(subst $(space)-p,$(null),$(MKDIR)) -p "$(dir $@)"
+# Make the timestamp old enough for not being a problem with symbolic links
+# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
+# 198001010000 would translate to something older than FAT epoch.
+	@$(TOUCH) -t 198001030000 "$@"
+
+# A handful of makefiles are attempting "mkdir dot".
+# tbpl/valgrind builds are using this target
+# https://bugzilla.mozilla.org/show_bug.cgi?id=837754
+.mkdir.done:
+	@echo "WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)"
+	@$(TOUCH) -t 198001030000 "$@"
+
+INCLUDED_AUTOTARGETS_MK = 1
+endif #}
+
+
+## Accumulate deps and cleanup
+ifneq (,$(GENERATED_DIRS))
+  GENERATED_DIRS := $(strip $(sort $(GENERATED_DIRS)))
+  tmpauto :=$(call mkdir_deps,GENERATED_DIRS)
+  GENERATED_DIRS_DEPS +=$(tmpauto)
+  GARBAGE_DIRS        +=$(GENERATED_DIRS)
+endif
+
+#################################################################
+# One ring/dep to rule them all:
+#   config/rules.mk::all target is available by default
+#   Add $(AUTO_DEPS) as an explicit target dependency when needed.
+#################################################################
+
+AUTO_DEPS +=$(GENERATED_DIRS_DEPS)
+AUTO_DEPS := $(strip $(sort $(AUTO_DEPS)))
+
+# Complain loudly if deps have not loaded so getargv != $(NULL)
+$(call requiredfunction,getargv)
--- a/configure.in
+++ b/configure.in
@@ -1780,18 +1780,19 @@ ia64*-hpux*)
     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
 
     dnl set NO_X11 defines here as the general check is skipped on win32
     no_x=yes
     AC_DEFINE(NO_X11)
 
     case "$host" in
     *-mingw*)
-	MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
-	;;
+        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
+        L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
+        ;;
     esac
 
     case "$host" in
     *-mingw*)
 
     if test -z "$MOZ_TOOLS"; then
         AC_MSG_ERROR([MOZ_TOOLS is not set])
     fi
--- a/mail/config/mozconfigs/linux32/l10n-mozconfig
+++ b/mail/config/mozconfigs/linux32/l10n-mozconfig
@@ -1,13 +1,14 @@
 ac_add_options --enable-application=mail
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 ac_add_options --enable-profiling
+ac_add_options --with-l10n-base=../../l10n-central
 
 # Temporary options until bug 794378 is fixed
 ac_add_options --enable-gnomevfs
 ac_add_options --disable-gio
 
 . $topsrcdir/build/unix/mozconfig.linux
 
 # Avoid dependency on libstdc++ 4.5
--- a/mail/config/mozconfigs/linux64/l10n-mozconfig
+++ b/mail/config/mozconfigs/linux64/l10n-mozconfig
@@ -1,13 +1,14 @@
 ac_add_options --enable-application=mail
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 ac_add_options --enable-profiling
+ac_add_options --with-l10n-base=../../l10n-central
 
 # Temporary options until bug 794378 is fixed
 ac_add_options --enable-gnomevfs
 ac_add_options --disable-gio
 
 . $topsrcdir/build/unix/mozconfig.linux
 
 # Avoid dependency on libstdc++ 4.5
--- a/mail/config/mozconfigs/macosx-universal/l10n-mozconfig
+++ b/mail/config/mozconfigs/macosx-universal/l10n-mozconfig
@@ -2,28 +2,29 @@
 # mixed up with host/target CPUs when trying to work out how to do the
 # universal build. When we redo the build system (bug 648979) this will
 # go away.
 if test -e "$topsrcdir/mail/config/version.txt"; then
   unset CC
   unset CXX
 fi
 
-. $topsrcdir/build/macosx/universal/mozconfig
+#. $topsrcdir/build/macosx/universal/mozconfig
 
 # Universal builds override the default of mail (bug 575283 comment 29)
 ac_add_options --enable-application=mail
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-codesighs
 ac_add_options --disable-install-strip
 ac_add_options --enable-profiling
+ac_add_options --with-l10n-base=../../../l10n-central
 
 # Make sure Lightning is also unified
-mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
+#mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
 
 # For NSS symbols
 export MOZ_DEBUG_SYMBOLS=1
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Enable parallel compiling
--- a/mail/config/mozconfigs/win32/l10n-mozconfig
+++ b/mail/config/mozconfigs/win32/l10n-mozconfig
@@ -1,15 +1,16 @@
 . "$topsrcdir/build/mozconfig.common"
 
 ac_add_options --enable-application=mail
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
 ac_add_options --enable-jemalloc
 ac_add_options --enable-profiling
+ac_add_options --with-l10n-base=../../l10n-central
 
 # For NSS symbols
 export MOZ_DEBUG_SYMBOLS=1
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 if test -n "${_PYMAKE}"; then
--- a/mail/locales/Makefile.in
+++ b/mail/locales/Makefile.in
@@ -34,18 +34,17 @@ PWD := $(CURDIR)
 # override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not
 # work in that case.
 ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE)
 WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
 RETRIEVE_WINDOWS_INSTALLER = 1
 
 MOZ_LANGPACK_EID=langpack-$(AB_CD)@thunderbird.mozilla.org
 
-PREF_JS_EXPORTS = $(firstword $(wildcard $(LOCALE_SRCDIR)/all-l10n.js) \
-                       $(srcdir)/en-US/all-l10n.js )
+PREF_JS_EXPORTS = $(call MERGE_FILE,all-l10n.js)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
 MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
 MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
 endif
 
@@ -132,17 +131,17 @@ langpack: langpack-$(AB_CD)
 # This is a generic target that will make a langpack, repack ZIP (+tarball)
 # builds, and repack and installer if applicable. It is called from the
 # tinderbox scripts. Alter it with caution.
 
 installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
 	@echo "repackaging done"
 
 ifdef MOZ_UPDATER
-libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini)
+libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
 ifeq ($(OS_ARCH),WINNT)
 	cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
 	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
 	  sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
 	  $(FINAL_TARGET)/updater.ini
 else
 	cat $< | \
 	  sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \