logo

overlay

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

webkit-gtk-2.26.3.ebuild (8621B)


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