webkit-gtk-2.24.1.ebuild (8468B)
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 CMAKE_MAKEFILE_GENERATOR="ninja"
6 PYTHON_COMPAT=( python2_7 )
7 USE_RUBY="ruby23 ruby24 ruby25 ruby26"
8
9 inherit check-reqs cmake-utils flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs virtualx
10
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"
15
16 LICENSE="LGPL-2+ BSD"
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"
19
20 IUSE="aqua coverage doc +egl examples experimental +geolocation gles2 gnome-keyring +gstreamer +introspection +jit jpeg2k +jumbo-build libnotify nsplugin +opengl spell wayland +webgl +X"
21
22 # webgl needs gstreamer, bug #560612
23 # gstreamer with opengl/gles2 needs egl
24 REQUIRED_USE="
25 geolocation? ( introspection )
26 gles2? ( egl !opengl )
27 gstreamer? ( opengl? ( egl ) )
28 nsplugin? ( X )
29 webgl? ( gstreamer
30 || ( gles2 opengl ) )
31 wayland? ( egl )
32 || ( aqua wayland X )
33 "
34
35 # Tests fail to link for inexplicable reasons
36 # https://bugs.webkit.org/show_bug.cgi?id=148210
37 RESTRICT="test"
38
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)
44 RDEPEND="
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.6.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:=
52 virtual/jpeg:0=
53 >=net-libs/libsoup-2.48:2.4[introspection?]
54 >=dev-libs/libxml2-2.8.0:2
55 >=media-libs/libpng-1.4:0=
56 dev-db/sqlite:3=
57 sys-libs/zlib:0
58 >=dev-libs/atk-2.8.0
59 media-libs/libwebp:=
60
61 >=dev-libs/glib-2.40:2
62 >=dev-libs/libxslt-1.1.7
63 media-libs/woff2
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:= )
67 dev-libs/libtasn1:=
68 >=dev-libs/libgcrypt-1.7.0:0=
69 nsplugin? ( >=x11-libs/gtk+-2.24.10:2 )
70 spell? ( >=app-text/enchant-0.22:= )
71 gstreamer? (
72 >=media-libs/gstreamer-1.14:1.0
73 >=media-libs/gst-plugins-base-1.14:1.0[egl?,gles2?,opengl?]
74 >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
75 >=media-libs/gst-plugins-bad-1.14:1.0
76 )
77
78 X? (
79 x11-libs/libX11
80 x11-libs/libXcomposite
81 x11-libs/libXdamage
82 x11-libs/libXrender
83 x11-libs/libXt
84 )
85
86 libnotify? ( x11-libs/libnotify )
87 dev-libs/hyphen
88 jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
89
90 egl? ( media-libs/mesa[egl] )
91 gles2? ( media-libs/mesa[gles2] )
92 opengl? ( virtual/opengl )
93 webgl? (
94 x11-libs/libXcomposite
95 x11-libs/libXdamage
96 )
97 "
98
99 # paxctl needed for bug #407085
100 # Need real bison, not yacc
101 DEPEND="${RDEPEND}
102 ${PYTHON_DEPS}
103 ${RUBY_DEPS}
104 >=app-accessibility/at-spi2-core-2.5.3
105 dev-util/glib-utils
106 >=dev-util/gtk-doc-am-1.10
107 >=dev-util/gperf-3.0.1
108 >=sys-devel/bison-2.4.3
109 || ( >=sys-devel/gcc-6.0 >=sys-devel/clang-3.3 )
110 sys-devel/gettext
111 virtual/pkgconfig
112
113 >=dev-lang/perl-5.10
114 virtual/perl-Data-Dumper
115 virtual/perl-Carp
116 virtual/perl-JSON-PP
117
118 doc? ( >=dev-util/gtk-doc-1.10 )
119 geolocation? ( dev-util/gdbus-codegen )
120 introspection? ( jit? ( sys-apps/paxctl ) )
121 "
122 # test? (
123 # dev-python/pygobject:3[python_targets_python2_7]
124 # x11-themes/hicolor-icon-theme
125 # jit? ( sys-apps/paxctl ) )
126
127 S="${WORKDIR}/${MY_P}"
128
129 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
130
131 pkg_pretend() {
132 if [[ ${MERGE_TYPE} != "binary" ]] ; then
133 if is-flagq "-g*" && ! is-flagq "-g*0" ; then
134 einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
135 check-reqs_pkg_pretend
136 fi
137
138 if ! test-flag-CXX -std=c++11 ; then
139 die "You need at least GCC 4.9.x or Clang >= 3.3 for C++11-specific compiler flags"
140 fi
141
142 if tc-is-gcc && [[ $(gcc-version) < 4.9 ]] ; then
143 die 'The active compiler needs to be gcc 4.9 (or newer)'
144 fi
145 fi
146 }
147
148 pkg_setup() {
149 if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
150 check-reqs_pkg_setup
151 fi
152
153 python-any-r1_pkg_setup
154 }
155
156 src_prepare() {
157 cmake-utils_src_prepare
158 gnome2_src_prepare
159 }
160
161 src_configure() {
162 # Respect CC, otherwise fails on prefix #395875
163 tc-export CC
164
165 # Arches without JIT support also need this to really disable it in all places
166 use jit || append-cppflags -DENABLE_JIT=0 -DENABLE_YARR_JIT=0 -DENABLE_ASSEMBLER=0
167
168 # It does not compile on alpha without this in LDFLAGS
169 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
170 use alpha && append-ldflags "-Wl,--no-relax"
171
172 # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
173 use ia64 && append-ldflags "-Wl,--no-as-needed"
174
175 # Sigbuses on SPARC with mcpu and co., bug #???
176 use sparc && filter-flags "-mvis"
177
178 # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
179 use ppc64 && append-flags "-mminimal-toc"
180
181 # Try to use less memory, bug #469942 (see Fedora .spec for reference)
182 # --no-keep-memory doesn't work on ia64, bug #502492
183 if ! use ia64; then
184 append-ldflags "-Wl,--no-keep-memory"
185 fi
186
187 # We try to use gold when possible for this package
188 # if ! tc-ld-is-gold ; then
189 # append-ldflags "-Wl,--reduce-memory-overheads"
190 # fi
191
192 # Multiple rendering bugs on youtube, github, etc without this, bug #547224
193 append-flags $(test-flags -fno-strict-aliasing)
194
195 # Ruby situation is a bit complicated. See bug 513888
196 local rubyimpl
197 local ruby_interpreter=""
198 for rubyimpl in ${USE_RUBY}; do
199 if has_version "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
200 ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
201 fi
202 done
203 # This will rarely occur. Only a couple of corner cases could lead us to
204 # that failure. See bug 513888
205 [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
206
207 # TODO: Check Web Audio support
208 # should somehow let user select between them?
209 #
210 # FTL_JIT requires llvm
211 #
212 # opengl needs to be explicetly handled, bug #576634
213
214 local opengl_enabled
215 if use opengl || use gles2; then
216 opengl_enabled=ON
217 else
218 opengl_enabled=OFF
219 fi
220
221 local mycmakeargs=(
222 -DUSE_SYSTEM_MALLOC=ON
223 -DENABLE_WEBDRIVER=OFF
224 -DENABLE_WEB_CRYPTO=OFF
225 -DENABLE_TOUCH_EVENTS=OFF
226 -DENABLE_DRAG_SUPPORT=OFF
227 -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
228 -DSHOULD_INSTALL_JS_SHELL=ON
229 -DENABLE_EXPERIMENTAL_FEATURES=$(usex experimental)
230 -DENABLE_MINIBROWSER=$(usex examples)
231 -DENABLE_QUARTZ_TARGET=$(usex aqua)
232 -DENABLE_API_TESTS=$(usex test)
233 -DENABLE_GTKDOC=$(usex doc)
234 -DENABLE_GEOLOCATION=$(usex geolocation)
235 $(cmake-utils_use_find_package gles2 OpenGLES2)
236 -DENABLE_GLES2=$(usex gles2)
237 -DENABLE_VIDEO=$(usex gstreamer)
238 -DENABLE_WEB_AUDIO=$(usex gstreamer)
239 -DENABLE_INTROSPECTION=$(usex introspection)
240 -DENABLE_JIT=$(usex jit)
241 -DUSE_LIBNOTIFY=$(usex libnotify)
242 -DUSE_LIBSECRET=$(usex gnome-keyring)
243 -DUSE_OPENJPEG=$(usex jpeg2k)
244 -DUSE_WOFF2=ON
245 -DENABLE_PLUGIN_PROCESS_GTK2=$(usex nsplugin)
246 -DENABLE_SPELLCHECK=$(usex spell)
247 -DENABLE_WAYLAND_TARGET=$(usex wayland)
248 -DENABLE_WEBGL=$(usex webgl)
249 $(cmake-utils_use_find_package egl EGL)
250 $(cmake-utils_use_find_package opengl OpenGL)
251 -DENABLE_X11_TARGET=$(usex X)
252 -DENABLE_OPENGL=${opengl_enabled}
253 -DCMAKE_BUILD_TYPE=Release
254 -DPORT=GTK
255 ${ruby_interpreter}
256 )
257
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 )
263 # else
264 # mycmakeargs+=( -DUSE_LD_GOLD=OFF )
265 # fi
266
267 cmake-utils_src_configure
268 }
269
270 src_compile() {
271 cmake-utils_src_compile
272 }
273
274 src_test() {
275 # Prevents test failures on PaX systems
276 use jit && pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
277
278 cmake-utils_src_test
279 }
280
281 src_install() {
282 cmake-utils_src_install
283
284 # Prevents crashes on PaX systems, bug #522808
285 use jit && 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"
287 use nsplugin && pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"2
288 }