summaryrefslogtreecommitdiff
path: root/debian/rules
blob: e803f9475abcf6bd4a0983188870a35a832b3ba0 (plain)
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
include /usr/share/dpkg/buildflags.mk

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_HOST_ARCH_BITS  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS)
DEB_HOST_MULTIARCH  ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEBHELPER_VERSION = $(shell dpkg-query -W -f='$${source:Version}' debhelper)

GTK_VERSIONS = 2.0 3.0

CFLAGS += -Wall -fno-delete-null-pointer-checks
LDFLAGS += -Wl,--as-needed

COMMON_CONFIGURE_ARGUMENTS = \
	--libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
	--disable-silent-rules \
	--host=$(DEB_HOST_GNU_TYPE) \
	--build=$(DEB_BUILD_GNU_TYPE) \
	--enable-gtk-doc \
	--enable-introspection \
	--enable-geolocation

# Sacrifice speed in order to make it more likely resource limits
# won't be hit.
ifeq ($(DEB_HOST_ARCH_BITS),32)
	LDFLAGS += -Wl,--no-keep-memory
endif

ifeq ($(DEB_BUILD_ARCH),alpha)
        LDFLAGS += -Wl,--no-relax
endif

# The size of the debugging symbols is causing problems
# in all these arches, so use -g1
ifneq (,$(filter $(DEB_BUILD_ARCH),i386 hurd-i386 ia64 kfreebsd-i386 kfreebsd-amd64 mips mipsel mips64el powerpc powerpcspe s390 s390x sparc armel armhf hppa arm64))
	CFLAGS := $(CFLAGS:-g=-g1)
endif

# disable jit on some architectures (bug #651636)
ifneq (,$(filter $(DEB_BUILD_ARCH),armel mips mipsel))
	COMMON_CONFIGURE_ARGUMENTS += --disable-jit
endif

# See https://bugs.webkit.org/show_bug.cgi?id=113638
ifeq (,$(filter $(DEB_BUILD_ARCH),i386 amd64 hurd-i386 kfreebsd-i386 kfreebsd-amd64 armel armhf mips mipsel))
	CPPFLAGS += -DENABLE_JIT=0 -DENABLE_YARR_JIT=0 -DENABLE_ASSEMBLER=0
endif

# Disabling GLX on ARM will make it use EGL, which works better.
ifneq (,$(filter $(DEB_BUILD_ARCH),armel armhf arm64))
       COMMON_CONFIGURE_ARGUMENTS += --enable-glx=no
endif

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	COMMON_CONFIGURE_ARGUMENTS += --disable-fast-malloc --disable-optimizations
endif

ifneq (,$(filter debug,$(DEB_BUILD_OPTIONS)))
	COMMON_CONFIGURE_ARGUMENTS += --enable-debug
else
	CPPFLAGS += -DNDEBUG -DG_DISABLE_CAST_CHECKS
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEARGUMENTS += -j$(NUMJOBS)
endif

ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	DEB_DH_GENCONTROL_ARGS += -- -Vgst:Recommends=""
else
	DEB_DH_GENCONTROL_ARGS += -- -Vgst:Recommends="gstreamer1.0-plugins-bad, gstreamer1.0-libav,"
endif

clean:
	dh_testdir
	dh_testroot

	rm -f reconf-stamp build-stamp install-stamp
	rm -rf build-*
	rm -rf debian/tmp-*
	rm -f Source/WebKit/gtk/docs/version.xml
	find . -name \*.pyc -delete

	dh_autoreconf_clean

	dh_clean

build: build-arch build-indep

build-indep:

build-arch: build-stamp

reconf-stamp:
	dh_testdir
	# See https://bugs.webkit.org/show_bug.cgi?id=117334
	dh_autoreconf autoreconf -- -fiv -I Source/autotools
	touch reconf-stamp

build-stamp: reconf-stamp
	dh_testdir

ifeq (3.0,$(filter 3.0,$(GTK_VERSIONS)))
	test -d build-3.0 || mkdir build-3.0
	cd build-3.0; \
	env -u AR_FLAGS \
	CFLAGS="$(CFLAGS)" \
	CXXFLAGS="$(CFLAGS)" \
	CPPFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS)" \
	../configure --prefix=/usr \
		--with-gtk=3.0 \
		$(COMMON_CONFIGURE_ARGUMENTS) \
		--disable-webkit2

	$(MAKE) $(MAKEARGUMENTS) -C build-3.0

	$(MAKE) -C build-3.0 install DESTDIR="$(CURDIR)"/debian/tmp-3.0
	ln -s JavaScriptCore-3.0.typelib \
		debian/tmp-3.0/usr/lib/$(DEB_HOST_MULTIARCH)/girepository-1.0/JSCore-3.0.typelib
	mv debian/tmp-3.0/usr/bin/jsc-3 debian/tmp-3.0/usr/bin/jsc

	rm -rf build-3.0
endif

