media-tv/kodi: disallow gles/vaapi together #464306
[gentoo.git] / media-tv / kodi / kodi-16.0.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6
7 # Does not work with py3 here
8 PYTHON_COMPAT=( python2_7 )
9 PYTHON_REQ_USE="sqlite"
10
11 inherit eutils linux-info python-single-r1 multiprocessing autotools toolchain-funcs
12
13 CODENAME="Jarvis"
14 case ${PV} in
15 9999)
16         EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
17         inherit git-r3
18         ;;
19 *|*_p*)
20         MY_PV=${PV/_p/_r}
21         MY_P="${PN}-${MY_PV}"
22         SRC_URI="http://mirrors.kodi.tv/releases/source/${MY_PV}-${CODENAME}.tar.gz -> ${P}.tar.gz
23                 https://github.com/xbmc/xbmc/archive/${PV}-${CODENAME}.tar.gz -> ${P}.tar.gz
24                 !java? ( http://mirrors.kodi.tv/releases/source/${MY_P}-generated-addons.tar.xz )"
25         KEYWORDS="~amd64 ~x86"
26
27         S=${WORKDIR}/xbmc-${PV}-${CODENAME}
28         ;;
29 esac
30
31 DESCRIPTION="Kodi is a free and open source media-player and entertainment hub"
32 HOMEPAGE="http://kodi.tv/ http://kodi.wiki/"
33
34 LICENSE="GPL-2"
35 SLOT="0"
36 IUSE="airplay alsa avahi bluetooth bluray caps cec css dbus debug gles java joystick midi mysql nfs +opengl profile pulseaudio rtmp +samba sftp test +texturepacker udisks upnp upower +usb vaapi vdpau webserver +X"
37 # gles/vaapi: http://trac.kodi.tv/ticket/10552
38 REQUIRED_USE="
39         gles? ( !vaapi )
40         !vaapi? ( !gles )
41         udisks? ( dbus )
42         upower? ( dbus )
43 "
44
45 COMMON_DEPEND="${PYTHON_DEPS}
46         app-arch/bzip2
47         app-arch/unzip
48         app-arch/zip
49         app-i18n/enca
50         airplay? ( app-pda/libplist )
51         dev-libs/boost
52         dev-libs/expat
53         dev-libs/fribidi
54         dev-libs/libcdio[-minimal]
55         cec? ( >=dev-libs/libcec-3.0 )
56         dev-libs/libpcre[cxx]
57         dev-libs/libxml2
58         dev-libs/libxslt
59         >=dev-libs/lzo-2.04
60         dev-libs/tinyxml[stl]
61         dev-libs/yajl
62         dev-python/simplejson[${PYTHON_USEDEP}]
63         media-fonts/corefonts
64         media-fonts/roboto
65         alsa? ( media-libs/alsa-lib )
66         media-libs/flac
67         media-libs/fontconfig
68         media-libs/freetype
69         media-libs/jasper
70         media-libs/jbigkit
71         >=media-libs/libass-0.9.7
72         bluray? ( >=media-libs/libbluray-0.7.0 )
73         css? ( media-libs/libdvdcss )
74         media-libs/libmad
75         media-libs/libmodplug
76         media-libs/libmpeg2
77         media-libs/libogg
78         media-libs/libpng:0=
79         media-libs/libsamplerate
80         joystick? ( media-libs/libsdl2 )
81         >=media-libs/taglib-1.8
82         media-libs/libvorbis
83         media-libs/tiff:0=
84         media-sound/dcadec
85         pulseaudio? ( media-sound/pulseaudio )
86         media-sound/wavpack
87         >=media-video/ffmpeg-2.6:=[encode]
88         rtmp? ( media-video/rtmpdump )
89         avahi? ( net-dns/avahi )
90         nfs? ( net-fs/libnfs:= )
91         webserver? ( net-libs/libmicrohttpd[messages] )
92         sftp? ( net-libs/libssh[sftp] )
93         net-misc/curl
94         samba? ( >=net-fs/samba-3.4.6[smbclient(+)] )
95         bluetooth? ( net-wireless/bluez )
96         dbus? ( sys-apps/dbus )
97         caps? ( sys-libs/libcap )
98         sys-libs/zlib
99         virtual/jpeg:0=
100         usb? ( virtual/libusb:1 )
101         mysql? ( virtual/mysql )
102         opengl? (
103                 virtual/glu
104                 virtual/opengl
105                 >=media-libs/glew-1.5.6
106         )
107         gles? (
108                 media-libs/mesa[gles2]
109         )
110         vaapi? ( x11-libs/libva[opengl] )
111         vdpau? (
112                 || ( >=x11-libs/libvdpau-1.1 >=x11-drivers/nvidia-drivers-180.51 )
113                 media-video/ffmpeg[vdpau]
114         )
115         X? (
116                 x11-apps/xdpyinfo
117                 x11-apps/mesa-progs
118                 x11-libs/libXinerama
119                 x11-libs/libXrandr
120                 x11-libs/libXrender
121         )"
122 RDEPEND="${COMMON_DEPEND}
123         !media-tv/xbmc
124         udisks? ( sys-fs/udisks:0 )
125         upower? ( || ( sys-power/upower sys-power/upower-pm-utils ) )"
126 DEPEND="${COMMON_DEPEND}
127         app-arch/xz-utils
128         dev-lang/swig
129         dev-libs/crossguid
130         dev-util/gperf
131         texturepacker? ( media-libs/giflib )
132         X? ( x11-proto/xineramaproto )
133         dev-util/cmake
134         x86? ( dev-lang/nasm )
135         java? ( virtual/jre )
136         test? ( dev-cpp/gtest )
137         virtual/pkgconfig"
138 # Force java for latest git version to avoid having to hand maintain the
139 # generated addons package.  #488118
140 [[ ${PV} == "9999" ]] && DEPEND+=" virtual/jre"
141
142 CONFIG_CHECK="~IP_MULTICAST"
143 ERROR_IP_MULTICAST="
144 In some cases Kodi needs to access multicast addresses.
145 Please consider enabling IP_MULTICAST under Networking options.
146 "
147
148 pkg_setup() {
149         check_extra_config
150         python-single-r1_pkg_setup
151 }
152
153 src_unpack() {
154         [[ ${PV} == "9999" ]] && git-r3_src_unpack || default
155 }
156
157 src_prepare() {
158         epatch "${FILESDIR}"/${PN}-9999-no-arm-flags.patch #400617
159         epatch "${FILESDIR}"/${PN}-9999-texturepacker.patch
160         epatch_user #293109
161
162         # some dirs ship generated autotools, some dont
163         multijob_init
164         local d dirs=(
165                 tools/depends/native/TexturePacker/src/configure
166                 $(printf 'f:\n\t@echo $(BOOTSTRAP_TARGETS)\ninclude bootstrap.mk\n' | emake -f - f)
167         )
168         for d in "${dirs[@]}" ; do
169                 [[ -e ${d} ]] && continue
170                 pushd ${d/%configure/.} >/dev/null || die
171                 AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" \
172                 multijob_child_init eautoreconf
173                 popd >/dev/null
174         done
175         multijob_finish
176         elibtoolize
177
178         if [[ ${PV} == "9999" ]] || use java ; then #558798
179                 tc-env_build emake -f codegenerator.mk
180         fi
181
182         # Disable internal func checks as our USE/DEPEND
183         # stuff handles this just fine already #408395
184         export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
185
186         # Fix the final version string showing as "exported"
187         # instead of the SVN revision number.
188         export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
189
190         # avoid long delays when powerkit isn't running #348580
191         sed -i \
192                 -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
193                 xbmc/linux/*.cpp || die
194
195         # Tweak autotool timestamps to avoid regeneration
196         find . -type f -exec touch -r configure {} +
197 }
198
199 src_configure() {
200         # Disable documentation generation
201         export ac_cv_path_LATEX=no
202         # Avoid help2man
203         export HELP2MAN=$(type -P help2man || echo true)
204         # No configure flage for this #403561
205         export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
206         # Requiring java is asine #434662
207         [[ ${PV} != "9999" ]] && export ac_cv_path_JAVA_EXE=$(which $(usex java java true))
208
209         econf \
210                 --docdir=/usr/share/doc/${PF} \
211                 --disable-ccache \
212                 --disable-optimizations \
213                 --with-ffmpeg=shared \
214                 $(use_enable alsa) \
215                 $(use_enable airplay) \
216                 $(use_enable avahi) \
217                 $(use_enable bluray libbluray) \
218                 $(use_enable caps libcap) \
219                 $(use_enable cec libcec) \
220                 $(use_enable css dvdcss) \
221                 $(use_enable dbus) \
222                 $(use_enable debug) \
223                 $(use_enable gles) \
224                 $(use_enable joystick) \
225                 $(use_enable midi mid) \
226                 $(use_enable mysql) \
227                 $(use_enable nfs) \
228                 $(use_enable opengl gl) \
229                 $(use_enable profile profiling) \
230                 $(use_enable pulseaudio pulse) \
231                 $(use_enable rtmp) \
232                 $(use_enable samba) \
233                 $(use_enable sftp ssh) \
234                 $(use_enable usb libusb) \
235                 $(use_enable test gtest) \
236                 $(use_enable texturepacker) \
237                 $(use_enable upnp) \
238                 $(use_enable vaapi) \
239                 $(use_enable vdpau) \
240                 $(use_enable webserver) \
241                 $(use_enable X x11)
242 }
243
244 src_compile() {
245         emake V=1
246 }
247
248 src_install() {
249         default
250         rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}* || die
251
252         domenu tools/Linux/kodi.desktop
253         newicon media/icon48x48.png kodi.png
254
255         # Remove fonconfig settings that are used only on MacOSX.
256         # Can't be patched upstream because they just find all files and install
257         # them into same structure like they have in git.
258         rm -rf "${ED}"/usr/share/kodi/system/players/dvdplayer/etc
259
260         # Replace bundled fonts with system ones.
261         rm "${ED}"/usr/share/kodi/addons/skin.confluence/fonts/Roboto-* || die
262         dosym /usr/share/fonts/roboto/Roboto-Regular.ttf \
263                 /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Regular.ttf
264         dosym /usr/share/fonts/roboto/Roboto-Bold.ttf \
265                 /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Bold.ttf
266
267         python_domodule tools/EventClients/lib/python/xbmcclient.py
268         python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send
269 }