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.
24 # Alternatively, the contents of this file may be used under the terms of
25 # either the GNU General Public License Version 2 or later (the "GPL"), or
26 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 # in which case the provisions of the GPL or the LGPL are applicable instead
28 # of those above. If you wish to allow use of your version of this file only
29 # under the terms of either the GPL or the LGPL, and not to allow others to
30 # use your version of this file under the terms of the MPL, indicate your
31 # decision by deleting the provisions above and replace them with the notice
32 # and other provisions required by the GPL or the LGPL. If you do not delete
33 # the provisions above, a recipient may use your version of this file under
34 # the terms of any one of the MPL, the GPL or the LGPL.
36 # ***** END LICENSE BLOCK *****
39 topsrcdir
= @top_srcdir@
42 relativesrcdir
= browser
/locales
44 include $(DEPTH
)/config
/autoconf.mk
46 include $(topsrcdir
)/config
/config.mk
48 vpath
%.xml @
srcdir@
/en-US
/searchplugins
49 vpath
%.xml
$(LOCALE_SRCDIR
)/searchplugins
52 vpath crashreporter
%.ini
$(LOCALE_MERGEDIR
)/browser
/crashreporter
54 vpath crashreporter
%.ini
$(LOCALE_SRCDIR
)/crashreporter
56 vpath crashreporter
%.ini @
srcdir@
/en-US
/crashreporter
59 vpath book
%.inc
$(LOCALE_MERGEDIR
)/browser
/profile
61 vpath book
%.inc
$(LOCALE_SRCDIR
)/profile
63 vpath book
%.inc @
srcdir@
/en-US
/profile
67 run_for_effects
:= $(shell if
! test -d
$(DIST
); then
$(NSINSTALL
) -D
$(DIST
); fi
; if
! test -d
$(DIST
)/branding
; then
$(NSINSTALL
) -D
$(DIST
)/branding
; fi
)
68 _ABS_DIST
:= $(shell cd
$(DIST
) && pwd
)
70 ifdef MOZ_BRANDING_DIRECTORY
72 $(DEPTH
)/$(MOZ_BRANDING_DIRECTORY
)/Makefile \
73 $(DEPTH
)/$(MOZ_BRANDING_DIRECTORY
)/locales
/Makefile \
77 # This makefile uses variable overrides from the libs-% target to
78 # build non-default locales to non-default dist/ locations. Be aware!
80 AB
= $(firstword $(subst -, ,$(AB_CD
)))
82 APP_VERSION
:= $(shell cat
$(srcdir)/..
/config
/version.txt
)
85 core_abspath
= $(if
$(findstring :,$(1)),$(1),$(if
$(filter /%,$(1)),$(1),$(PWD
)/$(1)))
87 # ZIP_IN is defaulted to be compatible with the files the wget-en-US target
88 # pulls. You may override ZIP_IN if you provide your own files. You also _must_
89 # override ZIP_IN when MOZ_PKG_PRETTYNAMES is defined - the default will not
91 ZIP_IN ?
= $(_ABS_DIST
)/$(PACKAGE
)
95 -DMOZ_LANGPACK_EID
=langpack-
$(AB_CD
)@firefox.mozilla.org \
96 -DMOZ_APP_VERSION
=$(MOZ_APP_VERSION
) \
97 -DLOCALE_SRCDIR
=$(call core_abspath
,$(LOCALE_SRCDIR
)) \
98 -DPKG_BASENAME
="$(PKG_BASENAME)" \
99 -DPKG_INST_BASENAME
="$(PKG_INST_BASENAME)" \
102 ifndef MOZ_BRANDING_DIRECTORY
103 DEFINES
+= -DMOZ_USE_GENERIC_BRANDING
106 ifeq (,$(filter-out pref
,$(MOZ_EXTENSIONS
)))
107 DEFINES
+= -DEXTENSION_PREF
110 PREF_JS_EXPORTS
= $(LOCALE_SRCDIR
)/firefox-l10n.js
112 include $(topsrcdir
)/config
/rules.mk
115 @if
test -f
"$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
116 $(PERL
) $(topsrcdir
)/config
/preprocessor.pl
$(PREF_PPFLAGS
) $(DEFINES
) $(ACDEFINES
) $(XULPPFLAGS
) \
117 $(LOCALE_SRCDIR
)/existing-profile-defaults.js
> $(FINAL_TARGET
)/defaults
/existing-profile-defaults.js
; \
120 @if
test -f
"$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
121 $(PERL
) $(topsrcdir
)/config
/preprocessor.pl
$(PREF_PPFLAGS
) $(DEFINES
) $(ACDEFINES
) $(XULPPFLAGS
) \
122 $(LOCALE_SRCDIR
)/existing-profile-defaults.js
> $(DESTDIR
)$(mozappdir
)/defaults
/existing-profile-defaults.js
; \
134 PROFILE_CHROME
= userChrome-example.css userContent-example.css
136 libs
:: $(addprefix $(LOCALE_SRCDIR
)/,$(README_FILES
))
137 ifeq ($(OS_ARCH
),WINNT
)
140 $(PERL
) -pe
's/(?<!\r)\n/\r\n/g;' < $$file > $(FINAL_TARGET
)/`basename $$file`; \
143 ifneq ($(OS_ARCH
),OS2
)
144 $(SYSINSTALL
) $(IFLAGS1
) $^
$(FINAL_TARGET
)
148 NO_JA_JP_MAC_AB_CD
:= $(if
$(filter ja-JP-mac
, $(AB_CD
)),ja
,$(AB_CD
))
150 %/defaults
/profile
/bookmarks.html
: bookmarks.inc generic
/profile
/bookmarks.html.in
151 $(SYSINSTALL
) -D
$(dir $@
)
152 $(PYTHON
) $(topsrcdir
)/config
/Preprocessor.py \
154 -DAB_CD
=$(NO_JA_JP_MAC_AB_CD
) \
155 $(srcdir)/generic
/profile
/bookmarks.html.in \
158 libs
:: $(FINAL_TARGET
)/defaults
/profile
/bookmarks.html
;
160 libs
:: $(addprefix generic
/profile
/,$(PROFILE_FILES
))
161 $(SYSINSTALL
) $(IFLAGS1
) $^
$(FINAL_TARGET
)/defaults
/profile
163 libs
:: $(addprefix $(LOCALE_SRCDIR
)/profile
/chrome
/,$(PROFILE_CHROME
))
164 $(SYSINSTALL
) $(IFLAGS1
) $^
$(FINAL_TARGET
)/defaults
/profile
/chrome
166 install:: $(DESTDIR
)$(mozappdir
)/defaults
/profile
/bookmarks.html
;
168 install:: $(addprefix generic
/profile
/,$(PROFILE_FILES
))
169 $(SYSINSTALL
) $(IFLAGS1
) $^
$(DESTDIR
)$(mozappdir
)/defaults
/profile
171 install:: $(addprefix $(LOCALE_SRCDIR
)/profile
/chrome
/,$(PROFILE_CHROME
))
172 $(SYSINSTALL
) $(IFLAGS1
) $^
$(DESTDIR
)$(mozappdir
)/defaults
/profile
/chrome
174 SEARCH_PLUGINS
= $(shell cat
$(LOCALE_SRCDIR
)/searchplugins
/list.txt
)
176 libs
:: $(addsuffix .xml
,$(SEARCH_PLUGINS
))
177 $(SYSINSTALL
) $(IFLAGS1
) $^
$(FINAL_TARGET
)/searchplugins
179 install:: $(addsuffix .xml
,$(SEARCH_PLUGINS
))
180 $(SYSINSTALL
) $(IFLAGS1
) $^
$(DESTDIR
)$(mozappdir
)/searchplugins
183 ifneq (en-US
, $(AB_CD
))
184 @echo
"Verifying $(AB_CD) installer variable usage"
185 @
$(PERL
) $(topsrcdir
)/toolkit
/mozapps
/installer
/windows
/nsis
/check-locales.pl
$(LOCALE_SRCDIR
)/installer
189 $(RM
) -rf
$(DIST
)/xpi-stage
/locale-
$*
192 $(NSINSTALL
) -D
$(DIST
)/install
193 @
$(MAKE
) -C ..
/..
/toolkit
/locales libs-
$* BOTH_MANIFESTS
=1
194 @
$(MAKE
) -C ..
/..
/extensions
/reporter
/locales libs AB_CD
=$* XPI_NAME
=locale-
$* BOTH_MANIFESTS
=1
195 @
$(MAKE
) -C ..
/..
/extensions
/spellcheck
/locales AB_CD
=$* XPI_NAME
=locale-
$* BOTH_MANIFESTS
=1
196 @
$(MAKE
) libs AB_CD
=$* XPI_NAME
=locale-
$* PREF_DIR
=defaults
/pref BOTH_MANIFESTS
=1
197 ifdef MOZ_BRANDING_DIRECTORY
198 @
$(MAKE
) -C
$(DEPTH
)/$(MOZ_BRANDING_DIRECTORY
)/locales AB_CD
=$* XPI_NAME
=locale-
$* BOTH_MANIFESTS
=1
200 @
$(MAKE
) tests AB_CD
=$*
202 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
203 MOZ_PKG_MAC_DSSTORE
=$(_ABS_DIST
)/branding
/dsstore
204 MOZ_PKG_MAC_BACKGROUND
=$(_ABS_DIST
)/branding
/background.png
205 MOZ_PKG_MAC_ICON
=$(_ABS_DIST
)/branding
/disk.icns
206 MOZ_PKG_MAC_EXTRA
=--symlink
"/Applications:/ "
210 include $(topsrcdir
)/toolkit
/mozapps
/installer
/packager.mk
211 include $(call EXPAND_LOCALE_SRCDIR
,toolkit
/locales
)/installer
/windows
/charset.mk
213 repackage-win32-installer
: WIN32_INSTALLER_OUT
="$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
214 repackage-win32-installer
: $(WIN32_INSTALLER_IN
) $(SUBMAKEFILES
)
215 @echo
"Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
216 ifdef MOZ_BRANDING_DIRECTORY
217 $(MAKE
) -C
$(DEPTH
)/$(MOZ_BRANDING_DIRECTORY
) export
219 $(MAKE
) -C ..
/installer
/windows
export
221 if
test ! -d
$(_ABS_DIST
)/$(PKG_INST_PATH
); then \
222 $(NSINSTALL
) -D
$(_ABS_DIST
)/$(PKG_INST_PATH
); \
225 $(NSINSTALL
) -D l10n-stage
226 $(CYGWIN_WRAPPER
) 7z x
-ol10n-stage
$(WIN32_INSTALLER_IN
)
227 $(RM
) -r l10n-stage
/localized
228 $(RM
) l10n-stage
/setup.exe
229 cp
-r
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) l10n-stage
/localized
230 $(MAKE
) -C ..
/installer
/windows CONFIG_DIR
=l10ngen l10ngen
/setup.exe l10ngen
/7zSD.sfx
231 cp ..
/installer
/windows
/l10ngen
/setup.exe l10n-stage
232 $(NSINSTALL
) -D l10n-stage
/localized
/uninstall
233 cp ..
/installer
/windows
/l10ngen
/helper.exe l10n-stage
/localized
/uninstall
236 $(CYGWIN_WRAPPER
) 7z a
-r
-t7z ..
/app
.7z
-mx
-m0
=BCJ2
-m1
=LZMA
:d24
-m2
=LZMA
:d19
-m3
=LZMA
:d19
-mb0
:1 -mb0s1
:2 -mb0s2
:3
237 cat ..
/installer
/windows
/l10ngen
/7zSD.sfx \
238 $(topsrcdir
)/browser
/installer
/windows
/app.tag \
239 app
.7z
> $(WIN32_INSTALLER_OUT
)
240 chmod
0755 $(WIN32_INSTALLER_OUT
)
242 ifeq (WINNT
,$(OS_ARCH
))
243 repackage-win32-installer-
%: WIN32_INSTALLER_IN
=$(_ABS_DIST
)/$(PKG_INST_PATH
)$(PKG_INST_BASENAME
).exe
244 repackage-win32-installer-
%: $(WIN32_INSTALLER_IN
) libs-
%
245 @
$(MAKE
) repackage-win32-installer AB_CD
=$* WIN32_INSTALLER_IN
=$(WIN32_INSTALLER_IN
)
247 repackage-win32-installer-
%: ;
250 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
251 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)/$(_APPNAME
)/Contents
/MacOS
253 STAGEDIST
= $(_ABS_DIST
)/l10n-stage
/$(MOZ_PKG_APPNAME
)
256 $(STAGEDIST
): AB_CD
:=en-US
257 $(STAGEDIST
): UNPACKAGE
=$(ZIP_IN
)
258 $(STAGEDIST
): $(ZIP_IN
)
259 # only mac needs to remove the parent of STAGEDIST...
260 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
261 if
test -d
$(DIST
)/l10n-stage
; then \
262 $(RM
) -r
-v
$(DIST
)/l10n-stage
; \
265 # ... and windows doesn't like removing STAGEDIST itself, remove all children
266 if
test -d
$(DIST
)/l10n-stage
; then \
267 find
$(STAGEDIST
) -maxdepth
1 -print0 | xargs
-0 $(RM
) -r
; \
270 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
271 cd
$(DIST
)/l10n-stage
&& \
273 make clobber-zip AB_CD
=en-US
276 $(RM
) $(STAGEDIST
)/chrome
/$(AB_CD
).jar \
277 $(STAGEDIST
)/chrome
/$(AB_CD
).manifest \
278 $(STAGEDIST
)/defaults
/pref
/firefox-l10n.js
279 $(RM
) -rf
$(STAGEDIST
)/searchplugins \
280 $(STAGEDIST
)/dictionaries \
281 $(STAGEDIST
)/defaults
/profile \
282 $(STAGEDIST
)/chrome
/$(AB_CD
)
287 repackage-zip
: ZIP_OUT
="$(_ABS_DIST)/$(PACKAGE)"
288 repackage-zip
: UNPACKAGE
="$(ZIP_IN)"
290 ifeq (WINNT
,$(OS_ARCH
))
291 $(RM
) -r
$(STAGEDIST
)/uninstall
292 $(NSINSTALL
) -D
$(STAGEDIST
)/uninstall
293 cp ..
/installer
/windows
/l10ngen
/helper.exe
$(STAGEDIST
)/uninstall
295 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
296 tar $(TAR_CREATE_FLAGS
) - * |
( cd
$(STAGEDIST
) && tar -xf
- )
298 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
299 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
302 $(NSINSTALL
) -D
$(DIST
)/l10n-stage
/$(PKG_PATH
)
303 cd
$(DIST
)/l10n-stage
; \
305 ifdef MOZ_MAKE_COMPLETE_MAR
306 $(MAKE
) -C
$(DEPTH
)/tools
/update-packaging full-update AB_CD
=$(AB_CD
) \
307 MOZ_PKG_PRETTYNAMES
=$(MOZ_PKG_PRETTYNAMES
) \
308 PACKAGE_BASE_DIR
="$(_ABS_DIST)/l10n-stage" \
311 # packaging done, undo l10n stuff
313 ifneq (,$(filter mac cocoa
,$(MOZ_WIDGET_TOOLKIT
)))
314 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
317 $(MAKE
) clobber-zip AB_CD
=$(AB_CD
)
318 $(NSINSTALL
) -D
$(DIST
)/$(PKG_PATH
)
319 mv
-f
"$(DIST)/l10n-stage/$(PACKAGE)" "$(DIST)/$(PACKAGE)"
321 repackage-zip-
%: ZIP_IN
=$(_ABS_DIST
)/$(PACKAGE
)
322 repackage-zip-
%: $(ZIP_IN
) $(STAGEDIST
) libs-
%
323 @
$(MAKE
) repackage-zip AB_CD
=$* ZIP_IN
=$(ZIP_IN
)
325 langpack-
%: LANGPACK_FILE
=$(_ABS_DIST
)/$(PKG_LANGPACK_PATH
)$(PKG_LANGPACK_BASENAME
).xpi
327 langpack-
%: XPI_NAME
=locale-
$*
329 @echo
"Making langpack $(LANGPACK_FILE)"
330 $(NSINSTALL
) -D
$(DIST
)/$(PKG_LANGPACK_PATH
)
331 $(PERL
) $(topsrcdir
)/config
/preprocessor.pl
$(DEFINES
) $(ACDEFINES
) -I
$(call EXPAND_LOCALE_SRCDIR
,toolkit
/locales
)/defines.inc
-I
$(LOCALE_SRCDIR
)/defines.inc
$(srcdir)/generic
/install.rdf
> $(FINAL_TARGET
)/install.rdf
332 cd
$(DIST
)/xpi-stage
/locale-
$(AB_CD
) && \
333 $(ZIP
) -r9D
$(LANGPACK_FILE
) install.rdf chrome
/$(AB_CD
).jar chrome.manifest
335 # This is a generic target that will make a langpack, repack ZIP (+tarball)
336 # builds, and repack an installer if applicable. It is called from the
337 # tinderbox scripts. Alter it with caution.
339 installers-
%: clobber-
% langpack-
% repackage-win32-installer-
% repackage-zip-
%
340 @echo
"repackaging done"
343 libs
:: $(addprefix $(LOCALE_SRCDIR
)/,updater
/updater.ini
)
344 ifeq ($(OS_ARCH
),WINNT
)
345 cat
$< $(srcdir)/updater_append.ini
$(srcdir)/..
/installer
/windows
/nsis
/updater_append.ini | \
346 sed
-e
"s/%AB_CD%/$(AB_CD)/" | \
347 iconv
-f UTF-8
-t
$(WIN_INSTALLER_CHARSET
) > $(FINAL_TARGET
)/updater.ini
349 cat
$< $(srcdir)/updater_append.ini | \
350 sed
-e
"s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET
)/updater.ini
354 ifdef MOZ_CRASHREPORTER
355 libs
:: crashreporter-override.ini
356 $(SYSINSTALL
) $(IFLAGS1
) $^
$(FINAL_TARGET
)
359 # This variable is to allow the wget-en-US target to know which ftp server to download from
360 ifndef EN_US_BINARY_URL
361 EN_US_BINARY_URL
= $(error You must set EN_US_BINARY_URL
)
364 # This make target allows us to wget the latest en-US binary from a specified website
365 # The make installers-% target needs the en-US binary in dist/
366 # and for the windows repackages we need the .installer.exe in dist/sea
369 $(error Wget not installed
)
371 (cd
$(_ABS_DIST
) && $(WGET
) -nv
-N
$(EN_US_BINARY_URL
)/$(PACKAGE
))
372 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(_ABS_DIST)/$(PACKAGE)"
373 ifeq ($(OS_ARCH
), WINNT
)
374 $(NSINSTALL
) -D
$(_ABS_DIST
)/$(PKG_INST_PATH
)
375 (cd
$(_ABS_DIST
)/$(PKG_INST_PATH
) && $(WGET
) -nv
-N
"$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe")
376 @echo
"Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe"
380 @
$(PYTHON
) $(topsrcdir
)/config
/printconfigsetting.py
$(STAGEDIST
)/application.ini App SourceStamp
382 #These make targets call prepare-repackages by setting different UPLOAD_DIR
383 prepare-upload-latest-
%:
384 @
$(MAKE
) prepare-repackages-
$* UPLOAD_DIR
=$(DIST
)/upload
/latest
386 prepare-upload-dated-
%:
387 @
$(MAKE
) prepare-repackages-
$* UPLOAD_DIR
=$(DIST
)/upload
/`date "+%Y-%m-%d-%H"`-$(MOZ_PKG_APPNAME
)$(MOZ_APP_VERSION
)-l10n
389 #Each platform uploads their xpi files to different folders
390 ifeq (Linux
, $(OS_ARCH
))
391 XPI_DESTINATION
= linux-xpi
393 ifeq (Darwin
, $(OS_ARCH
))
394 XPI_DESTINATION
= mac-xpi
396 ifeq (WINNT
, $(OS_ARCH
))
397 XPI_DESTINATION
= windows-xpi
400 # This target will generate a UPLOAD_DIR folder with
401 # l10n repackages in the way that we offer l10n nightlies
403 # 2) ./{linux,mac,windows}-xpi/locale.xpi
404 prepare-repackages-
%:
405 ifndef XPI_DESTINATION
406 $(error XPI_DESTINATION not defined
; \
407 This is the folder where the xpi files will be moved to
)
410 $(error UPLOAD_DIR not defined
)
412 $(NSINSTALL
) -D
$(UPLOAD_DIR
)
413 $(NSINSTALL
) -D
$(UPLOAD_DIR
)/$(XPI_DESTINATION
)
415 mv
$(DIST
)/install/firefox-
$(MOZ_APP_VERSION
).
$*.langpack.xpi \
416 $(UPLOAD_DIR
)/$(XPI_DESTINATION
)/$*.xpi
418 mv
$(DIST
)/firefox-
$(MOZ_APP_VERSION
).
$*.
* \
420 # Move the windows installer
421 ifeq (WINNT
, $(OS_ARCH
))
422 mv
$(DIST
)/install/sea
/firefox-
$(MOZ_APP_VERSION
).
$*.win32.installer.exe \
425 # Set the permissions that the folders will have in ftp once uploaded
426 chmod
-vR
775 $(UPLOAD_DIR
)
429 ifdef LOCALE_MERGEDIR
430 $(RM
) -rf
$(LOCALE_MERGEDIR
)
431 MACOSX_DEPLOYMENT_TARGET
= compare-locales
-m
$(LOCALE_MERGEDIR
) $(srcdir)/l10n.ini
$(L10NBASEDIR
) $*