bug 525438, l10n-merge doesn't merge all files, make targets work with PRETTY_NAMES, too. Adding a l10n-checks target for a dummy repack. r=ted
authorAxel Hecht <l10n@mozilla.com>
Fri, 18 Mar 2011 18:29:56 +0100
changeset 63519 fff61d7cc07715a2f687c7307686977739c377bc
parent 63518 c52cc6c8f4a88c3cca512cca5b0345a210753b52
child 63520 c91d12adbc19a8a703127d5dd54c473f665177c5
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs525438
milestone2.0b13pre
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 525438, l10n-merge doesn't merge all files, make targets work with PRETTY_NAMES, too. Adding a l10n-checks target for a dummy repack. r=ted
browser/build.mk
browser/installer/windows/Makefile.in
browser/locales/Makefile.in
config/config.mk
js/src/config/config.mk
toolkit/locales/l10n.mk
toolkit/mozapps/installer/packager.mk
toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -76,16 +76,19 @@ distclean::
 	@$(MAKE) -C browser/installer distclean
 
 source-package::
 	@$(MAKE) -C browser/installer source-package
 
 upload::
 	@$(MAKE) -C browser/installer upload
 
+l10n-check::
+	@$(MAKE) -C browser/locales l10n-check
+
 ifdef ENABLE_TESTS
 # Implemented in testing/testsuite-targets.mk
 
 mochitest-browser-chrome:
 	$(RUN_MOCHITEST) --browser-chrome
 	$(CHECK_TEST_ERROR)
 
 mochitest:: mochitest-browser-chrome
--- a/browser/installer/windows/Makefile.in
+++ b/browser/installer/windows/Makefile.in
@@ -72,38 +72,48 @@ DEFINES += \
 	-DAB_CD=$(AB_CD) \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
 	-DMOZ_APP_DISPLAYNAME=${MOZ_APP_DISPLAYNAME} \
 	-DMOZILLA_VERSION=${MOZILLA_VERSION} \
 	$(NULL)
 
 include $(topsrcdir)/config/config.mk
 
+ifdef LOCALE_MERGEDIR
+PPL_LOCALE_ARGS = \
+  --l10n-dir=$(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
+
 installer::
 	$(MAKE) -C .. installer-stage
 	$(MAKE) $(CONFIG_DIR)/setup.exe
 
 # For building the uninstaller during the application build so it can be
 # included for mar file generation.
 uninstaller::
 	$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) \
 	  $(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
 	  --preprocess-locale $(topsrcdir) \
-	  $(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
+	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 
 $(CONFIG_DIR)/setup.exe::
 	$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
 	$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) \
 	  $(srcdir)/nsis/defines.nsi.in > $(CONFIG_DIR)/defines.nsi
 	$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
 	  --preprocess-locale $(topsrcdir) \
-	  $(call EXPAND_LOCALE_SRCDIR,browser/locales)/installer $(AB_CD) $(CONFIG_DIR)
+	  $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
 
 GARBARGE_DIRS += instgen
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/makensis.mk
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -82,18 +82,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)@firefox.mozilla.org
 
