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