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