logo

overlay

My (experimental) gentoo overlay

webkit-gtk-2.26.1.ebuild (8826B)


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