net-libs/libwebsockets: update version to 4.0.4
[gentoo.git] / net-libs / webkit-gtk / webkit-gtk-2.28.1.ebuild
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="~amd64 ~arm64 ~ppc64 ~sparc ~x86"
20
21 IUSE="aqua coverage +egl +geolocation gles2-only gnome-keyring +gstreamer gtk-doc +introspection +jpeg2k +jumbo-build libnotify +opengl seccomp spell wayland +X"
22
23 # gstreamer with opengl/gles2 needs egl
24 REQUIRED_USE="
25         gles2-only? ( egl !opengl )
26         gstreamer? ( opengl? ( egl ) )
27         wayland? ( egl )
28         || ( aqua wayland X )
29 "
30
31 # Tests fail to link for inexplicable reasons
32 # https://bugs.webkit.org/show_bug.cgi?id=148210
33 RESTRICT="test"
34
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)
40 wpe_depend="
41         >=gui-libs/libwpe-1.3.0:1.0
42         >=gui-libs/wpebackend-fdo-1.3.1:1.0
43 "
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.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:=
52         virtual/jpeg:0=
53         >=net-libs/libsoup-2.54: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.16.0
59         media-libs/libwebp:=
60
61         >=dev-libs/glib-2.44.0:2
62         >=dev-libs/libxslt-1.1.7
63         media-libs/woff2
64         gnome-keyring? ( app-crypt/libsecret )
65         introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
66         dev-libs/libtasn1:=
67         spell? ( >=app-text/enchant-0.22:2 )
68         gstreamer? (
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 )
74
75         X? (
76                 x11-libs/libX11
77                 x11-libs/libXcomposite
78                 x11-libs/libXdamage
79                 x11-libs/libXrender
80                 x11-libs/libXt )
81
82         libnotify? ( x11-libs/libnotify )
83         dev-libs/hyphen
84         jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
85
86         egl? ( media-libs/mesa[egl] )
87         gles2-only? ( media-libs/mesa[gles2] )
88         opengl? ( virtual/opengl )
89         wayland? (
90                 dev-libs/wayland
91                 >=dev-libs/wayland-protocols-1.12
92                 opengl? ( ${wpe_depend} )
93                 gles2-only? ( ${wpe_depend} )
94         )
95
96         seccomp? (
97                 >=sys-apps/bubblewrap-0.3.1
98                 sys-libs/libseccomp
99                 sys-apps/xdg-dbus-proxy
100         )
101 "
102 unset wpe_depend
103 # paxctl needed for bug #407085
104 # Need real bison, not yacc
105 DEPEND="${RDEPEND}
106         ${PYTHON_DEPS}
107         ${RUBY_DEPS}
108         >=app-accessibility/at-spi2-core-2.5.3
109         dev-util/glib-utils
110         >=dev-util/gperf-3.0.1
111         >=sys-devel/bison-2.4.3
112         || ( >=sys-devel/gcc-7.3 >=sys-devel/clang-5 )
113         sys-devel/gettext
114         virtual/pkgconfig
115
116         >=dev-lang/perl-5.10
117         virtual/perl-Data-Dumper
118         virtual/perl-Carp
119         virtual/perl-JSON-PP
120
121         gtk-doc? ( >=dev-util/gtk-doc-1.10 )
122         geolocation? ( dev-util/gdbus-codegen )
123 "
124 #       test? (
125 #               dev-python/pygobject:3[python_targets_python2_7]
126 #               x11-themes/hicolor-icon-theme
127 #               jit? ( sys-apps/paxctl ) )
128 RDEPEND="${RDEPEND}
129         geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
130 "
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         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
171         gnome2_src_prepare
172 }
173
174 src_configure() {
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 use_wpe_renderer=OFF
220         local opengl_enabled
221         if use opengl || use gles2-only; then
222                 opengl_enabled=ON
223                 use wayland && use_wpe_renderer=ON
224         else
225                 opengl_enabled=OFF
226         fi
227
228         local mycmakeargs=(
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)
242                 -DUSE_WOFF2=ON
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
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         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         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 }