File: rules

package info (click to toggle)
webkit2gtk 2.51.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 455,340 kB
  • sloc: cpp: 3,865,253; javascript: 197,710; ansic: 165,177; python: 49,241; asm: 21,868; ruby: 18,095; perl: 16,926; xml: 4,623; sh: 2,409; yacc: 2,356; java: 2,019; lex: 1,330; pascal: 372; makefile: 210
file content (284 lines) | stat: -rwxr-xr-x 10,390 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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
#!/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

# gtk3 build -> 4.1 API packages
# gtk4 build -> 6.0 API packages
ENABLE_GTK3=YES
ENABLE_GTK4=YES
# YES => build libwebkit2gtk-4.0-doc, libjavascriptcoregtk-4.0-bin and webkit2gtk-driver (for trixie)
BUILD_TRANSITIONAL_PKGS=NO

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 \
	   -DUSE_LIBBACKTRACE=OFF \
	   -DENABLE_MINIBROWSER=ON
DH_GENCONTROL_ARGS =

ifneq ($(filter amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x hppa loong64 powerpc ppc64 sh4,$(DEB_HOST_ARCH)),)
EXTRA_CMAKE_ARGUMENTS += -DUSE_SYSPROF_CAPTURE=ON
else
EXTRA_CMAKE_ARGUMENTS += -DUSE_SYSPROF_CAPTURE=OFF
endif

# Skia strongly recommends using clang
# https://skia.org/docs/user/build/#supported-and-preferred-compilers
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 armel armhf i386 ppc64el riscv64 s390x))
	EXTRA_CMAKE_ARGUMENTS += \
	   -DCMAKE_C_COMPILER=clang \
	   -DCMAKE_CXX_COMPILER=clang++
endif

# GCC 15 fails in mips64el with an internal compiler error.
# (Clang also fails with "failed to perform tail call elimination").
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1116217
ifneq (,$(filter $(DEB_HOST_ARCH),mips64el))
	EXTRA_CMAKE_ARGUMENTS += \
	   -DCMAKE_C_COMPILER=gcc-14 \
	   -DCMAKE_CXX_COMPILER=g++-14
endif

# The WebKit build scripts look at the CPU to detect the architecture.
# This is a problem if we e.g. build for i386 on an amd64 machine.
# Forcing a 32-bit build solves this.
ifeq ($(DEB_HOST_ARCH_BITS),32)
	EXTRA_CMAKE_ARGUMENTS += -DFORCE_32BIT=ON
endif

# Sacrifice speed in order to make it more likely resource limits
# won't be hit.
ifeq ($(DEB_BUILD_ARCH_BITS),32)
	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)
CXXFLAGS := $(CXXFLAGS:-g=-g1)

# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949621
LDFLAGS += -Wl,--reduce-memory-overheads

# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1104703
ifneq (,$(filter $(DEB_HOST_ARCH),arm64))
	CFLAGS := $(patsubst -mbranch-protection=%,-mbranch-protection=pac-ret,$(CFLAGS))
	CXXFLAGS := $(patsubst -mbranch-protection=%,-mbranch-protection=pac-ret,$(CXXFLAGS))
endif

# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1101547
ifneq (,$(filter $(DEB_HOST_ARCH),alpha))
	CPPFLAGS += -mlarge-data -mlarge-text
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_DOCUMENTATION=OFF
else ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_DOCUMENTATION=OFF
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_DOCUMENTATION=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

# libmanette is no longer available in Ubuntu i386.
# Let's disable it completely (also in Debian) to simplify maintenance.
ifneq (,$(filter $(DEB_HOST_ARCH),i386))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GAMEPAD=OFF
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:Recommends="xdg-desktop-portal-gtk"
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_BUBBLEWRAP_SANDBOX=OFF
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

# libavif is not in Ubuntu main
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DUSE_AVIF=OFF
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

# flite (speech) and libmanette (gamepad) are not in Ubuntu main LP: #2096940 LP: #1918446
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_SPEECH_SYNTHESIS=OFF -DENABLE_GAMEPAD=OFF
endif

