logo

overlay

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

webkit-gtk-2.30.0.ebuild (8735B)


      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 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"
     22 
     23 # gstreamer with opengl/gles2 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 	!gtk4? ( >=x11-libs/gtk+-3.22.0:3[aqua?,introspection?,wayland?,X?] )
     45 	gtk4? ( x11-libs/gtk+:4[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
     60 	gnome-keyring? ( app-crypt/libsecret )
     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?,X?]
     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[X?]
     70 	)
     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 	systemd? ( sys-apps/systemd:= )
     98 "
     99 
    100 # paxctl needed for bug #407085
    101 # Need real bison, not yacc
    102 DEPEND="${RDEPEND}
    103 	${PYTHON_DEPS}
    104 	${RUBY_DEPS}
    105 	dev-util/glib-utils
    106 	>=dev-util/gtk-doc-am-1.10
    107 	>=dev-util/gperf-3.0.1
    108 	>=sys-devel/bison-2.4.3
    109 	|| ( >=sys-devel/gcc-7.3 >=sys-devel/clang-5 )
    110 	sys-devel/gettext
    111 	virtual/pkgconfig
    112 
    113 	>=dev-lang/perl-5.10
    114 	virtual/perl-Data-Dumper
    115 	virtual/perl-Carp
    116 	virtual/perl-JSON-PP
    117 
    118 	gtk-doc? ( >=dev-util/gtk-doc-1.10 )
    119 	geolocation? ( dev-util/gdbus-codegen )
    120 	sys-apps/paxctl
    121 
    122 "
    123 RDEPEND="${RDEPEND}
    124 	geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
    125 "
    126 RESTRICT="test"
    127 # tests are b0rk, PYTHON_USEDEP is as well
    128 #	test? (
    129 #		dev-python/pygobject:3[${PYTHON_USEDEP}]
    130 #		x11-themes/hicolor-icon-theme )
    131 
    132 S="${WORKDIR}/${MY_P}"
    133 
    134 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
    135 
    136 pkg_pretend() {
    137 	if [[ ${MERGE_TYPE} != "binary" ]] ; then
    138 		if is-flagq "-g*" && ! is-flagq "-g*0" ; then
    139 			einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
    140 			check-reqs_pkg_pretend
    141 		fi
    142 
    143 		if ! test-flag-CXX -std=c++17 ; then
    144 			die "You need at least GCC 7.3.x or Clang >= 5 for C++17-specific compiler flags"
    145 		fi
    146 	fi
    147 
    148 	if ! use opengl && ! use gles2-only; then
    149 		ewarn
    150 		ewarn "You are disabling OpenGL usage (USE=opengl or USE=gles2-only) completely."
    151 		ewarn "This is an unsupported configuration meant for very specific embedded"
    152 		ewarn "use cases, where there truly is no GL possible (and even that use case"
    153 		ewarn "is very unlikely to come by). If you have GL (even software-only), you"
    154 		ewarn "really really should be enabling OpenGL!"
    155 		ewarn
    156 	fi
    157 }
    158 
    159 pkg_setup() {
    160 	if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
    161 		check-reqs_pkg_setup
    162 	fi
    163 
    164 	python-any-r1_pkg_setup
    165 }
    166 
    167 src_prepare() {
    168 	eapply "${FILESDIR}"/2.28.2-opengl-without-X-fixes.patch
    169 	cmake-utils_src_prepare
    170 	gnome2_src_prepare
    171 }
    172 
    173 src_configure() {
    174 	if use debug; then
    175 		CMAKE_BUILD_TYPE="Debug"
    176 	fi
    177 
    178 	# gtk-doc fails to generate docs when ld.lld is used, force binutils
    179 	if use gtk-doc; then
    180 		export CC_LD="ld"
    181 		export LD="ld"
    182 	fi
    183 
    184 	# Respect CC, otherwise fails on prefix #395875
    185 	tc-export CC
    186 
    187 	# It does not compile on alpha without this in LDFLAGS
    188 	# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
    189 	use alpha && append-ldflags "-Wl,--no-relax"
    190 
    191 	# ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
    192 	use ia64 && append-ldflags "-Wl,--no-as-needed"
    193 
    194 	# Sigbuses on SPARC with mcpu and co., bug #???
    195 	use sparc && filter-flags "-mvis"
    196 
    197 	# https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
    198 	use ppc64 && append-flags "-mminimal-toc"
    199 
    200 	# Try to use less memory, bug #469942 (see Fedora .spec for reference)
    201 	# --no-keep-memory doesn't work on ia64, bug #502492
    202 	if ! use ia64; then
    203 		append-ldflags "-Wl,--no-keep-memory"
    204 	fi
    205 
    206 	# We try to use gold when possible for this package
    207 #	if ! tc-ld-is-gold ; then
    208 #		append-ldflags "-Wl,--reduce-memory-overheads"
    209 #	fi
    210 
    211 	# Ruby situation is a bit complicated. See bug 513888
    212 	local rubyimpl
    213 	local ruby_interpreter=""
    214 	for rubyimpl in ${USE_RUBY}; do
    215 		if has_version --host-root "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
    216 			ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
    217 		fi
    218 	done
    219 	# This will rarely occur. Only a couple of corner cases could lead us to
    220 	# that failure. See bug 513888
    221 	[[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
    222 
    223 	# TODO: Check Web Audio support
    224 	# should somehow let user select between them?
    225 	#
    226 	# opengl needs to be explicetly handled, bug #576634
    227 
    228 	local opengl_enabled
    229 	if use opengl || use gles2-only; then
    230 		opengl_enabled=ON
    231 	else
    232 		opengl_enabled=OFF
    233 	fi
    234 
    235 	local mycmakeargs=(
    236 		# begin PRIVATE options
    237 		-DENABLE_API_TESTS=$(usex test)
    238 		-DSHOULD_INSTALL_JS_SHELL=$(usex examples)
    239 		-DENABLE_GEOLOCATION=$(usex geolocation) # Runtime optional (talks over dbus service)
    240 		-DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
    241 		# end PRIVATE options
    242 		-DUSE_SYSTEMD=$(usex systemd)
    243 		-DUSE_GTK4=$(usex gtk4)
    244 		-DENABLE_WEBDRIVER=OFF
    245 		-DENABLE_WEB_CRYPTO=OFF
    246 		# -DENABLE_TOUCH_EVENTS=OFF
    247 		# -DENABLE_DRAG_SUPPORT=OFF
    248 		-DENABLE_MINIBROWSER=$(usex examples)
    249 		-DENABLE_QUARTZ_TARGET=$(usex aqua)
    250 		-DENABLE_GTKDOC=$(usex gtk-doc)
    251 		$(cmake-utils_use_find_package gles2-only OpenGLES2)
    252 		-DENABLE_GLES2=$(usex gles2-only)
    253 		-DENABLE_VIDEO=$(usex gstreamer)
    254 		-DENABLE_WEB_AUDIO=$(usex gstreamer)
    255 		-DENABLE_INTROSPECTION=$(usex introspection)
    256 		-DUSE_LIBNOTIFY=$(usex libnotify)
    257 		-DUSE_LIBSECRET=$(usex gnome-keyring)
    258 		-DUSE_OPENJPEG=$(usex jpeg2k)
    259 		-DUSE_WOFF2=ON
    260 		-DENABLE_SPELLCHECK=$(usex spell)
    261 		-DENABLE_WAYLAND_TARGET=$(usex wayland)
    262 		$(cmake-utils_use_find_package egl EGL)
    263 		$(cmake-utils_use_find_package opengl OpenGL)
    264 		-DENABLE_X11_TARGET=$(usex X)
    265 		-DENABLE_OPENGL=${opengl_enabled}
    266 		-DENABLE_WEBGL=${opengl_enabled}
    267 		-DUSE_WPE_RENDERER=$(usex wpe)
    268 		-DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
    269 		-DENABLE_MEDIA_SOURCE=$(usex media-source)
    270 		-DBWRAP_EXECUTABLE="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
    271 		-DUSE_LD_GOLD=ON
    272 		-DPORT=GTK
    273 		${ruby_interpreter}
    274 	)
    275 
    276 	cmake-utils_src_configure
    277 }
    278 
    279 src_compile() {
    280 	cmake-utils_src_compile
    281 }
    282 
    283 src_test() {
    284 	# Prevents test failures on PaX systems
    285 	pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
    286 
    287 	cmake-utils_src_test
    288 }
    289 
    290 src_install() {
    291 	cmake-utils_src_install
    292 
    293 	# Prevents crashes on PaX systems, bug #522808
    294 	pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
    295 	pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
    296 }