logo

overlay

My (experimental) gentoo overlay

webkit-gtk-2.22.2.ebuild (8310B)


      1 # Copyright 1999-2018 Gentoo Authors, Haelwenn (lanodan) Monnier <contact@hacktivis.me>
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI=6
      5 CMAKE_MAKEFILE_GENERATOR="ninja"
      6 PYTHON_COMPAT=( python2_7 )
      7 USE_RUBY="ruby23 ruby24 ruby25"
      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 +geolocation gles2 gnome-keyring +gstreamer +introspection +jit libnotify nsplugin +opengl spell wayland +webgl +X"
     21 
     22 # webgl needs gstreamer, bug #560612
     23 REQUIRED_USE="
     24 	geolocation? ( introspection )
     25 	gles2? ( egl !opengl )
     26 	introspection? ( gstreamer )
     27 	nsplugin? ( X )
     28 	webgl? ( gstreamer
     29 		|| ( gles2 opengl ) )
     30 	wayland? ( egl )
     31 	|| ( aqua wayland X )
     32 "
     33 
     34 # Tests fail to link for inexplicable reasons
     35 # https://bugs.webkit.org/show_bug.cgi?id=148210
     36 RESTRICT="test"
     37 
     38 # Aqua support in gtk3 is untested
     39 # Dependencies found at Source/cmake/OptionsGTK.cmake
     40 # Various compile-time optionals for gtk+-3.22.0 - ensure it
     41 # Missing OpenWebRTC checks and conditionals, but ENABLE_MEDIA_STREAM/ENABLE_WEB_RTC is experimental upstream (PRIVATE OFF)
     42 # TODO: Raise gst-plugins-opus dep to 1.14.4-r1 once we can, and eventually drop the blocker from epiphany; or remove the dep when older than -opus-1.14.4-r1 is not available anymore
     43 RDEPEND="
     44 	>=x11-libs/cairo-1.10.2:=[X?]
     45 	>=media-libs/fontconfig-2.8.0:1.0
     46 	>=media-libs/freetype-2.4.2:2
     47 	>=dev-libs/libgcrypt-1.6.0:0=
     48 	>=x11-libs/gtk+-3.22:3[aqua?,introspection?,wayland?,X?]
     49 	>=media-libs/harfbuzz-1.3.3:=[icu(+)]
     50 	>=dev-libs/icu-3.8.1-r1:=
     51 	virtual/jpeg:0=
     52 	>=net-libs/libsoup-2.48:2.4[introspection?]
     53 	>=dev-libs/libxml2-2.8.0:2
     54 	>=media-libs/libpng-1.4:0=
     55 	dev-db/sqlite:3=
     56 	sys-libs/zlib:0
     57 	>=dev-libs/atk-2.8.0
     58 	media-libs/libwebp:=
     59 
     60 	>=dev-libs/glib-2.40:2
     61 	>=dev-libs/libxslt-1.1.7
     62 	media-libs/woff2
     63 	gnome-keyring? ( app-crypt/libsecret )
     64 	geolocation? ( >=app-misc/geoclue-2.1.5:2.0 )
     65 	introspection? ( >=dev-libs/gobject-introspection-1.32.0:= )
     66 	dev-libs/libtasn1:=
     67 	>=dev-libs/libgcrypt-1.7.0:0=
     68 	nsplugin? ( >=x11-libs/gtk+-2.24.10:2 )
     69 	spell? ( >=app-text/enchant-0.22:= )
     70 	gstreamer? (
     71 		>=media-libs/gstreamer-1.8.3:1.0
     72 		>=media-libs/gst-plugins-base-1.8.3:1.0
     73 		>=media-plugins/gst-plugins-opus-1.8.3:1.0
     74 		>=media-libs/gst-plugins-bad-1.10:1.0[egl?,gles2?,opengl?] )
     75 
     76 	X? (
     77 		x11-libs/libX11
     78 		x11-libs/libXcomposite
     79 		x11-libs/libXdamage
     80 		x11-libs/libXrender
     81 		x11-libs/libXt )
     82 
     83 	libnotify? ( x11-libs/libnotify )
     84 	dev-libs/hyphen
     85 
     86 	egl? ( media-libs/mesa[egl] )
     87 	gles2? ( media-libs/mesa[gles2] )
     88 	opengl? ( virtual/opengl )
     89 	webgl? (
     90 		x11-libs/libXcomposite
     91 		x11-libs/libXdamage )
     92 "
     93 
     94 # paxctl needed for bug #407085
     95 # Need real bison, not yacc
     96 DEPEND="${RDEPEND}
     97 	${PYTHON_DEPS}
     98 	${RUBY_DEPS}
     99 	>=app-accessibility/at-spi2-core-2.5.3
    100 	>=dev-lang/perl-5.10
    101 	dev-util/glib-utils
    102 	>=dev-util/gtk-doc-am-1.10
    103 	>=dev-util/gperf-3.0.1
    104 	>=sys-devel/bison-2.4.3
    105 	|| ( >=sys-devel/gcc-6.0 >=sys-devel/clang-3.3 )
    106 	sys-devel/gettext
    107 	virtual/pkgconfig
    108 
    109 	dev-lang/perl
    110 	virtual/perl-Data-Dumper
    111 	virtual/perl-Carp
    112 	virtual/perl-JSON-PP
    113 
    114 	doc? ( >=dev-util/gtk-doc-1.10 )
    115 	geolocation? ( dev-util/gdbus-codegen )
    116 	introspection? ( jit? ( sys-apps/paxctl ) )
    117 "
    118 #	test? (
    119 #		dev-python/pygobject:3[python_targets_python2_7]
    120 #		x11-themes/hicolor-icon-theme
    121 #		jit? ( sys-apps/paxctl ) )
    122 
    123 S="${WORKDIR}/${MY_P}"
    124 
    125 CHECKREQS_DISK_BUILD="18G" # and even this might not be enough, bug #417307
    126 
    127 pkg_pretend() {
    128 	if [[ ${MERGE_TYPE} != "binary" ]] ; then
    129 		if is-flagq "-g*" && ! is-flagq "-g*0" ; then
    130 			einfo "Checking for sufficient disk space to build ${PN} with debugging CFLAGS"
    131 			check-reqs_pkg_pretend
    132 		fi
    133 
    134 		if ! test-flag-CXX -std=c++11 ; then
    135 			die "You need at least GCC 4.9.x or Clang >= 3.3 for C++11-specific compiler flags"
    136 		fi
    137 
    138 		if tc-is-gcc && [[ $(gcc-version) < 4.9 ]] ; then
    139 			die 'The active compiler needs to be gcc 4.9 (or newer)'
    140 		fi
    141 	fi
    142 }
    143 
    144 pkg_setup() {
    145 	if [[ ${MERGE_TYPE} != "binary" ]] && is-flagq "-g*" && ! is-flagq "-g*0" ; then
    146 		check-reqs_pkg_setup
    147 	fi
    148 
    149 	python-any-r1_pkg_setup
    150 }
    151 
    152 src_prepare() {
    153 	cmake-utils_src_prepare
    154 	gnome2_src_prepare
    155 }
    156 
    157 src_configure() {
    158 	# Respect CC, otherwise fails on prefix #395875
    159 	tc-export CC
    160 
    161 	# Arches without JIT support also need this to really disable it in all places
    162 	use jit || append-cppflags -DENABLE_JIT=0 -DENABLE_YARR_JIT=0 -DENABLE_ASSEMBLER=0
    163 
    164 	# It does not compile on alpha without this in LDFLAGS
    165 	# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648761
    166 	use alpha && append-ldflags "-Wl,--no-relax"
    167 
    168 	# ld segfaults on ia64 with LDFLAGS --as-needed, bug #555504
    169 	use ia64 && append-ldflags "-Wl,--no-as-needed"
    170 
    171 	# Sigbuses on SPARC with mcpu and co., bug #???
    172 	use sparc && filter-flags "-mvis"
    173 
    174 	# https://bugs.webkit.org/show_bug.cgi?id=42070 , #301634
    175 	use ppc64 && append-flags "-mminimal-toc"
    176 
    177 	# Try to use less memory, bug #469942 (see Fedora .spec for reference)
    178 	# --no-keep-memory doesn't work on ia64, bug #502492
    179 	if ! use ia64; then
    180 		append-ldflags "-Wl,--no-keep-memory"
    181 	fi
    182 
    183 	# We try to use gold when possible for this package
    184 #	if ! tc-ld-is-gold ; then
    185 #		append-ldflags "-Wl,--reduce-memory-overheads"
    186 #	fi
    187 
    188 	# Multiple rendering bugs on youtube, github, etc without this, bug #547224
    189 	append-flags $(test-flags -fno-strict-aliasing)
    190 
    191 	# Ruby situation is a bit complicated. See bug 513888
    192 	local rubyimpl
    193 	local ruby_interpreter=""
    194 	for rubyimpl in ${USE_RUBY}; do
    195 		if has_version "virtual/rubygems[ruby_targets_${rubyimpl}]"; then
    196 			ruby_interpreter="-DRUBY_EXECUTABLE=$(type -P ${rubyimpl})"
    197 		fi
    198 	done
    199 	# This will rarely occur. Only a couple of corner cases could lead us to
    200 	# that failure. See bug 513888
    201 	[[ -z $ruby_interpreter ]] && die "No suitable ruby interpreter found"
    202 
    203 	# TODO: Check Web Audio support
    204 	# should somehow let user select between them?
    205 	#
    206 	# FTL_JIT requires llvm
    207 	#
    208 	# opengl needs to be explicetly handled, bug #576634
    209 
    210 	local opengl_enabled
    211 	if use opengl || use gles2; then
    212 		opengl_enabled=ON
    213 	else
    214 		opengl_enabled=OFF
    215 	fi
    216 
    217 	local mycmakeargs=(
    218 		-DUSE_SYSTEM_MALLOC=ON
    219 		-DENABLE_WEBDRIVER=OFF
    220 		-DENABLE_WEB_CRYPTO=OFF
    221 		-DENABLE_TOUCH_EVENTS=OFF
    222 		-DENABLE_DRAG_SUPPORT=OFF
    223 		-DENABLE_QUARTZ_TARGET=$(usex aqua)
    224 		-DENABLE_API_TESTS=$(usex test)
    225 		-DENABLE_GTKDOC=$(usex doc)
    226 		-DENABLE_GEOLOCATION=$(usex geolocation)
    227 		$(cmake-utils_use_find_package gles2 OpenGLES2)
    228 		-DENABLE_GLES2=$(usex gles2)
    229 		-DENABLE_VIDEO=$(usex gstreamer)
    230 		-DENABLE_WEB_AUDIO=$(usex gstreamer)
    231 		-DENABLE_INTROSPECTION=$(usex introspection)
    232 		-DENABLE_JIT=$(usex jit)
    233 		-DUSE_LIBNOTIFY=$(usex libnotify)
    234 		-DUSE_LIBSECRET=$(usex gnome-keyring)
    235 		-DUSE_WOFF2=ON
    236 		-DENABLE_PLUGIN_PROCESS_GTK2=$(usex nsplugin)
    237 		-DENABLE_SPELLCHECK=$(usex spell)
    238 		-DENABLE_WAYLAND_TARGET=$(usex wayland)
    239 		-DENABLE_WEBGL=$(usex webgl)
    240 		$(cmake-utils_use_find_package egl EGL)
    241 		$(cmake-utils_use_find_package opengl OpenGL)
    242 		-DENABLE_X11_TARGET=$(usex X)
    243 		-DENABLE_OPENGL=${opengl_enabled}
    244 		-DCMAKE_BUILD_TYPE=Release
    245 		-DPORT=GTK
    246 		${ruby_interpreter}
    247 	)
    248 
    249 	# Allow it to use GOLD when possible as it has all the magic to
    250 	# detect when to use it and using gold for this concrete package has
    251 	# multiple advantages and is also the upstream default, bug #585788
    252 #	if tc-ld-is-gold ; then
    253 #		mycmakeargs+=( -DUSE_LD_GOLD=ON )
    254 #	else
    255 #		mycmakeargs+=( -DUSE_LD_GOLD=OFF )
    256 #	fi
    257 
    258 	cmake-utils_src_configure
    259 }
    260 
    261 src_compile() {
    262 	cmake-utils_src_compile
    263 }
    264 
    265 src_test() {
    266 	# Prevents test failures on PaX systems
    267 	use jit && pax-mark m $(list-paxables Programs/*[Tt]ests/*) # Programs/unittests/.libs/test*
    268 
    269 	cmake-utils_src_test
    270 }
    271 
    272 src_install() {
    273 	cmake-utils_src_install
    274 
    275 	# Prevents crashes on PaX systems, bug #522808
    276 	use jit && pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/jsc" "${ED}usr/libexec/webkit2gtk-4.0/WebKitWebProcess"
    277 	pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"
    278 	use nsplugin && pax-mark m "${ED}usr/libexec/webkit2gtk-4.0/WebKitPluginProcess"2
    279 }