calendar/lightning/lightning-packager.mk
author Siddharth Agarwal <sid.bugzilla@gmail.com>
Tue, 16 Aug 2011 00:35:27 +0530
changeset 8757 69050ad29af01176ec99a8e94a91d0a55ef28d1a
parent 7134 40969e8de0a80830660afdda54480625a8b10abd
child 8433 dce479d8d80794a0fafd6e9edf1bd89624449c3c
permissions -rw-r--r--
Bug 656736 - Support upgrading to the latest version of MozMill. r=Standard8 This patch adds mozmill 1.5.4b4, mozrunner 2.5.5b4 and jsbridge 2.4.4b4 to the tree. It also sets up a virtualenv to install mozmill and its dependencies in. This patch means Thunderbird developers will no longer need to have MozMill or its dependencies installed in order to run MozMill tests.

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Calendar code.
#
# The Initial Developer of the Original Code is
#   Philipp Kewisch <mozilla@kewis.ch>
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****

_ABS_DIST := $(call core_abspath,$(DIST))
ZIP_IN ?= $(_ABS_DIST)/xpi-stage/$(XPI_NAME).xpi

# This variable is to allow the wget-en-US target to know which ftp server to download from
ifndef EN_US_BINARY_URL
EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL)
endif

# Target Directory used for the l10n files
L10N_TARGET = $(DIST)/xpi-stage/$(XPI_NAME)-$(AB_CD)

$(DIST)/xpi-stage:
	mkdir -p $@

wget-en-US: $(DIST)/xpi-stage
ifndef WGET
	$(error wget not installed)
endif
	(cd $(DIST)/xpi-stage && $(WGET) -nv -N $(EN_US_BINARY_URL)/$(XPI_NAME).xpi)
	@echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to	$(ZIP_IN)"

unpack: $(ZIP_IN)
# We're unpacking directly into FINAL_TARGET, this keeps code to do manual
# repacks cleaner.
	if test -d $(FINAL_TARGET); then \
	  $(RM) -r -v $(FINAL_TARGET); \
	fi
	$(NSINSTALL) -D $(FINAL_TARGET)
	cd $(FINAL_TARGET) && $(UNZIP) $(ZIP_IN)
	@echo done unpacking

# Call this target to upload the localized lightning package.
l10n-upload-%: AB_CD=$*
l10n-upload-%:
	$(PYTHON) $(MOZILLA_SRCDIR)/build/upload.py --base-path $(DIST)/xpi-stage/  "$(L10N_TARGET).xpi"

# Call this target to trigger repackaging lightning for a specific language
# Usage: make AB_CD=<language> repack-l10n
repack-l10n: L10N_XPI_NAME=$(subst -en-US,,$(XPI_NAME)-$(AB_CD))
repack-l10n: recreate-platformini repack-clobber libs-$(AB_CD) repack-process-extrafiles
	@echo "Finished repackaging $(XPI_NAME) locale for Language $(AB_CD)"

# This target should not be called directly
repack-clobber-all:
	@echo "Repackaging $(XPI_NAME) locale for Language $(AB_CD)"
	$(RM) -rf $(L10N_TARGET)
	cp -R $(DIST)/xpi-stage/$(XPI_NAME) $(L10N_TARGET)

# This target should not be called directly
repack-clobber: repack-clobber-all
	grep -v 'locale \w\+ en-US' $(L10N_TARGET)/chrome.manifest > $(L10N_TARGET)/chrome.manifest~ && \
	  mv $(L10N_TARGET)/chrome.manifest~ $(L10N_TARGET)/chrome.manifest
ifeq ($(MOZ_CHROME_FILE_FORMAT),flat)
	$(RM) -rf $(L10N_TARGET)/chrome/lightning-en-US/
	$(RM) -rf $(L10N_TARGET)/chrome/calendar-en-US/