-PREF_JS_EXPORTS = $(firstword $(wildcard $(LOCALE_SRCDIR)/firefox-l10n.js) \
-                       $(srcdir)/en-US/firefox-l10n.js )
+PREF_JS_EXPORTS = $(call MERGE_FILE,firefox-l10n.js)
 
 ifneq (,$(filter 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
 
@@ -121,28 +120,26 @@ libs::
 	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
 	fi
 install::
 	@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
 	  $(PERL) $(topsrcdir)/config/preprocessor.pl $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
 	    $(LOCALE_SRCDIR)/existing-profile-defaults.js > $(DESTDIR)$(mozappdir)/defaults/existing-profile-defaults.js; \
 	fi
 
-README_FILES = \
-	README.txt \
-	$(NULL)
+README_FILE = $(call MERGE_FILE,README.txt)
 
 PROFILE_FILES = \
 	localstore.rdf \
 	mimeTypes.rdf \
 	$(NULL)
 
 PROFILE_CHROME = userChrome-example.css userContent-example.css
 
-libs:: $(addprefix $(LOCALE_SRCDIR)/,$(README_FILES))
+libs:: $(README_FILE)
 ifeq ($(OS_ARCH),WINNT)
 	$(EXIT_ON_ERROR) \
 	for file in $^; do \
 	  $(PERL) -pe 's/(?<!\r)\n/\r\n/g;' < $$file > $(FINAL_TARGET)/`basename $$file`; \
 	done
 else
 ifneq ($(OS_ARCH),OS2)
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
@@ -159,28 +156,28 @@ NO_JA_JP_MAC_AB_CD := $(if $(filter ja-J
 	  $(srcdir)/generic/profile/bookmarks.html.in \
 	  > $@
 
 libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
 
 libs:: $(addprefix generic/profile/,$(PROFILE_FILES))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile
 
-libs:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
+libs:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/defaults/profile/chrome
 
 install:: $(DESTDIR)$(mozappdir)/defaults/profile/bookmarks.html ;
 
 install:: $(addprefix generic/profile/,$(PROFILE_FILES))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile
 
-install:: $(addprefix $(LOCALE_SRCDIR)/profile/chrome/,$(PROFILE_CHROME))
+install:: $(call MERGE_FILES,$(addprefix profile/chrome/,$(PROFILE_CHROME)))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/defaults/profile/chrome
 
-SEARCH_PLUGINS = $(shell cat $(LOCALE_SRCDIR)/searchplugins/list.txt)
+SEARCH_PLUGINS = $(shell cat $(call MERGE_FILE,/searchplugins/list.txt))
 
 libs:: $(addsuffix .xml,$(SEARCH_PLUGINS))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/searchplugins
 
 install:: $(addsuffix .xml,$(SEARCH_PLUGINS))
 	$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/searchplugins
 
 
@@ -188,41 +185,36 @@ libs-%:
 	$(NSINSTALL) -D $(DIST)/install
 	@$(MAKE) -C ../../toolkit/locales libs-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 	@$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 	@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=defaults/pref BOTH_MANIFESTS=1
 	@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$* BOTH_MANIFESTS=1
 
 
-repackage-win32-installer: WIN32_INSTALLER_OUT="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
-repackage-win32-installer: $(WIN32_INSTALLER_IN) $(SUBMAKEFILES)
+repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
+repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
 	@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
 	$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
 	$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
 	$(MAKE) repackage-zip \
 	  AB_CD=$(AB_CD) \
 	  MOZ_PKG_FORMAT=SFX7Z \
-	  ZIP_IN=$(WIN32_INSTALLER_IN) \
-	  ZIP_OUT=$(WIN32_INSTALLER_OUT) \
+	  ZIP_IN="$(WIN32_INSTALLER_IN)" \
+	  ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
 	  SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
 	              $(topsrcdir)/browser/installer/windows/app.tag"
 
 ifeq (WINNT,$(OS_ARCH))
-repackage-win32-installer-%: $(WIN32_INSTALLER_IN) libs-%
-	@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN=$(WIN32_INSTALLER_IN)
+repackage-win32-installer-%:
+	@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
 else
 repackage-win32-installer-%: ;
 endif
 
-ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
-STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
-else
-STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
-endif
 
 clobber-zip:
 	$(RM) $(STAGEDIST)/chrome/$(AB_CD).jar \
 	  $(STAGEDIST)/chrome/$(AB_CD).manifest \
 	  $(STAGEDIST)/defaults/pref/firefox-l10n.js
 	$(RM) -rf  $(STAGEDIST)/searchplugins \
 	  $(STAGEDIST)/dictionaries \
 	  $(STAGEDIST)/defaults/profile \
@@ -234,17 +226,17 @@ 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-%: 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)
 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=/" | \
@@ -267,8 +259,16 @@ ident:
 	    $(STAGEDIST)/application.ini App BuildID
 
 merge-%:
 ifdef LOCALE_MERGEDIR
 	$(RM) -rf $(LOCALE_MERGEDIR)
 	MACOSX_DEPLOYMENT_TARGET= compare-locales -m $(LOCALE_MERGEDIR) $(srcdir)/l10n.ini $(L10NBASEDIR) $*
 endif
 	@echo
+
+# test target, depends on make package
+# try to repack x-test, with just toolkit/defines.inc being there
+l10n-check::
+	$(RM) -rf x-test
+	$(NSINSTALL) -D x-test/toolkit
+	echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
+	$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
--- a/config/config.mk
+++ b/config/config.mk
@@ -788,16 +788,26 @@ ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 endif
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
 endif
 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)))
+
 ifdef WINCE
 RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
 else
 ifeq (OS2,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
 else
 ifneq (WINNT,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -788,16 +788,26 @@ ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(LOCALE_MERGEDIR)/$(subst /locales,,$(relativesrcdir))
 endif
 MAKE_JARS_FLAGS += -c $(LOCALE_SRCDIR)
 ifdef LOCALE_MERGEDIR
 MAKE_JARS_FLAGS += -c $(topsrcdir)/$(relativesrcdir)/en-US
 endif
 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)))
+
 ifdef WINCE
 RUN_TEST_PROGRAM = $(PYTHON) $(topsrcdir)/build/mobile/devicemanager-run-test.py
 else
 ifeq (OS2,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(DIST)"
 else
 ifneq (WINNT,$(OS_ARCH))
 RUN_TEST_PROGRAM = $(DIST)/bin/run-mozilla.sh
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -97,24 +97,24 @@ clobber-%:
 	$(RM) -rf $(DIST)/xpi-stage/locale-$*
 
 
 PACKAGER_NO_LIBS = 1
 include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk
 
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS
+STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/MacOS
 else
 STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
 endif
 
 $(STAGEDIST): AB_CD:=en-US
-$(STAGEDIST): UNPACKAGE=$(ZIP_IN)
-$(STAGEDIST): $(ZIP_IN)
+$(STAGEDIST): UNPACKAGE=$(call ESCAPE_SPACE,$(ZIP_IN))
+$(STAGEDIST): $(call ESCAPE_SPACE,$(ZIP_IN))
 # only mac needs to remove the parent of STAGEDIST...
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 	$(RM) -r -v $(DIST)/l10n-stage
 else
 # ... and windows doesn't like removing STAGEDIST itself, remove all children
 	find $(STAGEDIST) -maxdepth 1 -print0 | xargs -0 $(RM) -r
 endif
 	$(NSINSTALL) -D $(DIST)/l10n-stage
@@ -126,29 +126,29 @@ endif
 unpack: $(STAGEDIST)
 	@echo done unpacking
 
 # The path to the object dir for the mozilla-central build system,
 # may be overridden if necessary.
 MOZDEPTH ?= $(DEPTH)
 
 repackage-zip: UNPACKAGE="$(ZIP_IN)"
-repackage-zip:
+repackage-zip:  libs-$(AB_CD)
 # Adjust jar logs with the new locale (can't use sed -i because of bug 373784)
 	-$(PERL) -pi -e "s/en-US/$(AB_CD)/g" $(_ABS_DIST)/jarlog/*.jar.log
 # call a hook for apps to put their uninstall helper.exe into the package
 	$(UNINSTALLER_PACKAGE_HOOK)
 # copy xpi-stage over, but not install.rdf and chrome.manifest,
 # those are just for language packs
 	cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
 	  tar --exclude=install.rdf --exclude=chrome.manifest $(TAR_CREATE_FLAGS) - * | ( cd $(STAGEDIST) && tar -xf - )
 	mv $(STAGEDIST)/chrome/$(AB_CD).manifest $(STAGEDIST)/chrome/localized.manifest
 ifneq (en,$(AB))
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/en.lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/$(AB).lproj
+	mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj
 endif
 endif
 	$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
 	cd $(DIST)/l10n-stage; \
 	  $(MAKE_PACKAGE)
 ifeq (WINCE,$(OS_ARCH))
 	cd $(DIST)/l10n-stage; \
 	  $(MAKE_CAB)
@@ -157,31 +157,31 @@ ifdef MOZ_MAKE_COMPLETE_MAR
 	$(MAKE) -C $(MOZDEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \
 	  MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \
 	  PACKAGE_BASE_DIR="$(_ABS_DIST)/l10n-stage" \
 	  DIST="$(_ABS_DIST)"
 endif
 # packaging done, undo l10n stuff
 ifneq (en,$(AB))
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/Resources/en.lproj
+	mv $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/$(AB).lproj $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/Resources/en.lproj
 endif
 endif
 ifdef MOZ_OMNIJAR
 	@(cd $(STAGEDIST) && $(UNPACK_OMNIJAR))
 endif
 	$(MAKE) clobber-zip AB_CD=$(AB_CD)
 	$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
 	mv -f "$(DIST)/l10n-stage/$(PACKAGE)" "$(ZIP_OUT)"
 ifeq (WINCE,$(OS_ARCH))
 	mv -f "$(DIST)/l10n-stage/$(PKG_BASENAME).cab" "$(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab"
 endif
 
-repackage-zip-%: $(ZIP_IN) $(STAGEDIST) libs-%
-	@$(MAKE) repackage-zip AB_CD=$* ZIP_IN=$(ZIP_IN)
+repackage-zip-%: $(STAGEDIST)
+	@$(MAKE) repackage-zip AB_CD=$* ZIP_IN="$(ZIP_IN)"
 
 APP_DEFINES = $(firstword $(wildcard $(LOCALE_SRCDIR)/defines.inc) \
                           $(srcdir)/en-US/defines.inc)
 TK_DEFINES = $(firstword \
    $(wildcard $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/defines.inc) \
    $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc)
 
 langpack-%: LANGPACK_FILE=$(_ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
@@ -202,18 +202,19 @@ endif
 
 # This make target allows us to wget the latest en-US binary from a specified website
 # The make installers-% target needs the en-US binary in dist/
 # and for the windows repackages we need the .installer.exe in dist/sea
 wget-en-US:
 ifndef WGET
 	$(error Wget not installed)
 endif
-	(cd $(_ABS_DIST) && $(WGET) -nv -N  $(EN_US_BINARY_URL)/$(PACKAGE))
-	@echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PACKAGE)"
+	$(NSINSTALL) -D $(_ABS_DIST)/$(PKG_PATH)
+	(cd $(_ABS_DIST)/$(PKG_PATH) && $(WGET) -nv -N  "$(EN_US_BINARY_URL)/$(PACKAGE)")
+	@echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PKG_PATH)/$(PACKAGE)"
 ifdef RETRIEVE_WINDOWS_INSTALLER
 ifeq ($(OS_ARCH), WINNT)
 	$(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH)
 	(cd $(_ABS_DIST)/$(PKG_INST_PATH) && $(WGET) -nv -N "$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe")
 	@echo "Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
 endif
 endif
 
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -678,16 +678,17 @@ INSTALLER_PACKAGE = $(DIST)/$(PKG_PATH)$
 endif
 
 # These are necessary because some of our packages/installers contain spaces
 # in their filenames and GNU Make's $(wildcard) function doesn't properly
 # deal with them.
 empty :=
 space = $(empty) $(empty)
 QUOTED_WILDCARD = $(if $(wildcard $(subst $(space),?,$(1))),"$(1)")
+ESCAPE_SPACE = $(subst $(space),\$(space),$(1))
 
 # This variable defines which OpenSSL algorithm to use to 
 # generate checksums for files that we upload
 CHECKSUM_ALGORITHM = 'sha512'
 
 # This variable defines where the checksum file will be located
 CHECKSUM_FILE = "$(DIST)/$(PKG_PATH)/$(PKG_BASENAME).checksums"
 
--- a/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
+++ b/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py
@@ -7,66 +7,19 @@
 #
 # Preprocesses installer locale properties files and creates a basic NSIS nlf
 # file when invoked with --preprocess-locale.
 # 
 # Converts a UTF-8 file to a new UTF-16LE file when invoked with
 # --convert-utf8-utf16le.
 
 from codecs import BOM_UTF16_LE
-from os.path import join
+from os.path import join, isfile
 import sys
-
-def preprocess_locale(argv):
-    """
-    Validates command line arguments and displays usage if necessary
-    """
-    if len(argv) < 1 or (argv[0] != '--convert-utf8-utf16le' and argv[0] != '--preprocess-locale'):
-        sys.stderr.write("""
-preprocess-locale.py
-
-Commands:
- --convert-utf8-utf16le - preprocesses installer locale properties files and
-                          creates a basic NSIS nlf file
- --preprocess-locale    - converts a UTF-8 file to a new UTF-16LE file
-
-use "preprocess-locale.py <command>" to see the usage for each command
-""")
-        sys.exit(1)
-
-    if argv[0] == '--convert-utf8-utf16le':
-        if len(argv) != 3:
-            sys.stderr.write("""
-Converts a UTF-8 file to UTF-16LE
-
-Usage: preprocess-locale.py --convert-utf8-utf16le <src> <dest>
-
-Arguments:
- <src> \tthe path to the UTF-8 source file to convert
- <dest>\tthe path to the UTF-16LE destination file to create
-""")
-            sys.exit(1)
-	convert_utf8_utf16le(argv[1], argv[2])
-
-    if argv[0] == '--preprocess-locale':
-        if len(argv) != 5:
-            sys.stderr.write("""
-Preprocesses the installer localized properties files into the format
-required by NSIS and creates a basic NSIS nlf file.
-
-Usage: preprocess-locale.py --preprocess-locale <src> <locale> <code> <dest>
-
-Arguments:
- <src>   \tthe path to top source directory for the toolkit source
- <locale>\tthe path to the installer's locale files
- <code>  \tthe locale code
- <dest>  \tthe path to the destination directory
-""")
-            sys.exit(1)
-        preprocess_locale_files(argv[1], argv[2], argv[3], argv[4])
+from optparse import OptionParser
 
 def open_utf16le_file(path):
     """
     Returns an opened file object with a a UTF-16LE byte order mark.
     """
     fp = open(path, "w+b")
     fp.write(BOM_UTF16_LE)
     return fp
@@ -103,26 +56,32 @@ def get_locale_strings(path, prefix, mid
         value = value.replace("\\r", "$\\r") # prefix \r with $
         value = value.replace("\\n", "$\\n") # prefix \n with $
         value = value.replace("\\t", "$\\t") # prefix \t with $
 
         output += prefix + name.strip() + middle + " \"" + value + "\"\n"
     fp.close()
     return output
 
-def preprocess_locale_files(moz_dir, locale_dir, ab_cd, config_dir):
+def lookup(path, l10ndirs):
+    for d in l10ndirs:
+        if isfile(join(d, path)):
+            return join(d, path)
+    return join(l10ndirs[-1], path)
+
+def preprocess_locale_files(moz_dir, ab_cd, config_dir, l10ndirs):
     """
     Preprocesses the installer localized properties files into the format
     required by NSIS and creates a basic NSIS nlf file.
 
     Parameters:
     moz_dir    - the path to top source directory for the toolkit source
-    locale_dir - the path to the installer's locale files
     ab_cd      - the locale code
     config_dir - the path to the destination directory
+    l10ndirs  - list of paths to search for installer locale files
     """
 
     # Set the language ID to 0 to make this locale the default locale. An
     # actual ID will need to be used to create a multi-language installer
     # (e.g. for CD distributions, etc.).
     lang_id = "0"
     rtl = "-"
 
@@ -152,38 +111,38 @@ NLF v6
 -
 # RTL - anything else than RTL means LTR
 %s
 """ % (lang_id, rtl)).encode("utf-16-le"))
     fp.close()
 
     # Create the main NSIS language file
     fp = open_utf16le_file(join(config_dir, "overrideLocale.nsh"))
-    locale_strings = get_locale_strings(join(locale_dir, "override.properties"),
+    locale_strings = get_locale_strings(lookup("override.properties", l10ndirs),
                                         "LangString ^", " " + lang_id + " ", False)
     fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
     fp.close()
 
     # Create the Modern User Interface language file
     fp = open_utf16le_file(join(config_dir, "baseLocale.nsh"))
     fp.write((u""";NSIS Modern User Interface - Language File
 ;Compatible with Modern UI 1.68
 ;Language: baseLocale (%s)
 !insertmacro MOZ_MUI_LANGUAGEFILE_BEGIN \"baseLocale\"
 !define MUI_LANGNAME \"baseLocale\"
 """ % (lang_id)).encode("utf-16-le"))
-    locale_strings = get_locale_strings(join(locale_dir, "mui.properties"),
+    locale_strings = get_locale_strings(lookup("mui.properties", l10ndirs),
                                         "!define ", " ", True)
     fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
     fp.write(u"!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le"))
     fp.close()
 
     # Create the custom language file for our custom strings
     fp = open_utf16le_file(join(config_dir, "customLocale.nsh"))
-    locale_strings = get_locale_strings(join(locale_dir, "custom.properties"),
+    locale_strings = get_locale_strings(lookup("custom.properties", l10ndirs),
                         "LangString ", " " + lang_id + " ", True)
     fp.write(unicode(locale_strings, "utf-8").encode("utf-16-le"))
     fp.close()
 
 def convert_utf8_utf16le(in_file_path, out_file_path):
     """
     Converts a UTF-8 file to a new UTF-16LE file
 
@@ -193,9 +152,65 @@ def convert_utf8_utf16le(in_file_path, o
     """
     in_fp = open(in_file_path, "r")
     out_fp = open_utf16le_file(out_file_path)
     out_fp.write(unicode(in_fp.read(), "utf-8").encode("utf-16-le"))
     in_fp.close()
     out_fp.close()
 
 if __name__ == '__main__':
-    sys.exit(preprocess_locale(sys.argv[1:]))
+    usage = """usage: %prog command <args>
+
+Commands:
+ --convert-utf8-utf16le - preprocesses installer locale properties files and
+                          creates a basic NSIS nlf file
+ --preprocess-locale    - Preprocesses the installer localized properties files
+                          into the format required by NSIS and creates a basic
+                          NSIS nlf file.
+
+preprocess-locale.py --preprocess-locale <src> <locale> <code> <dest>
+
+Arguments:
+ <src>   \tthe path to top source directory for the toolkit source
+ <locale>\tthe path to the installer's locale files
+ <code>  \tthe locale code
+ <dest>  \tthe path to the destination directory
+
+
+preprocess-locale.py --convert-utf8-utf16le <src> <dest>
+
+Arguments:
+ <src> \tthe path to the UTF-8 source file to convert
+ <dest>\tthe path to the UTF-16LE destination file to create
+"""
+    p = OptionParser(usage=usage)
+    p.add_option("--preprocess-locale", action="store_true", default=False,
+                 dest='preprocess')
+    p.add_option("--l10n-dir", action="append", default=[],
+                 dest="l10n_dirs",
+                 help="Add directory to lookup for locale files")
+    p.add_option("--convert-utf8-utf16le", action="store_true", default=False,
+                 dest='convert')
+
+    options, args = p.parse_args()
+
+    if ((not (options.preprocess or options.convert)) or
+        (options.preprocess and options.convert)):
+        p.error("You need to specify either --preprocess-locale or --convert-utf-utf16le")
+
+    if options.preprocess:
+        if len(args) not in (3,4):
+            p.error("--preprocess-locale needs all of <src> <locale> <code> <dest>")
+        pargs = args[:]
+        if len(args) == 4:
+            l10n_dirs = [args[1]]
+            del pargs[1]
+        else:
+            if not options.l10n_dirs:
+                p.error("--preprocess-locale needs either <locale> or --l10ndir")
+            l10n_dirs = options.l10n_dirs
+
+        pargs.append(l10n_dirs)
+        preprocess_locale_files(*pargs)
+    else:
+        if len(args) != 2:
+            p.error("--convert-utf8-utf16le needs both of <src> <dest>")
+        convert_utf8_utf16le(*args)