logo

overlay

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

webkit-gtk-2.26.2.ebuild (8898B)


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