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.31.1.ebuild (9039B)


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