1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 CMAKE_MAKEFILE_GENERATOR="ninja"
6 PYTHON_COMPAT=( python{2_7,3_5,3_6,3_7} )
7 USE_RUBY="ruby24 ruby25 ruby26"
9 inherit check-reqs cmake-utils flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs virtualx
11 MY_P="webkitgtk-${PV}"
12 DESCRIPTION="Open source web browser engine"
13 HOMEPAGE="https://www.webkitgtk.org"
14 SRC_URI="https://www.webkitgtk.org/releases/${MY_P}.tar.xz"
17 SLOT="4/37" # soname version of libwebkit2gtk-4.0
18 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~x86-macos"
20 IUSE="aqua coverage doc +egl +geolocation gles2 gnome-keyring +gstreamer +introspection +jpeg2k libnotify nsplugin +opengl spell wayland +webgl +X"
22 # webgl needs gstreamer, bug #560612
23 # gstreamer with opengl/gles2 needs egl
25 geolocation? ( introspection )
26 gles2? ( egl !opengl )
27 gstreamer? ( opengl? ( egl ) )
35 # Tests fail to link for inexplicable reasons
36 # https://bugs.webkit.org/show_bug.cgi?id=148210
39 # Aqua support in gtk3 is untested
40 # Dependencies found at Source/cmake/OptionsGTK.cmake
41 # Various compile-time optionals for gtk+-3.22.0 - ensure it
42 # Missing OpenWebRTC checks and conditionals, but ENABLE_MEDIA_STREAM/ENABLE_WEB_RTC is experimental upstream (PRIVATE OFF)
43 # >=gst-plugins-opus-1.14.4-r1 for opusparse (required by MSE)
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: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.48:2.4[introspection?]
54 >=dev-libs/libxml2-2.8.0:2
55 >=media-libs/libpng-1.4:0=
61 >=dev-libs/glib-2.40:2
62 >=dev-libs/libxslt-1.1.7
64 gnome-keyring? ( app-crypt/libsecret )
65 geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
66 introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
68 nsplugin? ( >=x11-libs/gtk+-2.24.10:2 )
69 spell? ( >=app-text/enchant-0.22:= )
71 >=media-libs/gstreamer-1.14:1.0
72 >=media-libs/gst-plugins-base-1.14:1.0[egl?,gles2?,opengl?]
73 >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
74 >=media-libs/gst-plugins-bad-1.14:1.0 )
78 x11-libs/libXcomposite
83 libnotify? ( x11-libs/libnotify )
85 jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
87 egl? ( media-libs/mesa[egl] )
88 gles2? ( media-libs/mesa[gles2] )
89 opengl? ( virtual/opengl )
91 x11-libs/libXcomposite
95 # paxctl needed for bug #407085
96 # Need real bison, not yacc
100 >=app-accessibility/at-spi2-core-2.5.3
102 >=dev-util/gtk-doc-am-1.10
103 >=dev-util/gperf-3.0.1
104 >=sys-devel/bison-2.4.3
105 || ( >=sys-devel/gcc-6.0 >=sys-devel/clang-3.3 )
110 virtual/perl-Data-Dumper
114 doc? ( >=dev-util/gtk-doc-1.10 )
115 geolocation? ( dev-util/gdbus-codegen )
118 # dev-python/pygobject:3[python_targets_python2_7]
119 # x11-themes/hicolor-icon-theme
120 # jit? ( sys-apps/paxctl ) )
122 S="${WORKDIR}/${MY_P}"
124 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
127 if [[ ${MERGE_TYPE} != "binary" ]] ; then
128 if is-flagq "-g*" && ! is-flagq "-g*0" ; then
129 einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
130 check-reqs_pkg_pretend
133 if ! test-flag-CXX -std=c++11 ; then
134 die "You need at least GCC 4.9.x or Clang >= 3.3 for C++11-specific compiler flags"
137 if tc-is-gcc && [[ $(gcc-version) < 4.9 ]] ; then
138 die 'The active compiler needs to be gcc 4.9 (or newer)'
142 if ! use opengl && ! use gles2; then
144 ewarn "You are disabling OpenGL usage (USE=opengl or USE=gles) completely."
145 ewarn "This is an unsupported configuration meant for very specific embedded"
146 ewarn "use cases, where there truly is no GL possible (and even that use case"
147 ewarn "is very unlikely to come by). If you have GL (even software-only), you"
148 ewarn "really really should be enabling OpenGL!"
154 if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
158 python-any-r1_pkg_setup
162 cmake-utils_src_prepare
167 # Respect CC, otherwise fails on prefix #395875
170 # It does not compile on alpha without this in LDFLAGS
171 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
172 use alpha && append-ldflags "-Wl,--no-relax"
174 # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
175 use ia64 && append-ldflags "-Wl,--no-as-needed"
177 # Sigbuses on SPARC with mcpu and co., bug #???
178 use sparc && filter-flags "-mvis"
180 # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
181 use ppc64 && append-flags "-mminimal-toc"
183 # Try to use less memory, bug #469942 (see Fedora .spec for reference)
184 # --no-keep-memory doesn't work on ia64, bug #502492
186 append-ldflags "-Wl,--no-keep-memory"
189 # We try to use gold when possible for this package
190 # if ! tc-ld-is-gold ; then
191 # append-ldflags "-Wl,--reduce-memory-overheads"
194 # Multiple rendering bugs on youtube, github, etc without this, bug #547224
195 append-flags $(test-flags -fno-strict-aliasing)
197 # Ruby situation is a bit complicated. See bug 513888
199 local ruby_interpreter=""
200 for rubyimpl in ${USE_RUBY}; do
201 if has_version "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
202 ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
205 # This will rarely occur. Only a couple of corner cases could lead us to
206 # that failure. See bug 513888
207 [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
209 # TODO: Check Web Audio support
210 # should somehow let user select between them?
212 # FTL_JIT requires llvm
214 # opengl needs to be explicetly handled, bug #576634
217 if use opengl || use gles2; then
224 #-DENABLE_UNIFIED_BUILDS=$(usex jumbo-build) # broken in 2.24.1
225 -DENABLE_QUARTZ_TARGET=$(usex aqua)
226 -DENABLE_API_TESTS=$(usex test)
227 -DENABLE_GTKDOC=$(usex doc)
228 -DENABLE_GEOLOCATION=$(usex geolocation)
229 $(cmake-utils_use_find_package gles2 OpenGLES2)
230 -DENABLE_GLES2=$(usex gles2)
231 -DENABLE_VIDEO=$(usex gstreamer)
232 -DENABLE_WEB_AUDIO=$(usex gstreamer)
233 -DENABLE_INTROSPECTION=$(usex introspection)
234 -DUSE_LIBNOTIFY=$(usex libnotify)
235 -DUSE_LIBSECRET=$(usex gnome-keyring)
236 -DUSE_OPENJPEG=$(usex jpeg2k)
238 -DENABLE_PLUGIN_PROCESS_GTK2=$(usex nsplugin)
239 -DENABLE_SPELLCHECK=$(usex spell)
240 -DENABLE_WAYLAND_TARGET=$(usex wayland)
241 -DENABLE_WEBGL=$(usex webgl)
242 $(cmake-utils_use_find_package egl EGL)
243 $(cmake-utils_use_find_package opengl OpenGL)
244 -DENABLE_X11_TARGET=$(usex X)
245 -DENABLE_OPENGL=${opengl_enabled}
246 -DCMAKE_BUILD_TYPE=Release
251 # Allow it to use GOLD when possible as it has all the magic to
252 # detect when to use it and using gold for this concrete package has
253 # multiple advantages and is also the upstream default, bug #585788
254 # if tc-ld-is-gold ; then
255 # mycmakeargs+=( -DUSE_LD_GOLD=ON )
257 # mycmakeargs+=( -DUSE_LD_GOLD=OFF )
260 cmake-utils_src_configure
264 cmake-utils_src_compile
268 # Prevents test failures on PaX systems
269 pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
275 cmake-utils_src_install
277 # Prevents crashes on PaX systems, bug #522808
278 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
279 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
280 use nsplugin && pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"2