bug 313956: expand installer .exe contents to make complete mar. r=ted.
[gecko.git] / toolkit / locales / l10n.mk
blob3acd247370c4bdb2228ac1d42961edaefca9b6df
1 # vim:set ts=8 sw=8 sts=8 noet:
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is the Mozilla Browser code.
17 # The Initial Developer of the Original Code is
18 # Benjamin Smedberg <bsmedberg@covad.net>
19 # Portions created by the Initial Developer are Copyright (C) 2004
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
23 # Axel Hecht <l10n@mozilla.com>
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
40 # Shared makefile that can be used to easily kick off l10n builds
41 # of Mozilla applications.
42 # This makefile should be included, and then assumes that the including
43 # makefile defines the following targets:
44 # clobber-zip
45 # This target should remove all language dependent-files from $(STAGEDIST),
46 # depending on $(AB_CD) set to the locale code.
47 # $(AB_CD) will be en-US on the initial unpacking of the package
48 # libs-%
49 # This target should call into the various libs targets that this
50 # application depends on.
51 # Make sure to set BOTH_MANIFESTS=1, as this will be called only once
52 # for both packages and language packs.
53 # installer-%
54 # This target should list all required targets, a typical rule would be
55 # installers-%: clobber-% langpack-% repackage-zip-%
56 # @echo "repackaging done"
57 # to initially clobber the locale staging area, and then to build the
58 # language pack and zip package.
59 # Other targets like windows installers might be listed, too, and should
60 # be defined in the including makefile.
61 # The including makefile should provide values for the variables
62 # MOZ_APP_VERSION and MOZ_LANGPACK_EID.
65 run_for_effects := $(shell if test ! -d $(DIST); then $(NSINSTALL) -D $(DIST); fi)
67 # This makefile uses variable overrides from the libs-% target to
68 # build non-default locales to non-default dist/ locations. Be aware!
70 AB = $(firstword $(subst -, ,$(AB_CD)))
72 core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(CURDIR)/$(1)))
74 # These are defaulted to be compatible with the files the wget-en-US target
75 # pulls. You may override them if you provide your own files. You _must_
76 # override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not
77 # work in that case.
78 ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE)
79 WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
81 # Allows overriding the final destination of the repackaged file
82 ZIP_OUT ?= $(_ABS_DIST)/$(PACKAGE)
84 DEFINES += \
85 -DAB_CD=$(AB_CD) \
86 -DMOZ_LANGPACK_EID=$(MOZ_LANGPACK_EID) \
87 -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
88 -DLOCALE_SRCDIR=$(call core_abspath,$(LOCALE_SRCDIR)) \
89 -DPKG_BASENAME="$(PKG_BASENAME)" \
90 -DPKG_INST_BASENAME="$(PKG_INST_BASENAME)" \
91 $(NULL)
94 clobber-%:
95 $(RM) -rf $(DIST)/xpi-stage/locale-$*
98 PACKAGER_NO_LIBS = 1
99 include $(MOZILLA_DIR)/toolkit/mozapps/installer/packager.mk
102 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
103 STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)/$(_APPNAME)/Contents/MacOS
104 else
105 STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR)
106 endif
108 $(STAGEDIST): AB_CD:=en-US
109 $(STAGEDIST): UNPACKAGE=$(call ESCAPE_SPACE,$(ZIP_IN))
110 $(STAGEDIST): $(call ESCAPE_SPACE,$(ZIP_IN))
111 # only mac needs to remove the parent of STAGEDIST...
112 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
113 $(RM) -r -v $(DIST)/l10n-stage
114 else
115 # ... and windows doesn't like removing STAGEDIST itself, remove all children
116 find $(STAGEDIST) -maxdepth 1 -print0 | xargs -0 $(RM) -r
117 endif
118 $(NSINSTALL) -D $(DIST)/l10n-stage
119 cd $(DIST)/l10n-stage && \
120 $(UNMAKE_PACKAGE)
121 $(MAKE) clobber-zip AB_CD=en-US
124 unpack: $(STAGEDIST)
125 @echo done unpacking
127 # The path to the object dir for the mozilla-central build system,
128 # may be overridden if necessary.
129 MOZDEPTH ?= $(DEPTH)
131 ifdef MOZ_MAKE_COMPLETE_MAR
132 MAKE_COMPLETE_MAR = 1
133 ifeq ($(OS_ARCH), WINNT)
134 ifneq ($(MOZ_PKG_FORMAT), SFX7Z)
135 MAKE_COMPLETE_MAR =
136 endif
137 endif
138 endif
139 repackage-zip: UNPACKAGE="$(ZIP_IN)"
140 repackage-zip: libs-$(AB_CD)
141 # Adjust jar logs with the new locale (can't use sed -i because of bug 373784)
142 -$(PERL) -pi -e "s/en-US/$(AB_CD)/g" $(_ABS_DIST)/jarlog/*.jar.log
143 # call a hook for apps to put their uninstall helper.exe into the package
144 $(UNINSTALLER_PACKAGE_HOOK)
145 # copy xpi-stage over, but not install.rdf and chrome.manifest,
146 # those are just for language packs
147 cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
148 tar --exclude=install.rdf --exclude=chrome.manifest $(TAR_CREATE_FLAGS) - * | ( cd $(STAGEDIST) && tar -xf - )
149 mv $(STAGEDIST)/chrome/$(AB_CD).manifest $(STAGEDIST)/chrome/localized.manifest
150 ifneq (en,$(AB))
151 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
152 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
153 endif
154 endif
155 $(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
156 cd $(DIST)/l10n-stage; \
157 $(MAKE_PACKAGE)
158 ifeq (WINCE,$(OS_ARCH))
159 cd $(DIST)/l10n-stage; \
160 $(MAKE_CAB)
161 endif
162 ifdef MAKE_COMPLETE_MAR
163 $(MAKE) -C $(MOZDEPTH)/tools/update-packaging full-update AB_CD=$(AB_CD) \
164 MOZ_PKG_PRETTYNAMES=$(MOZ_PKG_PRETTYNAMES) \
165 PACKAGE_BASE_DIR="$(_ABS_DIST)/l10n-stage" \
166 DIST="$(_ABS_DIST)"
167 endif
168 # packaging done, undo l10n stuff
169 ifneq (en,$(AB))
170 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
171 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
172 endif
173 endif
174 ifdef MOZ_OMNIJAR
175 @(cd $(STAGEDIST) && $(UNPACK_OMNIJAR))
176 endif
177 $(MAKE) clobber-zip AB_CD=$(AB_CD)
178 $(NSINSTALL) -D $(DIST)/$(PKG_PATH)
179 mv -f "$(DIST)/l10n-stage/$(PACKAGE)" "$(ZIP_OUT)"
180 ifeq (WINCE,$(OS_ARCH))
181 mv -f "$(DIST)/l10n-stage/$(PKG_BASENAME).cab" "$(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab"
182 endif
184 repackage-zip-%: $(STAGEDIST)
185 @$(MAKE) repackage-zip AB_CD=$* ZIP_IN="$(ZIP_IN)"
187 APP_DEFINES = $(firstword $(wildcard $(LOCALE_SRCDIR)/defines.inc) \
188 $(srcdir)/en-US/defines.inc)
189 TK_DEFINES = $(firstword \
190 $(wildcard $(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/defines.inc) \
191 $(MOZILLA_DIR)/toolkit/locales/en-US/defines.inc)
193 langpack-%: LANGPACK_FILE=$(_ABS_DIST)/$(PKG_LANGPACK_PATH)$(PKG_LANGPACK_BASENAME).xpi
194 langpack-%: AB_CD=$*
195 langpack-%: XPI_NAME=locale-$*
196 langpack-%: libs-%
197 @echo "Making langpack $(LANGPACK_FILE)"
198 $(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH)
199 $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) -I$(TK_DEFINES) -I$(APP_DEFINES) $(srcdir)/generic/install.rdf > $(FINAL_TARGET)/install.rdf
200 cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
201 $(ZIP) -r9D $(LANGPACK_FILE) install.rdf chrome chrome.manifest -x chrome/$(AB_CD).manifest
204 # This variable is to allow the wget-en-US target to know which ftp server to download from
205 ifndef EN_US_BINARY_URL
206 EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL)
207 endif
209 # This make target allows us to wget the latest en-US binary from a specified website
210 # The make installers-% target needs the en-US binary in dist/
211 # and for the windows repackages we need the .installer.exe in dist/sea
212 wget-en-US:
213 ifndef WGET
214 $(error Wget not installed)
215 endif
216 $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_PATH)
217 (cd $(_ABS_DIST)/$(PKG_PATH) && $(WGET) -nv -N "$(EN_US_BINARY_URL)/$(PACKAGE)")
218 @echo "Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PKG_PATH)/$(PACKAGE)"
219 ifdef RETRIEVE_WINDOWS_INSTALLER
220 ifeq ($(OS_ARCH), WINNT)
221 $(NSINSTALL) -D $(_ABS_DIST)/$(PKG_INST_PATH)
222 (cd $(_ABS_DIST)/$(PKG_INST_PATH) && $(WGET) -nv -N "$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe")
223 @echo "Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
224 endif
225 endif
227 generate-snippet-%:
228 $(PYTHON) $(MOZILLA_DIR)/tools/update-packaging/generatesnippet.py \
229 --mar-path=$(_ABS_DIST)/update \
230 --application-ini-file=$(STAGEDIST)/application.ini \
231 --locale=$* \
232 --product=$(MOZ_PKG_APPNAME) \
233 --platform=$(MOZ_PKG_PLATFORM) \
234 --download-base-URL=$(DOWNLOAD_BASE_URL) \
235 --verbose