File: rules

package info (click to toggle)
webkit2gtk 2.36.4-1~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 293,692 kB
  • sloc: cpp: 2,617,621; javascript: 191,348; ansic: 125,749; xml: 63,766; python: 34,562; ruby: 16,868; perl: 15,491; asm: 9,864; yacc: 2,324; sh: 2,018; lex: 1,319; java: 935; makefile: 183; pascal: 60
file content (246 lines) | stat: -rwxr-xr-x 8,379 bytes parent folder | download
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
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk

# soup2 build -> 4.0 API packages, soup3 build -> 4.1 API packages
ENABLE_SOUP2=YES
ENABLE_SOUP3=NO

# We can also disable the soup2/soup3 builds by removing the build deps
ifeq ($(shell pkg-config --exists libsoup-2.4 || echo no),no)
	ENABLE_SOUP2=NO
endif
ifeq ($(shell pkg-config --exists libsoup-3.0 || echo no),no)
	ENABLE_SOUP3=NO
endif

EXTRA_DH_ARGUMENTS =
EXTRA_CMAKE_ARGUMENTS = -DPORT=GTK \
	   -DCMAKE_INSTALL_LIBEXECDIR=lib/$(DEB_HOST_MULTIARCH) \
	   -DCMAKE_C_FLAGS_RELEASE="" \
	   -DCMAKE_C_FLAGS_DEBUG="" \
	   -DCMAKE_CXX_FLAGS_RELEASE="" \
	   -DCMAKE_CXX_FLAGS_DEBUG="" \
	   -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \
	   -DENABLE_GAMEPAD=OFF \
	   -DUSE_LCMS=OFF \
	   -DENABLE_MINIBROWSER=ON
EXTRA_BUILD_ARGUMENTS =
DH_GENCONTROL_ARGS =

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

# The debug packages produced by webkit are huge and cause problems in
# most buildds. Use -g1 in all architectures to make them smaller.
CFLAGS := $(CFLAGS:-g=-g1)

# Use the CLoop Javascript interpreter and disable the JIT. This is
# slow but it is the most compatible solution for old (non-SSE2) CPUs.
ifneq (,$(filter $(DEB_HOST_ARCH),i386))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON
endif

# Systemd/elogind and libmanette are Linux-only
ifneq ($(DEB_HOST_ARCH_OS),linux)
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_JOURNALD_LOG=OFF
endif

# See https://bugs.webkit.org/show_bug.cgi?id=197192
ifneq (,$(filter $(DEB_HOST_ARCH),arm64))
	EXTRA_CMAKE_ARGUMENTS += -DWTF_CPU_ARM64_CORTEXA53=OFF
endif

# Disable Gold where it causes build problems, see #949618
ifneq (,$(filter $(DEB_HOST_ARCH),powerpc))
	EXTRA_CMAKE_ARGUMENTS += -DUSE_LD_GOLD=OFF
endif

# Lower memory requirements on architectures with only 2 GB address space
ifneq (,$(filter $(DEB_HOST_ARCH),mips mipsel sh4))
	CFLAGS := $(CFLAGS:-g1=-g0)
	CFLAGS := $(CFLAGS:-O2=-Os)
	CPPFLAGS += --param ggc-min-expand=10
endif

# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93876
# and: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93877
ifneq (,$(filter $(DEB_HOST_ARCH),sh3 sh4))
	CFLAGS := $(CFLAGS:-O2=-O1)
endif

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DUSE_SYSTEM_MALLOC=ON
	CPPFLAGS += -DRELEASE_WITHOUT_OPTIMIZATIONS
endif

ifeq (,$(filter %-doc,$(shell dh_listpackages)))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GTKDOC=OFF
else ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GTKDOC=OFF
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GTKDOC=ON
endif

ifneq (,$(filter debug,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DCMAKE_BUILD_TYPE=Debug
else
	EXTRA_CMAKE_ARGUMENTS += -DCMAKE_BUILD_TYPE=Release
	CPPFLAGS += -DNDEBUG -DG_DISABLE_CAST_CHECKS
endif

# Don't recommend xdg portals on Ubuntu i386 where it doesn't exist
ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes) $(DEB_HOST_ARCH), yes i386)
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_BUBBLEWRAP_SANDBOX=ON
	DH_GENCONTROL_ARGS += -Vbwrap:Depends="bubblewrap (>= 0.3.1), \
					xdg-dbus-proxy"
# Disable the bubblewrap sandbox if libseccomp-dev is not available
else ifeq ($(shell pkg-config --exists libseccomp && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_BUBBLEWRAP_SANDBOX=ON
	DH_GENCONTROL_ARGS += -Vbwrap:Depends="bubblewrap (>= 0.3.1), \
					xdg-dbus-proxy"
	DH_GENCONTROL_ARGS += -Vbwrap:Suggests="xdg-desktop-portal-gtk"
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_BUBBLEWRAP_SANDBOX=OFF
endif

# Disable WPE on Ubuntu since the required backend is in universe
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DUSE_WPE_RENDERER=OFF
# Disable the WPE renderer if libwpebackend-fdo-1.0-dev is not available
else ifeq ($(shell pkg-config --exists wpebackend-fdo-1.0 && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DUSE_WPE_RENDERER=ON
else
	EXTRA_CMAKE_ARGUMENTS += -DUSE_WPE_RENDERER=OFF
endif

# Lower max parallel jobs on some of Ubuntu's builders
ifeq ($(shell dpkg-vendor --is Ubuntu && echo yes),yes)
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64))
	EXTRA_BUILD_ARGUMENTS += --max-parallel=2
endif
endif

# set the distributor agent for Ubuntu
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DUSER_AGENT_BRANDING="Ubuntu"
endif

# gstreamer1.0-libav and gstreamer1.0-plugins-bad are not in Ubuntu "main"
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	DH_GENCONTROL_ARGS += -Vgst:Suggests="gstreamer1.0-libav, gstreamer1.0-plugins-bad"
else
	DH_GENCONTROL_ARGS += -Vgst:Recommends="gstreamer1.0-libav, gstreamer1.0-plugins-bad"
endif

CXXFLAGS=$(CFLAGS)

# Disable commands and binary packages of the builds that we don't want
ifneq ($(ENABLE_SOUP2),YES)
	SOUP2_BUILD = @:
	EXTRA_DH_ARGUMENTS += \
		-Ngir1.2-javascriptcoregtk-4.0 \
		-Ngir1.2-webkit2-4.0 \
		-Nlibjavascriptcoregtk-4.0-18 \
		-Nlibjavascriptcoregtk-4.0-bin \
		-Nlibjavascriptcoregtk-4.0-dev \
		-Nlibwebkit2gtk-4.0-37 \
		-Nlibwebkit2gtk-4.0-dev \
		-Nlibwebkit2gtk-4.0-doc \
		-Nwebkit2gtk-driver
endif
ifneq ($(ENABLE_SOUP3),YES)
	SOUP3_BUILD = @:
endif

# The debhelper files for the soup2 and soup3 builds are identical
# (apart from the API version) so we generate the latter from the former.
WEBKIT_DH_FILES = \
	gir1.2-javascriptcoregtk-4.0.install \
	gir1.2-javascriptcoregtk-4.0.lintian-overrides \
	gir1.2-webkit2-4.0.install \
	gir1.2-webkit2-4.0.lintian-overrides \
	libjavascriptcoregtk-4.0-18.install \
	libjavascriptcoregtk-4.0-dev.install \
	libjavascriptcoregtk-4.0-dev.lintian-overrides \
	libwebkit2gtk-4.0-37.docs \
	libwebkit2gtk-4.0-37.install \
	libwebkit2gtk-4.0-37.lintian-overrides \
	libwebkit2gtk-4.0-37.symbols \
	libwebkit2gtk-4.0-dev.install \
	libwebkit2gtk-4.0-dev.lintian-overrides

# This converts debhelper file names and contents to the soup3 versions
WEBKIT_DH_RENAME = sed -e 's/4\.0-18/4.1-0/g' \
		       -e 's/4\.0-37/4.1-0/g' \
		       -e 's/4\.0\.so\.37/4.1.so.0/g' \
		       -e 's/4\.0/4.1/g'

%:
	dh $@ --with gir --buildsystem=cmake+ninja $(EXTRA_DH_ARGUMENTS)

override_dh_gencontrol:
	dh_gencontrol -- $(DH_GENCONTROL_ARGS)

override_dh_auto_configure:
	if [ "$(ENABLE_SOUP3)" = "YES" ]; then \
		echo debian/clean > debian/clean ; \
		for src in $(WEBKIT_DH_FILES); do \
			dst=`echo $$src | $(WEBKIT_DH_RENAME)` ; \
			$(WEBKIT_DH_RENAME) debian/$$src > debian/$$dst ; \
			echo debian/$$dst >> debian/clean ; \
		done ; \
	fi
	$(SOUP2_BUILD) dh_auto_configure -Bbuild-soup2 -- \
		$(EXTRA_CMAKE_ARGUMENTS) -DUSE_SOUP2=ON
	$(SOUP3_BUILD) dh_auto_configure -Bbuild-soup3 -- \
		$(EXTRA_CMAKE_ARGUMENTS) -DUSE_SOUP2=OFF \
		-DENABLE_WEBDRIVER=OFF -DENABLE_GTKDOC=OFF

override_dh_auto_build:
	$(SOUP2_BUILD) CCACHE_NOHASHDIR=1 CCACHE_DIR=$(CURDIR)/ccache \
		CCACHE_BASEDIR=$(CURDIR)/build-soup2 \
		dh_auto_build -Bbuild-soup2 $(EXTRA_BUILD_ARGUMENTS)
	$(SOUP3_BUILD) CCACHE_NOHASHDIR=1 CCACHE_DIR=$(CURDIR)/ccache \
		CCACHE_BASEDIR=$(CURDIR)/build-soup3 \
		dh_auto_build -Bbuild-soup3 $(EXTRA_BUILD_ARGUMENTS)

override_dh_auto_install:
	$(SOUP2_BUILD) dh_auto_install -Bbuild-soup2
	$(SOUP3_BUILD) dh_auto_install -Bbuild-soup3

override_dh_auto_clean:
	$(SOUP2_BUILD) dh_auto_clean -Bbuild-soup2
	$(SOUP3_BUILD) dh_auto_clean -Bbuild-soup3
	find Source Tools -type f -name "*.pyc" -exec rm {} \;
	find Source Tools -depth -type d -name __pycache__ -exec rmdir {} \;
	rm -rf ccache

# Create a dummy doc directory in case the "nodoc" build option is set
override_dh_install:
	mkdir -p debian/tmp/usr/share/gtk-doc/html/webkit2gtk-4.0
	touch debian/tmp/usr/share/gtk-doc/html/webkit2gtk-4.0/index.html
	dh_install
	jdupes -rl debian/libwebkit2gtk-4.0-doc/usr

override_dh_makeshlibs:
	$(SOUP2_BUILD) dh_makeshlibs -plibwebkit2gtk-4.0-37 -Xinjected-bundle
	$(SOUP2_BUILD) dh_makeshlibs -plibjavascriptcoregtk-4.0-18
	$(SOUP3_BUILD) dh_makeshlibs -plibwebkit2gtk-4.1-0 -Xinjected-bundle
	$(SOUP3_BUILD) dh_makeshlibs -plibjavascriptcoregtk-4.1-0

override_dh_missing:
	dh_missing --fail-missing

override_dh_builddeb:
	DEB_BUILD_OPTIONS="$(filter-out parallel=%,$(DEB_BUILD_OPTIONS))" \
		dh_builddeb

override_dh_auto_test: