File: rules

package info (click to toggle)
wpewebkit 2.38.6-1~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 311,496 kB
  • sloc: cpp: 2,653,313; javascript: 289,013; ansic: 121,268; xml: 64,149; python: 35,534; ruby: 17,287; perl: 15,877; asm: 11,072; yacc: 2,326; sh: 1,863; lex: 1,319; java: 937; makefile: 151; pascal: 60
file content (207 lines) | stat: -rwxr-xr-x 6,983 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
#!/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 -> 1.0 API packages, soup3 build -> 1.1 API packages
USE_SOUP_VERSION=2

# Set to YES to use the docs from the tarball instead of generating them.
# Use only if gi-docgen is not available.
USE_PREBUILT_DOCS=NO

EXTRA_DH_ARGUMENTS =
EXTRA_CMAKE_ARGUMENTS = -DPORT=WPE \
	   -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_WPE_QT_API=OFF \
	   -DENABLE_MINIBROWSER=ON
DH_GENCONTROL_ARGS =

ifeq ($(USE_SOUP_VERSION),2)
	EXTRA_CMAKE_ARGUMENTS += -DUSE_SOUP2=ON
	WK_API_VERSION = 1.0
	LIBWPEWEBKIT_PKG = libwpewebkit-1.0-3
	SOUPDEV_PKG = libsoup2.4-dev
	USE_PREBUILT_DOCS=YES
else
	EXTRA_CMAKE_ARGUMENTS += -DUSE_SOUP2=OFF
	WK_API_VERSION = 1.1
	LIBWPEWEBKIT_PKG = libwpewebkit-1.1-0
	SOUPDEV_PKG = libsoup-3.0-dev
endif

# gcc 10 segfaults when building webkit in amd64 (#1008098) so use clang
# However in i386, mipsel and arm64 clang is the buggy one (#1010329, #1016811)
ifneq (,$(filter $(DEB_HOST_ARCH),amd64))
	EXTRA_CMAKE_ARGUMENTS += \
	   -DCMAKE_C_COMPILER=clang \
	   -DCMAKE_CXX_COMPILER=clang++
endif

# 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

# 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
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_UNIFIED_BUILDS=OFF
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_DOCUMENTATION=OFF -DENABLE_INTROSPECTION=OFF
	USE_PREBUILT_DOCS=NO
else ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_DOCUMENTATION=OFF -DENABLE_INTROSPECTION=OFF
	USE_PREBUILT_DOCS=NO
else ifeq ($(USE_PREBUILT_DOCS),YES)
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_DOCUMENTATION=OFF -DENABLE_INTROSPECTION=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

# Disable the bubblewrap sandbox if libseccomp-dev is not available
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"
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_BUBBLEWRAP_SANDBOX=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),arm64))
	EXTRA_DH_ARGUMENTS += --max-parallel=2
endif
endif

CXXFLAGS=$(CFLAGS)

# 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 = \
	libwpewebkit-1.0-3.docs \
	libwpewebkit-1.0-3.install \
	libwpewebkit-1.0-3.lintian-overrides \
	libwpewebkit-1.0-3.symbols \
	libwpewebkit-1.0-dev.install

# This converts debhelper file names and contents to the soup3 versions
WEBKIT_DH_RENAME = sed -e 's/1\.0-3/1.1-0/g' \
		       -e 's/1\.0\.so\.3/1.1.so.0/g' \
		       -e 's/1\.0/1.1/g'

debian/control: debian/control.in debian/rules
	echo '# This file is autogenerated. DO NOT EDIT' > debian/control
	cat debian/control.in | \
		sed -e 's/@SOUPDEV_PKG@/$(SOUPDEV_PKG)/g' \
		    -e 's/@WK_API_VERSION@/$(WK_API_VERSION)/g' \
		    -e 's/@LIBWPEWEBKIT_PKG@/$(LIBWPEWEBKIT_PKG)/g' \
		    -e 's/@SOUP_VERSION@/$(USE_SOUP_VERSION)/g' \
		>> debian/control
ifeq ($(USE_PREBUILT_DOCS),YES)
	sed -i -e 's/^\(Build-Depends-Indep:\)/# \1/' debian/control
endif

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

override_dh_gencontrol:
	dh_gencontrol -- $(DH_GENCONTROL_ARGS)

override_dh_auto_configure:
	if [ "$(USE_SOUP_VERSION)" = "3" ]; 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
	dh_auto_configure -- $(EXTRA_CMAKE_ARGUMENTS)

override_dh_auto_clean: debian/control
	dh_auto_clean
	find Source Tools -type f -name "*.pyc" -exec rm {} \;
	find Source Tools -depth -type d -name __pycache__ -exec rmdir {} \;

# If USE_PREBUILT_DOCS=YES then install them. Otherwise create dummy
# doc directories in case the "nodoc" build option is set.
override_dh_install:
ifeq ($(USE_PREBUILT_DOCS),YES)
	mkdir -p debian/tmp/usr/share/gtk-doc/html
	cp -r Documentation/wpe-webkit-1.1 debian/tmp/usr/share/gtk-doc/html/
	cp -r Documentation/wpe-web-extension-1.1 debian/tmp/usr/share/gtk-doc/html/
	cp -r Documentation/wpe-javascriptcore-1.1 debian/tmp/usr/share/gtk-doc/html/
else
	mkdir -p debian/tmp/usr/share/gtk-doc/html/wpe-webkit-1.1
	touch debian/tmp/usr/share/gtk-doc/html/wpe-webkit-1.1/index.html
	mkdir -p debian/tmp/usr/share/gtk-doc/html/wpe-web-extension-1.1
	touch debian/tmp/usr/share/gtk-doc/html/wpe-web-extension-1.1/index.html
	mkdir -p debian/tmp/usr/share/gtk-doc/html/wpe-javascriptcore-1.1
	touch debian/tmp/usr/share/gtk-doc/html/wpe-javascriptcore-1.1/index.html
endif
	dh_install
	jdupes -rl debian/libwpewebkit-1.0-doc/usr

override_dh_shlibdeps:
	dh_shlibdeps -XMiniBrowser

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: