logo

overlay

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

webkit-gtk-2.28.0-r1.ebuild (8698B)


      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 	cmake-utils_src_prepare
    164 	gnome2_src_prepare
    165 }
    166 
    167 src_configure() {
    168 	if use debug; then
    169 		CMAKE_BUILD_TYPE="Debug"
    170 	else
    171 		CMAKE_BUILD_TYPE="RelWithDebInfo"
    172 	fi
    173 
    174 	# Respect CC, otherwise fails on prefix #395875
    175 	tc-export CC
    176 
    177 	# It does not compile on alpha without this in LDFLAGS
    178 	# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
    179 	use alpha && append-ldflags "-Wl,--no-relax"
    180 
    181 	# ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
    182 	use ia64 && append-ldflags "-Wl,--no-as-needed"
    183 
    184 	# Sigbuses on SPARC with mcpu and co., bug #???
    185 	use sparc && filter-flags "-mvis"
    186 
    187 	# https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
    188 	use ppc64 && append-flags "-mminimal-toc"
    189 
    190 	# Try to use less memory, bug #469942 (see Fedora .spec for reference)
    191 	# --no-keep-memory doesn't work on ia64, bug #502492
    192 	if ! use ia64; then
    193 		append-ldflags "-Wl,--no-keep-memory"
    194 	fi
    195 
    196 	# We try to use gold when possible for this package
    197 #	if ! tc-ld-is-gold ; then
    198 #		append-ldflags "-Wl,--reduce-memory-overheads"
    199 #	fi
    200 
    201 	# Ruby situation is a bit complicated. See bug 513888
    202 	local rubyimpl
    203 	local ruby_interpreter=""
    204 	for rubyimpl in ${USE_RUBY}; do
    205 		if has_version --host-root "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
    206 			ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
    207 		fi
    208 	done
    209 	# This will rarely occur. Only a couple of corner cases could lead us to
    210 	# that failure. See bug 513888
    211 	[[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
    212 
    213 	# TODO: Check Web Audio support
    214 	# should somehow let user select between them?
    215 	#
    216 	# opengl needs to be explicetly handled, bug #576634
    217 
    218 	local opengl_enabled
    219 	if use opengl || use gles2-only; then
    220 		opengl_enabled=ON
    221 	else
    222 		opengl_enabled=OFF
    223 	fi
    224 
    225 	local mycmakeargs=(
    226 		# begin PRIVATE options
    227 		-DSHOULD_INSTALL_JS_SHELL=$(usex examples)
    228 		-DENABLE_GEOLOCATION=$(usex geolocation)
    229 		-DENABLE_UNIFIED_BUILDS=$(usex jumbo-build)
    230 		-DENABLE_API_TESTS=$(usex test)
    231 		# end
    232 		-DENABLE_WEBDRIVER=OFF
    233 		-DENABLE_WEB_CRYPTO=OFF
    234 		# -DENABLE_TOUCH_EVENTS=OFF
    235 		# -DENABLE_DRAG_SUPPORT=OFF
    236 		-DENABLE_MINIBROWSER=$(usex examples)
    237 		-DENABLE_QUARTZ_TARGET=$(usex aqua)
    238 		# Fails with ld.lld, often breaks the builds if there is compiler warnings
    239 		# -DENABLE_GTKDOC=$(usex doc)
    240 		$(cmake-utils_use_find_package gles2-only OpenGLES2)
    241 		-DENABLE_GLES2=$(usex gles2-only)
    242 		-DENABLE_VIDEO=$(usex gstreamer)
    243 		-DENABLE_WEB_AUDIO=$(usex gstreamer)
    244 		-DENABLE_INTROSPECTION=$(usex introspection)
    245 		-DUSE_LIBNOTIFY=$(usex libnotify)
    246 		-DUSE_LIBSECRET=$(usex gnome-keyring)
    247 		-DUSE_OPENJPEG=$(usex jpeg2k)
    248 		-DUSE_WOFF2=ON
    249 		-DENABLE_SPELLCHECK=$(usex spell)
    250 		-DENABLE_WAYLAND_TARGET=$(usex wayland)
    251 		$(cmake-utils_use_find_package egl EGL)
    252 		$(cmake-utils_use_find_package opengl OpenGL)
    253 		-DENABLE_X11_TARGET=$(usex X)
    254 		-DENABLE_OPENGL=${opengl_enabled}
    255 		-DENABLE_WEBGL=${opengl_enabled}
    256 		-DUSE_WPE_RENDERER=$(usex wpe)
    257 		-DENABLE_BUBBLEWRAP_SANDBOX=$(usex seccomp)
    258 		-DENABLE_MEDIA_SOURCE=$(usex media-source)
    259 		-DBWRAP_EXECUTABLE="${EPREFIX}"/usr/bin/bwrap # If bubblewrap[suid] then portage makes it go-r and cmake find_program fails with that
    260 		-DPORT=GTK
    261 		${ruby_interpreter}
    262 	)
    263 
    264 	# Allow it to use GOLD when possible as it has all the magic to
    265 	# detect when to use it and using gold for this concrete package has
    266 	# multiple advantages and is also the upstream default, bug #585788
    267 #	if tc-ld-is-gold ; then
    268 #		mycmakeargs+=( -DUSE_LD_GOLD=ON )
    269 #	else
    270 #		mycmakeargs+=( -DUSE_LD_GOLD=OFF )
    271 #	fi
    272 
    273 	cmake-utils_src_configure
    274 }
    275 
    276 src_compile() {
    277 	cmake-utils_src_compile
    278 }
    279 
    280 src_test() {
    281 	# Prevents test failures on PaX systems
    282 	pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
    283 
    284 	cmake-utils_src_test
    285 }
    286 
    287 src_install() {
    288 	cmake-utils_src_install
    289 
    290 	# Prevents crashes on PaX systems, bug #522808
    291 	pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
    292 	pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
    293 }