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
85 -DMOZ_LANGPACK_EID
=$(MOZ_LANGPACK_EID
) \
86 -DMOZ_APP_VERSION
=$(MOZ_APP_VERSION
) \
87 -DLOCALE_SRCDIR
=$(call core_abspath
,$(LOCALE_SRCDIR
)) \
88 -DPKG_BASENAME
="$(PKG_BASENAME)" \
89 -DPKG_INST_BASENAME
="$(PKG_INST_BASENAME)" \
94 $(RM
) -rf
$(DIST
)/xpi-stage
/locale-
$*
98 include $(topsrcdir
)/toolkit
/mozapps
/installer
/packager.mk
101 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
102 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/MacOS
104 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_DIR
)
107 $(STAGEDIST
): AB_CD
:=en-US
108 $(STAGEDIST
): UNPACKAGE
=$(ZIP_IN
)
109 $(STAGEDIST
): $(ZIP_IN
)
110 # only mac needs to remove the parent of STAGEDIST...
111 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
112 $(RM
) -r
-v
$(DIST
)/l10n-stage
114 # ... and windows doesn't like removing STAGEDIST itself, remove all children
115 find
$(STAGEDIST
) -maxdepth
1 -print0 | xargs
-0 $(RM
) -r
117 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
118 cd
$(DIST
)/l10n-stage
&& \
120 $(MAKE
) clobber-zip AB_CD
=en-US
126 repackage-zip
: ZIP_OUT
="$(_ABS_DIST)/$(PACKAGE)"
127 repackage-zip
: UNPACKAGE
="$(ZIP_IN)"
129 # call a hook for apps to put their uninstall helper.exe into the package
130 $(UNINSTALLER_PACKAGE_HOOK
)
131 # copy xpi-stage over, but not install.rdf and chrome.manifest,
132 # those are just for language packs
133 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
134 tar --exclude
=install.rdf
--exclude
=chrome.manifest
$(TAR_CREATE_FLAGS
) - * |
( cd
$(STAGEDIST
) && tar -xf
- )
136 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
137 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
140 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
/$(PKG_PATH
)
141 cd
$(DIST
)/l10n-stage
; \
143 ifdef MOZ_MAKE_COMPLETE_MAR
144 $(MAKE
) -C
$(DEPTH
)/tools
/update-packaging full-update AB_CD
=$(AB_CD
) \
145 MOZ_PKG_PRETTYNAMES
=$(MOZ_PKG_PRETTYNAMES
) \
146 PACKAGE_BASE_DIR
="$(_ABS_DIST)/l10n-stage" \
149 # packaging done, undo l10n stuff
151 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
152 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
155 $(MAKE
) clobber-zip AB_CD
=$(AB_CD
)
156 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
157 mv
-f
"$(DIST)/l10n-stage/$(PACKAGE)" "$(DIST)/$(PACKAGE)"
159 repackage-zip-
%: $(ZIP_IN
) $(STAGEDIST
) libs-
%
160 @
$(MAKE
) repackage-zip AB_CD
=$* ZIP_IN
=$(ZIP_IN
)
162 APP_DEFINES
= $(firstword $(wildcard $(LOCALE_SRCDIR
)/defines.inc
) \
163 $(srcdir)/en-US
/defines.inc
)
164 TK_DEFINES
= $(firstword \
165 $(wildcard $(call EXPAND_LOCALE_SRCDIR
,toolkit
/locales
)/defines.inc
) \
166 $(topsrcdir
)/toolkit
/locales
/en-US
/defines.inc
)
168 langpack-
%: LANGPACK_FILE
=$(_ABS_DIST
)/$(PKG_LANGPACK_PATH
)$(PKG_LANGPACK_BASENAME
).xpi
170 langpack-
%: XPI_NAME
=locale-
$*
172 @echo
"Making langpack $(LANGPACK_FILE)"
173 $(NSINSTALL
) -D
$(DIST
)/$(PKG_LANGPACK_PATH
)
174 $(PERL
) $(topsrcdir
)/config
/preprocessor.pl
$(DEFINES
) $(ACDEFINES
) -I
$(TK_DEFINES
) -I
$(APP_DEFINES
) $(srcdir)/generic
/install.rdf
> $(FINAL_TARGET
)/install.rdf
175 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
176 $(ZIP
) -r9D
$(LANGPACK_FILE
) install.rdf chrome chrome.manifest
-x chrome
/$(AB_CD
).manifest
179 # This variable is to allow the wget-en-US target to know which ftp server to download from
180 ifndef EN_US_BINARY_URL
181 EN_US_BINARY_URL
= $(error You must set EN_US_BINARY_URL
)
184 # This make target allows us to wget the latest en-US binary from a specified website
185 # The make installers-% target needs the en-US binary in dist/
186 # and for the windows repackages we need the .installer.exe in dist/sea
189 $(error Wget not installed
)
191 (cd
$(_ABS_DIST
) && $(WGET
) -nv
-N
$(EN_US_BINARY_URL
)/$(PACKAGE
))
192 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PACKAGE)"
193 ifeq ($(OS_ARCH
), WINNT
)
194 $(NSINSTALL
) -D
$(_ABS_DIST
)/$(PKG_INST_PATH
)
195 (cd
$(_ABS_DIST
)/$(PKG_INST_PATH
) && $(WGET
) -nv
-N
"$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe")
196 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
200 $(PYTHON
) $(topsrcdir
)/tools
/update-packaging
/generatesnippet.py \
201 --mar-path
=$(_ABS_DIST
)/update \
202 --application-ini-file
=$(STAGEDIST
)/application.ini \
204 --product
=$(MOZ_PKG_APPNAME
) \
205 --download-base-URL
=$(DOWNLOAD_BASE_URL
) \