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
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.
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:
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
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.
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
)
66 _ABS_DIST
:= $(shell cd
$(DIST
) && pwd
)
69 # This makefile uses variable overrides from the libs-% target to
70 # build non-default locales to non-default dist/ locations. Be aware!
72 AB
= $(firstword $(subst -, ,$(AB_CD
)))
74 core_abspath
= $(if
$(findstring :,$(1)),$(1),$(if
$(filter /%,$(1)),$(1),$(CURDIR
)/$(1)))
76 # These are defaulted to be compatible with the files the wget-en-US target
77 # pulls. You may override them if you provide your own files. You _must_
78 # override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not
80 ZIP_IN ?
= $(_ABS_DIST
)/$(PACKAGE
)
81 WIN32_INSTALLER_IN ?
= $(_ABS_DIST
)/$(PKG_INST_PATH
)$(PKG_INST_BASENAME
).exe
83 # Allows overriding the final destination of the repackaged file
84 ZIP_OUT ?
= $(_ABS_DIST
)/$(PACKAGE
)
88 -DMOZ_LANGPACK_EID
=$(MOZ_LANGPACK_EID
) \
89 -DMOZ_APP_VERSION
=$(MOZ_APP_VERSION
) \
90 -DLOCALE_SRCDIR
=$(call core_abspath
,$(LOCALE_SRCDIR
)) \
91 -DPKG_BASENAME
="$(PKG_BASENAME)" \
92 -DPKG_INST_BASENAME
="$(PKG_INST_BASENAME)" \
97 $(RM
) -rf
$(DIST
)/xpi-stage
/locale-
$*
101 include $(MOZILLA_DIR
)/toolkit
/mozapps
/installer
/packager.mk
104 ifeq (cocoa
,$(MOZ_WIDGET_TOOLKIT
))
105 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/MacOS
107 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_DIR
)
110 $(STAGEDIST
): AB_CD
:=en-US
111 $(STAGEDIST
): UNPACKAGE
=$(ZIP_IN
)
112 $(STAGEDIST
): $(ZIP_IN
)
113 # only mac needs to remove the parent of STAGEDIST...
114 ifeq (cocoa
,$(MOZ_WIDGET_TOOLKIT
))
115 $(RM
) -r
-v
$(DIST
)/l10n-stage
117 # ... and windows doesn't like removing STAGEDIST itself, remove all children
118 find
$(STAGEDIST
) -maxdepth
1 -print0 | xargs
-0 $(RM
) -r
120 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
121 cd
$(DIST
)/l10n-stage
&& \
123 $(MAKE
) clobber-zip AB_CD
=en-US
129 # The path to the object dir for the mozilla-central build system,
130 # may be overridden if necessary.
133 repackage-zip
: UNPACKAGE
="$(ZIP_IN)"
135 # Adjust jar logs with the new locale (can't use sed -i because of bug 373784)
136 -$(PERL
) -pi
-e
"s/en-US/$(AB_CD)/g" $(_ABS_DIST
)/jarlog
/*.jar.log
137 # call a hook for apps to put their uninstall helper.exe into the package
138 $(UNINSTALLER_PACKAGE_HOOK
)
139 # copy xpi-stage over, but not install.rdf and chrome.manifest,
140 # those are just for language packs
141 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
142 tar --exclude
=install.rdf
--exclude
=chrome.manifest
$(TAR_CREATE_FLAGS
) - * |
( cd
$(STAGEDIST
) && tar -xf
- )
143 mv
$(STAGEDIST
)/chrome
/$(AB_CD
).manifest
$(STAGEDIST
)/chrome
/localized.manifest
145 ifeq (cocoa
,$(MOZ_WIDGET_TOOLKIT
))
146 mv
$(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/Resources
/en.lproj
$(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/Resources
/$(AB
).lproj
149 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
/$(PKG_PATH
)
150 cd
$(DIST
)/l10n-stage
; \
152 ifeq (WINCE
,$(OS_ARCH
))
153 cd
$(DIST
)/l10n-stage
; \
156 ifdef MOZ_MAKE_COMPLETE_MAR
157 $(MAKE
) -C
$(MOZDEPTH
)/tools
/update-packaging full-update AB_CD
=$(AB_CD
) \
158 MOZ_PKG_PRETTYNAMES
=$(MOZ_PKG_PRETTYNAMES
) \
159 PACKAGE_BASE_DIR
="$(_ABS_DIST)/l10n-stage" \
162 # packaging done, undo l10n stuff
164 ifeq (cocoa
,$(MOZ_WIDGET_TOOLKIT
))
165 mv
$(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/Resources
/$(AB
).lproj
$(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/Resources
/en.lproj
169 @
(cd
$(STAGEDIST
) && $(UNPACK_OMNIJAR
))
171 $(MAKE
) clobber-zip AB_CD
=$(AB_CD
)
172 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
173 mv
-f
"$(DIST)/l10n-stage/$(PACKAGE)" "$(ZIP_OUT)"
174 ifeq (WINCE
,$(OS_ARCH
))
175 mv
-f
"$(DIST)/l10n-stage/$(PKG_BASENAME).cab" "$(DIST)/$(PKG_PATH)$(PKG_BASENAME).cab"
178 repackage-zip-
%: $(ZIP_IN
) $(STAGEDIST
) libs-
%
179 @
$(MAKE
) repackage-zip AB_CD
=$* ZIP_IN
=$(ZIP_IN
)
181 APP_DEFINES
= $(firstword $(wildcard $(LOCALE_SRCDIR
)/defines.inc
) \
182 $(srcdir)/en-US
/defines.inc
)
183 TK_DEFINES
= $(firstword \
184 $(wildcard $(call EXPAND_LOCALE_SRCDIR
,toolkit
/locales
)/defines.inc
) \
185 $(MOZILLA_DIR
)/toolkit
/locales
/en-US
/defines.inc
)
187 langpack-
%: LANGPACK_FILE
=$(_ABS_DIST
)/$(PKG_LANGPACK_PATH
)$(PKG_LANGPACK_BASENAME
).xpi
189 langpack-
%: XPI_NAME
=locale-
$*
191 @echo
"Making langpack $(LANGPACK_FILE)"
192 $(NSINSTALL
) -D
$(DIST
)/$(PKG_LANGPACK_PATH
)
193 $(PERL
) $(MOZILLA_DIR
)/config
/preprocessor.pl
$(DEFINES
) $(ACDEFINES
) -I
$(TK_DEFINES
) -I
$(APP_DEFINES
) $(srcdir)/generic
/install.rdf
> $(FINAL_TARGET
)/install.rdf
194 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
195 $(ZIP
) -r9D
$(LANGPACK_FILE
) install.rdf chrome chrome.manifest
-x chrome
/$(AB_CD
).manifest
198 # This variable is to allow the wget-en-US target to know which ftp server to download from
199 ifndef EN_US_BINARY_URL
200 EN_US_BINARY_URL
= $(error You must set EN_US_BINARY_URL
)
203 # This make target allows us to wget the latest en-US binary from a specified website
204 # The make installers-% target needs the en-US binary in dist/
205 # and for the windows repackages we need the .installer.exe in dist/sea
208 $(error Wget not installed
)
210 (cd
$(_ABS_DIST
) && $(WGET
) -nv
-N
$(EN_US_BINARY_URL
)/$(PACKAGE
))
211 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PACKAGE)"
212 ifdef RETRIEVE_WINDOWS_INSTALLER
213 ifeq ($(OS_ARCH
), WINNT
)
214 $(NSINSTALL
) -D
$(_ABS_DIST
)/$(PKG_INST_PATH
)
215 (cd
$(_ABS_DIST
)/$(PKG_INST_PATH
) && $(WGET
) -nv
-N
"$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe")
216 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
221 $(PYTHON
) $(MOZILLA_DIR
)/tools
/update-packaging
/generatesnippet.py \
222 --mar-path
=$(_ABS_DIST
)/update \
223 --application-ini-file
=$(STAGEDIST
)/application.ini \
225 --product
=$(MOZ_PKG_APPNAME
) \
226 --platform
=$(MOZ_PKG_PLATFORM
) \
227 --download-base-URL
=$(DOWNLOAD_BASE_URL
) \