1*edff4923SAndrew GeisslerSUMMARY = "WebKit web rendering engine for the GTK+ platform"
2*edff4923SAndrew GeisslerHOMEPAGE = "https://www.webkitgtk.org/"
3*edff4923SAndrew GeisslerBUGTRACKER = "https://bugs.webkit.org/"
4*edff4923SAndrew Geissler
5*edff4923SAndrew GeisslerLICENSE = "BSD-2-Clause & LGPL-2.0-or-later"
6*edff4923SAndrew GeisslerLIC_FILES_CHKSUM = "file://Source/JavaScriptCore/COPYING.LIB;md5=d0c6d6397a5d84286dda758da57bd691 \
7*edff4923SAndrew Geissler                    file://Source/WebCore/LICENSE-APPLE;md5=4646f90082c40bcf298c285f8bab0b12 \
8*edff4923SAndrew Geissler                    file://Source/WebCore/LICENSE-LGPL-2;md5=36357ffde2b64ae177b2494445b79d21 \
9*edff4923SAndrew Geissler                    file://Source/WebCore/LICENSE-LGPL-2.1;md5=a778a33ef338abbaf8b8a7c36b6eec80 \
10*edff4923SAndrew Geissler                    "
11*edff4923SAndrew Geissler
12*edff4923SAndrew GeisslerSRC_URI = "https://www.webkitgtk.org/releases/webkitgtk-${PV}.tar.xz \
13*edff4923SAndrew Geissler           file://0001-FindGObjectIntrospection.cmake-prefix-variables-obta.patch \
14*edff4923SAndrew Geissler           file://reproducibility.patch \
15*edff4923SAndrew Geissler           file://no-musttail-arm.patch \
16*edff4923SAndrew Geissler           file://0001-LowLevelInterpreter.cpp-339-21-error-t6-was-not-decl.patch \
17*edff4923SAndrew Geissler           file://30e1d5e22213fdaca2a29ec3400c927d710a37a8.patch \
18*edff4923SAndrew Geissler           "
19*edff4923SAndrew GeisslerSRC_URI[sha256sum] = "523f42c8ff24832add17631f6eaafe8f9303afe316ef1a7e1844b952a7f7521b"
20*edff4923SAndrew Geissler
21*edff4923SAndrew Geisslerinherit cmake pkgconfig gobject-introspection perlnative features_check upstream-version-is-even gi-docgen
22*edff4923SAndrew Geissler
23*edff4923SAndrew GeisslerS = "${WORKDIR}/webkitgtk-${PV}"
24*edff4923SAndrew Geissler
25*edff4923SAndrew GeisslerANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}"
26*edff4923SAndrew GeisslerREQUIRED_DISTRO_FEATURES = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'opengl', '', d)}"
27*edff4923SAndrew Geissler
28*edff4923SAndrew GeisslerCVE_PRODUCT = "webkitgtk webkitgtk\+"
29*edff4923SAndrew Geissler
30*edff4923SAndrew GeisslerDEPENDS += " \
31*edff4923SAndrew Geissler          ruby-native \
32*edff4923SAndrew Geissler          gperf-native \
33*edff4923SAndrew Geissler          unifdef-native \
34*edff4923SAndrew Geissler          cairo \
35*edff4923SAndrew Geissler          harfbuzz \
36*edff4923SAndrew Geissler          jpeg \
37*edff4923SAndrew Geissler          atk \
38*edff4923SAndrew Geissler          libwebp \
39*edff4923SAndrew Geissler          gtk+3 \
40*edff4923SAndrew Geissler          libxslt \
41*edff4923SAndrew Geissler          libtasn1 \
42*edff4923SAndrew Geissler          libnotify \
43*edff4923SAndrew Geissler          gstreamer1.0 \
44*edff4923SAndrew Geissler          gstreamer1.0-plugins-base \
45*edff4923SAndrew Geissler          glib-2.0-native \
46*edff4923SAndrew Geissler          gettext-native \
47*edff4923SAndrew Geissler          "
48*edff4923SAndrew Geissler
49*edff4923SAndrew GeisslerPACKAGECONFIG_SOUP ?= "soup3"
50*edff4923SAndrew GeisslerPACKAGECONFIG ??= " \
51*edff4923SAndrew Geissler	   ${@bb.utils.filter('DISTRO_FEATURES', 'systemd wayland x11', d)} \
52*edff4923SAndrew Geissler	   ${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'webgl opengl', '', d)} \
53*edff4923SAndrew Geissler	   ${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', 'webgl gles2', d)} \
54*edff4923SAndrew Geissler	   ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'opengl-or-es', '', d)} \
55*edff4923SAndrew Geissler	   enchant \
56*edff4923SAndrew Geissler	   libsecret \
57*edff4923SAndrew Geissler	   ${PACKAGECONFIG_SOUP} \
58*edff4923SAndrew Geissler	   "
59*edff4923SAndrew Geissler
60*edff4923SAndrew GeisslerPACKAGECONFIG[wayland] = "-DENABLE_WAYLAND_TARGET=ON,-DENABLE_WAYLAND_TARGET=OFF,wayland libwpe wpebackend-fdo wayland-native"
61*edff4923SAndrew GeisslerPACKAGECONFIG[angle] = "-DUSE_ANGLE_WEBGL=ON,-DUSE_ANGLE_WEBGL=OFF"
62*edff4923SAndrew GeisslerPACKAGECONFIG[x11] = "-DENABLE_X11_TARGET=ON,-DENABLE_X11_TARGET=OFF,virtual/libx11 libxcomposite libxdamage libxrender libxt"
63*edff4923SAndrew GeisslerPACKAGECONFIG[geoclue] = "-DENABLE_GEOLOCATION=ON,-DENABLE_GEOLOCATION=OFF,geoclue"
64*edff4923SAndrew GeisslerPACKAGECONFIG[enchant] = "-DENABLE_SPELLCHECK=ON,-DENABLE_SPELLCHECK=OFF,enchant2"
65*edff4923SAndrew GeisslerPACKAGECONFIG[gles2] = "-DENABLE_GLES2=ON,-DENABLE_GLES2=OFF,virtual/libgles2"
66*edff4923SAndrew GeisslerPACKAGECONFIG[jpegxl] = " -DUSE_JPEGXL=ON,-DUSE_JPEGXL=OFF,libjxl"
67*edff4923SAndrew GeisslerPACKAGECONFIG[webgl] = "-DENABLE_WEBGL=ON,-DENABLE_WEBGL=OFF,virtual/egl"
68*edff4923SAndrew GeisslerPACKAGECONFIG[opengl] = "-DENABLE_GRAPHICS_CONTEXT_GL=ON,-DENABLE_GRAPHICS_CONTEXT_GL=OFF,virtual/egl"
69*edff4923SAndrew GeisslerPACKAGECONFIG[opengl-or-es] = "-DUSE_OPENGL_OR_ES=ON,-DUSE_OPENGL_OR_ES=OFF"
70*edff4923SAndrew GeisslerPACKAGECONFIG[libsecret] = "-DUSE_LIBSECRET=ON,-DUSE_LIBSECRET=OFF,libsecret"
71*edff4923SAndrew GeisslerPACKAGECONFIG[libhyphen] = "-DUSE_LIBHYPHEN=ON,-DUSE_LIBHYPHEN=OFF,libhyphen"
72*edff4923SAndrew GeisslerPACKAGECONFIG[woff2] = "-DUSE_WOFF2=ON,-DUSE_WOFF2=OFF,woff2"
73*edff4923SAndrew GeisslerPACKAGECONFIG[openjpeg] = "-DUSE_OPENJPEG=ON,-DUSE_OPENJPEG=OFF,openjpeg"
74*edff4923SAndrew GeisslerPACKAGECONFIG[systemd] = "-DUSE_SYSTEMD=ON,-DUSE_SYSTEMD=off,systemd"
75*edff4923SAndrew GeisslerPACKAGECONFIG[reduce-size] = "-DCMAKE_BUILD_TYPE=MinSizeRel,-DCMAKE_BUILD_TYPE=Release,,"
76*edff4923SAndrew GeisslerPACKAGECONFIG[lcms] = "-DUSE_LCMS=ON,-DUSE_LCMS=OFF,lcms"
77*edff4923SAndrew GeisslerPACKAGECONFIG[soup2] = "-DUSE_SOUP2=ON,-DUSE_SOUP2=OFF,libsoup-2.4,,,soup3"
78*edff4923SAndrew GeisslerPACKAGECONFIG[soup3] = ",,libsoup,,,soup2"
79*edff4923SAndrew GeisslerPACKAGECONFIG[journald] = "-DENABLE_JOURNALD_LOG=ON,-DENABLE_JOURNALD_LOG=OFF,systemd"
80*edff4923SAndrew GeisslerPACKAGECONFIG[avif] = "-DUSE_AVIF_LOG=ON,-DUSE_AVIF=OFF,libavif"
81*edff4923SAndrew GeisslerPACKAGECONFIG[media-recorder] = "-DENABLE_MEDIA_RECORDER=ON,-DENABLE_MEDIA_RECORDER=OFF,gstreamer1.0-plugins-bad"
82*edff4923SAndrew GeisslerPACKAGECONFIG[gamepad] = "-DENABLE_GAMEPAD=ON,-DENABLE_GAMEPAD=OFF,libmanette"
83*edff4923SAndrew GeisslerPACKAGECONFIG[webrtc] = "-DENABLE_WEB_RTC=ON,-DENABLE_WEB_RTC=OFF"
84*edff4923SAndrew GeisslerPACKAGECONFIG[bubblewrap] = "-DENABLE_BUBBLEWRAP_SANDBOX=ON -DBWRAP_EXECUTABLE=${bindir}/bwrap -DDBUS_PROXY_EXECUTABLE=${bindir}/xdg-dbus-proxy,-DENABLE_BUBBLEWRAP_SANDBOX=OFF,,bubblewrap xdg-dbus-proxy"
85*edff4923SAndrew GeisslerPACKAGECONFIG[backtrace] = "-DUSE_LIBBACKTRACE=ON,-DUSE_LIBBACKTRACE=OFF,libbacktrace"
86*edff4923SAndrew Geissler
87*edff4923SAndrew GeisslerEXTRA_OECMAKE = " \
88*edff4923SAndrew Geissler	-DPORT=GTK \
89*edff4923SAndrew Geissler	-DUSE_GTK4=OFF \
90*edff4923SAndrew Geissler	${@bb.utils.contains('GI_DATA_ENABLED', 'True', '-DENABLE_INTROSPECTION=ON', '-DENABLE_INTROSPECTION=OFF', d)} \
91*edff4923SAndrew Geissler	${@bb.utils.contains('GIDOCGEN_ENABLED', 'True', '-DENABLE_DOCUMENTATION=ON', '-DENABLE_DOCUMENTATION=OFF', d)} \
92*edff4923SAndrew Geissler	-DENABLE_MINIBROWSER=ON \
93*edff4923SAndrew Geissler	-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF \
94*edff4923SAndrew Geissler		"
95*edff4923SAndrew Geissler# Unless DEBUG_BUILD is enabled, pass -g1 to massively reduce the size of the
96*edff4923SAndrew Geissler# debug symbols (4.3GB to 700M at time of writing)
97*edff4923SAndrew GeisslerDEBUG_FLAGS:append = "${@oe.utils.vartrue('DEBUG_BUILD', '', ' -g1', d)}"
98*edff4923SAndrew Geissler
99*edff4923SAndrew Geissler# Javascript JIT is not supported on ARC
100*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:arc = " -DENABLE_JIT=OFF "
101*edff4923SAndrew Geissler# By default 25-bit "medium" calls are used on ARC
102*edff4923SAndrew Geissler# which is not enough for binaries larger than 32 MiB
103*edff4923SAndrew GeisslerCFLAGS:append:arc = " -mlong-calls"
104*edff4923SAndrew GeisslerCXXFLAGS:append:arc = " -mlong-calls"
105*edff4923SAndrew Geissler
106*edff4923SAndrew Geissler# Needed for non-mesa graphics stacks when x11 is disabled
107*edff4923SAndrew GeisslerCXXFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', '', '-DEGL_NO_X11=1', d)}"
108*edff4923SAndrew Geissler
109*edff4923SAndrew Geissler# Javascript JIT is not supported on powerpc
110*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:powerpc = " -DENABLE_JIT=OFF "
111*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:powerpc64 = " -DENABLE_JIT=OFF "
112*edff4923SAndrew Geissler
113*edff4923SAndrew Geissler# ARM JIT code does not build on ARMv4/5/6 anymore
114*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv4 = " -DENABLE_JIT=OFF "
115*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv5 = " -DENABLE_JIT=OFF "
116*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv6 = " -DENABLE_JIT=OFF "
117*edff4923SAndrew Geissler
118*edff4923SAndrew Geissler# And for armv7* don't enable it for softfp, because after:
119*edff4923SAndrew Geissler# https://github.com/WebKit/WebKit/commit/a2ec4ef1997d6fafa6ffc607bffb54e76168a918
120*edff4923SAndrew Geissler# https://bugs.webkit.org/show_bug.cgi?id=242172
121*edff4923SAndrew Geissler# softfp armv7* fails because WEBASSEMBLY is left enabled by default and JIT gets
122*edff4923SAndrew Geissler# explicitly disabled causing:
123*edff4923SAndrew Geissler# http://errors.yoctoproject.org/Errors/Details/734587/
124*edff4923SAndrew Geissler# PR was sent upstream, but the end result is the same both JIT and WEBASSEMBLY disabled
125*edff4923SAndrew Geissler# https://github.com/WebKit/WebKit/pull/17447
126*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv7a = " -DENABLE_JIT=${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'ON', 'OFF', d)}"
127*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv7r = " -DENABLE_JIT=${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'ON', 'OFF', d)}"
128*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:armv7ve = " -DENABLE_JIT=${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'ON', 'OFF', d)}"
129*edff4923SAndrew Geissler
130*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:mipsarch = " -DUSE_LD_GOLD=OFF "
131*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:powerpc = " -DUSE_LD_GOLD=OFF "
132*edff4923SAndrew Geissler
133*edff4923SAndrew Geissler# JIT and gold linker does not work on RISCV
134*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:riscv32 = " -DUSE_LD_GOLD=OFF -DENABLE_JIT=OFF"
135*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:riscv64 = " -DUSE_LD_GOLD=OFF"
136*edff4923SAndrew Geissler
137*edff4923SAndrew Geissler# JIT not supported on MIPS either
138*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:mipsarch = " -DENABLE_JIT=OFF -DENABLE_C_LOOP=ON "
139*edff4923SAndrew Geissler
140*edff4923SAndrew Geissler# JIT not supported on X32
141*edff4923SAndrew Geissler# An attempt was made to upstream JIT support for x32 in
142*edff4923SAndrew Geissler# https://bugs.webkit.org/show_bug.cgi?id=100450, but this was closed as
143*edff4923SAndrew Geissler# unresolved due to limited X32 adoption.
144*edff4923SAndrew GeisslerEXTRA_OECMAKE:append:x86-x32 = " -DENABLE_JIT=OFF "
145*edff4923SAndrew Geissler
146*edff4923SAndrew GeisslerSECURITY_CFLAGS:remove:aarch64 = "-fpie"
147*edff4923SAndrew GeisslerSECURITY_CFLAGS:append:aarch64 = " -fPIE"
148*edff4923SAndrew Geissler
149*edff4923SAndrew GeisslerFILES:${PN} += "${libdir}/webkit2gtk-4.*/injected-bundle/libwebkit2gtkinjectedbundle.so"
150*edff4923SAndrew Geissler
151*edff4923SAndrew GeisslerRRECOMMENDS:${PN} += "ca-certificates shared-mime-info"
152*edff4923SAndrew Geissler
153*edff4923SAndrew Geissler# http://errors.yoctoproject.org/Errors/Details/20370/
154*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv4 = "arm"
155*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv5 = "arm"
156*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv6 = "arm"
157*edff4923SAndrew Geissler
158*edff4923SAndrew Geissler# https://bugzilla.yoctoproject.org/show_bug.cgi?id=9474
159*edff4923SAndrew Geissler# https://bugs.webkit.org/show_bug.cgi?id=159880
160*edff4923SAndrew Geissler# JSC JIT can build on ARMv7 with -marm, but doesn't work on runtime.
161*edff4923SAndrew Geissler# Upstream only tests regularly the JSC JIT on ARMv7 with Thumb2 (-mthumb).
162*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv7a = "thumb"
163*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv7r = "thumb"
164*edff4923SAndrew GeisslerARM_INSTRUCTION_SET:armv7ve = "thumb"
165*edff4923SAndrew Geissler
166*edff4923SAndrew Geissler# ANGLE requires SSE support as of webkit 2.40.x on 32 bit x86
167*edff4923SAndrew GeisslerCOMPATIBLE_HOST:x86 = "${@bb.utils.contains_any('TUNE_FEATURES', 'core2 corei7', '.*', 'null', d)}"
168*edff4923SAndrew Geissler
169*edff4923SAndrew Geissler# introspection inside qemu-arm hangs forever on musl/arm builds
170*edff4923SAndrew Geissler# therefore disable GI_DATA
171*edff4923SAndrew GeisslerGI_DATA_ENABLED:libc-musl:armv7a = "False"
172*edff4923SAndrew GeisslerGI_DATA_ENABLED:libc-musl:armv7ve = "False"
173*edff4923SAndrew Geissler
174*edff4923SAndrew Geisslerdo_install:append() {
175*edff4923SAndrew Geissler	mv ${D}${bindir}/WebKitWebDriver ${D}${bindir}/WebKitWebDriver3
176*edff4923SAndrew Geissler}
177*edff4923SAndrew Geissler
178*edff4923SAndrew GeisslerPACKAGE_PREPROCESS_FUNCS += "src_package_preprocess"
179*edff4923SAndrew Geisslersrc_package_preprocess () {
180*edff4923SAndrew Geissler        # Trim build paths from comments in generated sources to ensure reproducibility
181*edff4923SAndrew Geissler        sed -i -e "s,${WORKDIR},,g" \
182*edff4923SAndrew Geissler            ${B}/JavaScriptCore/DerivedSources/*.h \
183*edff4923SAndrew Geissler            ${B}/JavaScriptCore/DerivedSources/yarr/*.h \
184*edff4923SAndrew Geissler            ${B}/JavaScriptCore/PrivateHeaders/JavaScriptCore/*.h \
185*edff4923SAndrew Geissler            ${B}/WebCore/DerivedSources/*.cpp \
186*edff4923SAndrew Geissler            ${B}/WebKitGTK/DerivedSources/webkit/*.cpp
187*edff4923SAndrew Geissler}
188*edff4923SAndrew Geissler
189