Mac v2 signing - Bug 1047584 - Modify the .app file structure to allow for OSX v2 signing. r=bsmedberg
authorStephen Pohl <spohl.mozilla.bugs@gmail.com>
Mon, 29 Sep 2014 11:50:56 -0700
changeset 207892 fbc1ceea4d6f3df07e6c243f21517ec3d78bc6e8
parent 207891 3ff20d4c7f39e3b5c440c69051ce79385a08cc60
child 207893 f877c9b66cec79c8546dc2f2410afd3d72823c4f
push id49811
push usercbook@mozilla.com
push dateTue, 30 Sep 2014 13:36:20 +0000
treeherdermozilla-inbound@68ea04e7f688 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1047584
milestone35.0a1
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
Mac v2 signing - Bug 1047584 - Modify the .app file structure to allow for OSX v2 signing. r=bsmedberg
browser/app/Makefile.in
browser/app/macbuild/Contents/CodeResources
browser/app/macbuild/Contents/Info.plist.in
browser/app/macbuild/Contents/MacOS-files.in
browser/app/macbuild/Contents/_CodeSignature/CodeResources
browser/installer/package-manifest.in
config/createprecomplete.py
toolkit/locales/Makefile.in
toolkit/mozapps/installer/packager.mk
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -92,33 +92,28 @@ endif
 
 AB_CD = $(MOZ_UI_LOCALE)
 
 AB := $(firstword $(subst -, ,$(AB_CD)))
 
 clean clobber repackage::
 	$(RM) -r $(dist_dest)
 
-ifdef LIBXUL_SDK
-APPFILES = Resources
-else
-APPFILES = MacOS
-endif
-
 MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/config/buildid)
 
 .PHONY: repackage
 tools repackage:: $(PROGRAM)
 	$(MKDIR) -p $(dist_dest)/Contents/MacOS
 	$(MKDIR) -p $(dist_dest)/Contents/Resources/$(AB).lproj
 	rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents $(dist_dest) --exclude English.lproj
 	rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(dist_dest)/Contents/Resources/$(AB).lproj
 	sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(dist_dest)/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_dest)/Contents/Resources/$(AB).lproj/InfoPlist.strings
-	rsync -a $(DIST)/bin/ $(dist_dest)/Contents/$(APPFILES)
+	rsync -a --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ $(dist_dest)/Contents/Resources
+	rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ $(dist_dest)/Contents/MacOS
 	$(RM) $(dist_dest)/Contents/MacOS/$(PROGRAM)
 	rsync -aL $(PROGRAM) $(dist_dest)/Contents/MacOS
 	cp -RL $(DIST)/branding/firefox.icns $(dist_dest)/Contents/Resources/firefox.icns
 	cp -RL $(DIST)/branding/document.icns $(dist_dest)/Contents/Resources/document.icns
 	printf APPLMOZB > $(dist_dest)/Contents/PkgInfo
 endif
 
 ifdef LIBXUL_SDK #{
deleted file mode 100644
--- a/browser/app/macbuild/Contents/CodeResources
+++ /dev/null
@@ -1,1 +0,0 @@
-_CodeSignature/CodeResources
\ No newline at end of file
--- a/browser/app/macbuild/Contents/Info.plist.in
+++ b/browser/app/macbuild/Contents/Info.plist.in
@@ -142,17 +142,17 @@
 			<string>Viewer</string>
 		</dict>
 	</array>
 	<key>CFBundleExecutable</key>
 	<string>firefox</string>
 	<key>CFBundleGetInfoString</key>
 	<string>%MAC_APP_NAME% %APP_VERSION%</string>
 	<key>CFBundleIconFile</key>
-	<string>firefox</string>
+	<string>firefox.icns</string>
 	<key>CFBundleIdentifier</key>
 	<string>%MOZ_MACBUNDLE_ID%</string>
 	<key>CFBundleInfoDictionaryVersion</key>
 	<string>6.0</string>
 	<key>CFBundleName</key>
 	<string>%MAC_APP_NAME%</string>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
