~mozillateam/xulrunner/xulrunner-1.9.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/make -f

MOZ_CVS_ROOT := :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH		?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

DEB_MOZ_APPLICATION	:= $(shell dpkg-parsechangelog | sed -n 's/^Source: *\(.*\)$$/\1/ p')
DEB_MOZ_VERSION		:= $(shell echo $(DEB_MOZ_APPLICATION) | sed -e 's/.*-//')

DEBIAN_VERSION		:= $(shell dpkg-parsechangelog | sed -n 's/^Version: *\(.*\)$$/\1/ p')
DEBIAN_REV_CODE		:= $(shell echo $(DEBIAN_VERSION) | sed 's/^.*-\([0-9]*\)[^-]*$$/0\1/ ; s/^.*\(..\)$$/\1/')
DEBIAN_XUL_VER		 = $(shell tail -1 mozilla/config/milestone.txt)
DEBIAN_XUL_DIR		 = /usr/lib/xulrunner-$(DEBIAN_XUL_VER)
DEB_SRCDIR		:= mozilla

# minVersion and maxVersion used in install.rdf
EM_TRANSLATION_VERSION		= $(DEBIAN_XUL_VER)
EM_TRANSLATION_MIN_VERSION	= 1.9
EM_TRANSLATION_MAX_VERSION	= 1.9.0.*

EXTRA_SYSTEM_CONFIGURE_FLAGS = $(NULL)

USE_SYSTEM_CAIRO := $(shell pkg-config --exists 'cairo >= 1.5.8'; a=$$?; if test $$a != 1; then echo 1; fi)
# for old cairo versions we cannot use system cairo
ifeq (1,$(USE_SYSTEM_CAIRO))
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --enable-system-cairo
else
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --disable-system-cairo
endif

USE_SYSTEM_SQLITE :=  $(shell pkg-config --exists 'sqlite3 >= 3.5'; a=$$?; if test $$a != 1; then echo 1; fi)
ifeq (1,$(USE_SYSTEM_SQLITE))
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --enable-system-sqlite
else
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --disable-system-sqlite
endif

# gutsy doesn't have the right system-nss/nspr
USE_SYSTEM_NSPR := $(shell pkg-config --exists 'nspr >= 4.7'; a=$$?; if test $$a != 1; then echo 1; fi)
ifeq (1,$(USE_SYSTEM_NSPR))
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --with-system-nspr
endif

USE_SYSTEM_NSS := $(shell pkg-config --exists 'nss >= 3.12'; a=$$?; if test $$a != 1; then echo 1; fi)
ifeq (1,$(USE_SYSTEM_NSS))
   EXTRA_SYSTEM_CONFIGURE_FLAGS += --with-system-nss
endif

# translation flags

MOZ_TRANSLATION_AUTO_XPI_OUTDIR		:= debian/lp-export-xpis/
MOZ_TRANSLATION_AUTO_XPI_SEARCHDIRS	:= debian/$(DEB_MOZ_APPLICATION)
MOZ_TRANSLATION_AUTO_XPI_LOCALE		:= en-US

# enable below to disable symbolic-functions linkage
# LDFLAGS=$(shell echo $$LDFLAGS | sed -e 's/-Wl,-Bsymbolic-functions//')
# export LDFLAGS

DEB_AUTO_UPDATE_AUTOCONF=2.13

# workaround cdbs wrongly unapplying patches before cleaning up
clean:: 
	[ ! -f $(DEB_SRCDIR)/Makefile ] || $(MAKE) -C $(DEB_SRCDIR) distclean

ifneq (,$(wildcard *.tar.bz2)$(DEBIAN_MOZCLIENT_EMBEDDED))
   DEB_TAR_SRCDIR := mozilla
   MOZCLIENT_EMBEDDED = 1
   DEBIAN_XUL_VER = $(shell tail -1 build-tree/mozilla/config/milestone.txt)
   include /usr/share/cdbs/1/rules/tarball.mk
endif
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
include /usr/share/cdbs/1/class/autotools.mk
include /usr/share/mozilla-devscripts/$(DEB_MOZ_APPLICATION).mk
include /usr/share/mozilla-devscripts/lp-locale-export.mk

DEB_MAKE_CLEAN_TARGET	 = $(NULL)
# We don't want build-tree/mozilla/README to be shipped as a doc
DEB_INSTALL_DOCS_ALL	:= $(NULL)
MOZ_APPLICATION		 = xulrunner

# List all extensions we want
DEB_MOZ_EXTENSIONS=xml-rpc,venkman,inspector,gnomevfs,cview,tasks,reporter,python/xpcom

CFLAGS   = -g
CXXFLAGS = -g

