logo

overlay

My own overlay for experimentations, use with caution, no support is provided git clone https://hacktivis.me/git/overlay.git

webkit-gtk-2.33.1.ebuild (9198B)


  1. # Copyright 1999-2021 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. CMAKE_MAKEFILE_GENERATOR="ninja"
  5. PYTHON_COMPAT=( python3_{7..9} )
  6. USE_RUBY="ruby24 ruby25 ruby26 ruby27 ruby30"
  7. inherit check-reqs cmake flag-o-matic gnome2 pax-utils python-any-r1 ruby-single toolchain-funcs virtualx
  8. MY_P="webkitgtk-${PV}"
  9. DESCRIPTION="Open source web browser engine"
  10. HOMEPAGE="https://www.webkitgtk.org"
  11. SRC_URI="https://www.webkitgtk.org/releases/${MY_P}.tar.xz"
  12. LICENSE="LGPL-2+ BSD"
  13. SLOT="4/37" # soname version of libwebkit2gtk-4.0
  14. KEYWORDS=""
  15. IUSE="aqua debug +egl examples gamepad +geolocation gles2-only gnome-keyring +gstreamer gtk-doc +introspection +jpeg2k +jumbo-build libnotify media-source +opengl seccomp spell systemd wayland +X"
  16. # gstreamer with opengl/gles2 needs egl
  17. REQUIRED_USE="
  18. geolocation? ( introspection )
  19. gles2-only? ( egl !opengl )
  20. gstreamer? ( opengl? ( egl ) )
  21. wayland? ( egl )
  22. media-source? ( gstreamer )
  23. || ( aqua wayland X )
  24. "
  25. # Tests fail to link for inexplicable reasons
  26. # https://bugs.webkit.org/show_bug.cgi?id=148210
  27. RESTRICT="test"
  28. # Aqua support in gtk3 is untested
  29. # Dependencies found at Source/cmake/OptionsGTK.cmake
  30. # Various compile-time optionals for gtk+-3.22.0 - ensure it
  31. # Missing WebRTC support, but ENABLE_MEDIA_STREAM/ENABLE_WEB_RTC is experimental upstream (PRIVATE OFF) and shouldn't be used yet in 2.30
  32. # >=gst-plugins-opus-1.14.4-r1 for opusparse (required by MSE)
  33. wpe_depend="
  34. >=gui-libs/libwpe-1.5.0:1.0
  35. >=gui-libs/wpebackend-fdo-1.7.0:1.0
  36. "
  37. RDEPEND="
  38. >=x11-libs/cairo-1.16.0:=[X?]
  39. >=media-libs/fontconfig-2.13.0:1.0
  40. >=media-libs/freetype-2.9.0:2
  41. >=dev-libs/libgcrypt-1.7.0:0=
  42. >=x11-libs/gtk+-3.22.0:3[aqua?,introspection?,wayland?,X?]
  43. >=media-libs/harfbuzz-1.4.2:=[icu(+)]
  44. >=dev-libs/icu-60.2:=
  45. virtual/jpeg:0=
  46. >=net-libs/libsoup-2.54:2.4[introspection?]
  47. >=dev-libs/libxml2-2.8.0:2
  48. >=media-libs/libpng-1.4:0=
  49. dev-db/sqlite:3=
  50. sys-libs/zlib:0
  51. >=dev-libs/atk-2.16.0
  52. media-libs/libwebp:=
  53. >=dev-libs/glib-2.67.1:2
  54. >=dev-libs/libxslt-1.1.7
  55. media-libs/woff2
  56. gnome-keyring? ( app-crypt/libsecret )
  57. introspection? ( >=dev-libs/gobject-introspection-1.59.1:= )
  58. dev-libs/libtasn1:=
  59. spell? ( >=app-text/enchant-0.22:2 )
  60. gstreamer? (
  61. >=media-libs/gstreamer-1.14:1.0
  62. >=media-libs/gst-plugins-base-1.14:1.0[egl?,opengl?,X?]
  63. gles2-only? ( media-libs/gst-plugins-base:1.0[gles2] )
  64. >=media-plugins/gst-plugins-opus-1.14.4-r1:1.0
  65. >=media-libs/gst-plugins-bad-1.14:1.0[X?]
  66. )
  67. media-source? ( >=media-libs/gstreamer-1.16:1.0 )
  68. X? (
  69. x11-libs/libX11
  70. x11-libs/libXcomposite
  71. x11-libs/libXdamage
  72. x11-libs/libXrender
  73. x11-libs/libXt )
  74. libnotify? ( x11-libs/libnotify )
  75. dev-libs/hyphen
  76. jpeg2k? ( >=media-libs/openjpeg-2.2.0:2= )
  77. egl? ( media-libs/mesa[egl] )
  78. gles2-only? ( media-libs/mesa[gles2] )
  79. opengl? ( virtual/opengl )
  80. wayland? (
  81. dev-libs/wayland
  82. >=dev-libs/wayland-protocols-1.12
  83. opengl? ( ${wpe_depend} )
  84. gles2-only? ( ${wpe_depend} )
  85. )
  86. seccomp? (
  87. >=sys-apps/bubblewrap-0.3.1
  88. sys-libs/libseccomp
  89. sys-apps/xdg-dbus-proxy
  90. )
  91. systemd? ( sys-apps/systemd:= )
  92. gamepad? ( >=dev-libs/libmanette-0.2.4 )
  93. "
  94. unset wpe_depend
  95. DEPEND="${RDEPEND}"
  96. # paxctl needed for bug #407085
  97. # Need real bison, not yacc
  98. BDEPEND="
  99. ${PYTHON_DEPS}
  100. ${RUBY_DEPS}
  101. dev-util/glib-utils
  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-7.3 >=sys-devel/clang-5 )
  106. sys-devel/gettext
  107. virtual/pkgconfig
  108. >=dev-lang/perl-5.10
  109. virtual/perl-Data-Dumper
  110. virtual/perl-Carp
  111. virtual/perl-JSON-PP
  112. gtk-doc? ( >=dev-util/gtk-doc-1.32 )
  113. geolocation? ( dev-util/gdbus-codegen )
  114. >=dev-util/cmake-3.10
  115. sys-apps/paxctl
  116. "
  117. RDEPEND="${RDEPEND}
  118. geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
  119. "
  120. S="${WORKDIR}/${MY_P}"
  121. CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
  122. pkg_pretend() {
  123. if [[ ${MERGE_TYPE} != "binary" ]] ; then
  124. if is-flagq "-g*" && ! is-flagq "-g*0" ; then
  125. einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
  126. check-reqs_pkg_pretend
  127. fi
  128. if ! test-flag-CXX -std=c++17 ; then
  129. die "You need at least GCC 7.3.x or Clang >= 5 for C++17-specific compiler flags"
  130. fi
  131. fi
  132. if ! use opengl && ! use gles2-only; then
  133. ewarn
  134. ewarn "You are disabling OpenGL usage (USE=opengl or USE=gles2-only) completely."
  135. ewarn "This is an unsupported configuration meant for very specific embedded"
  136. ewarn "use cases, where there truly is no GL possible (and even that use case"
  137. ewarn "is very unlikely to come by). If you have GL (even software-only), you"
  138. ewarn "really really should be enabling OpenGL!"
  139. ewarn
  140. fi
  141. }
  142. pkg_setup() {
  143. if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
  144. check-reqs_pkg_setup
  145. fi
  146. python-any-r1_pkg_setup
  147. }
  148. src_prepare() {
  149. eapply "${FILESDIR}"/2.28.2-opengl-without-X-fixes.patch
  150. eapply "${FILESDIR}"/${PV}-Properly-use-CompletionHandler-when-USE_OPENGL_OR_ES.patch
  151. cmake_src_prepare
  152. gnome2_src_prepare
  153. }
  154. src_configure() {
  155. if use debug; then
  156. CMAKE_BUILD_TYPE="Debug"
  157. fi
  158. # gtk-doc fails to generate docs when ld.lld is used, force binutils
  159. if use gtk-doc; then
  160. export CC_LD="ld"
  161. export LD="ld"
  162. fi
  163. # Respect CC, otherwise fails on prefix #395875
  164. tc-export CC
  165. # It does not compile on alpha without this in LDFLAGS
  166. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
  167. use alpha && append-ldflags "-Wl,--no-relax"
  168. # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
  169. use ia64 && append-ldflags "-Wl,--no-as-needed"
  170. # Sigbuses on SPARC with mcpu and co., bug #???
  171. use sparc && filter-flags "-mvis"
  172. # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
  173. use ppc64 && append-flags "-mminimal-toc"
  174. # Try to use less memory, bug #469942 (see Fedora .spec for reference)
  175. # --no-keep-memory doesn't work on ia64, bug #502492
  176. if ! use ia64; then
  177. append-ldflags "-Wl,--no-keep-memory"
  178. fi
  179. # We try to use gold when possible for this package
  180. # if ! tc-ld-is-gold ; then
  181. # append-ldflags "-Wl,--reduce-memory-overheads"
  182. # fi
  183. # Ruby situation is a bit complicated. See bug 513888
  184. local rubyimpl
  185. local ruby_interpreter=""
  186. for rubyimpl in ${USE_RUBY}; do
  187. if has_version -b "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
  188. ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
  189. fi
  190. done
  191. # This will rarely occur. Only a couple of corner cases could lead us to
  192. # that failure. See bug 513888
  193. [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
  194. # TODO: Check Web Audio support
  195. # should somehow let user select between them?
  196. #
  197. # opengl needs to be explicetly handled, bug #576634
  198. local use_wpe_renderer=OFF
  199. local opengl_enabled
  200. if use opengl || use gles2-only; then
  201. opengl_enabled=ON
  202. use wayland && use_wpe_renderer=ON
  203. else
  204. opengl_enabled=OFF
  205. fi
  206. local mycmakeargs=(
  207. -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
  208. -DENABLE_WEBDRIVER=OFF
  209. -DENABLE_WEB_CRYPTO=OFF
  210. # -DENABLE_TOUCH_EVENTS=OFF
  211. # -DENABLE_DRAG_SUPPORT=OFF
  212. -DENABLE_QUARTZ_TARGET=$(usex aqua)
  213. -DENABLE_API_TESTS=$(usex test)
  214. -DENABLE_GTKDOC=$(usex gtk-doc)
  215. -DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
  216. $(cmake_use_find_package gles2-only OpenGLES2)
  217. -DENABLE_GLES2=$(usex gles2-only)
  218. -DENABLE_MINIBROWSER=$(usex examples)
  219. -DSHOULD_INSTALL_JS_SHELL=$(usex examples)
  220. -DENABLE_VIDEO=$(usex gstreamer)
  221. -DENABLE_MEDIA_SOURCE=$(usex media-source)
  222. -DENABLE_WEB_AUDIO=$(usex gstreamer)
  223. -DENABLE_INTROSPECTION=$(usex introspection)
  224. -DUSE_LIBNOTIFY=$(usex libnotify)
  225. -DUSE_LIBSECRET=$(usex gnome-keyring)
  226. -DUSE_OPENJPEG=$(usex jpeg2k)
  227. -DUSE_WOFF2=ON
  228. -DENABLE_SPELLCHECK=$(usex spell)
  229. -DUSE_SYSTEMD=$(usex systemd) # Whether to enable journald logging
  230. -DENABLE_GAMEPAD=$(usex gamepad)
  231. -DENABLE_WAYLAND_TARGET=$(usex wayland)
  232. -DUSE_WPE_RENDERER=${use_wpe_renderer} # WPE renderer is used to implement accelerated compositing under wayland
  233. $(cmake_use_find_package egl EGL)
  234. $(cmake_use_find_package opengl OpenGL)
  235. -DENABLE_X11_TARGET=$(usex X)
  236. -DUSE_OPENGL_OR_ES=${opengl_enabled}
  237. -DENABLE_WEBGL=${opengl_enabled}
  238. # Supported only under ANGLE, see
  239. # https://bugs.webkit.org/show_bug.cgi?id=225563
  240. # https://bugs.webkit.org/show_bug.cgi?id=224888
  241. -DENABLE_WEBGL2=OFF
  242. -DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
  243. -DUSE_LD_GOLD=ON
  244. -DUSE_GTK4=OFF
  245. -DBWRAP_EXECUTABLE:FILEPATH="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
  246. -DDBUS_PROXY_EXECUTABLE:FILEPATH="${EPREFIX}"/usr/bin/xdg-dbus-proxy
  247. -DPORT=GTK
  248. ${ruby_interpreter}
  249. )
  250. # https://bugs.gentoo.org/761238
  251. append-cppflags -DNDEBUG
  252. cmake_src_configure
  253. }
  254. src_compile() {
  255. cmake_src_compile
  256. }
  257. src_test() {
  258. # Prevents test failures on PaX systems
  259. pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
  260. cmake_src_test
  261. }
  262. src_install() {
  263. cmake_src_install
  264. # Prevents crashes on PaX systems, bug #522808
  265. pax-mark m "${ED}/usr/libexec/webkit2gtk-4.0/jsc" "${ED}/usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
  266. pax-mark m "${ED}/usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
  267. }