new file mode 100644
--- /dev/null
+++ b/browser/app/macbuild/Contents/MacOS-files.in
@@ -0,0 +1,5 @@
+/*.app/***
+/*.dylib
+/firefox-bin
+/webapprt-stub
+/XUL
deleted file mode 100644
--- a/browser/app/macbuild/Contents/_CodeSignature/CodeResources
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-    <dict>
-        <key>rules</key>
-        <dict>
-            <key>^Info.plist$</key>
-            <true/>
-            <key>^PkgInfo$</key>
-            <true/>
-            <key>^MacOS/</key>
-            <true/>
-            <key>^Resources/</key>
-            <true/>
-            <key>^MacOS/distribution/.*</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/override.ini</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/updates/.*</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/active-update.xml$</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/defaults/.*</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/removed-files$</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^MacOS/updates.xml$</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^Updated.app/.*</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-            <key>^updating/.*</key><dict>
-                <key>omit</key>
-                <true/>
-                <key>weight</key>
-                <real>10</real>
-            </dict>
-        </dict>
-    </dict>
-</plist>
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -18,20 +18,19 @@
 ;
 
 #filter substitution
 
 #ifdef XP_MACOSX
 ; Mac bundle stuff
 @APPNAME@/Contents/Info.plist
 @APPNAME@/Contents/PkgInfo
-@APPNAME@/Contents/Resources/
-#ifdef MOZ_SIGNING
-@APPNAME@/Contents/_CodeSignature/CodeResources
-#endif
+@APPNAME@/Contents/Resources/firefox.icns
+@APPNAME@/Contents/Resources/document.icns
+@APPNAME@/Contents/Resources/en.lproj/*
 #endif
 
 [@AB_CD@]
 @BINPATH@/browser/chrome/@AB_CD@@JAREXT@
 @BINPATH@/browser/chrome/@AB_CD@.manifest
 @BINPATH@/chrome/@AB_CD@@JAREXT@
 @BINPATH@/chrome/@AB_CD@.manifest
 @BINPATH@/browser/defaults/profile/bookmarks.html
@@ -50,41 +49,57 @@
 @BINPATH@/updater.ini
 #endif
 
 [xpcom]
 @BINPATH@/dependentlibs.list
 #ifdef GKMEDIAS_SHARED_LIBRARY
 @BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
 #endif
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
+#endif
 #ifdef MOZ_SHARED_MOZGLUE
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@mozglue@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
 #endif
+#endif
 #ifndef MOZ_STATIC_JS
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@mozjs@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@
 #endif
+#endif
 #ifdef MOZ_DMD
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@dmd@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
 #endif
+#endif
 #ifndef MOZ_NATIVE_NSPR
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
 #endif
 #endif
 #ifdef XP_MACOSX
-@BINPATH@/XUL
+@APPNAME@/Contents/MacOS/XUL
 #else
 @BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
 #endif
 #ifdef XP_MACOSX
-@BINPATH@/@MOZ_CHILD_PROCESS_NAME@.app/
-@BINPATH@/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
+@APPNAME@/Contents/MacOS/@MOZ_CHILD_PROCESS_NAME@.app/
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@plugin_child_interpose@DLL_SUFFIX@
 #else
 @BINPATH@/@MOZ_CHILD_PROCESS_NAME@
 #endif
 #ifdef XP_WIN32
 @BINPATH@/plugin-hang-ui@BIN_SUFFIX@
 #if MOZ_PACKAGE_MSVC_DLLS
 @BINPATH@/@MSVC_C_RUNTIME_DLL@
 @BINPATH@/@MSVC_CXX_RUNTIME_DLL@
@@ -104,28 +119,35 @@
 @BINPATH@/libicudata.so.@MOZ_ICU_VERSION@
 @BINPATH@/libicui18n.so.@MOZ_ICU_VERSION@
 @BINPATH@/libicuuc.so.@MOZ_ICU_VERSION@
 #endif
 #endif
 #endif
 #ifdef MOZ_REPLACE_MALLOC
 #ifndef MOZ_JEMALLOC3
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@replace_jemalloc@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@replace_jemalloc@DLL_SUFFIX@
 #endif
 #endif
+#endif
 #ifdef MOZ_GTK3
 @BINPATH@/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@mozgtk2@DLL_SUFFIX@
 #endif
 
 [browser]
 ; [Base Browser Files]
 #ifndef XP_UNIX
 @BINPATH@/@MOZ_APP_NAME@.exe
+#elif XP_MACOSX
+@APPNAME@/Contents/MacOS/@MOZ_APP_NAME@-bin
+@APPNAME@/Contents/MacOS/@MOZ_APP_NAME@
 #else
 @BINPATH@/@MOZ_APP_NAME@-bin
 @BINPATH@/@MOZ_APP_NAME@
 #endif
 @BINPATH@/application.ini
 #ifdef MOZ_UPDATER
 @BINPATH@/update-settings.ini
 #endif
@@ -735,29 +757,43 @@
 @BINPATH@/components/dom_smil.xpt
 
 ; [Personal Security Manager]
 ;
 ; NSS libraries are signed in the staging directory,
 ; meaning their .chk files are created there directly.
 ;
 #ifndef MOZ_NATIVE_NSS
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@freebl3@DLL_SUFFIX@
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@nss3@DLL_SUFFIX@
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@nssckbi@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nss3@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@nssckbi@DLL_SUFFIX@
+#endif
 #ifndef NSS_DISABLE_DBM
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@nssdbm3@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@nssdbm3@DLL_SUFFIX@
 #endif
+#endif
 #ifndef MOZ_FOLD_LIBS
 @BINPATH@/@DLL_PREFIX@nssutil3@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@smime3@DLL_SUFFIX@
 @BINPATH@/@DLL_PREFIX@ssl3@DLL_SUFFIX@
 #endif
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/@DLL_PREFIX@softokn3@DLL_SUFFIX@
+#else
 @BINPATH@/@DLL_PREFIX@softokn3@DLL_SUFFIX@
 #endif
+#endif
 @BINPATH@/chrome/pippki@JAREXT@
 @BINPATH@/chrome/pippki.manifest
 @BINPATH@/components/pipboot.xpt
 @BINPATH@/components/pipnss.xpt
 @BINPATH@/components/pippki.xpt
 
 ; For process sandboxing
 #if defined(MOZ_SANDBOX)
@@ -774,17 +810,17 @@ bin/libfreebl_32fpu_3.so
 bin/libfreebl_32int_3.so
 bin/libfreebl_32int64_3.so
 #endif
 
 ; [Updater]
 ;
 #ifdef MOZ_UPDATER
 #ifdef XP_MACOSX
-@BINPATH@/updater.app/
+@APPNAME@/Contents/MacOS/updater.app/
 #else
 @BINPATH@/updater@BIN_SUFFIX@
 #endif
 #endif
 
 ; [MaintenanceService]
 ;
 #ifdef MOZ_MAINTENANCE_SERVICE
@@ -794,17 +830,17 @@ bin/libfreebl_32int64_3.so
 
 ; [Crash Reporter]
 ;
 #ifdef MOZ_CRASHREPORTER
 @BINPATH@/components/CrashService.manifest
 @BINPATH@/components/CrashService.js
 @BINPATH@/components/toolkit_crashservice.xpt
 #ifdef XP_MACOSX
-@BINPATH@/crashreporter.app/
+@APPNAME@/Contents/MacOS/crashreporter.app/
 #else
 @BINPATH@/crashreporter@BIN_SUFFIX@
 @BINPATH@/crashreporter.ini
 #ifdef XP_UNIX
 @BINPATH@/Throbber-small.gif
 #endif
 #endif
 @BINPATH@/browser/crashreporter-override.ini
@@ -813,17 +849,21 @@ bin/libfreebl_32int64_3.so
 #endif
 #endif
 
 #ifdef MOZ_WEBAPP_RUNTIME
 [WebappRuntime]
 #ifdef XP_WIN
 @BINPATH@/webapp-uninstaller@BIN_SUFFIX@
 #endif
+#ifdef XP_MACOSX
+@APPNAME@/Contents/MacOS/webapprt-stub@BIN_SUFFIX@
+#else
 @BINPATH@/webapprt-stub@BIN_SUFFIX@
+#endif
 @BINPATH@/webapprt/webapprt.ini
 @BINPATH@/webapprt/chrome.manifest
 @BINPATH@/webapprt/chrome/webapprt@JAREXT@
 @BINPATH@/webapprt/chrome/webapprt.manifest
 @BINPATH@/webapprt/chrome/@AB_CD@@JAREXT@
 @BINPATH@/webapprt/chrome/@AB_CD@.manifest
 @BINPATH@/webapprt/components/CommandLineHandler.js
 @BINPATH@/webapprt/components/ContentPermission.js
--- a/config/createprecomplete.py
+++ b/config/createprecomplete.py
@@ -40,17 +40,17 @@ def get_build_entries(root_path):
     return rel_file_path_list, rel_dir_path_list
 
 def generate_precomplete(root_path):
     """ Creates the precomplete file containing the remove and rmdir
         application update instructions. The given directory is used
         for the location to enumerate and to create the precomplete file.
     """
     # If inside a Mac bundle use the root of the bundle for the path.
-    if os.path.basename(root_path) == "MacOS":
+    if os.path.basename(root_path) == "Resources":
         root_path = os.path.abspath(os.path.join(root_path, '../../'))
 
     rel_file_path_list, rel_dir_path_list = get_build_entries(root_path)
     precomplete_file_path = os.path.join(root_path,"precomplete")
     # open in binary mode to prevent OS specific line endings.
     precomplete_file = open(precomplete_file_path, "wb")
     for rel_file_path in rel_file_path_list:
         precomplete_file.writelines("remove \""+rel_file_path+"\"\n")
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -31,13 +31,13 @@ chrome-%:
 ifdef MOZ_UPDATER
 libs:: update.locale
 	sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
 endif
 
 ifdef MOZ_CRASHREPORTER
 libs:: crashreporter.ini
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/MacOS
+	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/Resources
 else
 	$(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
 endif
 endif
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -34,17 +34,17 @@ ifeq ($(OS_ARCH),WINNT)
 INSTALLER_DIR   = windows
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 ifndef _APPNAME
 _APPNAME = $(MOZ_MACBUNDLE_NAME)
 endif
 ifndef _BINPATH
-_BINPATH = /$(_APPNAME)/Contents/MacOS
+_BINPATH = /$(_APPNAME)/Contents/Resources
 endif # _BINPATH
 ifdef UNIVERSAL_BINARY
 STAGEPATH = universal/
 endif
 endif
 
 PACKAGE_BASE_DIR = $(_ABS_DIST)
 PACKAGE       = $(PKG_PATH)$(PKG_BASENAME)$(PKG_SUFFIX)
@@ -531,18 +531,16 @@ endif
 # For final GPG / authenticode signing / dmg signing if required
 ifdef MOZ_EXTERNAL_SIGNING_FORMAT
 MOZ_SIGN_PACKAGE_CMD=$(MOZ_SIGN_CMD) $(foreach f,$(MOZ_EXTERNAL_SIGNING_FORMAT),-f $(f))
 endif
 
 ifdef MOZ_SIGN_PREPARED_PACKAGE_CMD
 ifeq (Darwin, $(OS_ARCH))
 MAKE_PACKAGE    = cd ./$(PKG_DMG_SOURCE) && $(MOZ_SIGN_PREPARED_PACKAGE_CMD) $(MOZ_MACBUNDLE_NAME) \
-                  && rm $(MOZ_MACBUNDLE_NAME)/Contents/CodeResources \
-                  && cp $(MOZ_MACBUNDLE_NAME)/Contents/_CodeSignature/CodeResources $(MOZ_MACBUNDLE_NAME)/Contents \
                   && cd $(PACKAGE_BASE_DIR) \
                   && $(INNER_MAKE_PACKAGE)
 else
 MAKE_PACKAGE    = $(MOZ_SIGN_PREPARED_PACKAGE_CMD) \
 		  $(MOZ_PKG_DIR) && $(INNER_MAKE_PACKAGE)
 endif #Darwin
 
 else