19
19
# We need this to execute before the debian/control target gets called
21
21
cp debian/control debian/control.old
22
cp debian/tests/control debian/tests/control.old
22
23
ifneq (1, $(MOZ_DISABLE_CLEAN_CHECKS))
23
24
touch debian/control.in
25
touch debian/tests/control.in
25
27
touch debian/control
28
touch debian/tests/control
28
31
-include /usr/share/cdbs/1/rules/debhelper.mk
38
41
MOZ_APP_NAME ?= $(MOZ_PKG_NAME)
40
43
# Define other variables used throughout the build
41
# The value of "Name" to use in application.ini, which the profile location is based on.
42
# Derived from the desired MOZ_APP_NAME, but can be overridden
44
MOZ_DEFAULT_APP_NAME ?= $(MOZ_PKG_BASENAME)
43
45
MOZ_APP_BASENAME ?= $(shell echo $(MOZ_APP_NAME) | sed -n 's/\-.\|\<./\U&/g p')
44
# The default value of "Name" in the application.ini, derived from the upstream build system
45
# It is used for the profile location. This should be set manually if not provided
46
MOZ_DEFAULT_APP_BASENAME ?= $(shell . ./$(DEB_SRCDIR)/$(MOZ_APP)/confvars.sh; echo $$MOZ_APP_BASENAME)
47
# Equal to upstreams default MOZ_APP_NAME. If not a lower case version of the "Name"
48
# in application.ini, then this should be manually overridden
49
MOZ_DEFAULT_APP_NAME ?= $(MOZ_DEFAULT_APP_BASENAME_L)
50
# Location for searchplugins
46
MOZ_DEFAULT_APP_BASENAME ?= $(shell echo $(MOZ_DEFAULT_APP_NAME) | sed -n 's/\-.\|\<./\U&/g p')
51
47
MOZ_SEARCHPLUGIN_DIR ?= $(MOZ_LIBDIR)/distribution/searchplugins
53
MOZ_APP_BASENAME_L := $(shell echo $(MOZ_APP_BASENAME) | tr A-Z a-z)
54
MOZ_DEFAULT_APP_BASENAME_L := $(shell echo $(MOZ_DEFAULT_APP_BASENAME) | tr A-Z a-z)
57
50
$(error "Need to set MOZ_APP")
62
55
ifeq (,$(MOZ_PKG_NAME))
63
56
$(error "Need to set MOZ_PKG_NAME")
58
ifeq (,$(MOZ_PKG_BASENAME))
59
$(error "Need to set MOZ_PKG_BASENAME")
66
62
MOZ_PKG_NAMES = $(shell sed -n 's/Package\: \(.*\)/\1/ p' < debian/control)
75
71
DEB_DH_STRIP_ARGS := --dbg-package=$(MOZ_PKG_NAME)-dbg
76
72
# We don't want build-tree/mozilla/README to be shipped as a doc
77
73
DEB_INSTALL_DOCS_ALL := $(NULL)
74
# scour breaks the testsuite
75
DEB_DH_SCOUR_ARGS := -N$(MOZ_PKG_NAME)-testsuite
79
77
MOZ_VERSION := $(shell cat $(DEB_SRCDIR)/$(MOZ_APP)/config/version.txt)
80
78
MOZ_LIBDIR := usr/lib/$(MOZ_APP_NAME)
92
90
PROFILE_BASE = $(shell echo $(MOZ_VENDOR) | tr A-Z a-z)/
94
MOZ_PROFILEDIR := .$(PROFILE_BASE)$(MOZ_APP_BASENAME_L)
95
MOZ_DEFAULT_PROFILEDIR := .$(PROFILE_BASE)$(MOZ_DEFAULT_APP_BASENAME_L)
92
MOZ_PROFILEDIR := .$(PROFILE_BASE)$(shell echo $(MOZ_APP_BASENAME) | tr A-Z a-z)
93
MOZ_DEFAULT_PROFILEDIR := .$(PROFILE_BASE)$(shell echo $(MOZ_DEFAULT_APP_BASENAME) | tr A-Z a-z)
97
95
DEB_AUTO_UPDATE_DEBIAN_CONTROL = no
99
97
MOZ_PYTHON := $(shell which python)
98
VIRTENV_PYTHON := $(CURDIR)/debian/_virtualenv/bin/python
100
99
DISTRIB := $(shell lsb_release -i -s)
132
131
# enable the crash reporter only on i386, amd64 and armel
133
ifeq (,$(filter lucid maverick natty oneiric,$(DISTRIB_CODENAME)))
134
SUPPORTED_ARM = armhf
136
SUPPORTED_ARM = armel
138
ifeq (,$(filter i386 amd64 $(SUPPORTED_ARM),$(DEB_HOST_ARCH)))
132
ifeq (,$(filter i386 amd64 armhf,$(DEB_HOST_ARCH)))
139
133
MOZ_ENABLE_BREAKPAD = 0
160
154
MOZ_BUILD_PGO = 0
163
ifneq (,$(wildcard $(CURDIR)/debian/globalmenu))
167
ifeq (1,$(HAVE_GLOBALMENU))
168
ifeq (,$(filter lucid maverick, $(DISTRIB_CODENAME)))
169
MOZ_ENABLE_GLOBALMENU = 1
157
export SHELL=/bin/bash
173
158
export NO_PNG_PKG_MANGLE=1
175
160
export DEB_BUILD_HARDENING=1
176
export MOZCONFIG=$(CURDIR)/debian/config/mozconfig
177
161
ifeq (Ubuntu, $(DISTRIB))
178
162
export MOZ_UA_VENDOR=Ubuntu
191
175
LANGPACK_DIR := $(DEB_HOST_GNU_SYSTEM)-$(DEB_HOST_GNU_CPU)/xpi
194
ifeq (1,$(MOZ_ENABLE_GLOBALMENU))
195
178
MOZ_PKG_SUPPORT_RECOMMENDS ?= $(MOZ_PKG_NAME)-globalmenu
197
179
MOZ_PKG_SUPPORT_SUGGESTS ?= $(MOZ_PKG_NAME)-gnome-support
199
181
# Defines used for the Mozilla text preprocessor
228
210
ifeq (1,$(MOZ_DEBUG))
229
211
MOZ_DEFINES += -DMOZ_DEBUG
231
ifeq (1,$(MOZ_ENABLE_GLOBALMENU))
232
MOZ_DEFINES += -DMOZ_ENABLE_GLOBALMENU
234
213
ifeq (official, $(MOZ_BRANDING))
235
214
MOZ_DEFINES += -DMOZ_OFFICIAL_BRANDING
260
240
$(MOZ_PKGCONFIG_FILES) \
243
debian/tests/control: debian/tests/control.in
244
sed -e 's/@MOZ_PKG_NAME@/$(MOZ_PKG_NAME)/g' < debian/tests/control.in > debian/tests/control
263
246
debian/control:: debian/control.in debian/control.langpacks debian/control.langpacks.unavail debian/config/locales.shipped debian/config/locales.all
265
248
@echo "*****************************"
267
250
@echo "*****************************"
270
sed -e 's/@MOZ_PKG_NAME@/$(MOZ_PKG_NAME)/g' < debian/control.in > debian/control
253
sed -e 's/@MOZ_PKG_NAME@/$(MOZ_PKG_NAME)/g' \
254
-e 's/@MOZ_LOCALE_PKGS@/$(shell perl debian/build/dump-langpack-control-entries.pl -l | sed 's/\(\,\?\)\([^\,]*\)\(\,\?\)/\1$(MOZ_PKG_NAME)\-locale\-\2 (= $${binary:Version})\3 /g')/g' < debian/control.in > debian/control
271
255
perl debian/build/dump-langpack-control-entries.pl > debian/control.tmp
272
256
sed -e 's/@MOZ_PKG_NAME@/$(MOZ_PKG_NAME)/g' < debian/control.tmp >> debian/control && rm -f debian/control.tmp
274
258
$(pkgname_subst_files): $(foreach file,$(pkgname_subst_files),$(subst $(MOZ_PKG_NAME),$(MOZ_PKG_BASENAME),$(file).in))
275
$(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) $(CURDIR)/$(subst $(MOZ_PKG_NAME),$(MOZ_PKG_BASENAME),$@.in) > $(CURDIR)/$@
259
PYTHONDONTWRITEBYTECODE=1 $(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) $(CURDIR)/$(subst $(MOZ_PKG_NAME),$(MOZ_PKG_BASENAME),$@.in) > $(CURDIR)/$@
277
261
$(appname_subst_files): $(foreach file,$(appname_subst_files),$(subst $(MOZ_APP_NAME),$(MOZ_PKG_BASENAME),$(file).in))
278
$(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) $(CURDIR)/$(subst $(MOZ_APP_NAME),$(MOZ_PKG_BASENAME),$@.in) > $(CURDIR)/$@
262
PYTHONDONTWRITEBYTECODE=1 $(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) $(CURDIR)/$(subst $(MOZ_APP_NAME),$(MOZ_PKG_BASENAME),$@.in) > $(CURDIR)/$@
280
264
%.pc: WCHAR_CFLAGS = $(shell cat $(MOZ_OBJDIR)/config/autoconf.mk | grep WCHAR_CFLAGS | sed 's/^[^=]*=[[:space:]]*\(.*\)$$/\1/')
281
265
%.pc: %.pc.in debian/stamp-makefile-build
282
$(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) -DWCHAR_CFLAGS="$(WCHAR_CFLAGS)" $(CURDIR)/$< > $(CURDIR)/$@
266
PYTHONDONTWRITEBYTECODE=1 $(MOZ_PYTHON) $(CURDIR)/debian/build/Preprocessor.py -Fsubstitution --marker="%%" $(MOZ_DEFINES) -DWCHAR_CFLAGS="$(WCHAR_CFLAGS)" $(CURDIR)/$< > $(CURDIR)/$@
284
268
make-buildsymbols: debian/stamp-makebuildsymbols
285
269
debian/stamp-makebuildsymbols: debian/stamp-makefile-build
303
287
rm -rf $(CURDIR)/debian/l10n-mergedirs/$*
304
288
mkdir -p $(CURDIR)/debian/l10n-mergedirs/$*
306
@export PATH=$(CURDIR)/compare-locales/scripts/:$$PATH ; \
307
export PYTHONPATH=$(CURDIR)/compare-locales/lib ; \
290
@export PATH=$(CURDIR)/debian/_virtualenv/bin/:$$PATH ; \
308
291
cd $(MOZ_OBJDIR)/$(MOZ_APP)/locales ; \
309
292
$(MAKE) merge-$* LOCALE_MERGEDIR=$(CURDIR)/debian/l10n-mergedirs/$* || exit 1 ; \
310
293
$(MAKE) langpack-$* LOCALE_MERGEDIR=$(CURDIR)/debian/l10n-mergedirs/$* || exit 1;
317
300
@echo "$(MOZ_PKG_SUPPORT_SUGGESTS)" | perl -0 -ne 's/[ \t\n]+/ /g; /\w/ and print "support:Suggests=$$_\n"' >> debian/$(MOZ_PKG_NAME).substvars
318
301
@echo "$(MOZ_PKG_SUPPORT_RECOMMENDS)" | perl -0 -ne 's/[ \t\n]+/ /g; /\w/ and print "support:Recommends=$$_\n"' >> debian/$(MOZ_PKG_NAME).substvars
320
install/$(MOZ_PKG_NAME)-gnome-support::
321
ifneq (,$(filter lucid maverick natty, $(DISTRIB_CODENAME)))
322
@echo "Adding libgconf2-4 dependency"
323
@echo "gconf:Depends=libgconf2-4" >> debian/$(MOZ_PKG_NAME)-gnome-support.substvars
326
303
ifneq ($(MOZ_PKG_NAME),$(MOZ_APP_NAME))
328
305
@echo "Adding conflicts / provides for renamed package"
341
318
install -m 0644 $(CURDIR)/debian/apport/blacklist $(CURDIR)/debian/$(MOZ_PKG_NAME)/etc/apport/blacklist.d/$(MOZ_PKG_NAME)
342
319
install -m 0644 $(CURDIR)/debian/apport/native-origins $(CURDIR)/debian/$(MOZ_PKG_NAME)/etc/apport/native-origins.d/$(MOZ_PKG_NAME)
344
ifeq (1, $(MOZ_ENABLE_GLOBALMENU))
345
binary-install/$(MOZ_PKG_NAME)-globalmenu::
346
unzip -o -d debian/$(MOZ_PKG_NAME)-globalmenu/$(MOZ_ADDONDIR)/extensions/globalmenu@ubuntu.com/ $(MOZ_DISTDIR)/xpi-stage/globalmenu.xpi
349
321
GNOME_SUPPORT_FILES = libmozgnome.so
350
322
binary-post-install/$(MOZ_PKG_NAME):: install-searchplugins-,$(MOZ_PKG_NAME)
351
323
$(foreach file,$(GNOME_SUPPORT_FILES),rm -fv debian/$(MOZ_PKG_NAME)/$(MOZ_LIBDIR)/components/$(file);) true
366
338
dh_installdirs -p$(MOZ_PKG_NAME)-locale-$* $(MOZ_ADDONDIR)/extensions
367
339
@for lang in $(shell grep $*$$ debian/config/locales.shipped | sed -n 's/\([^\:]*\)\:\?.*/\1/ p' | tr '\n' ' '); \
369
id=`python $(CURDIR)/debian/build/get-xpi-id.py $(CURDIR)/$(MOZ_DISTDIR)/$(LANGPACK_DIR)/$(MOZ_APP_NAME)-$(MOZ_VERSION).$$lang.langpack.xpi 2>/dev/null`; \
341
id=`PYTHONDONTWRITEBYTECODE=1 $(MOZ_PYTHON) $(CURDIR)/debian/build/xpi-id.py $(CURDIR)/$(MOZ_DISTDIR)/$(LANGPACK_DIR)/$(MOZ_APP_NAME)-$(MOZ_VERSION).$$lang.langpack.xpi 2>/dev/null`; \
370
342
echo "Installing $(MOZ_APP_NAME)-$(MOZ_VERSION).$$lang.langpack.xpi to $$id.xpi in to $(MOZ_PKG_NAME)-locale-$*"; \
371
343
install -m 0644 $(CURDIR)/$(MOZ_DISTDIR)/$(LANGPACK_DIR)/$(MOZ_APP_NAME)-$(MOZ_VERSION).$$lang.langpack.xpi \
372
344
$(CURDIR)/debian/$(MOZ_PKG_NAME)-locale-$*/$(MOZ_ADDONDIR)/extensions/$$id.xpi; \
448
420
# install them at binary-install/* stage, but copy them over _after_ the shlibdeps had been generated
449
421
$(foreach file,$(GNOME_SUPPORT_FILES),mv debian/$(MOZ_PKG_NAME)-gnome-support/$(MOZ_LIBDIR)/components/$(file) debian/$(MOZ_PKG_NAME)/$(MOZ_LIBDIR)/components/;) true
451
pre-build:: auto-refresh-supported-locales $(pkgname_subst_files) $(appname_subst_files) enable-dist-patches
452
cp $(CURDIR)/debian/syspref.js $(CURDIR)/debian/$(MOZ_PKG_BASENAME).js
453
ifeq (1,$(HAVE_GLOBALMENU))
454
mkdir -p $(DEB_SRCDIR)/$(MOZ_MOZDIR)/extensions/globalmenu
455
(cd debian/globalmenu && tar -cvhf - .) | (cd $(DEB_SRCDIR)/$(MOZ_MOZDIR)/extensions/globalmenu && tar -xf -)
457
ifeq (,$(MOZ_DEFAULT_APP_BASENAME))
458
$(error "Need to set MOZ_DEFAULT_APP_BASENAME")
423
mozconfig: debian/config/mozconfig
426
create-virtualenv: $(VIRTENV_PYTHON)
428
mkdir -p debian/_virtualenv
429
$(MOZ_PYTHON) $(CURDIR)/$(MOZ_MOZDIR)/python/virtualenv/virtualenv.py --system-site-packages $(CURDIR)/debian/_virtualenv
430
cd $(CURDIR)/$(MOZ_MOZDIR)/python/compare-locales; $(VIRTENV_PYTHON) $(CURDIR)/$(MOZ_MOZDIR)/python/compare-locales/setup.py install
432
post-patches:: create-virtualenv
434
pre-build:: auto-refresh-supported-locales $(pkgname_subst_files) $(appname_subst_files) mozconfig
460
435
ifeq (,$(MOZ_BRANDING_OPTION))
461
436
$(error "Need to set MOZ_BRANDING_OPTION")
509
484
clean:: auto-refresh-supported-locales
513
CODENAME = $(PATCHES_DIST)
515
CODENAME = $(DISTRIB_CODENAME)
519
ARCH = $(PATCHES_ARCH)
521
ARCH = $(DEB_HOST_ARCH)
525
perl $(CURDIR)/debian/build/enable-dist-patches.pl $(CODENAME) $(ARCH)
527
487
RESTORE_BACKUP = $(shell if [ -f $(1).bak ] ; then rm -f $(1); mv $(1).bak $(1); fi)
529
489
get-orig-source: ARGS = -r $(MOZILLA_REPO) -l $(L10N_REPO) -n $(MOZ_PKG_NAME) -a $(MOZ_APP)
533
493
ifdef LOCAL_BRANCH
534
494
get-orig-source: ARGS += -c $(LOCAL_BRANCH)
497
get-orig-source: ARGS += -m $(MOZ_MOZDIR)
537
python $(CURDIR)/debian/build/create-tarball.py $(ARGS)
500
PYTHONDONTWRITEBYTECODE=1 $(MOZ_PYTHON) $(CURDIR)/debian/build/create-tarball.py $(ARGS)
505
clean:: debian/tests/control
543
506
@if ! cmp -s debian/control debian/control.old ; \
554
517
rm -f debian/control.old
555
perl $(CURDIR)/debian/build/enable-dist-patches.pl --clean $(CURDIR)/debian/patches/series
518
@if ! cmp -s debian/tests/control debian/tests/control.old ; \
521
echo "*******************************************************************************" ; \
522
echo "* debian/tests/control file is out of date. Please refresh and try again *" ; \
523
echo "* To refresh, run \"debian/rules debian/tests/control\" in the source directory *" ; \
524
echo "*******************************************************************************" ; \
526
rm -f debian/control.old ; \
529
rm -f debian/tests/control.old
556
530
rm -f $(pkgname_subst_files) $(appname_subst_files)
557
531
rm -f debian/stamp-*
558
532
rm -rf debian/l10n-mergedirs
559
rm -f debian/$(MOZ_PKG_BASENAME).js
560
533
rm -rf $(MOZ_OBJDIR)
561
534
rm -f debian/searchplugin*.list
562
find debian -name *.pyc -delete
563
find compare-locales -name *.pyc -delete
536
rm -rf debian/_virtualenv
537
rm -rf debian/tests/_results
565
.PHONY: make-buildsymbols make-testsuite make-langpack-xpis refresh-supported-locales auto-refresh-supported-locales enable-dist-patches get-orig-source
539
.PHONY: make-buildsymbols make-testsuite make-langpack-xpis refresh-supported-locales auto-refresh-supported-locales get-orig-source create-virtualenv