else ifeq ($(MOZ_CHROME_FILE_FORMAT),jar)
	$(RM) -rf $(L10N_TARGET)/chrome/lightning-en-US.jar
	$(RM) -rf $(L10N_TARGET)/chrome/calendar-en-US.jar
else
	@echo "ERROR: Unhandled chrome file format: $(MOZ_CHROME_FILE_FORMAT)"
	@exit 1
endif

# Repack the existing lightning to contain all locales in lightning-all.xpi
repack-l10n-all: AB_CD=all
repack-l10n-all: L10N_XPI_NAME=lightning-all
repack-l10n-all: repack-clobber-all $(addprefix libs-,$(shell cat $(topsrcdir)/calendar/locales/shipped-locales))

# Helper target to align names better to targets from other locale Makefiles
repack-l10n-%:
	$(MAKE) AB_CD=$* repack-l10n

# Actual locale packaging targets. If L10N_XPI_NAME is set, then use it.
# Otherwise keep the original XPI_NAME
libs-%: FINAL_XPI_NAME=$(if $(L10N_XPI_NAME),$(L10N_XPI_NAME),$(XPI_NAME))
libs-%:
	$(MAKE) -C locales libs AB_CD=$* XPI_NAME=$(FINAL_XPI_NAME) XPI_PKGNAME=$(FINAL_XPI_NAME) USE_EXTENSION_MANIFEST=1
	$(MAKE) -C ../locales libs AB_CD=$* XPI_NAME=$(FINAL_XPI_NAME) XPI_PKGNAME=$(FINAL_XPI_NAME) USE_EXTENSION_MANIFEST=1

# For localized xpis, the install.rdf and lightning-l10n.js need to be
# reprocessed with some defines from the locale.
repack-process-extrafiles: LOCALE_BASEDIR=$(call EXPAND_LOCALE_SRCDIR,calendar/locales)
repack-process-extrafiles:
	$(PYTHON) $(MOZILLA_SRCDIR)/config/Preprocessor.py $(XULAPP_DEFINES) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) -I $(LOCALE_BASEDIR)/defines.inc $(srcdir)/install.rdf > $(DIST)/xpi-stage/$(L10N_XPI_NAME)/install.rdf
	$(PYTHON) $(MOZILLA_SRCDIR)/config/Preprocessor.py $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(LOCALE_BASEDIR)/lightning-l10n.js  > $(DIST)/xpi-stage/$(L10N_XPI_NAME)/$(PREF_DIR)/lightning-l10n.js

# When repackaging lightning from the builder, platform.ini is not yet created.i
# Recreate it from the application.ini bundled with the downloaded xpi.
$(LIBXUL_DIST)/bin/platform.ini:
	 echo "[Build]" >> $(LIBXUL_DIST)/bin/platform.ini
	 
	 echo -n "Milestone=" >> $(LIBXUL_DIST)/bin/platform.ini
	 $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(DIST)/xpi-stage/$(XPI_NAME)/application.ini Gecko MaxVersion >> $(LIBXUL_DIST)/bin/platform.ini
	 
	 echo -n "SourceStamp=" >> $(LIBXUL_DIST)/bin/platform.ini
	 $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(DIST)/xpi-stage/$(XPI_NAME)/application.ini Build SourceStamp >> $(LIBXUL_DIST)/bin/platform.ini
	 
	 echo -n "SourceRepository=" >> $(LIBXUL_DIST)/bin/platform.ini
	 $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(DIST)/xpi-stage/$(XPI_NAME)/application.ini Build SourceRepository >> $(LIBXUL_DIST)/bin/platform.ini
	 
	 echo -n "BuildID=" >> $(LIBXUL_DIST)/bin/platform.ini
	 $(PYTHON) $(MOZILLA_SRCDIR)/config/printconfigsetting.py $(DIST)/xpi-stage/$(XPI_NAME)/application.ini App BuildID >> $(LIBXUL_DIST)/bin/platform.ini

recreate-platformini: $(LIBXUL_DIST)/bin/platform.ini