# This is loaded at runtime using libepoxy so add an explicit dependency (#1033230)
ifneq (,$(filter $(DEB_HOST_ARCH),arm64 armel armhf))
	DH_GENCONTROL_ARGS += -Vgles:Depends="libgles2"
endif

# Disable commands and binary packages of the builds that we don't want
ifneq ($(ENABLE_GTK3),YES)
	GTK3_BUILD = @:
	EXTRA_DH_ARGUMENTS += -Nlibjavascriptcoregtk-bin
else
	GTK3_BUILD_DEP=libgtk-3-dev,gir1.2-gtk-3.0-dev,
endif
ifneq ($(ENABLE_GTK4),YES)
	GTK4_BUILD = @:
	EXTRA_DH_ARGUMENTS += -Nlibwebkitgtk-doc
else
	GTK4_BUILD_DEP=libgtk-4-dev,gir1.2-gtk-4.0-dev,
endif

# Decide what version of the WebKit WebDriver to build
ENABLE_WEBDRIVER_GTK3 = -DENABLE_WEBDRIVER=OFF
ENABLE_WEBDRIVER_GTK4 = -DENABLE_WEBDRIVER=OFF
ifeq ($(ENABLE_GTK3),YES)
	ENABLE_WEBDRIVER_GTK3 = -DENABLE_WEBDRIVER=ON
	WEBDRIVER_DEP_PKG = libwebkit2gtk-4.1-0
else
	ENABLE_WEBDRIVER_GTK4 = -DENABLE_WEBDRIVER=ON
	WEBDRIVER_DEP_PKG = libwebkitgtk-6.0-4
endif

# The debhelper files for the gtk3 and gtk4 builds are almost
# identical so we generate the latter from the former.
WEBKIT_DH_FILES = \
	gir1.2-javascriptcoregtk-4.1.install \
	gir1.2-webkit2-4.1.install \
	libjavascriptcoregtk-4.1-0.install \
	libjavascriptcoregtk-4.1-dev.install \
	libwebkit2gtk-4.1-0.docs \
	libwebkit2gtk-4.1-0.install \
	libwebkit2gtk-4.1-0.symbols \
	libwebkit2gtk-4.1-dev.install

# This converts debhelper file contents to the gtk4 versions
WEBKIT_DH_CONVERT_GTK4 = sed -e '/usr\/include\/webkitgtk-4.1\/webkit2/d' \
			     -e '/usr\/include\/webkitgtk-4.1\/webkitdom/d' \
			     -e '/usr\/include\/webkitgtk-4.1\/JavaScriptCore/d' \
			     -e 's/webkit2gtk-web-extension/webkitgtk-web-process-extension/' \
			     -e 's/WebKit2WebExtension/WebKitWebProcessExtension/' \
			     -e 's/webkit2webextension/webkitwebprocessextension/' \
			     -e 's/4\.1-0/6.0-4/g' \
			     -e 's/4\.1\.so\.0/6.0.so.4/g' \
			     -e 's/4\.1/6.0/g' \
			     -e 's/webkit2/webkit/g' \
			     -e 's/WebKit2/WebKit/g' \
			     -e '/gtk3-only/s/^ /\#/' \
			     -e '/gtk4-only/s/^\#/ /'

# This converts debhelper file names to the gtk4 versions
WEBKIT_DH_RENAME_GTK4 = sed -e 's/libwebkit2gtk-4.1-0/libwebkitgtk-6.0-4/' \
			    -e 's/libjavascriptcoregtk-4.1-0/libjavascriptcoregtk-6.0-1/' \
			    -e 's/webkit2/webkit/g' \
			    -e 's/4\.1/6.0/g'

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

debian/control: debian/control.in debian/control-common.in debian/control-transitional.in debian/rules
	echo '# This file is autogenerated. DO NOT EDIT' > debian/control
	cat debian/control.in | \
		sed -e 's/@EXTRA_BUILD_DEPS@/$(GTK3_BUILD_DEP)$(GTK4_BUILD_DEP)/' \
		    -e 's/@WEBDRIVER_DEP_PKG@/$(WEBDRIVER_DEP_PKG)/' \
		>> debian/control
