rules 4.12 KB
Newer Older
1
2
#!/usr/bin/make -f

Alberto Garcia's avatar
Alberto Garcia committed
3
4
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

5
include /usr/share/dpkg/architecture.mk
6
include /usr/share/dpkg/buildflags.mk
7

8
EXTRA_CMAKE_ARGUMENTS =
9
DH_GENCONTROL_ARGS =
10

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

17
# The debug packages produced by webkit are huge and cause problems in
Alberto Garcia's avatar
Alberto Garcia committed
18
19
# most buildds. Use -g1 in all architectures to make them smaller.
CFLAGS := $(CFLAGS:-g=-g1)
Alberto Garcia's avatar
Alberto Garcia committed
20

21
22
23
24
25
26
# 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

27
28
29
30
31
# 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

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

37
38
39
40
41
42
43
44
# Enable the new register allocator on SH and
# disable one particular optimization flag
# 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))
        CPPFLAGS += -mlra -fno-move-loop-invariants
endif

45
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
46
	EXTRA_CMAKE_ARGUMENTS += -DUSE_SYSTEM_MALLOC=ON
47
	CPPFLAGS += -DRELEASE_WITHOUT_OPTIMIZATIONS
48
49
endif

Alberto Garcia's avatar
Alberto Garcia committed
50
51
52
53
54
55
ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GTKDOC=OFF
else
	EXTRA_CMAKE_ARGUMENTS += -DENABLE_GTKDOC=ON
endif

56
ifneq (,$(filter debug,$(DEB_BUILD_OPTIONS)))
57
58
59
	EXTRA_CMAKE_ARGUMENTS += -DCMAKE_BUILD_TYPE=Debug
else
	EXTRA_CMAKE_ARGUMENTS += -DCMAKE_BUILD_TYPE=Release
60
	CPPFLAGS += -DNDEBUG -DG_DISABLE_CAST_CHECKS
61
62
endif

63
64
65
66
67
68
69
70
# 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

71
72
73
# 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
Alberto Garcia's avatar
Alberto Garcia committed
74
# Disable the WPE renderer if libwpebackend-fdo-1.0-dev is not available
75
else ifeq ($(shell pkg-config --exists wpebackend-fdo-1.0 && echo yes),yes)
Alberto Garcia's avatar
Alberto Garcia committed
76
77
78
79
80
	EXTRA_CMAKE_ARGUMENTS += -DUSE_WPE_RENDERER=ON
else
	EXTRA_CMAKE_ARGUMENTS += -DUSE_WPE_RENDERER=OFF
endif

81
# openjpeg2 is not in Ubuntu main yet https://launchpad.net/bugs/711061
82
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
83
	EXTRA_CMAKE_ARGUMENTS += -DUSE_OPENJPEG=OFF -DUSER_AGENT_BRANDING="Ubuntu"
84
85
86
87
endif

# gstreamer1.0-libav is not in Ubuntu "main"
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
88
	DH_GENCONTROL_ARGS += -Vgst:Suggests="gstreamer1.0-libav"
89
else
90
	DH_GENCONTROL_ARGS += -Vgst:Recommends="gstreamer1.0-libav"
91
92
endif

93
94
95
%:
	dh $@ --with gir --buildsystem=cmake+ninja --builddirectory=build

96
97
98
override_dh_gencontrol:
	dh_gencontrol -- $(DH_GENCONTROL_ARGS)

99
override_dh_auto_configure:
100
	CXXFLAGS="$(CFLAGS)" \
101
102
103
104
105
106
107
	dh_auto_configure -- \
	   -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="" \
108
	   -DENABLE_MINIBROWSER=ON \
109
110
	   $(EXTRA_CMAKE_ARGUMENTS)

Alberto Garcia's avatar
Alberto Garcia committed
111
112
113
114
115
# Create a dummy doc directory in case the "nodoc" build option is set
override_dh_install:
	mkdir -p $(CURDIR)/debian/tmp/usr/share/gtk-doc/html/webkit2gtk-4.0
	touch $(CURDIR)/debian/tmp/usr/share/gtk-doc/html/webkit2gtk-4.0/index.html
	dh_install
116
	jdupes -rl $(CURDIR)/debian/libwebkit2gtk-4.0-doc/usr
Alberto Garcia's avatar
Alberto Garcia committed
117

118
override_dh_makeshlibs:
119
120
	dh_makeshlibs -plibwebkit2gtk-4.0-37 -Xinjected-bundle
	dh_makeshlibs -plibjavascriptcoregtk-4.0-18
121

122
123
124
override_dh_missing:
	dh_missing --fail-missing

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

129
override_dh_auto_test: