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.34.6-r100.ebuild (9100B)


  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.1/0" # soname version of libwebkit2gtk-4.1
  14. KEYWORDS="~amd64 ~arm ~arm64 ~x86"
  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.99.9:3.0[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. cmake_src_prepare
  150. gnome2_src_prepare
  151. }
  152. src_configure() {
  153. if use debug; then
  154. CMAKE_BUILD_TYPE="Debug"
  155. fi
  156. # gtk-doc fails to generate docs when ld.lld is used, force binutils
  157. if use gtk-doc; then
  158. export CC_LD="ld"
  159. export LD="ld"
  160. fi
  161. # Respect CC, otherwise fails on prefix #395875
  162. tc-export CC
  163. # It does not compile on alpha without this in LDFLAGS
  164. # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
  165. use alpha && append-ldflags "-Wl,--no-relax"
  166. # ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
  167. use ia64 && append-ldflags "-Wl,--no-as-needed"
  168. # Sigbuses on SPARC with mcpu and co., bug #???
  169. use sparc && filter-flags "-mvis"
  170. # https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
  171. use ppc64 && append-flags "-mminimal-toc"
  172. # Try to use less memory, bug #469942 (see Fedora .spec for reference)
  173. # --no-keep-memory doesn't work on ia64, bug #502492
  174. if ! use ia64; then
  175. append-ldflags "-Wl,--no-keep-memory"
  176. fi
  177. # We try to use gold when possible for this package
  178. # if ! tc-ld-is-gold ; then
  179. # append-ldflags "-Wl,--reduce-memory-overheads"
  180. # fi
  181. # Ruby situation is a bit complicated. See bug 513888
  182. local rubyimpl
  183. local ruby_interpreter=""
  184. for rubyimpl in ${USE_RUBY}; do
  185. if has_version -b "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
  186. ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
  187. fi
  188. done
  189. # This will rarely occur. Only a couple of corner cases could lead us to
  190. # that failure. See bug 513888
  191. [[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
  192. # TODO: Check Web Audio support
  193. # should somehow let user select between them?
  194. #
  195. # opengl needs to be explicetly handled, bug #576634
  196. local use_wpe_renderer=OFF
  197. local opengl_enabled
  198. if use opengl || use gles2-only; then
  199. opengl_enabled=ON
  200. use wayland && use_wpe_renderer=ON
  201. else
  202. opengl_enabled=OFF
  203. fi
  204. local mycmakeargs=(
  205. -DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
  206. -DENABLE_WEBDRIVER=OFF
  207. -DENABLE_WEB_CRYPTO=OFF
  208. # -DENABLE_TOUCH_EVENTS=OFF
  209. # -DENABLE_DRAG_SUPPORT=OFF
  210. -DENABLE_QUARTZ_TARGET=$(usex aqua)
  211. -DENABLE_API_TESTS=$(usex test)
  212. -DENABLE_GTKDOC=$(usex gtk-doc)
  213. -DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
  214. $(cmake_use_find_package gles2-only OpenGLES2)
  215. -DENABLE_GLES2=$(usex gles2-only)
  216. -DENABLE_MINIBROWSER=$(usex examples)
  217. -DSHOULD_INSTALL_JS_SHELL=$(usex examples)
  218. -DENABLE_VIDEO=$(usex gstreamer)
  219. -DENABLE_MEDIA_SOURCE=$(usex media-source)
  220. -DENABLE_WEB_AUDIO=$(usex gstreamer)
  221. -DENABLE_INTROSPECTION=$(usex introspection)
  222. -DUSE_LIBNOTIFY=$(usex libnotify)
  223. -DUSE_LIBSECRET=$(usex gnome-keyring)
  224. -DUSE_OPENJPEG=$(usex jpeg2k)
  225. -DUSE_WOFF2=ON
  226. -DENABLE_SPELLCHECK=$(usex spell)
  227. -DUSE_SYSTEMD=$(usex systemd) # Whether to enable journald logging
  228. -DENABLE_GAMEPAD=$(usex gamepad)
  229. -DENABLE_WAYLAND_TARGET=$(usex wayland)
  230. -DUSE_WPE_RENDERER=${use_wpe_renderer} # WPE renderer is used to implement accelerated compositing under wayland
  231. $(cmake_use_find_package egl EGL)
  232. $(cmake_use_find_package opengl OpenGL)
  233. -DENABLE_X11_TARGET=$(usex X)
  234. -DUSE_OPENGL_OR_ES=${opengl_enabled}
  235. -DENABLE_WEBGL=${opengl_enabled}
  236. # Supported only under ANGLE, see
  237. # https://bugs.webkit.org/show_bug.cgi?id=225563
  238. # https://bugs.webkit.org/show_bug.cgi?id=224888
  239. -DENABLE_WEBGL2=OFF
  240. -DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
  241. -DUSE_LD_GOLD=ON
  242. -DUSE_GTK4=OFF
  243. -DUSE_SOUP2=OFF
  244. -DBWRAP_EXECUTABLE:FILEPATH="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
  245. -DDBUS_PROXY_EXECUTABLE:FILEPATH="${EPREFIX}"/usr/bin/xdg-dbus-proxy
  246. -DPORT=GTK
  247. ${ruby_interpreter}
  248. )
  249. # https://bugs.gentoo.org/761238
  250. append-cppflags -DNDEBUG
  251. cmake_src_configure
  252. }
  253. src_compile() {
  254. cmake_src_compile
  255. }
  256. src_test() {
  257. # Prevents test failures on PaX systems
  258. pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
  259. cmake_src_test
  260. }
  261. src_install() {
  262. cmake_src_install
  263. # Prevents crashes on PaX systems, bug #522808
  264. pax-mark m "${ED}/usr/libexec/webkit2gtk-4.0/jsc" "${ED}/usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
  265. pax-mark m "${ED}/usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
  266. }