logo

overlay

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

webkit-gtk-2.28.4.ebuild (8559B)


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