ifeq ($(BUILD_TRANSITIONAL_PKGS),YES)
	cat debian/control-transitional.in >> debian/control
endif
	$(GTK3_BUILD) cat debian/control-common.in | \
		sed -e 's/@WK_API_VERSION@/4.1/g' \
		    -e 's/@LIBJSC_PKG@/libjavascriptcoregtk-4.1-0/g' \
		    -e 's/@WEBKIT@/webkit2/g' \
		    -e 's/@LIBWEBKITGTK_PKG@/libwebkit2gtk-4.1-0/g' \
		    -e 's/@GTK_VERSION@/3/g' \
		>> debian/control
	$(GTK4_BUILD) cat debian/control-common.in | \
		sed -e 's/@WK_API_VERSION@/6.0/g' \
		    -e 's/@LIBJSC_PKG@/libjavascriptcoregtk-6.0-1/g' \
		    -e 's/@WEBKIT@/webkit/g' \
		    -e 's/@LIBWEBKITGTK_PKG@/libwebkitgtk-6.0-4/g' \
		    -e 's/@GTK_VERSION@/4/g' \
		>> debian/control
	sed -i '$${/^$$/d}' debian/control # Remove last empty line

override_dh_gencontrol:
	dh_gencontrol -- $(DH_GENCONTROL_ARGS)

override_dh_auto_configure:
	echo debian/clean > debian/clean
	if [ "$(ENABLE_GTK4)" = "YES" ]; then \
		for src in $(WEBKIT_DH_FILES); do \
			dst=`echo $$src | $(WEBKIT_DH_RENAME_GTK4)` ; \
			$(WEBKIT_DH_CONVERT_GTK4) debian/$$src > debian/$$dst ; \
			echo debian/$$dst >> debian/clean ; \
		done ; \
	fi
	$(GTK3_BUILD) dh_auto_configure -Bbuild-gtk3 -- \
		$(EXTRA_CMAKE_ARGUMENTS) -DUSE_GTK4=OFF \
		$(ENABLE_WEBDRIVER_GTK3) -DENABLE_DOCUMENTATION=OFF
	$(GTK4_BUILD) dh_auto_configure -Bbuild-gtk4 -- \
		$(EXTRA_CMAKE_ARGUMENTS) \
		$(ENABLE_WEBDRIVER_GTK4)

override_dh_auto_build:
	$(GTK3_BUILD) dh_auto_build -Bbuild-gtk3
	$(GTK4_BUILD) dh_auto_build -Bbuild-gtk4

override_dh_auto_install:
	$(GTK3_BUILD) dh_auto_install -Bbuild-gtk3
	$(GTK4_BUILD) dh_auto_install -Bbuild-gtk4

override_dh_auto_clean: debian/control
	$(GTK3_BUILD) dh_auto_clean -Bbuild-gtk3
	$(GTK4_BUILD) dh_auto_clean -Bbuild-gtk4
	find Source Tools -type f -name "*.pyc" -exec rm {} \;
	find Source Tools -depth -type d -name __pycache__ -exec rmdir {} \;

# Create a dummy doc directory in case the "nodoc" build option is set.
override_dh_install-indep:
	mkdir -p debian/tmp/usr/share/doc/webkitgtk-6.0
	touch debian/tmp/usr/share/doc/webkitgtk-6.0/index.html
	dh_install -i
ifneq (,$(filter libwebkitgtk-doc,$(shell dh_listpackages)))
	jdupes -rl debian/libwebkitgtk-doc/usr
endif

override_dh_makeshlibs:
	$(GTK3_BUILD) dh_makeshlibs -plibwebkit2gtk-4.1-0 -Xinjected-bundle
	$(GTK3_BUILD) dh_makeshlibs -plibjavascriptcoregtk-4.1-0 -VNone
	$(GTK4_BUILD) dh_makeshlibs -plibwebkitgtk-6.0-4 -Xinjected-bundle
	$(GTK4_BUILD) dh_makeshlibs -plibjavascriptcoregtk-6.0-1 -VNone

override_dh_auto_test:

override_dh_dwz: