logo

overlay

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

webkit-gtk-2.26.4.ebuild (8695B)


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