Fix bug 1130854 - Package Lightning with Thunderbird - Make mac unification work. r=jcranmer
authorPhilipp Kewisch <mozilla@kewis.ch>
Mon, 13 Apr 2015 21:54:08 +0200
changeset 25882 b11a42c262d6ce8a814c132a00a3bea820fa965e
parent 25881 fc7ec66919e6b092a00799527d05bec86be73cd5
child 25883 5fbe0977bfbf826d13fd1c7c29561adc1635577a
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjcranmer
bugs1130854
Fix bug 1130854 - Package Lightning with Thunderbird - Make mac unification work. r=jcranmer
calendar/lightning/build/universal.mk
calendar/lightning/lightning-tests.mk
mail/config/mozconfigs/macosx-universal/nightly
mail/config/mozconfigs/macosx-universal/release
--- a/calendar/lightning/build/universal.mk
+++ b/calendar/lightning/build/universal.mk
@@ -19,28 +19,41 @@ include $(topsrcdir)/mozilla/toolkit/moz
 
 THUNDERBIRD_VERSION := $(shell cat $(topsrcdir)/mail/config/version.txt)
 LIGHTNING_VERSION := $(shell $(PYTHON) $(topsrcdir)/calendar/lightning/build/makeversion.py $(word 1,$(MOZ_PKG_VERSION) $(THUNDERBIRD_VERSION)))
 XPI_PKGNAME = lightning-$(LIGHTNING_VERSION).$(AB_CD).$(MOZ_PKG_PLATFORM)
 
 STANDALONE_MAKEFILE := 1
 include $(TOPSRCDIR)/config/config.mk
 
