Bug 696436: consolidate Mac bundle name selection, and allow adding a prefix to it at build time (and switch MoCo configs to add "Firefox" prefix), r=dolske, r=ted, a=akeybl
authorGavin Sharp <gavin@gavinsharp.com>
Thu, 27 Oct 2011 10:27:56 -0700
changeset 81491 bd759f82e517cc014edbd7c5f1a0fb5a65396152
parent 81490 ca95ccbc8194f1a602a28395737045b5fae2a908
child 81492 5ff54f9f7888a3dd6e0a868b38e4b1c1ad66ed15
push id434
push userclegnitto@mozilla.com
push dateWed, 21 Dec 2011 12:10:54 +0000
treeherdermozilla-beta@bddb6ed8dd47 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, ted, akeybl
bugs696436
milestone10.0a2
Bug 696436: consolidate Mac bundle name selection, and allow adding a prefix to it at build time (and switch MoCo configs to add "Firefox" prefix), r=dolske, r=ted, a=akeybl
browser/app/Makefile.in
browser/app/macbuild/Contents/Info.plist.in
browser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
browser/components/feeds/src/FeedWriter.js
browser/components/feeds/src/Makefile.in
browser/components/preferences/Makefile.in
browser/components/preferences/applications.js
browser/config/mozconfigs/macosx-universal/nightly
browser/config/mozconfigs/macosx32/debug
browser/config/mozconfigs/macosx64/debug
build/binary-location.mk
build/macosx/js-icc-flight.mk
build/macosx/universal/flight.mk
build/pgo/Makefile.in
config/autoconf.mk.in
configure.in
toolkit/mozapps/installer/packager.mk
tools/update-packaging/Makefile.in
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -202,69 +202,69 @@ endif
 libs:: $(srcdir)/profile/prefs.js
 	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin/defaults/profile
 
 libs:: $(srcdir)/blocklist.xml
 	$(INSTALL) $(IFLAGS1) $^ $(DIST)/bin
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 
-APP_NAME = $(MOZ_APP_DISPLAYNAME)
+MAC_APP_NAME = $(MOZ_APP_DISPLAYNAME)
 
 ifdef MOZ_DEBUG
-APP_NAME := $(APP_NAME)Debug
+MAC_APP_NAME := $(MAC_APP_NAME)Debug
 endif
 
-LOWER_APP_NAME = $(shell echo $(APP_NAME) | tr '[A-Z]' '[a-z]')
+LOWER_MAC_APP_NAME = $(shell echo $(MAC_APP_NAME) | tr '[A-Z]' '[a-z]')
 
 AB_CD = $(MOZ_UI_LOCALE)
 
 AB := $(firstword $(subst -, ,$(AB_CD)))
 
 clean clobber repackage::
-	$(RM) -r $(DIST)/$(APP_NAME).app
+	$(RM) -r $(DIST)/$(MOZ_MACBUNDLE_NAME)
 
 ifdef LIBXUL_SDK
 APPFILES = Resources
 else
 APPFILES = MacOS
 endif
 
 libs repackage:: $(PROGRAM) application.ini
