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