webkit-gtk-2.28.3.ebuild (8754B)
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="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~x86-linux ~x86-macos"
20
21 IUSE="aqua coverage debug +egl examples +geolocation gles2-only gnome-keyring +gstreamer gtk-doc +introspection +jpeg2k +jumbo-build libnotify media-source +opengl seccomp spell 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 >=x11-libs/gtk+-3.22.0:3[aqua?,introspection?,wayland?,X?]
45 >=media-libs/harfbuzz-1.4.2:=[icu(+)]
46 >=dev-libs/icu-3.8.1-r1:=
47 virtual/jpeg:0=
48 >=net-libs/libsoup-2.54:2.4[introspection?]
49 >=dev-libs/libxml2-2.8.0:2
50 >=media-libs/libpng-1.4:0=
51 dev-db/sqlite:3=
52 sys-libs/zlib:0
53 >=dev-libs/atk-2.16.0
54 media-libs/libwebp:=
55
56 >=dev-libs/glib-2.44.0:2
57 >=dev-libs/libxslt-1.1.7
58 media-libs/woff2
59 gnome-keyring? ( app-crypt/libsecret )
60 introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
61 dev-libs/libtasn1:=
62 spell? ( >=app-text/enchant-0.22:= )
63 gstreamer? (
64 >=media-libs/gstreamer-1.14:1.0
65 >=media-libs/gst-plugins-base-1.14:1.0[egl?,opengl?,X?]
66 gles2-only? ( media-libs/gst-plugins-base:1.0[gles2] )
67 >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
68 >=media-libs/gst-plugins-bad-1.14:1.0[X?]
69 )
70
71 media-source? ( >=media-libs/gstreamer-1.16:1.0 )
72
73 X? (
74 x11-libs/libX11
75 x11-libs/libXcomposite
76 x11-libs/libXdamage
77 x11-libs/libXrender
78 x11-libs/libXt )
79
80 libnotify? ( x11-libs/libnotify )
81 dev-libs/hyphen
82 jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
83
84 egl? ( media-libs/mesa[egl] )
85 gles2-only? ( media-libs/mesa[gles2] )
86 opengl? ( virtual/opengl )
87 wpe? (
88 >=gui-libs/libwpe-1.3.0:=
89 >=gui-libs/wpebackend-fdo-1.3.1:=
90 )
91 seccomp? (
92 >=sys-apps/bubblewrap-0.3.1
93 sys-libs/libseccomp
94 sys-apps/xdg-dbus-proxy
95 )
96 "
97
98 # paxctl needed for bug #407085
99 # Need real bison, not yacc
100 DEPEND="${RDEPEND}
101 ${PYTHON_DEPS}
102 ${RUBY_DEPS}
103 dev-util/glib-utils
104 >=dev-util/gtk-doc-am-1.10
105 >=dev-util/gperf-3.0.1
106 >=sys-devel/bison-2.4.3
107 || ( >=sys-devel/gcc-7.3 >=sys-devel/clang-5 )
108 sys-devel/gettext
109 virtual/pkgconfig
110
111 >=dev-lang/perl-5.10
112 virtual/perl-Data-Dumper
113 virtual/perl-Carp
114 virtual/perl-JSON-PP
115
116 gtk-doc? ( >=dev-util/gtk-doc-1.10 )
117 geolocation? ( dev-util/gdbus-codegen )
118 sys-apps/paxctl
119
120 "
121 RDEPEND="${RDEPEND}
122 geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
123 "
124 RESTRICT="test"
125 # tests are b0rk, PYTHON_USEDEP is as well
126 # test? (
127 # dev-python/pygobject:3[${PYTHON_USEDEP}]
128 # x11-themes/hicolor-icon-theme )
129
130 S="${WORKDIR}/${MY_P}"
131
132 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
133
134 pkg_pretend() {
135 if [[ ${MERGE_TYPE} != "binary" ]] ; then
136 if is-flagq "-g*" && ! is-flagq "-g*0" ; then
137 einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
138 check-reqs_pkg_pretend
139 fi
140
141 if ! test-flag-CXX -std=c++17 ; then
142 die "You need at least GCC 7.3.x or Clang >= 5 for C++17-specific compiler flags"
143 fi
144 fi
145
146 if ! use opengl && ! use gles2-only; then
147 ewarn
148 ewarn "You are disabling OpenGL usage (USE=opengl or USE=gles2-only) completely."
149 ewarn "This is an unsupported configuration meant for very specific embedded"
150 ewarn "use cases, where there truly is no GL possible (and even that use case"
151 ewarn "is very unlikely to come by). If you have GL (even software-only), you"
152 ewarn "really really should be enabling OpenGL!"
153 ewarn
154 fi
155 }
156
157 pkg_setup() {
158 if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
159 check-reqs_pkg_setup
160 fi
161
162 python-any-r1_pkg_setup
163 }
164
165 src_prepare() {
166 cmake-utils_src_prepare
167 gnome2_src_prepare
168 }
169
170 src_configure() {
171 if use debug; then
172 CMAKE_BUILD_TYPE="Debug"
173 fi
174
175 # Respect CC, otherwise fails on prefix #395875
176 tc-export CC
177
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"
181
182 # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
183 use ia64 && append-ldflags "-Wl,--no-as-needed"
184
185 # Sigbuses on SPARC with mcpu and co., bug #???
186 use sparc && filter-flags "-mvis"
187
188 # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
189 use ppc64 && append-flags "-mminimal-toc"
190
191 # Try to use less memory, bug #469942 (see Fedora .spec for reference)
192 # --no-keep-memory doesn't work on ia64, bug #502492
193 if ! use ia64; then
194 append-ldflags "-Wl,--no-keep-memory"
195 fi
196
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"
200 # fi
201
202 # Ruby situation is a bit complicated. See bug 513888
203 local rubyimpl
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})"
208 fi
209 done
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"
213
214 # TODO: Check Web Audio support
215 # should somehow let user select between them?
216 #
217 # opengl needs to be explicetly handled, bug #576634
218
219 local opengl_enabled
220 if use opengl || use gles2-only; then
221 opengl_enabled=ON
222 else
223 opengl_enabled=OFF
224 fi
225
226 local mycmakeargs=(
227 # begin PRIVATE options
228 -DENABLE_API_TESTS=$(usex test)
229 -DSHOULD_INSTALL_JS_SHELL=$(usex examples)
230 -DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
231 -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
232 # end PRIVATE options
233 -DENABLE_WEBDRIVER=OFF
234 -DENABLE_WEB_CRYPTO=OFF
235 # -DENABLE_TOUCH_EVENTS=OFF
236 # -DENABLE_DRAG_SUPPORT=OFF
237 -DENABLE_MINIBROWSER=$(usex examples)
238 -DENABLE_QUARTZ_TARGET=$(usex aqua)
239 # Fails with ld.lld, often breaks the builds if there is compiler warnings
240 # -DENABLE_GTKDOC=$(usex gtk-doc)
241 $(cmake-utils_use_find_package gles2-only OpenGLES2)
242 -DENABLE_GLES2=$(usex gles2-only)
243 -DENABLE_VIDEO=$(usex gstreamer)
244 -DENABLE_WEB_AUDIO=$(usex gstreamer)
245 -DENABLE_INTROSPECTION=$(usex introspection)
246 -DUSE_LIBNOTIFY=$(usex libnotify)
247 -DUSE_LIBSECRET=$(usex gnome-keyring)
248 -DUSE_OPENJPEG=$(usex jpeg2k)
249 -DUSE_WOFF2=ON
250 -DENABLE_SPELLCHECK=$(usex spell)
251 -DENABLE_WAYLAND_TARGET=$(usex wayland)
252 $(cmake-utils_use_find_package egl EGL)
253 $(cmake-utils_use_find_package opengl OpenGL)
254 -DENABLE_X11_TARGET=$(usex X)
255 -DENABLE_OPENGL=${opengl_enabled}
256 -DENABLE_WEBGL=${opengl_enabled}
257 -DUSE_WPE_RENDERER=$(usex wpe)
258 -DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
259 -DENABLE_MEDIA_SOURCE=$(usex media-source)
260 -DBWRAP_EXECUTABLE="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
261 -DPORT=GTK
262 ${ruby_interpreter}
263 )
264
265 # Allow it to use GOLD when possible as it has all the magic to
266 # detect when to use it and using gold for this concrete package has
267 # multiple advantages and is also the upstream default, bug #585788
268 # if tc-ld-is-gold ; then
269 # mycmakeargs+=( -DUSE_LD_GOLD=ON )
270 # else
271 # mycmakeargs+=( -DUSE_LD_GOLD=OFF )
272 # fi
273
274 cmake-utils_src_configure
275 }
276
277 src_compile() {
278 cmake-utils_src_compile
279 }
280
281 src_test() {
282 # Prevents test failures on PaX systems
283 pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
284
285 cmake-utils_src_test
286 }
287
288 src_install() {
289 cmake-utils_src_install
290
291 # Prevents crashes on PaX systems, bug #522808
292 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
293 pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
294 }