1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 CMAKE_MAKEFILE_GENERATOR="ninja"
6 PYTHON_COMPAT=( python{3_6,3_7} )
7 USE_RUBY="ruby24 ruby25 ruby26 ruby27"
10 inherit check-reqs cmake-utils flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs virtualx
12 MY_P="webkitgtk-${PV}"
13 DESCRIPTION="Open source web browser engine"
14 HOMEPAGE="https://www.webkitgtk.org"
15 SRC_URI="https://www.webkitgtk.org/releases/${MY_P}.tar.xz"
18 SLOT="4/37" # soname version of libwebkit2gtk-4.0
19 KEYWORDS="~amd64 ~arm64 ~ppc64 ~sparc ~x86"
21 IUSE="aqua coverage +egl +geolocation gles2-only gnome-keyring +gstreamer gtk-doc +introspection +jpeg2k +jumbo-build libnotify +opengl seccomp spell wayland +X"
23 # gstreamer with opengl/gles2 needs egl
25 gles2-only? ( egl !opengl )
26 gstreamer? ( opengl? ( egl ) )
31 # Tests fail to link for inexplicable reasons
32 # https://bugs.webkit.org/show_bug.cgi?id=148210
35 # Aqua support in gtk3 is untested
36 # Dependencies found at Source/cmake/OptionsGTK.cmake
37 # Various compile-time optionals for gtk+-3.22.0 - ensure it
38 # Missing WebRTC support, but ENABLE_MEDIA_STREAM/ENABLE_WEB_RTC is experimental upstream (PRIVATE OFF) and shouldn't be used yet in 2.26
39 # >=gst-plugins-opus-1.14.4-r1 for opusparse (required by MSE)
41 >=gui-libs/libwpe-1.3.0:1.0
42 >=gui-libs/wpebackend-fdo-1.3.1:1.0
45 >=x11-libs/cairo-1.16.0:=[X?]
46 >=media-libs/fontconfig-2.13.0:1.0
47 >=media-libs/freetype-2.9.0:2
48 >=dev-libs/libgcrypt-1.7.0:0=
49 >=x11-libs/gtk+-3.22.0:3[aqua?,introspection?,wayland?,X?]
50 >=media-libs/harfbuzz-1.4.2:=[icu(+)]
51 >=dev-libs/icu-3.8.1-r1:=
53 >=net-libs/libsoup-2.54:2.4[introspection?]
54 >=dev-libs/libxml2-2.8.0:2
55 >=media-libs/libpng-1.4:0=
61 >=dev-libs/glib-2.44.0:2
62 >=dev-libs/libxslt-1.1.7
64 gnome-keyring? ( app-crypt/libsecret )
65 introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
67 spell? ( >=app-text/enchant-0.22:2 )
69 >=media-libs/gstreamer-1.14:1.0
70 >=media-libs/gst-plugins-base-1.14:1.0[egl?,opengl?]
71 gles2-only? ( media-libs/gst-plugins-base:1.0[gles2] )
72 >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
73 >=media-libs/gst-plugins-bad-1.14:1.0 )
77 x11-libs/libXcomposite
82 libnotify? ( x11-libs/libnotify )
84 jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
86 egl? ( media-libs/mesa[egl] )
87 gles2-only? ( media-libs/mesa[gles2] )
88 opengl? ( virtual/opengl )
91 >=dev-libs/wayland-protocols-1.12
92 opengl? ( ${wpe_depend} )
93 gles2-only? ( ${wpe_depend} )
97 >=sys-apps/bubblewrap-0.3.1
99 sys-apps/xdg-dbus-proxy
103 # paxctl needed for bug #407085
104 # Need real bison, not yacc
108 >=app-accessibility/at-spi2-core-2.5.3
110 >=dev-util/gperf-3.0.1
111 >=sys-devel/bison-2.4.3
112 || ( >=sys-devel/gcc-7.3 >=sys-devel/clang-5 )
117 virtual/perl-Data-Dumper
121 gtk-doc? ( >=dev-util/gtk-doc-1.10 )
122 geolocation? ( dev-util/gdbus-codegen )
125 # dev-python/pygobject:3[python_targets_python2_7]
126 # x11-themes/hicolor-icon-theme
127 # jit? ( sys-apps/paxctl ) )
129 geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
132 S="${WORKDIR}/${MY_P}"
134 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
137 if [[ ${MERGE_TYPE} != "binary" ]] ; then
138 if is-flagq "-g*" && ! is-flagq "-g*0" ; then
139 einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
140 check-reqs_pkg_pretend
143 if ! test-flag-CXX -std=c++17 ; then
144 die "You need at least GCC 7.3.x or Clang >= 5 for C++17-specific compiler flags"
148 if ! use opengl && ! use gles2-only; then
150 ewarn "You are disabling OpenGL usage (USE=opengl or USE=gles2-only) completely."
151 ewarn "This is an unsupported configuration meant for very specific embedded"
152 ewarn "use cases, where there truly is no GL possible (and even that use case"
153 ewarn "is very unlikely to come by). If you have GL (even software-only), you"
154 ewarn "really really should be enabling OpenGL!"
160 if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
164 python-any-r1_pkg_setup
168 eapply "${FILESDIR}/${PN}-2.24.4-eglmesaext-include.patch" # bug 699054 # https://bugs.webkit.org/show_bug.cgi?id=204108
169 eapply "${FILESDIR}"/2.26.3-fix-gtk-doc.patch # bug 704550 - retest without it once we can depend on >=gtk-doc-1.32
170 cmake-utils_src_prepare
175 # Respect CC, otherwise fails on prefix #395875
178 # It does not compile on alpha without this in LDFLAGS
179 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
180 use alpha && append-ldflags "-Wl,--no-relax"
182 # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
183 use ia64 && append-ldflags "-Wl,--no-as-needed"
185 # Sigbuses on SPARC with mcpu and co., bug #???
186 use sparc && filter-flags "-mvis"
188 # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
189 use ppc64 && append-flags "-mminimal-toc"
191 # Try to use less memory, bug #469942 (see Fedora .spec for reference)
192 # --no-keep-memory doesn't work on ia64, bug #502492
194 append-ldflags "-Wl,--no-keep-memory"
197 # We try to use gold when possible for this package
198 # if ! tc-ld-is-gold ; then
199 # append-ldflags "-Wl,--reduce-memory-overheads"
202 # Ruby situation is a bit complicated. See bug 513888
204 local ruby_interpreter=""
205 for rubyimpl in ${USE_RUBY}; do
206 if has_version --host-root "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
207 ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
210 # This will rarely occur. Only a couple of corner cases could lead us to
211 # that failure. See bug 513888
212 [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
214 # TODO: Check Web Audio support
215 # should somehow let user select between them?
217 # opengl needs to be explicetly handled, bug #576634
219 local use_wpe_renderer=OFF
221 if use opengl || use gles2-only; then
223 use wayland && use_wpe_renderer=ON
229 -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
230 -DENABLE_QUARTZ_TARGET=$(usex aqua)
231 -DENABLE_API_TESTS=$(usex test)
232 -DENABLE_GTKDOC=$(usex gtk-doc)
233 -DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
234 $(cmake-utils_use_find_package gles2-only OpenGLES2)
235 -DENABLE_GLES2=$(usex gles2-only)
236 -DENABLE_VIDEO=$(usex gstreamer)
237 -DENABLE_WEB_AUDIO=$(usex gstreamer)
238 -DENABLE_INTROSPECTION=$(usex introspection)
239 -DUSE_LIBNOTIFY=$(usex libnotify)
240 -DUSE_LIBSECRET=$(usex gnome-keyring)
241 -DUSE_OPENJPEG=$(usex jpeg2k)
243 -DENABLE_SPELLCHECK=$(usex spell)
244 -DENABLE_WAYLAND_TARGET=$(usex wayland)
245 -DUSE_WPE_RENDERER=${use_wpe_renderer} # WPE renderer is used to implement accelerated compositing under wayland
246 $(cmake-utils_use_find_package egl EGL)
247 $(cmake-utils_use_find_package opengl OpenGL)
248 -DENABLE_X11_TARGET=$(usex X)
249 -DENABLE_OPENGL=${opengl_enabled}
250 -DENABLE_WEBGL=${opengl_enabled}
251 -DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
252 -DBWRAP_EXECUTABLE="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
253 -DCMAKE_BUILD_TYPE=Release
258 # Allow it to use GOLD when possible as it has all the magic to
259 # detect when to use it and using gold for this concrete package has
260 # multiple advantages and is also the upstream default, bug #585788
261 # if tc-ld-is-gold ; then
262 # mycmakeargs+=( -DUSE_LD_GOLD=ON )
264 # mycmakeargs+=( -DUSE_LD_GOLD=OFF )
267 cmake-utils_src_configure
271 cmake-utils_src_compile
275 # Prevents test failures on PaX systems
276 pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
282 cmake-utils_src_install
284 # Prevents crashes on PaX systems, bug #522808
285 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
286 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"