-	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/MacOS
-	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
-	$(MKDIR) -p $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
-	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
-	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%LOWER_APP_NAME%/$(LOWER_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
-	sed -e "s/%APP_NAME%/$(APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj/InfoPlist.strings
-	rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
-	$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
+	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
+	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(MOZ_MACBUNDLE_NAME) --exclude English.lproj
+	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
+	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
+	sed -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" -e "s/%LOWER_MAC_APP_NAME%/$(LOWER_MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Info.plist
+	sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj/InfoPlist.strings
+	rsync -a $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/mangle $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)/shlibsign
 ifdef LIBXUL_SDK
-	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(APP_NAME).app/Contents/MacOS/firefox
+	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/firefox
 else
-	$(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
-	rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
+	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
+	rsync -aL $(PROGRAM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
 endif
-	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
-	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(APP_NAME).app/Contents/Resources/firefox.icns
-	cp -RL $(DIST)/branding/document.icns $(DIST)/$(APP_NAME).app/Contents/Resources/document.icns
-	printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
+	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/firefox.icns
+	cp -RL $(DIST)/branding/document.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/document.icns
+	printf APPLMOZB > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/PkgInfo
 #       remove CVS dirs from packaged app
-	find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
+	find $(DIST)/$(MOZ_MACBUNDLE_NAME) -type d -name "CVS" -prune -exec rm -rf {} \;
 
 else
 ifdef LIBXUL_SDK
 libs::
 	cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
 endif
 endif
 
 ifdef LIBXUL_SDK
 ifndef SKIP_COPY_XULRUNNER
 libs::
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
+	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Frameworks
 else
 	$(NSINSTALL) -D $(DIST)/bin/xulrunner
 	(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
 endif # cocoa
 endif # SKIP_COPY_XULRUNNER
 endif # LIBXUL_SDK
--- a/browser/app/macbuild/Contents/Info.plist.in
+++ b/browser/app/macbuild/Contents/Info.plist.in
@@ -140,25 +140,25 @@
 			<string>HTML5 Video (WebM)</string>
 			<key>CFBundleTypeRole</key>
 			<string>Viewer</string>
 		</dict>
 	</array>
 	<key>CFBundleExecutable</key>
 	<string>firefox</string>
 	<key>CFBundleGetInfoString</key>
-	<string>%APP_NAME% %APP_VERSION%</string>
+	<string>%MAC_APP_NAME% %APP_VERSION%</string>
 	<key>CFBundleIconFile</key>
 	<string>firefox</string>
 	<key>CFBundleIdentifier</key>
-	<string>org.mozilla.%LOWER_APP_NAME%</string>
+	<string>org.mozilla.%LOWER_MAC_APP_NAME%</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
-	<string>%APP_NAME%</string>
+	<string>%MAC_APP_NAME%</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<string>%APP_VERSION%</string>
 	<key>CFBundleSignature</key>
 	<string>MOZB</string>
 	<key>CFBundleURLTypes</key>
 	<array>
--- a/browser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
+++ b/browser/app/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in
@@ -1,1 +1,1 @@
-CFBundleName = "%APP_NAME%";
+CFBundleName = "%MAC_APP_NAME%";
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -760,17 +760,17 @@ FeedWriter.prototype = {
         if (this._selectedApp) {
           // XXXben - we need to compare this with the running instance executable
           //          just don't know how to do that via script...
           // XXXmano TBD: can probably add this to nsIShellService
 #ifdef XP_WIN
 #expand           if (fp.file.leafName != "__MOZ_APP_NAME__.exe") {
 #else
 #ifdef XP_MACOSX
-#expand           if (fp.file.leafName != "__MOZ_APP_DISPLAYNAME__.app") {
+#expand           if (fp.file.leafName != "__MOZ_MACBUNDLE_NAME__") {
 #else
 #expand           if (fp.file.leafName != "__MOZ_APP_NAME__-bin") {
 #endif
 #endif
             this._initMenuItemWithFile(this._contentSandbox.selectedAppMenuItem,
                                        this._selectedApp);
 
             // Show and select the selected application menuitem
--- a/browser/components/feeds/src/Makefile.in
+++ b/browser/components/feeds/src/Makefile.in
@@ -46,17 +46,17 @@ LIBRARY_NAME = browser_feeds_s
 FORCE_STATIC_LIB = 1
 FORCE_USE_PIC = 1
 ifndef MOZ_MEMORY
 USE_STATIC_LIBS = 1
 endif
 
 DEFINES += \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-	-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
+	-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
 	$(NULL)
 
 EXTRA_COMPONENTS = \
   BrowserFeeds.manifest \
   $(NULL)
 
 EXTRA_PP_COMPONENTS = \
 	FeedConverter.js \
--- a/browser/components/preferences/Makefile.in
+++ b/browser/components/preferences/Makefile.in
@@ -46,14 +46,14 @@ include $(DEPTH)/config/autoconf.mk
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += \
 	-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-	-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
+	-DMOZ_MACBUNDLE_NAME=$(MOZ_MACBUNDLE_NAME) \
 	$(NULL)
 
 ifneq (,$(filter windows gtk2 cocoa, $(MOZ_WIDGET_TOOLKIT)))
 DEFINES += -DHAVE_SHELL_SERVICE=1
 endif
--- a/browser/components/preferences/applications.js
+++ b/browser/components/preferences/applications.js
@@ -1347,17 +1347,17 @@ var gApplicationsPane = {
            aExecutable.isExecutable() &&
 // XXXben - we need to compare this with the running instance executable
 //          just don't know how to do that via script...
 // XXXmano TBD: can probably add this to nsIShellService
 #ifdef XP_WIN
 #expand    aExecutable.leafName != "__MOZ_APP_NAME__.exe";
 #else
 #ifdef XP_MACOSX
-#expand    aExecutable.leafName != "__MOZ_APP_DISPLAYNAME__.app";
+#expand    aExecutable.leafName != "__MOZ_MACBUNDLE_NAME__";
 #else
 #expand    aExecutable.leafName != "__MOZ_APP_NAME__-bin";
 #endif
 #endif
   },
 
   /**
    * Rebuild the actions menu for the selected entry.  Gets called by
--- a/browser/config/mozconfigs/macosx-universal/nightly
+++ b/browser/config/mozconfigs/macosx-universal/nightly
@@ -11,8 +11,10 @@ ac_add_options --disable-install-strip
 # Nightlies only since this has a cost in performance
 ac_add_options --enable-js-diagnostics
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 mk_add_options MOZ_MAKE_FLAGS="-j4"
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/browser/config/mozconfigs/macosx32/debug
+++ b/browser/config/mozconfigs/macosx32/debug
@@ -2,8 +2,10 @@
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/browser/config/mozconfigs/macosx64/debug
+++ b/browser/config/mozconfigs/macosx64/debug
@@ -2,8 +2,10 @@ ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 ac_add_options --enable-accessibility
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
+
+ac_add_options --with-macbundlename-prefix=Firefox
--- a/build/binary-location.mk
+++ b/build/binary-location.mk
@@ -48,17 +48,13 @@ endif
 endif
 
 TARGET_DIST = $(TARGET_DEPTH)/dist
 
 ifeq ($(MOZ_BUILD_APP),camino)
 browser_path = $(TARGET_DIST)/Camino.app/Contents/MacOS/Camino
 else
 ifeq ($(OS_ARCH),Darwin)
-ifdef MOZ_DEBUG
-browser_path = $(TARGET_DIST)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)
-else
-browser_path = $(TARGET_DIST)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)
-endif
+browser_path = $(TARGET_DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
 else
 browser_path = $(TARGET_DIST)/bin/$(PROGRAM)
 endif
 endif
--- a/build/macosx/js-icc-flight.mk
+++ b/build/macosx/js-icc-flight.mk
@@ -1,16 +1,10 @@
 OBJDIR_ICC = $(MOZ_OBJDIR)/js-icc
 OBJDIR_X86 = $(MOZ_OBJDIR)/i386
 
 include $(OBJDIR_X86)/config/autoconf.mk
 include $(TOPSRCDIR)/config/config.mk
 
-ifdef MOZ_DEBUG
-DBGTAG = Debug
-else
-DBGTAG =
-endif
-
 # Just copy the icc-produced libmozjs.dylib over
 postflight_all:
 	echo "Postflight: copying libmozjs.dylib..."
-	$(INSTALL) $(OBJDIR_ICC)/dist/bin/libmozjs.dylib $(OBJDIR_X86)/dist/$(MOZ_APP_DISPLAYNAME)$(DBGTAG).app/Contents/MacOS/
+	$(INSTALL) $(OBJDIR_ICC)/dist/bin/libmozjs.dylib $(OBJDIR_X86)/dist/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/
--- a/build/macosx/universal/flight.mk
+++ b/build/macosx/universal/flight.mk
@@ -46,36 +46,30 @@ DIST_ARCH_2 = $(OBJDIR_ARCH_2)/dist
 DIST_UNI = $(DIST_ARCH_1)/universal
 OBJDIR = $(OBJDIR_ARCH_1)
 endif
 
 include $(OBJDIR)/config/autoconf.mk
 
 DIST = $(OBJDIR)/dist
 
-ifdef MOZ_DEBUG
-DBGTAG = Debug
-else
-DBGTAG =
-endif
-
 ifdef LIBXUL_SDK # {
 APP_CONTENTS = Contents/Frameworks/XUL.framework
 else # } {
 APP_CONTENTS = Contents/MacOS
 endif # } LIBXUL_SDK
 
 ifeq ($(MOZ_BUILD_APP),camino) # {
 INSTALLER_DIR = camino/installer
 MOZ_PKG_APPNAME = camino
 APPNAME = Camino.app
 BUILDCONFIG_BASE = Contents/MacOS/chrome
 else # } {
 MOZ_PKG_APPNAME = $(MOZ_APP_NAME)
-APPNAME = $(MOZ_APP_DISPLAYNAME)$(DBGTAG).app
+APPNAME = $(MOZ_MACBUNDLE_NAME)
 INSTALLER_DIR = $(MOZ_BUILD_APP)/installer
 ifeq ($(MOZ_BUILD_APP),xulrunner) # {
 INSTALLER_DIR = xulrunner/installer/mac
 APPNAME = XUL.framework
 APP_CONTENTS = Versions/Current
 endif # } xulrunner
 BUILDCONFIG_BASE = $(APP_CONTENTS)/chrome
 endif # } !camino
--- a/build/pgo/Makefile.in
+++ b/build/pgo/Makefile.in
@@ -50,22 +50,20 @@ DIRS = \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 # We install to _profile/pgo
 TARGET_DEPTH = ../..
 include $(topsrcdir)/build/automation-build.mk
 
+# Need to override the browser_path from binary-location.mk (included via automation-build.mk)
+# since we want to run from e.g. dist/firefox rather than dist/bin
 ifeq ($(OS_ARCH),Darwin)
-ifdef MOZ_DEBUG
-browser_path = \"$(TARGET_DIST)/$(MOZ_APP_NAME)/$(MOZ_APP_DISPLAYNAME)Debug.app/Contents/MacOS/$(PROGRAM)\"
-else
-browser_path = \"$(TARGET_DIST)/$(MOZ_APP_NAME)/$(MOZ_APP_DISPLAYNAME).app/Contents/MacOS/$(PROGRAM)\"
-endif
+browser_path = \"$(TARGET_DIST)/$(MOZ_APP_NAME)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)\"
 else
 browser_path = \"$(TARGET_DIST)/$(MOZ_APP_NAME)/$(PROGRAM)\"
 endif
 
 # Stuff to make a build with a profile
 
 _PGO_FILES = 	\
   automation.py \
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -50,16 +50,17 @@ MOZ_BUILD_APP = @MOZ_BUILD_APP@
 MOZ_APP_NAME	= @MOZ_APP_NAME@
 MOZ_APP_DISPLAYNAME = @MOZ_APP_DISPLAYNAME@
 MOZ_APP_BASENAME = @MOZ_APP_BASENAME@
 MOZ_APP_VENDOR = @MOZ_APP_VENDOR@
 MOZ_APP_PROFILE = @MOZ_APP_PROFILE@
 MOZ_APP_UA_NAME = @MOZ_APP_UA_NAME@
 MOZ_APP_VERSION = @MOZ_APP_VERSION@
 MOZ_UA_BUILDID = @MOZ_UA_BUILDID@
+MOZ_MACBUNDLE_NAME = @MOZ_MACBUNDLE_NAME@
 
 MOZ_PKG_SPECIAL = @MOZ_PKG_SPECIAL@
 
 prefix		= @prefix@
 exec_prefix	= @exec_prefix@
 bindir		= @bindir@
 includedir	= @includedir@/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION)
 libdir		= @libdir@
--- a/configure.in
+++ b/configure.in
@@ -8357,16 +8357,36 @@ AC_SUBST(XPCOM_STANDALONE_GLUE_LDOPTS)
 AC_SUBST(USE_DEPENDENT_LIBS)
 
 AC_SUBST(MOZ_BUILD_ROOT)
 AC_SUBST(MOZ_OS2_TOOLS)
 
 AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
 AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
 
+dnl ========================================================
+dnl = Mac bundle name prefix
+dnl ========================================================
+MOZ_ARG_WITH_STRING(macbundlename-prefix,
+[  --with-macbundlename-prefix=prefix
+                          Prefix for MOZ_MACBUNDLE_NAME],
+[ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
+
+MOZ_MACBUNDLE_NAME=`echo $MOZ_APP_DISPLAYNAME | tr -d ' '`
+if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
+  MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX}${MOZ_MACBUNDLE_NAME}"
+fi
+
+if test "$MOZ_DEBUG"; then
+  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}Debug.app
+else
+  MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
+fi
+AC_SUBST(MOZ_MACBUNDLE_NAME)
+
 # The following variables are available to branding and application
 # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
 # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
 # impacts profile location and user-visible fields.
 # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
 # versions of a given application (e.g. Aurora and Firefox both use
 # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
 # for application.ini's "Name" field, which controls profile location in
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -343,21 +343,17 @@ INNER_UNMAKE_PACKAGE	= \
   mkdir $(MOZ_PKG_DIR) && \
   cd $(MOZ_PKG_DIR) && \
   $(UNZIP) $(UNPACKAGE) && \
   mv lib/$(ABI_DIR)/*.so . && \
   rm -rf lib
 endif
 ifeq ($(MOZ_PKG_FORMAT),DMG)
 ifndef _APPNAME
-ifdef MOZ_DEBUG
-_APPNAME	= $(MOZ_APP_DISPLAYNAME)Debug.app
-else
-_APPNAME	= $(MOZ_APP_DISPLAYNAME).app
-endif
+_APPNAME = $(MOZ_MACBUNDLE_NAME)
 endif
 ifndef _BINPATH
 _BINPATH	= /$(_APPNAME)/Contents/MacOS
 endif # _BINPATH
 PKG_SUFFIX	= .dmg
 PKG_DMG_FLAGS	=
 ifneq (,$(MOZ_PKG_MAC_DSSTORE))
 PKG_DMG_FLAGS += --copy "$(MOZ_PKG_MAC_DSSTORE):/.DS_Store"
--- a/tools/update-packaging/Makefile.in
+++ b/tools/update-packaging/Makefile.in
@@ -49,22 +49,22 @@ include $(DEPTH)/config/autoconf.mk
 PACKAGE_BASE_DIR	= $(DIST)
 
 # Default output location for update archive
 STAGE_DIR	= $(DIST)/$(PKG_UPDATE_PATH)
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 ifdef UNIVERSAL_BINARY
 ifneq (,$(filter %/l10n-stage,$(PACKAGE_BASE_DIR)))
-PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/$(MOZ_PKG_DIR)/$(MOZ_APP_DISPLAYNAME).app
+PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/$(MOZ_PKG_DIR)/$(MOZ_MACBUNDLE_NAME)
 else
-PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/universal/$(MOZ_PKG_DIR)/$(MOZ_APP_DISPLAYNAME).app
+PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/universal/$(MOZ_PKG_DIR)/$(MOZ_MACBUNDLE_NAME)
 endif
 else
-PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/$(MOZ_PKG_DIR)/$(MOZ_APP_DISPLAYNAME).app
+PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/$(MOZ_PKG_DIR)/$(MOZ_MACBUNDLE_NAME)
 endif
 else
 PACKAGE_DIR	= $(PACKAGE_BASE_DIR)/$(MOZ_PKG_DIR)
 endif
 
 MAR_BIN	= $(LIBXUL_DIST)/host/bin/mar$(HOST_BIN_SUFFIX)
 MBSDIFF_BIN	= $(LIBXUL_DIST)/host/bin/mbsdiff$(HOST_BIN_SUFFIX)