webkit-gtk-2.29.91.ebuild (8575B)
1 # Copyright 1999-2020 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=( python{3_6,3_7} )
7 USE_RUBY="ruby24 ruby25 ruby26 ruby27"
8 CMAKE_MIN_VERSION=3.10
9
10 inherit check-reqs cmake-utils flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs virtualx
11
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"
16
17 LICENSE="LGPL-2+ BSD"
18 SLOT="4/37" # soname version of libwebkit2gtk-4.0
19 KEYWORDS=""
20
21 IUSE="aqua debug +egl examples +geolocation gles2-only gnome-keyring +gstreamer gtk4 gtk-doc +introspection +jpeg2k +jumbo-build libnotify media-source +opengl seccomp spell systemd wayland +wpe +X"
22
23 # gstreamer with opengl/gles2 needs egl
24 REQUIRED_USE="
25 geolocation? ( introspection )
26 gles2-only? ( egl !opengl )
27 gstreamer? ( opengl? ( egl ) )
28 wayland? ( egl )
29 wpe? ( opengl wayland )
30 media-source? ( gstreamer )
31 || ( aqua wayland X )
32 "
33
34 # Aqua support in gtk3 is untested
35 # Dependencies found at Source/cmake/OptionsGTK.cmake
36 # Various compile-time optionals for gtk+-3.22.0 - ensure it
37 # Missing WebRTC support, but ENABLE_MEDIA_STREAM/ENABLE_WEB_RTC is experimental upstream (PRIVATE OFF) and shouldn't be used yet in 2.26
38 # >=gst-plugins-opus-1.14.4-r1 for opusparse (required by MSE)
39 RDEPEND="
40 >=x11-libs/cairo-1.16.0:=[X?]
41 >=media-libs/fontconfig-2.13.0:1.0
42 >=media-libs/freetype-2.9.0:2
43 >=dev-libs/libgcrypt-1.7.0:0=
44 !gtk4? ( >=x11-libs/gtk+-3.22.0:3[aqua?,introspection?,wayland?,X?] )
45 gtk4? ( x11-libs/gtk+:4[aqua?,introspection?,wayland?,X?] )
46 >=media-libs/harfbuzz-1.4.2:=[icu(+)]
47 >=dev-libs/icu-3.8.1-r1:=
48 virtual/jpeg:0=
49 >=net-libs/libsoup-2.54:2.4[introspection?]
50 >=dev-libs/libxml2-2.8.0:2
51 >=media-libs/libpng-1.4:0=
52 dev-db/sqlite:3=
53 sys-libs/zlib:0
54 >=dev-libs/atk-2.16.0
55 media-libs/libwebp:=
56
57 >=dev-libs/glib-2.44.0:2
58 >=dev-libs/libxslt-1.1.7
59 media-libs/woff2
60 gnome-keyring? ( app-crypt/libsecret )
61 introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
62 dev-libs/libtasn1:=
63 spell? ( >=app-text/enchant-0.22:= )
64 gstreamer? (
65 >=media-libs/gstreamer-1.14:1.0
66 >=media-libs/gst-plugins-base-1.14:1.0[egl?,opengl?,X?]
67 gles2-only? ( media-libs/gst-plugins-base:1.0[gles2] )
68 >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
69 >=media-libs/gst-plugins-bad-1.14:1.0[X?]
70 )
71
72 media-source? ( >=media-libs/gstreamer-1.16:1.0 )
73
74 X? (
75 x11-libs/libX11
76 x11-libs/libXcomposite
77 x11-libs/libXdamage
78 x11-libs/libXrender
79 x11-libs/libXt )
80
81 libnotify? ( x11-libs/libnotify )
82 dev-libs/hyphen
83 jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
84
85 egl? ( media-libs/mesa[egl] )
86 gles2-only? ( media-libs/mesa[gles2] )
87 opengl? ( virtual/opengl )
88 wpe? (
89 >=gui-libs/libwpe-1.3.0:=
90 >=gui-libs/wpebackend-fdo-1.3.1:=
91 )
92 seccomp? (
93 >=sys-apps/bubblewrap-0.3.1
94 sys-libs/libseccomp
95 sys-apps/xdg-dbus-proxy
96 )
97 systemd? ( sys-apps/systemd:= )
98 "
99
100 # paxctl needed for bug #407085
101 # Need real bison, not yacc
102 DEPEND="${RDEPEND}
103 ${PYTHON_DEPS}
104 ${RUBY_DEPS}
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-7.3 >=sys-devel/clang-5 )
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 gtk-doc? ( >=dev-util/gtk-doc-1.10 )
119 geolocation? ( dev-util/gdbus-codegen )
120 sys-apps/paxctl
121
122 "
123 RDEPEND="${RDEPEND}
124 geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
125 "
126 RESTRICT="test"
127 # tests are b0rk, PYTHON_USEDEP is as well
128 # test? (
129 # dev-python/pygobject:3[${PYTHON_USEDEP}]
130 # x11-themes/hicolor-icon-theme )
131
132 S="${WORKDIR}/${MY_P}"
133
134 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
135
136 pkg_pretend() {
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
141 fi
142
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"
145 fi
146 fi
147
148 if ! use opengl && ! use gles2-only; then
149 ewarn
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!"
155 ewarn
156 fi
157 }
158
159 pkg_setup() {
160 if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
161 check-reqs_pkg_setup
162 fi
163
164 python-any-r1_pkg_setup
165 }
166
167 src_prepare() {
168 cmake-utils_src_prepare
169 gnome2_src_prepare
170 }
171
172 src_configure() {
173 if use debug; then
174 CMAKE_BUILD_TYPE="Debug"
175 fi
176
177 # gtk-doc fails to generate docs when ld.lld is used, force binutils
178 if use gtk-doc; then
179 export CC_LD="ld"
180 export LD="ld"
181 fi
182
183 # Respect CC, otherwise fails on prefix #395875
184 tc-export CC
185
186 # It does not compile on alpha without this in LDFLAGS
187 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
188 use alpha && append-ldflags "-Wl,--no-relax"
189
190 # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
191 use ia64 && append-ldflags "-Wl,--no-as-needed"
192
193 # Sigbuses on SPARC with mcpu and co., bug #???
194 use sparc && filter-flags "-mvis"
195
196 # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
197 use ppc64 && append-flags "-mminimal-toc"
198
199 # Try to use less memory, bug #469942 (see Fedora .spec for reference)
200 # --no-keep-memory doesn't work on ia64, bug #502492
201 if ! use ia64; then
202 append-ldflags "-Wl,--no-keep-memory"
203 fi
204
205 # We try to use gold when possible for this package
206 # if ! tc-ld-is-gold ; then
207 # append-ldflags "-Wl,--reduce-memory-overheads"
208 # fi
209
210 # Ruby situation is a bit complicated. See bug 513888
211 local rubyimpl
212 local ruby_interpreter=""
213 for rubyimpl in ${USE_RUBY}; do
214 if has_version --host-root "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
215 ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
216 fi
217 done
218 # This will rarely occur. Only a couple of corner cases could lead us to
219 # that failure. See bug 513888
220 [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
221
222 # TODO: Check Web Audio support
223 # should somehow let user select between them?
224 #
225 # opengl needs to be explicetly handled, bug #576634
226
227 local opengl_enabled
228 if use opengl || use gles2-only; then
229 opengl_enabled=ON
230 else
231 opengl_enabled=OFF
232 fi
233
234 local mycmakeargs=(
235 # begin PRIVATE options
236 -DENABLE_API_TESTS=$(usex test)
237 -DSHOULD_INSTALL_JS_SHELL=$(usex examples)
238 -DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
239 -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
240 # end PRIVATE options
241 -DUSE_SYSTEMD=$(usex systemd)
242 -DUSE_GTK4=$(usex gtk4)
243 -DENABLE_WEBDRIVER=OFF
244 -DENABLE_WEB_CRYPTO=OFF
245 # -DENABLE_TOUCH_EVENTS=OFF
246 # -DENABLE_DRAG_SUPPORT=OFF
247 -DENABLE_MINIBROWSER=$(usex examples)
248 -DENABLE_QUARTZ_TARGET=$(usex aqua)
249 -DENABLE_GTKDOC=$(usex gtk-doc)
250 $(cmake-utils_use_find_package gles2-only OpenGLES2)
251 -DENABLE_GLES2=$(usex gles2-only)
252 -DENABLE_VIDEO=$(usex gstreamer)
253 -DENABLE_WEB_AUDIO=$(usex gstreamer)
254 -DENABLE_INTROSPECTION=$(usex introspection)
255 -DUSE_LIBNOTIFY=$(usex libnotify)
256 -DUSE_LIBSECRET=$(usex gnome-keyring)
257 -DUSE_OPENJPEG=$(usex jpeg2k)
258 -DUSE_WOFF2=ON
259 -DENABLE_SPELLCHECK=$(usex spell)
260 -DENABLE_WAYLAND_TARGET=$(usex wayland)
261 $(cmake-utils_use_find_package egl EGL)
262 $(cmake-utils_use_find_package opengl OpenGL)
263 -DENABLE_X11_TARGET=$(usex X)
264 -DENABLE_OPENGL=${opengl_enabled}
265 -DENABLE_WEBGL=${opengl_enabled}
266 -DUSE_WPE_RENDERER=$(usex wpe)
267 -DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
268 -DENABLE_MEDIA_SOURCE=$(usex media-source)
269 -DBWRAP_EXECUTABLE="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
270 -DUSE_LD_GOLD=ON
271 -DPORT=GTK
272 ${ruby_interpreter}
273 )
274
275 cmake-utils_src_configure
276 }
277
278 src_compile() {
279 cmake-utils_src_compile
280 }
281
282 src_test() {
283 # Prevents test failures on PaX systems
284 pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
285
286 cmake-utils_src_test
287 }
288
289 src_install() {
290 cmake-utils_src_install
291
292 # Prevents crashes on PaX systems, bug #522808
293 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
294 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
295 }