1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 # won't build with python-3, bug #392969
7 PYTHON_COMPAT=( python2_7 )
9 inherit autotools eutils multilib nsplugins python-any-r1 flag-o-matic xdg-utils
11 DESCRIPTION="GNU Flash movie player that supports many SWF v7,8,9 features"
12 HOMEPAGE="https://www.gnu.org/software/gnash/"
14 if [[ ${PV} = 9999* ]]; then
16 EGIT_REPO_URI="git://git.savannah.gnu.org/gnash.git"
19 # Release tarball is b0rked, upstream #35612
20 # SRC_URI="mirror://gnu/${PN}/${PV}/${P}.tar.bz2"
21 SRC_URI="mirror://gentoo/${P}.tar.xz"
26 KEYWORDS="amd64 ppc ~ppc64 ~sparc x86"
27 IUSE="X +agg cairo cygnal dbus directfb doc dump egl fbcon +ffmpeg libav libressl gnome gtk harden jemalloc lirc mysql +nls nsplugin opengl openvg python sdl +sdl-sound ssh ssl test vaapi"
35 || ( agg cairo opengl openvg )
36 || ( dump fbcon gtk sdl )
40 >=dev-libs/boost-1.41.0:0=
53 cairo? ( x11-libs/cairo )
58 >=app-text/docbook2X-0.8.8
59 app-text/docbook-sgml-utils
68 libav? ( media-video/libav:0=[vaapi?] )
69 !libav? ( media-video/ffmpeg:0=[vaapi?] )
73 python? ( dev-python/pygtk:2 )
75 jemalloc? ( dev-libs/jemalloc )
79 gtk? ( x11-libs/gtkglext )
82 media-libs/mesa[openvg]
84 sdl? ( media-libs/libsdl[X] )
85 sdl-sound? ( media-libs/libsdl )
88 >=sys-devel/libtool-2.2
89 mysql? ( virtual/mysql )
90 lirc? ( app-misc/lirc )
91 dbus? ( sys-apps/dbus )
92 ssh? ( >=net-libs/libssh-0.4[server] )
94 libressl? ( dev-libs/libressl:0= )
95 !libressl? ( dev-libs/openssl:0= )
97 vaapi? ( x11-libs/libva[opengl?] )
101 nls? ( sys-devel/gettext )
102 gnome? ( app-text/rarian )
103 nsplugin? ( net-misc/npapi-sdk )
104 test? ( dev-util/dejagnu )
107 # Tests hang with sandbox, bug #321017
111 python-any-r1_pkg_setup
114 ewarn "You are trying to build Gnash without choosing a media handler."
115 ewarn "Sound and video playback will not work."
121 # rename git snapshot directory to what portage expects
122 mv ${PN}-*/ ${P} || die
128 xdg_environment_reset # 591014
130 # Fix paths for klash, bug #339610
131 eapply "${FILESDIR}"/${PN}-0.8.9-klash.patch
133 # Use external dejagnu for tests, bug #321017
134 eapply "${FILESDIR}"/${PN}-0.8.9-external-dejagnu.patch
136 # Fix building on ppc64, bug #342535
137 use ppc64 && append-flags -mminimal-toc
139 # Fix kde multilib library path, bug #391283
140 eapply "${FILESDIR}"/${PN}-0.8.9-kde4-libdir.patch
142 # Fix libamf includes
143 eapply "${FILESDIR}"/${PN}-0.8.10-amf-include.patch
145 # Fix new adjacent_tokens_only() in >=boost-1.59 (bug 579142)
146 # See https://savannah.gnu.org/bugs/?46148
147 eapply "${FILESDIR}"/${PN}-0.8.10_p20150316-boost-1.60.patch
152 local device gui input media myconf myext renderers
154 # Set nsplugin install directory.
155 use nsplugin && myconf="${myconf} --with-npapi-plugindir=/usr/$(get_libdir)/gnash/npapi/"
157 # Set hardware acceleration.
158 use X && device+=",x11"
159 use directfb && device+=",directfb"
160 use egl && device+=",egl"
161 use fbcon && device+=",rawfb"
162 use vaapi && device+=",vaapi"
163 [[ "${device}x" == "x" ]] && device+=",none"
165 # Set rendering engine.
166 use agg && renderers+=",agg"
167 use cairo && renderers+=",cairo"
168 use opengl && renderers+=",opengl"
169 use openvg && renderers+=",openvg"
172 use ffmpeg || media+=",none"
173 use ffmpeg && media+=",ffmpeg"
176 use dump && gui+=",dump"
177 use fbcon && gui+=",fb"
178 use gtk && gui+=",gtk"
179 use sdl && gui+=",sdl"
181 if use sdl-sound; then
182 myconf="${myconf} --enable-sound=sdl"
184 myconf="${myconf} --enable-sound=none"
188 use mysql && myext=",mysql"
189 use gtk && myext="${myext},gtk"
190 use lirc && myext="${myext},lirc"
191 use dbus && myext="${myext},dbus"
193 # Strip extra comma from gui, myext, hwaccel and renderers.
194 device=$( echo $device | sed -e 's/,//' )
195 gui=$( echo $gui | sed -e 's/^,//' )
196 myext=$( echo $myext | sed -e 's/,//' )
197 renderers=$( echo $renderers | sed -e 's/,//' )
198 media=$( echo $media | sed -e 's/,//' )
204 $(use_enable cygnal) \
205 $(use_enable cygnal cgibins) \
206 $(use_enable doc docbook) \
207 $(use_enable gnome ghelp) \
208 $(use_enable harden) \
209 $(use_enable jemalloc) \
211 $(use_enable nsplugin npapi) \
212 $(use_enable python) \
215 $(use_enable test testsuite) \
216 --enable-gui=${gui} \
217 --enable-device=${device} \
218 --enable-extensions=${myext} \
219 --enable-renderer=${renderers} \
220 --enable-media=${media} \
224 local log=testsuite-results.txt
226 emake check || die "make check failed"
227 ./anaylse-results.sh > $log || die "results analyze failed"
231 emake DESTDIR="${D}" install || die "emake install failed"
233 # Install nsplugin in directory set by --with-npapi-plugindir.
234 if use nsplugin; then
235 emake DESTDIR="${D}" install-plugin || die "install plugins failed"
238 # Create a symlink in /usr/$(get_libdir)/nsbrowser/plugins to the nsplugin install directory.
239 use nsplugin && inst_plugin /usr/$(get_libdir)/gnash/npapi/libgnashplugin.so
241 # Remove eglinfo, bug #463654
243 rm -f "${D}"/usr/bin/eglinfo || die
249 if use !gnome || use !ffmpeg ; then
251 ewarn "Gnash was built without a media handler and or http handler !"
253 ewarn "If you want Gnash to support video then you will need to"
254 ewarn "rebuild Gnash with the ffmpeg and gnome use flags set."
257 ewarn "${PN} is still in heavy development"
258 ewarn "Please first report bugs on upstream gnashdevs and deal with them"
259 ewarn "And then report a Gentoo bug to the maintainer"