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