1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/locales/l10n.mk Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,197 @@ 1.4 +# vim:set ts=8 sw=8 sts=8 noet: 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 + 1.10 +# Shared makefile that can be used to easily kick off l10n builds 1.11 +# of Mozilla applications. 1.12 +# This makefile should be included, and then assumes that the including 1.13 +# makefile defines the following targets: 1.14 +# clobber-zip 1.15 +# This target should remove all language dependent-files from $(STAGEDIST), 1.16 +# depending on $(AB_CD) set to the locale code. 1.17 +# $(AB_CD) will be en-US on the initial unpacking of the package 1.18 +# libs-% 1.19 +# This target should call into the various libs targets that this 1.20 +# application depends on. 1.21 +# installer-% 1.22 +# This target should list all required targets, a typical rule would be 1.23 +# installers-%: clobber-% langpack-% repackage-zip-% 1.24 +# @echo "repackaging done" 1.25 +# to initially clobber the locale staging area, and then to build the 1.26 +# language pack and zip package. 1.27 +# Other targets like windows installers might be listed, too, and should 1.28 +# be defined in the including makefile. 1.29 +# The including makefile should provide values for the variables 1.30 +# MOZ_APP_VERSION and MOZ_LANGPACK_EID. 1.31 + 1.32 + 1.33 +run_for_effects := $(shell if test ! -d $(DIST); then $(NSINSTALL) -D $(DIST); fi) 1.34 + 1.35 +# This makefile uses variable overrides from the libs-% target to 1.36 +# build non-default locales to non-default dist/ locations. Be aware! 1.37 + 1.38 +AB = $(firstword $(subst -, ,$(AB_CD))) 1.39 + 1.40 +# These are defaulted to be compatible with the files the wget-en-US target 1.41 +# pulls. You may override them if you provide your own files. You _must_ 1.42 +# override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not 1.43 +# work in that case. 1.44 +ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE) 1.45 +WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe 1.46 + 1.47 +# Allows overriding the final destination of the repackaged file 1.48 +ZIP_OUT ?= $(_ABS_DIST)/$(PACKAGE) 1.49 + 1.50 +DEFINES += \ 1.51 + -DAB_CD=$(AB_CD) \ 1.52 + -DMOZ_LANGPACK_EID=$(MOZ_LANGPACK_EID) \ 1.53 + -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \ 1.54 + -DMOZ_APP_MAXVERSION=$(MOZ_APP_MAXVERSION) \ 1.55 + -DLOCALE_SRCDIR=$(abspath $(LOCALE_SRCDIR)) \ 1.56 + -DPKG_BASENAME='$(PKG_BASENAME)' \ 1.57 + -DPKG_INST_BASENAME='$(PKG_INST_BASENAME)' \ 1.58 + $(NULL) 1.59 + 1.60 + 1.61 +clobber-%: 1.62 + $(RM) -rf $(DIST)/xpi-stage/locale-$* 1.63 + 1.64 + 1.65 +PACKAGER_NO_LIBS = 1 1.66 + 1.67 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) 1.68 +STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/MacOS 1.69 +else 1.70 +STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR) 1.71 +endif 1.72 + 1.73 +include $(MOZILLA_DIR)/toolkit/mozapps/installer/signing.mk 1.74 +include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk 1.75 + 1.76 +PACKAGE_BASE_DIR = $(_ABS_DIST)/l10n-stage 1.77 + 1.78 +$(STAGEDIST): AB_CD:=en-US 1.79 +$(STAGEDIST): UNPACKAGE=$(call ESCAPE_WILDCARD,$(ZIP_IN)) 1.80 +$(STAGEDIST): $(call ESCAPE_WILDCARD,$(ZIP_IN)) 1.81 +# only mac needs to remove the parent of STAGEDIST... 1.82 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) 1.83 + $(RM) -r -v $(DIST)/l10n-stage 1.84 +else 1.85 +# ... and windows doesn't like removing STAGEDIST itself, remove all children 1.86 + find $(STAGEDIST) -maxdepth 1 -print0 | xargs -0 $(RM) -r 1.87 +endif 1.88 + $(NSINSTALL) -D $(DIST)/l10n-stage 1.89 + cd $(DIST)/l10n-stage && \ 1.90 + $(INNER_UNMAKE_PACKAGE) 1.91 + 1.92 + 1.93 +unpack: $(STAGEDIST) 1.94 + @echo done unpacking 1.95 + 1.96 +# The path to the object dir for the mozilla-central build system, 1.97 +# may be overridden if necessary. 1.98 +MOZDEPTH ?= $(DEPTH) 1.99 + 1.100 +ifdef MOZ_MAKE_COMPLETE_MAR 1.101 +MAKE_COMPLETE_MAR = 1 1.102 +ifeq ($(OS_ARCH), WINNT) 1.103 +ifneq ($(MOZ_PKG_FORMAT), SFX7Z) 1.104 +MAKE_COMPLETE_MAR = 1.105 +endif 1.106 +endif 1.107 +endif 1.108 +repackage-zip: UNPACKAGE='$(ZIP_IN)' 1.109 +repackage-zip: ALREADY_SZIPPED=1 1.110 +repackage-zip: libs-$(AB_CD) 1.111 +# call a hook for apps to put their uninstall helper.exe into the package 1.112 + $(UNINSTALLER_PACKAGE_HOOK) 1.113 +# call a hook for apps to build the stub installer 1.114 +ifdef MOZ_STUB_INSTALLER 1.115 + $(STUB_HOOK) 1.116 +endif 1.117 + $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/l10n-repack.py $(STAGEDIST) $(DIST)/xpi-stage/locale-$(AB_CD) \ 1.118 + $(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES))) 1.119 +ifneq (en,$(AB)) 1.120 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) 1.121 + 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 1.122 +endif 1.123 +endif 1.124 + $(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH) 1.125 + cd $(DIST)/l10n-stage; \ 1.126 + $(MAKE_PACKAGE) 1.127 +ifdef MAKE_COMPLETE_MAR 1.128 + $(MAKE) -C $(MOZDEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \ 1.129 + MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \ 1.130 + PACKAGE_BASE_DIR='$(_ABS_DIST)/l10n-stage' \ 1.131 + DIST='$(_ABS_DIST)' 1.132 +endif 1.133 +# packaging done, undo l10n stuff 1.134 +ifneq (en,$(AB)) 1.135 +ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) 1.136 + 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 1.137 +endif 1.138 +endif 1.139 + $(NSINSTALL) -D $(DIST)/$(PKG_PATH) 1.140 + mv -f '$(DIST)/l10n-stage/$(PACKAGE)' '$(ZIP_OUT)' 1.141 + if test -f '$(DIST)/l10n-stage/$(PACKAGE).asc'; then mv -f '$(DIST)/l10n-stage/$(PACKAGE).asc' '$(ZIP_OUT).asc'; fi 1.142 + 1.143 +repackage-zip-%: $(STAGEDIST) 1.144 + @$(MAKE) repackage-zip AB_CD=$* ZIP_IN='$(ZIP_IN)' 1.145 + 1.146 +APP_DEFINES = $(firstword $(wildcard $(LOCALE_SRCDIR)/defines.inc) \ 1.147 + $(srcdir)/en-US/defines.inc) 1.148 +TK_DEFINES = $(firstword \ 1.149 + $(wildcard $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/defines.inc) \ 1.150 + $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc) 1.151 + 1.152 +# Dealing with app sub dirs: If DIST_SUBDIRS is defined it contains a 1.153 +# listing of app sub-dirs we should include in langpack xpis. If not, 1.154 +# check DIST_SUBDIR, and if that isn't present, just package the default 1.155 +# chrome directory. 1.156 +PKG_ZIP_DIRS = chrome $(or $(DIST_SUBDIRS),$(DIST_SUBDIR)) 1.157 + 1.158 +langpack-%: LANGPACK_FILE=$(_ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi 1.159 +langpack-%: AB_CD=$* 1.160 +langpack-%: XPI_NAME=locale-$* 1.161 +langpack-%: libs-% 1.162 + @echo 'Making langpack $(LANGPACK_FILE)' 1.163 + $(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH) 1.164 + $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) \ 1.165 + -I$(TK_DEFINES) -I$(APP_DEFINES) $(srcdir)/generic/install.rdf -o $(DIST)/xpi-stage/$(XPI_NAME)/install.rdf) 1.166 + cd $(DIST)/xpi-stage/locale-$(AB_CD) && \ 1.167 + $(ZIP) -r9D $(LANGPACK_FILE) install.rdf $(PKG_ZIP_DIRS) chrome.manifest 1.168 + 1.169 +# This variable is to allow the wget-en-US target to know which ftp server to download from 1.170 +ifndef EN_US_BINARY_URL 1.171 +EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL) 1.172 +endif 1.173 + 1.174 +# This make target allows us to wget the latest en-US binary from a specified website 1.175 +# The make installers-% target needs the en-US binary in dist/ 1.176 +# and for the windows repackages we need the .installer.exe in dist/sea 1.177 +wget-en-US: 1.178 +ifndef WGET 1.179 + $(error Wget not installed) 1.180 +endif 1.181 + $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_PATH) 1.182 + (cd $(_ABS_DIST)/$(PKG_PATH) && $(WGET) --no-cache -nv -N '$(EN_US_BINARY_URL)/$(PACKAGE)') 1.183 + @echo 'Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PKG_PATH)/$(PACKAGE)' 1.184 +ifdef RETRIEVE_WINDOWS_INSTALLER 1.185 +ifeq ($(OS_ARCH), WINNT) 1.186 + $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH) 1.187 + (cd $(_ABS_DIST)/$(PKG_INST_PATH) && $(WGET) --no-cache -nv -N '$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe') 1.188 + @echo 'Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe' 1.189 +endif 1.190 +endif 1.191 + 1.192 +generate-snippet-%: 1.193 + $(PYTHON) $(MOZILLA_DIR)/tools/update-packaging/generatesnippet.py \ 1.194 + --mar-path=$(_ABS_DIST)/update \ 1.195 + --application-ini-file=$(STAGEDIST)/application.ini \ 1.196 + --locale=$* \ 1.197 + --product=$(MOZ_PKG_APPNAME) \ 1.198 + --platform=$(MOZ_PKG_PLATFORM) \ 1.199 + --download-base-URL=$(DOWNLOAD_BASE_URL) \ 1.200 + --verbose