ifeq (2.0,$(filter 2.0,$(GTK_VERSIONS)))
	test -d build-2.0 || mkdir build-2.0
	cd build-2.0; \
	env -u AR_FLAGS \
	CFLAGS="$(CFLAGS)" \
	CXXFLAGS="$(CFLAGS)" \
	CPPFLAGS="$(CPPFLAGS)" \
	LDFLAGS="$(LDFLAGS)" \
	../configure --prefix=/usr \
		--with-gtk=2.0 \
		$(COMMON_CONFIGURE_ARGUMENTS) \
		--disable-webkit2

	$(MAKE) $(MAKEARGUMENTS) -C build-2.0

	$(MAKE) -C build-2.0 install DESTDIR="$(CURDIR)"/debian/tmp-2.0

	rm -rf build-2.0
endif

	touch $@

# Build architecture-independent files here.
binary-indep: build
	dh_testdir
	dh_testroot
	dh_installdocs -i
	dh_installchangelogs -i
	dh_install -plibwebkitgtk-doc
	dh_link -i
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i -- -Zxz

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installdocs -a
	dh_installchangelogs -a
ifeq (2.0,$(filter 2.0,$(GTK_VERSIONS)))
	dh_install -plibjavascriptcoregtk-1.0-0 --sourcedir=debian/tmp-2.0
	dh_install -plibjavascriptcoregtk-1.0-dev --sourcedir=debian/tmp-2.0
	dh_install -plibjavascriptcoregtk-1.0-0-dbg --sourcedir=debian/tmp-2.0
	dh_install -plibwebkitgtk-1.0-0 --sourcedir=debian/tmp-2.0
	dh_install -plibwebkitgtk-dev --sourcedir=debian/tmp-2.0
	dh_install -plibwebkitgtk-1.0-0-dbg --sourcedir=debian/tmp-2.0
endif
ifeq (3.0,$(filter 3.0,$(GTK_VERSIONS)))
	dh_install -plibjavascriptcoregtk-3.0-0 --sourcedir=debian/tmp-3.0
	dh_install -plibjavascriptcoregtk-3.0-dev --sourcedir=debian/tmp-3.0
	dh_install -plibjavascriptcoregtk-3.0-0-dbg --sourcedir=debian/tmp-3.0
	dh_install -plibjavascriptcoregtk-3.0-bin --sourcedir=debian/tmp-3.0
	dh_install -pgir1.2-javascriptcoregtk-3.0 --sourcedir=debian/tmp-3.0
	dh_install -plibwebkitgtk-3.0-0 --sourcedir=debian/tmp-3.0
	dh_install -plibwebkitgtk-3.0-dev --sourcedir=debian/tmp-3.0
	dh_install -plibwebkitgtk-3.0-0-dbg --sourcedir=debian/tmp-3.0
	dh_install -pgir1.2-webkit-3.0 --sourcedir=debian/tmp-3.0
	dh_installman -plibjavascriptcoregtk-3.0-bin
endif
	dh_link -a
ifeq (2.0,$(filter 2.0,$(GTK_VERSIONS)))
	if dpkg --compare-versions $(DEBHELPER_VERSION) ge 9.20151219; then \
		dh_strip -plibjavascriptcoregtk-1.0-0 --ddeb-migration='libjavascriptcoregtk-1.0-0-dbg (<< 2.4.10)' ; \
		dh_strip -plibwebkitgtk-1.0-0 --ddeb-migration='libwebkitgtk-1.0-0-dbg (<< 2.4.10)' ; \
	fi
endif
ifeq (3.0,$(filter 3.0,$(GTK_VERSIONS)))
	if dpkg --compare-versions $(DEBHELPER_VERSION) ge 9.20151219; then \
		dh_strip -plibjavascriptcoregtk-3.0-0 --ddeb-migration='libjavascriptcoregtk-3.0-0-dbg (<< 2.4.10)'; \
		dh_strip -plibwebkitgtk-3.0-0 --ddeb-migration='libwebkitgtk-3.0-0-dbg (<< 2.4.10)' ; \
	fi
endif
	dh_strip -a
	dh_compress -a
	dh_fixperms -a
ifeq (2.0,$(filter 2.0,$(GTK_VERSIONS)))
	dh_makeshlibs -plibjavascriptcoregtk-1.0-0 -V 'libjavascriptcoregtk-1.0-0 (>= 1.5.1)' -- -c4
	dh_makeshlibs -plibwebkitgtk-1.0-0 -V 'libwebkitgtk-1.0-0 (>= 1.3.9)' -- -c4
endif
ifeq (3.0,$(filter 3.0,$(GTK_VERSIONS)))
	dh_makeshlibs -plibjavascriptcoregtk-3.0-0 -V 'libjavascriptcoregtk-3.0-0 (>= 1.5.1)' -- -c4
	dh_makeshlibs -plibwebkitgtk-3.0-0 -V 'libwebkitgtk-3.0-0 (>= 1.3.9)' -- -c4
	dh_girepository --package=gir1.2-javascriptcoregtk-3.0
	dh_girepository --package=gir1.2-webkit-3.0
endif
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	DEB_BUILD_OPTIONS="$(filter-out parallel=%,$(DEB_BUILD_OPTIONS))" \
		dh_builddeb -a -- -Zxz

binary: binary-indep binary-arch

.PHONY: build clean install binary binary-indep binary-arch