media-tv/kodi: run the codegenerator when USE=java #558798
[gentoo.git] / media-tv / kodi / kodi-14.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 python-single-r1 multiprocessing autotools
13
14 CODENAME="Helix"
15 case ${PV} in
16 9999)
17         EGIT_REPO_URI="git://github.com/xbmc/xbmc.git"
18         inherit git-2
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                 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 avahi bluetooth bluray caps cec css debug +fishbmc gles goom java joystick midi mysql nfs +opengl profile +projectm pulseaudio pvr +rsxs rtmp +samba sdl sftp test +texturepacker udisks upnp upower +usb vaapi vdpau webserver +X +xrandr"
37 REQUIRED_USE="
38         pvr? ( mysql )
39         rsxs? ( X )
40         xrandr? ( X )
41         joystick? ( sdl )
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-2.2 )
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         media-libs/alsa-lib
65         media-libs/flac
66         media-libs/fontconfig
67         media-libs/freetype
68         >=media-libs/glew-1.5.6
69         media-libs/jasper
70         media-libs/jbigkit
71         >=media-libs/libass-0.9.7
72         bluray? ( media-libs/libbluray )
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
79         projectm? ( media-libs/libprojectm )
80         media-libs/libsamplerate
81         sdl? ( media-libs/libsdl2 )
82         >=media-libs/taglib-1.8
83         media-libs/libvorbis
84         media-libs/tiff
85         pulseaudio? ( media-sound/pulseaudio )
86         media-sound/wavpack
87         >=media-video/ffmpeg-2.4:=[encode]
88         rtmp? ( media-video/rtmpdump )
89         avahi? ( net-dns/avahi )
90         nfs? ( net-fs/libnfs )
91         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         sys-apps/dbus
97         caps? ( sys-libs/libcap )
98         sys-libs/zlib
99         virtual/jpeg
100         usb? ( virtual/libusb )
101         mysql? ( virtual/mysql )
102         opengl? (
103                 virtual/glu
104                 virtual/opengl
105         )
106         gles? (
107                 virtual/opengl
108                 media-libs/mesa[gles2]
109         )
110         vaapi? ( x11-libs/libva[opengl] )
111         vdpau? (
112                 || ( x11-libs/libvdpau >=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                 xrandr? ( 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-util/gperf
130         texturepacker? (
131                 media-libs/libsdl
132                 media-libs/sdl-image
133         )
134         sdl? ( media-libs/sdl-image )
135         X? ( x11-proto/xineramaproto )
136         dev-util/cmake
137         x86? ( dev-lang/nasm )
138         java? ( virtual/jre )
139         test? ( dev-cpp/gtest )"
140 # Force java for latest git version to avoid having to hand maintain the
141 # generated addons package.  #488118
142 [[ ${PV} == "9999" ]] && DEPEND+=" virtual/jre"
143
144 pkg_setup() {
145         python-single-r1_pkg_setup
146 }
147
148 src_unpack() {
149         [[ ${PV} == "9999" ]] && git-2_src_unpack || default
150 }
151
152 src_prepare() {
153         epatch "${FILESDIR}"/${PN}-9999-nomythtv.patch
154         epatch "${FILESDIR}"/${P}-no-arm-flags.patch #400617
155         epatch "${FILESDIR}"/${PN}-14.0-dvddemux-ffmpeg.patch #526992#36
156         epatch "${FILESDIR}"/${P}-gcc-5.patch #557300
157         # The mythtv patch touches configure.ac, so force a regen
158         rm -f configure
159
160         # some dirs ship generated autotools, some dont
161         multijob_init
162         local d
163         for d in $(printf 'f:\n\t@echo $(BOOTSTRAP_TARGETS)\ninclude bootstrap.mk\n' | emake -f - f) ; do
164                 [[ -e ${d} ]] && continue
165                 pushd ${d/%configure/.} >/dev/null || die
166                 AT_NOELIBTOOLIZE="yes" AT_TOPLEVEL_EAUTORECONF="yes" \
167                 multijob_child_init eautoreconf
168                 popd >/dev/null
169         done
170         multijob_finish
171         elibtoolize
172
173         [[ ${PV} == "9999" ]] && emake -f codegenerator.mk
174
175         # Disable internal func checks as our USE/DEPEND
176         # stuff handles this just fine already #408395
177         export ac_cv_lib_avcodec_ff_vdpau_vc1_decode_picture=yes
178
179         # Fix the final version string showing as "exported"
180         # instead of the SVN revision number.
181         export HAVE_GIT=no GIT_REV=${EGIT_VERSION:-exported}
182
183         # avoid long delays when powerkit isn't running #348580
184         sed -i \
185                 -e '/dbus_connection_send_with_reply_and_block/s:-1:3000:' \
186                 xbmc/linux/*.cpp || die
187
188         epatch_user #293109
189
190         # Tweak autotool timestamps to avoid regeneration
191         find . -type f -exec touch -r configure {} +
192 }
193
194 src_configure() {
195         # Disable documentation generation
196         export ac_cv_path_LATEX=no
197         # Avoid help2man
198         export HELP2MAN=$(type -P help2man || echo true)
199         # No configure flage for this #403561
200         export ac_cv_lib_bluetooth_hci_devid=$(usex bluetooth)
201         # Requiring java is asine #434662
202         [[ ${PV} != "9999" ]] && export ac_cv_path_JAVA_EXE=$(which $(usex java java true))
203
204         econf \
205                 --docdir=/usr/share/doc/${PF} \
206                 --disable-ccache \
207                 --disable-optimizations \
208                 --with-ffmpeg=shared \
209                 $(use_enable airplay) \
210                 $(use_enable avahi) \
211                 $(use_enable bluray libbluray) \
212                 $(use_enable caps libcap) \
213                 $(use_enable cec libcec) \
214                 $(use_enable css dvdcss) \
215                 $(use_enable debug) \
216                 $(use_enable fishbmc) \
217                 $(use_enable gles) \
218                 $(use_enable goom) \
219                 $(use_enable joystick) \
220                 $(use_enable midi mid) \
221                 $(use_enable mysql) \
222                 $(use_enable nfs) \
223                 $(use_enable opengl gl) \
224                 $(use_enable profile profiling) \
225                 $(use_enable projectm) \
226                 $(use_enable pulseaudio pulse) \
227                 $(use_enable pvr mythtv) \
228                 $(use_enable rsxs) \
229                 $(use_enable rtmp) \
230                 $(use_enable samba) \
231                 $(use_enable sdl) \
232                 $(use_enable sftp ssh) \
233                 $(use_enable usb libusb) \
234                 $(use_enable test gtest) \
235                 $(use_enable texturepacker) \
236                 $(use_enable upnp) \
237                 $(use_enable vaapi) \
238                 $(use_enable vdpau) \
239                 $(use_enable webserver) \
240                 $(use_enable X x11) \
241                 $(use_enable xrandr)
242 }
243
244 src_install() {
245         default
246         rm "${ED}"/usr/share/doc/*/{LICENSE.GPL,copying.txt}*
247
248         domenu tools/Linux/kodi.desktop
249         newicon media/icon48x48.png kodi.png
250
251         # Remove optional addons (platform specific and disabled by USE flag).
252         local disabled_addons=(
253                 repository.pvr-{android,ios,osx{32,64},win32}.xbmc.org
254                 visualization.dxspectrum
255         )
256         use fishbmc  || disabled_addons+=( visualization.fishbmc )
257         use projectm || disabled_addons+=( visualization.{milkdrop,projectm} )
258         use rsxs     || disabled_addons+=( screensaver.rsxs.{euphoria,plasma,solarwinds} )
259         rm -rf "${disabled_addons[@]/#/${ED}/usr/share/kodi/addons/}"
260
261         # Remove fonconfig settings that are used only on MacOSX.
262         # Can't be patched upstream because they just find all files and install
263         # them into same structure like they have in git.
264         rm -rf "${ED}"/usr/share/kodi/system/players/dvdplayer/etc
265
266         # Replace bundled fonts with system ones
267         # teletext.ttf: unknown
268         # bold-caps.ttf: unknown
269         # roboto: roboto-bold, roboto-regular
270         # arial.ttf: font mashed from droid/roboto, not removed wrt bug#460514
271         rm -rf "${ED}"/usr/share/kodi/addons/skin.confluence/fonts/Roboto-*
272         dosym /usr/share/fonts/roboto/Roboto-Regular.ttf \
273                 /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Regular.ttf
274         dosym /usr/share/fonts/roboto/Roboto-Bold.ttf \
275                 /usr/share/kodi/addons/skin.confluence/fonts/Roboto-Bold.ttf
276
277         python_domodule tools/EventClients/lib/python/xbmcclient.py
278         python_newscript "tools/EventClients/Clients/Kodi Send/kodi-send.py" kodi-send
279 }