DEB_CONFIGURE_USER_FLAGS= \
	$(EXTRA_SYSTEM_CONFIGURE_FLAGS) \
	--enable-application=$(MOZ_APPLICATION) \
	--enable-extensions=$(DEB_MOZ_EXTENSIONS) \
	--enable-webservices \
	--enable-safe-browsing \
	--with-default-mozilla-five-home=$(DEBIAN_XUL_DIR) \
	--enable-startup-notification \
	--with-user-appdir=.mozilla \
	--without-system-jpeg \
	--with-system-zlib=/usr \
	--with-system-bz2=/usr \
	--enable-system-hunspell \
	--disable-javaxpcom \
	--disable-crashreporter \
	--disable-elf-dynstr-gc \
	--disable-installer \
	--disable-strip \
	--disable-strip-libs \
	--disable-install-strip \
	--disable-tests \
	--disable-mochitest \
	--disable-updater \
	--enable-optimize \
	--with-distribution-id=com.ubuntu \
	$(NULL)

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	DEB_CONFIGURE_USER_FLAGS += \
		--disable-optimize \
		$(NULL)
endif

NOT_EXECUTABLE = \
	*.xml \
	*.js  \
	*.png \
	*.xpm \
	*.txt \
	LICENSE \
	$(NULL)

ifeq (1,$(USE_SYSTEM_NSS))
binary-install/$(DEB_MOZ_APPLICATION)::
	dh_link usr/lib/nss/libnssckbi.so $(DEBIAN_XUL_DIR)/libnssckbi.so
endif

binary-install/$(DEB_MOZ_APPLICATION)::
	touch debian/xulrunner-$(DEB_MOZ_VERSION)/$(DEBIAN_XUL_DIR)/.autoreg
	dh_link usr/lib/xulrunner-addons/extensions  $(DEBIAN_XUL_DIR)/extensions
	dh_link usr/lib/xulrunner-addons/plugins  $(DEBIAN_XUL_DIR)/plugins
	dh_link $(DEBIAN_XUL_DIR)/xulrunner /usr/bin/$(DEB_MOZ_APPLICATION)
	dh_link $(DEBIAN_XUL_DIR)/xpcshell /usr/bin/xpcshell-$(DEB_MOZ_VERSION)
ifneq (1,$(USE_SYSTEM_SQLITE))
	dh_link $(DEBIAN_XUL_DIR)/libsqlite3.so $(DEBIAN_XUL_DIR)/libsqlite3.so.0
endif
	dh_install debian/system-greprefs.js /etc/xulrunner-$(DEB_MOZ_VERSION)/ 
	dh_link /etc/xulrunner-$(DEB_MOZ_VERSION)/system-greprefs.js $(DEBIAN_XUL_DIR)/greprefs/system-greprefs.js

LOCALE_VERSION = $(shell echo $(DEBIAN_VERSION) | sed -e 's/~cvs.*/pre/' | tr -d '~')

binary-post-install/$(DEB_MOZ_APPLICATION):: auto-locale-xpi.mk/translate fix-permissions compare
	dh_install -p$(DEB_MOZ_APPLICATION)-dev debian/build-system.tar.gz /usr/lib/xulrunner-devel-$(DEBIAN_XUL_VER)/sdk/
	sed \
		-e 's/@EM_VERSION@/$(EM_TRANSLATION_VERSION)/' \
		-e 's/@EM_TOOLKIT_MIN_VERSION@/$(EM_TRANSLATION_MIN_VERSION)/' \
		-e 's/@EM_TOOLKIT_MAX_VERSION@/$(EM_TRANSLATION_MAX_VERSION)/' \
		< debian/translation-support/install.rdf.in > debian/install.rdf
	cd debian && zip lp-export-xpis/en-US.xpi install.rdf
ifeq (,$(findstring $(EM_TRANSLATION_VERSION), $(LOCALE_VERSION)))
	$(error EM_TRANSLATION_VERSION=$(EM_TRANSLATION_VERSION) LOCALE_VERSION=$(LOCALE_VERSION). You need to explicitly adjust the translation version and min/max bounds.)
endif

FIND_EXP = $(foreach ext,$(NOT_EXECUTABLE),-name '$(ext)' -o)
FIND_NOT_EXECUTABLE = $(wordlist 1, $(shell expr $(words $(FIND_EXP)) - 1), $(FIND_EXP))

post-patches:: debian/$(DEB_MOZ_APPLICATION).postrm
	# Create a build-system for xulrunner applications
	sh debian/create-build-system.sh

fix-permissions:
	# Fix permissions
	cd debian ; \
	find . -type f \( $(FIND_NOT_EXECUTABLE) \) -perm -u=x -exec chmod -c 644 {} \;

debian/$(DEB_MOZ_APPLICATION).postrm: debian/$(DEB_MOZ_APPLICATION).postrm.in
	sed -e 's,@XULDIR@,$(DEBIAN_XUL_DIR),g' < debian/$(DEB_MOZ_APPLICATION).postrm.in \
	> debian/$(DEB_MOZ_APPLICATION).postrm

clean::
	rm -f debian/$(DEB_MOZ_APPLICATION).postrm debian/install.rdf
	rm -f debian/build-system.tar.gz