logo

overlay

My own overlay for experimentations, use with caution, no support is provided

webkit-gtk-2.30.1.ebuild (8735B)


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