gnu: kodi: Update to 18.0_alpha-8.ec16dbc.
[jackhill/guix/guix.git] / gnu / packages / kodi.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
4 ;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages kodi)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix utils)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
30 #:use-module (gnu packages algebra)
31 #:use-module (gnu packages audio)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages avahi)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages cdrom)
37 #:use-module (gnu packages cmake)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages curl)
40 #:use-module (gnu packages databases)
41 #:use-module (gnu packages documentation)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages fribidi)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages ghostscript)
46 #:use-module (gnu packages gawk)
47 #:use-module (gnu packages gl)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages gperf)
50 #:use-module (gnu packages gnunet)
51 #:use-module (gnu packages gnupg)
52 #:use-module (gnu packages image)
53 #:use-module (gnu packages java)
54 #:use-module (gnu packages libusb)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages mp3)
57 #:use-module (gnu packages pcre)
58 #:use-module (gnu packages pkg-config)
59 #:use-module (gnu packages pretty-print)
60 #:use-module (gnu packages pulseaudio)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages samba)
63 #:use-module (gnu packages sdl)
64 #:use-module (gnu packages ssh)
65 #:use-module (gnu packages swig)
66 #:use-module (gnu packages textutils)
67 #:use-module (gnu packages tls)
68 #:use-module (gnu packages video)
69 #:use-module (gnu packages web)
70 #:use-module (gnu packages xdisorg)
71 #:use-module (gnu packages xiph)
72 #:use-module (gnu packages xml)
73 #:use-module (gnu packages xorg)
74 #:use-module (gnu packages assembly))
75
76 (define-public crossguid
77 (let ((commit "8f399e8bd4252be9952f3dfa8199924cc8487ca4"))
78 (package
79 (name "crossguid")
80 (version (string-append "0.0-1." (string-take commit 7)))
81 ;; There's no official release. Just a Git repository.
82 (source (origin
83 (method git-fetch)
84 (uri (git-reference
85 (url "https://github.com/graeme-hill/crossguid.git")
86 (commit commit)))
87 (file-name (string-append name "-" version "-checkout"))
88 (sha256
89 (base32
90 "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9"))))
91 (build-system gnu-build-system)
92 (arguments
93 '(#:phases
94 (modify-phases %standard-phases
95 (delete 'configure) ; no configure script
96 ;; There's no build system here, so we have to do it ourselves.
97 (replace 'build
98 (lambda _
99 (and (zero? (system* "g++" "-c" "guid.cpp" "-o" "guid.o"
100 "-std=c++11" "-DGUID_LIBUUID"))
101 (zero? (system* "ar" "rvs" "libcrossguid.a" "guid.o")))))
102 (replace 'check
103 (lambda _
104 (and (zero? (system* "g++" "-c" "test.cpp" "-o" "test.o"
105 "-std=c++11"))
106 (zero? (system* "g++" "-c" "testmain.cpp" "-o" "testmain.o"
107 "-std=c++11"))
108 (zero? (system* "g++" "test.o" "guid.o" "testmain.o"
109 "-o" "test" "-luuid"))
110 (zero? (system* (string-append (getcwd) "/test"))))))
111 (replace 'install
112 (lambda* (#:key outputs #:allow-other-keys)
113 (let ((out (assoc-ref outputs "out")))
114 (install-file "guid.h" (string-append out "/include"))
115 (install-file "libcrossguid.a"
116 (string-append out "/lib"))
117 #t))))))
118 (inputs
119 `(("util-linux" ,util-linux)))
120 (synopsis "Lightweight universal identifier library")
121 (description "CrossGuid is a minimal GUID/UUID
122 generator library for C++.")
123 (home-page "https://github.com/graeme-hill/crossguid")
124 (license license:expat))))
125
126 ;; Kodi requires using their own special forks of these libraries.
127 ;; In addition, it insists on downloading and building these as part
128 ;; of the standard build process. To make things easier, we bootstrap
129 ;; and patch shebangs here, so we don't have to worry about it later.
130 (define libdvdnav/kodi
131 (let ((commit "6.0.0-Leia-Alpha-1"))
132 (package
133 (name "libdvdnav-bootstrapped")
134 (version commit)
135 (source (origin
136 (method git-fetch)
137 (uri (git-reference
138 (url "https://github.com/xbmc/libdvdnav.git")
139 (commit commit)))
140 (file-name (string-append name "-" version "-checkout"))
141 (sha256
142 (base32
143 "1xiyfgf8v8aknlxlzsvk6pbzkhclz0hbh3s1b0w6ivkng2k310j9"))))
144 (build-system gnu-build-system)
145 (arguments
146 '(#:tests? #f
147 #:phases
148 (modify-phases %standard-phases
149 (add-after 'unpack 'bootstrap
150 (lambda _ (zero? (system* "autoreconf" "-vif"))))
151 (delete 'configure)
152 (delete 'build)
153 (replace 'install
154 (lambda* (#:key outputs #:allow-other-keys)
155 (copy-recursively "." (assoc-ref outputs "out"))
156 #t)))))
157 (native-inputs
158 `(("autoconf" ,autoconf)
159 ("automake" ,automake)
160 ("libtool" ,libtool)
161 ("pkg-config" ,pkg-config)))
162 (home-page "https://github.com/xbmc/libdvdnav")
163 (synopsis (package-synopsis libdvdnav))
164 (description (package-description libdvdnav))
165 (license license:gpl2+))))
166
167 (define libdvdread/kodi
168 (let ((commit "6.0.0-Leia-Alpha-1"))
169 (package
170 (name "libdvdread-bootstrapped")
171 (version commit)
172 (source (origin
173 (method git-fetch)
174 (uri (git-reference
175 (url "https://github.com/xbmc/libdvdread.git")
176 (commit commit)))
177 (file-name (string-append name "-" version "-checkout"))
178 (sha256
179 (base32
180 "1c3g18n2vwhgcfz3dka1pmw58bnv2ram7xjvizfiykb3sgi9zfwp"))))
181 (build-system gnu-build-system)
182 (arguments
183 '(#:tests? #f
184 #:phases
185 (modify-phases %standard-phases
186 (add-after 'unpack 'bootstrap
187 (lambda _ (zero? (system* "autoreconf" "-vif"))))
188 (delete 'configure)
189 (delete 'build)
190 (replace 'install
191 (lambda* (#:key outputs #:allow-other-keys)
192 (copy-recursively "." (assoc-ref outputs "out"))
193 #t)))))
194 (native-inputs
195 `(("autoconf" ,autoconf)
196 ("automake" ,automake)
197 ("libtool" ,libtool)
198 ("pkg-config" ,pkg-config)))
199 (home-page "https://github.com/xbmc/libdvdread")
200 (synopsis (package-synopsis libdvdread))
201 (description (package-description libdvdread))
202 (license (list license:gpl2+ license:lgpl2.1+)))))
203
204 (define libdvdcss/kodi
205 (let ((commit "1.4.1-Leia-Alpha-1"))
206 (package
207 (name "libdvdcss-bootstrapped")
208 (version commit)
209 (source (origin
210 (method git-fetch)
211 (uri (git-reference
212 (url "https://github.com/xbmc/libdvdcss.git")
213 (commit commit)))
214 (file-name (string-append name "-" version "-checkout"))
215 (sha256
216 (base32
217 "0adafwsawxssj3nilkql447v0l4a2584rdpmy5rfjmznh91lykgh"))))
218 (build-system gnu-build-system)
219 (arguments
220 '(#:tests? #f
221 #:phases
222 (modify-phases %standard-phases
223 (add-after 'unpack 'bootstrap
224 (lambda _ (zero? (system* "autoreconf" "-vif"))))
225 (delete 'configure)
226 (delete 'build)
227 (replace 'install
228 (lambda* (#:key outputs #:allow-other-keys)
229 (copy-recursively "." (assoc-ref outputs "out"))
230 #t)))))
231 (native-inputs
232 `(("autoconf" ,autoconf)
233 ("automake" ,automake)
234 ("libtool" ,libtool)
235 ("pkg-config" ,pkg-config)))
236 (home-page "https://github.com/xbmc/libdvdcss")
237 (synopsis (package-synopsis libdvdcss))
238 (description (package-description libdvdcss))
239 (license license:gpl2+))))
240
241 (define-public kodi
242 ;; We package the git version because the current released
243 ;; version was cut while the cmake transition was in turmoil.
244 (let ((commit "ec16dbca4dcf2923f53f819695a6d47c52e68d74")
245 (revision "8"))
246 (package
247 (name "kodi")
248 (version (git-version "18.0_alpha" revision commit))
249 (source (origin
250 (method git-fetch)
251 (uri (git-reference
252 (url "https://github.com/xbmc/xbmc.git")
253 (commit commit)))
254 (file-name (git-file-name name version))
255 (sha256
256 (base32
257 "1rxg752cl59124cfpfwmyjldn6qpq5jginxddpzvgagfadf10i4d"))
258 (snippet
259 '(begin
260 (use-modules (guix build utils))
261 (for-each delete-file-recursively
262 '("project/BuildDependencies/bin/"
263 ;; TODO: Purge these jars.
264 ;;"tools/codegenerator/groovy"
265 ;; And these sources:
266 ;; "tools/depend/native/JsonSchemaBuilder"
267 ;; "tools/depend/native/TexturePacker"
268 ;; "lib/gtest"
269 ;; "lib/cpluff"
270 ;; "lib/libUPnP"
271 "lib/libUPnP/Neptune/ThirdParty"
272 "project/Win32BuildSetup/tools/7z"))
273 #t))
274 (modules '((guix build utils)))))
275 (build-system cmake-build-system)
276 (arguments
277 '(#:modules ((srfi srfi-1)
278 (guix build cmake-build-system)
279 (guix build utils))
280 #:configure-flags
281 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
282 "-DENABLE_INTERNAL_CROSSGUID=OFF"
283 (string-append "-Dlibdvdread_URL="
284 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
285 (string-append "-Dlibdvdnav_URL="
286 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
287 (string-append "-Dlibdvdcss_URL="
288 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
289 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
290 (assoc-ref %build-inputs "curl") "/lib"))
291 #:phases
292 (modify-phases %standard-phases
293 ;; The build system tries to bootstrap these bundled components
294 ;; during the regular build phase, which causes serious issues
295 ;; because there's no time for shebangs to be patched. So, we
296 ;; bootstrap it on our own instead.
297 (add-after 'unpack 'bootstrap-bundled-software
298 (lambda _
299 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
300 "lib/cpluff")))
301 (every (lambda (third-party)
302 (with-directory-excursion third-party
303 (zero? (system* "autoreconf" "-vif"))))
304 dirs))))
305 (add-after 'bootstrap-bundled-software 'patch-stuff
306 (lambda* (#:key inputs #:allow-other-keys)
307 ;; Prevent the build scripts from calling autoreconf in the
308 ;; build stage. Otherwise, it would undo the bootstrapping
309 ;; and shebang patching that we worked so hard for.
310 (substitute* "cmake/modules/FindCpluff.cmake"
311 (("autoreconf -vif") "true"))
312 (substitute* "lib/cpluff/po/Makefile.in.in"
313 (("/bin/sh") (which "sh")))
314 (substitute* "cmake/modules/FindLibDvd.cmake"
315 ;; The libdvd* sources that we bootstrapped separately are
316 ;; unpacked in the build phase. This is our best opportunity
317 ;; to make them writable before the build process starts.
318 (("autoreconf -vif") "chmod -R u+w ."))
319
320 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
321 (("/usr/share/zoneinfo")
322 (string-append (assoc-ref inputs "tzdata")
323 "/share/zoneinfo")))
324
325 ;; Let's disable some tests that are known not to work here.
326 ;; Doing this later while in the cmake "../build" directory
327 ;; is trickier.
328 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
329 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
330 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
331 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
332 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
333 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
334 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
335 #t))
336 (add-before 'build 'set-build-environment
337 (lambda _
338 ;; Some bundled build scripts fall back to /bin/sh
339 ;; if this is not set.
340 (setenv "CONFIG_SHELL" (which "sh"))
341 #t))
342 (add-before 'check 'build-kodi-test
343 (lambda _
344 (zero? (system* "make" "kodi-test")))))))
345 ;; TODO: Add dependencies for:
346 ;; - nfs
347 ;; - cec
348 ;; - plist
349 ;; - shairplay
350 (native-inputs
351 `(("autoconf" ,autoconf)
352 ("automake" ,automake)
353 ("gettext" ,gettext-minimal)
354 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
355 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
356 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
357 ("libdvdread-bootstrapped" ,libdvdread/kodi)
358 ("libtool" ,libtool)
359 ("pkg-config" ,pkg-config)
360 ("swig" ,swig)
361 ("yasm" ,yasm)))
362 (inputs
363 `(("alsa-lib" ,alsa-lib)
364 ("avahi" ,avahi)
365 ("bluez" ,bluez)
366 ("crossguid" ,crossguid)
367 ("curl" ,curl)
368 ("dcadec" ,dcadec)
369 ("dbus" ,dbus)
370 ("eudev" ,eudev)
371 ("ffmpeg" ,ffmpeg)
372 ("flac" ,flac)
373 ("fmt" ,fmt)
374 ("fontconfig" ,fontconfig)
375 ("freetype" ,freetype)
376 ("fribidi" ,fribidi)
377 ("giflib" ,giflib)
378 ("glew" ,glew)
379 ("gnutls" ,gnutls)
380 ("lame" ,lame)
381 ("lcms" ,lcms)
382 ("libass" ,libass)
383 ("libbluray" ,libbluray)
384 ("libcap" ,libcap)
385 ("libcdio" ,libcdio)
386 ("libdrm" ,libdrm)
387 ("libgcrypt" ,libgcrypt)
388 ("libjpeg" ,libjpeg)
389 ("libltdl" ,libltdl)
390 ("libmad" ,libmad)
391 ("libmicrohttpd" ,libmicrohttpd)
392 ("libmpeg2" ,libmpeg2)
393 ("libogg" ,libogg)
394 ("libpng" ,libpng)
395 ("libssh" ,libssh)
396 ("libtiff" ,libtiff)
397 ("libva" ,libva)
398 ("libvorbis" ,libvorbis)
399 ("libxml2" ,libxml2)
400 ("libxrandr" ,libxrandr)
401 ("libxrender" ,libxrender)
402 ("libxslt" ,libxslt)
403 ("lzo" ,lzo)
404 ("mysql" ,mysql)
405 ("openssl" ,openssl)
406 ("pcre" ,pcre)
407 ("pulseaudio" ,pulseaudio)
408 ("python" ,python-2)
409 ("rapidjson" ,rapidjson)
410 ("samba" ,samba)
411 ("sqlite" ,sqlite)
412 ("taglib" ,taglib)
413 ("tinyxml" ,tinyxml)
414 ("tzdata" ,tzdata)
415 ("util-linux" ,util-linux)
416 ("zip" ,zip)
417 ("zlib" ,zlib)))
418 (synopsis "Media center for home theater computers")
419 (description "Kodi is a media center application for playing videos,
420 music, games, etc. Kodi is highly customizable and features a theme and
421 plug-in system.")
422 (home-page "https://kodi.tv")
423 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
424 ;; there are some other licenses spread throughout.
425 (license (list license:gpl2+ license:lgpl2.1+
426 license:gpl3+ ;WiiRemote client
427 license:expat ;cpluff, dbwrappers
428 license:public-domain ;cpluff/examples
429 license:bsd-3 ;misc, gtest
430 license:bsd-2))))) ;xbmc/freebsd
431
432 (define-public kodi-cli
433 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
434 (revision "1")) ; `$HOME/.kodirc'.
435 (package
436 (name "kodi-cli")
437 (version (string-append "1.1-" revision "." (string-take commit 7)))
438 (source (origin
439 (method git-fetch)
440 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
441 (commit commit)))
442 (sha256
443 (base32
444 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
445 (file-name (string-append name "-" version "-checkout"))))
446 (build-system trivial-build-system)
447 (inputs
448 `(("bash" ,bash)
449 ("curl" ,curl)
450 ("mps-youtube" ,mps-youtube)))
451 (arguments
452 `(#:modules ((guix build utils))
453 #:builder
454 (begin
455 (use-modules (guix build utils))
456 (copy-recursively (assoc-ref %build-inputs "source") ".")
457 (substitute* "kodi-cli"
458 (("/bin/bash") (string-append (assoc-ref %build-inputs "bash")
459 "/bin/bash"))
460 (("output=\\$\\((curl)" all curl)
461 (string-append "output=$("
462 (assoc-ref %build-inputs "curl")
463 "/bin/" curl))
464 (("play_youtube `(mpsyt)" all mpsyt)
465 (string-append "play_youtube `"
466 (assoc-ref %build-inputs "mps-youtube")
467 "/bin/" mpsyt)))
468 (install-file "kodi-cli" (string-append %output "/bin"))
469 #t)))
470 (home-page "https://github.com/nawar/kodi-cli")
471 (synopsis "Control Kodi from the command line")
472 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
473 server using JSON RPC.
474
475 Features:
476
477 @itemize
478 @item Play, pause, stop the currently playing item.
479 @item Skip forward or backward in the currently playing item.
480 @item Play or queue to the currently list of YouTube videos.
481 @item Interactive and noninteractive volume control.
482 @item Interactive navigation.
483 @item Send text to the Kodi keyboard.
484 @item Toggle fullscreen.
485 @item Update or clean Kodi libraries.
486 @end itemize\n")
487 (license license:gpl2+))))