+define unify_lightning
+mkdir -p $(DIST_UNI)/$1
+rm -rf $(DIST_UNI)/$1/$2*
+cp -R $(DIST_ARCH_1)/$1/$2 $(DIST_UNI)/$1
+grep -v binary-component $(DIST_ARCH_1)/$1/$2/components/libical-manifest > \
+	$(DIST_UNI)/$1/$2/components/libical-manifest || true
+platform=`$(PYTHON) $(TOPSRCDIR)/calendar/lightning/build/get-platform.py \
+	$(DIST_ARCH_1)/$1/$2`; \
+mkdir -p $(DIST_UNI)/$1/$2/components/$$platform; \
+mv $(DIST_UNI)/$1/$2/components/*.dylib \
+	$(DIST_UNI)/$1/$2/components/$$platform; \
+$(foreach dylib,$(wildcard $(DIST_ARCH_1)/$1/$2/components/*.dylib),echo binary-component $$platform/$(notdir $(dylib)) abi=$$platform >> $(DIST_UNI)/$1/$2/components/libical-manifest)
+platform=`$(PYTHON) $(TOPSRCDIR)/calendar/lightning/build/get-platform.py \
+	$(DIST_ARCH_2)/$1/$2`; \
+mkdir -p $(DIST_UNI)/$1/$2/components/$$platform; \
+cp $(DIST_ARCH_2)/$1/$2/components/*.dylib \
+	$(DIST_UNI)/$1/$2/components/$$platform; \
+$(foreach dylib,$(wildcard $(DIST_ARCH_2)/$1/$2/components/*.dylib),echo binary-component $$platform/$(notdir $(dylib)) abi=$$platform >> $(DIST_UNI)/$1/$2/components/libical-manifest)
+grep -v em:targetPlatform $(DIST_ARCH_1)/$1/$2/install.rdf > $(DIST_UNI)/$1/$2/install.rdf
+endef
+
+define unify_lightning_repackage
+cd $(DIST_UNI)/$1/$2 && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
+endef
+
 postflight_all:
-	mkdir -p $(DIST_UNI)/xpi-stage
-	rm -rf $(DIST_UNI)/xpi-stage/lightning*
-	cp -R $(DIST_ARCH_1)/xpi-stage/lightning $(DIST_UNI)/xpi-stage
-	grep -v binary-component $(DIST_ARCH_1)/xpi-stage/lightning/components/libical-manifest > \
-	    $(DIST_UNI)/xpi-stage/lightning/components/libical-manifest || true
-	platform=`$(PYTHON) $(TOPSRCDIR)/calendar/lightning/build/get-platform.py \
-		$(DIST_ARCH_1)/xpi-stage/lightning`; \
-	mkdir -p $(DIST_UNI)/xpi-stage/lightning/components/$$platform; \
-	mv $(DIST_UNI)/xpi-stage/lightning/components/*.dylib \
-		$(DIST_UNI)/xpi-stage/lightning/components/$$platform; \
-	$(foreach dylib,$(wildcard $(DIST_ARCH_1)/xpi-stage/lightning/components/*.dylib),echo binary-component $$platform/$(notdir $(dylib)) abi=$$platform >> $(DIST_UNI)/xpi-stage/lightning/components/libical-manifest)
-	platform=`$(PYTHON) $(TOPSRCDIR)/calendar/lightning/build/get-platform.py \
-		$(DIST_ARCH_2)/xpi-stage/lightning`; \
-	mkdir -p $(DIST_UNI)/xpi-stage/lightning/components/$$platform; \
-	cp $(DIST_ARCH_2)/xpi-stage/lightning/components/*.dylib \
-		$(DIST_UNI)/xpi-stage/lightning/components/$$platform; \
-	$(foreach dylib,$(wildcard $(DIST_ARCH_2)/xpi-stage/lightning/components/*.dylib),echo binary-component $$platform/$(notdir $(dylib)) abi=$$platform >> $(DIST_UNI)/xpi-stage/lightning/components/libical-manifest)
-	grep -v em:targetPlatform $(DIST_ARCH_1)/xpi-stage/lightning/install.rdf > $(DIST_UNI)/xpi-stage/lightning/install.rdf
-	cd $(DIST_UNI)/xpi-stage/lightning && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
+	$(call unify_lightning,xpi-stage,lightning)
+	$(call unify_lightning_repackage,xpi-stage,lightning)
+ifdef NIGHTLY_BUILD
+	$(call unify_lightning,$(MOZ_APP_DISPLAYNAME).app/Contents/Resources/extensions,{e2fda1a4-762b-4020-b5ad-a41df1933103})
+else
+	$(call unify_lightning,$(MOZ_APP_DISPLAYNAME).app/Contents/Resources/distribution/extensions,{e2fda1a4-762b-4020-b5ad-a41df1933103})
+endif
--- a/calendar/lightning/lightning-tests.mk
+++ b/calendar/lightning/lightning-tests.mk
@@ -1,17 +1,13 @@
 # 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 UNIVERSAL_BINARY
 PKG_STAGE = $(DIST)/test-stage
-else
-PKG_STAGE = $(DIST)/universal/test-stage
-endif
 
 # This is the target that should be called externally
 stage-package: stage-extension stage-mozmill
 
 # stage the extension, avoiding per-platform differences so that the mac unify
 # target works.
 stage-extension:
 	$(NSINSTALL) -D $(PKG_STAGE)/extensions/$(XPI_EM_ID)
--- a/mail/config/mozconfigs/macosx-universal/nightly
+++ b/mail/config/mozconfigs/macosx-universal/nightly
@@ -2,16 +2,20 @@
 # 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
 
+# Make sure Lightning is also unified, this needs to happen before including
+# the universal mozconfig because Lightning's univeral.mk needs to run first.
+mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
+
 . $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 --disable-install-strip
 ac_add_options --enable-signmar
--- a/mail/config/mozconfigs/macosx-universal/release
+++ b/mail/config/mozconfigs/macosx-universal/release
@@ -2,16 +2,20 @@
 # 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
 
+# Make sure Lightning is also unified, this needs to happen before including
+# the universal mozconfig because Lightning's univeral.mk needs to run first.
+mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
+
 . $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-official-branding
 ac_add_options --enable-calendar
@@ -22,14 +26,11 @@ export MOZ_DEBUG_SYMBOLS=1
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
 
 # Package js shell
 export MOZ_PACKAGE_JSSHELL=1
 
-# Make sure Lightning is also unified
-mk_add_options MOZ_POSTFLIGHT_ALL+=calendar/lightning/build/universal.mk
-
 # Run client.py
 mk_add_options CLIENT_PY_ARGS="$([ -f $topsrcdir/build/client.py-args ] && cat $topsrcdir/build/client.py-args)"
 mk_add_options ALWAYS_RUN_CLIENT_PY=1