gnu: Add wl-clipboard.
[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>
2aa137e2 5;;; Copyright © 2018 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)
34f5618b
DT
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)
72df48db 37 #:use-module (gnu packages bash)
34f5618b
DT
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)
99828fa7 43 #:use-module (gnu packages documentation)
34f5618b
DT
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)
988b78ba 52 #:use-module (gnu packages groff)
34f5618b
DT
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)
f69e2034 62 #:use-module (gnu packages pretty-print)
34f5618b
DT
63 #:use-module (gnu packages pulseaudio)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages samba)
66 #:use-module (gnu packages sdl)
e3407254 67 #:use-module (gnu packages serialization)
34f5618b
DT
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)
148585c2 78 #:use-module (gnu packages assembly))
34f5618b 79
1e3fbf3c 80(define-public crossguid
e3407254
EF
81 (let ((commit "fef89a4174a7bf8cd99fa9154864ce9e8e3bf989")
82 (revision "2"))
1e3fbf3c
DT
83 (package
84 (name "crossguid")
e3407254
EF
85 (version (string-append "0.0-" revision "." (string-take commit 7)))
86 ;; This is the commit that Kodi wants.
1e3fbf3c
DT
87 (source (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://github.com/graeme-hill/crossguid.git")
91 (commit commit)))
7c776ddc 92 (file-name (string-append name "-" version "-checkout"))
1e3fbf3c
DT
93 (sha256
94 (base32
e3407254 95 "1blrkc7zcqrqcr5msvhyhm98s2jvm9hr0isqs4288q2r4mdnrfq0"))))
1e3fbf3c
DT
96 (build-system gnu-build-system)
97 (arguments
98 '(#:phases
99 (modify-phases %standard-phases
2aa137e2 100 (delete 'configure) ; no configure script
1e3fbf3c
DT
101 (replace 'build
102 (lambda _
2aa137e2
TGR
103 (invoke "g++" "-c" "guid.cpp" "-o" "guid.o"
104 "-std=c++11" "-DGUID_LIBUUID")
105 (invoke "ar" "rvs" "libcrossguid.a" "guid.o")))
1e3fbf3c
DT
106 (replace 'check
107 (lambda _
2aa137e2
TGR
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"))))
1e3fbf3c
DT
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")
7c49ab5b 125 (description "CrossGuid is a minimal GUID/UUID
1e3fbf3c
DT
126generator library for C++.")
127 (home-page "https://github.com/graeme-hill/crossguid")
128 (license license:expat))))
129
f69e2034
MB
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
e3407254 135 (let ((commit "6.0.0-Leia-Alpha-3"))
f69e2034
MB
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
e3407254 147 "0qwlf4lgahxqxk1r2pzl866mi03pbp7l1fc0rk522sc0ak2s9jhb"))))
f69e2034
MB
148 (build-system gnu-build-system)
149 (arguments
150 '(#:tests? #f
151 #:phases
152 (modify-phases %standard-phases
f69e2034
MB
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
e3407254 170 (let ((commit "6.0.0-Leia-Alpha-3"))
f69e2034
MB
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
e3407254 182 "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59"))))
f69e2034
MB
183 (build-system gnu-build-system)
184 (arguments
185 '(#:tests? #f
186 #:phases
187 (modify-phases %standard-phases
f69e2034
MB
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
e3407254 205 (let ((commit "1.4.2-Leia-Beta-5"))
f69e2034
MB
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
e3407254 217 "0j41ydzx0imaix069s3z07xqw9q95k7llh06fc27dcn6f7b8ydyl"))))
f69e2034
MB
218 (build-system gnu-build-system)
219 (arguments
220 '(#:tests? #f
221 #:phases
222 (modify-phases %standard-phases
f69e2034
MB
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
988b78ba
EF
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
263comparisons of strings and byte arrays, including multi-byte character strings.
264This can be useful in error messages, enabling the suggestion of likely valid
265alternatives. In compilers, this can reduce the cascade of secondary errors.")
266 (license license:gpl3+)))
267
34f5618b
DT
268(define-public kodi
269 (package
270 (name "kodi")
d037353c 271 (version "18.0rc3")
34f5618b 272 (source (origin
f69e2034
MB
273 (method git-fetch)
274 (uri (git-reference
275 (url "https://github.com/xbmc/xbmc.git")
e3407254 276 (commit (string-append version "-Leia"))))
9d2749f6 277 (file-name (git-file-name name version))
34f5618b
DT
278 (sha256
279 (base32
d037353c 280 "0bwi4gwmwppjw6bf0zihyg42zwnd0imq0aw4xxsgnacqakhxzii0"))
34f5618b 281 (snippet
34f5618b
DT
282 '(begin
283 (use-modules (guix build utils))
f69e2034 284 (for-each delete-file-recursively
e3407254 285 '("project/BuildDependencies/"
f69e2034
MB
286 ;; TODO: Purge these jars.
287 ;;"tools/codegenerator/groovy"
288 ;; And these sources:
289 ;; "tools/depend/native/JsonSchemaBuilder"
290 ;; "tools/depend/native/TexturePacker"
f69e2034
MB
291 ;; "lib/gtest"
292 ;; "lib/cpluff"
f69e2034
MB
293 ;; "lib/libUPnP"
294 "lib/libUPnP/Neptune/ThirdParty"
295 "project/Win32BuildSetup/tools/7z"))
296 #t))
34f5618b 297 (modules '((guix build utils)))))
f69e2034 298 (build-system cmake-build-system)
34f5618b 299 (arguments
f69e2034
MB
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"))
4951d2f3 312 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
4ec1f82c 313 (assoc-ref %build-inputs "curl") "/lib"))
34f5618b
DT
314 #:phases
315 (modify-phases %standard-phases
f69e2034
MB
316 ;; The build system tries to bootstrap these bundled components
317 ;; during the regular build phase, which causes serious issues
34f5618b
DT
318 ;; because there's no time for shebangs to be patched. So, we
319 ;; bootstrap it on our own instead.
f69e2034
MB
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
93ab9a5d 326 (invoke "autoreconf" "-vif")))
f69e2034
MB
327 dirs))))
328 (add-after 'bootstrap-bundled-software 'patch-stuff
8c011737 329 (lambda* (#:key inputs #:allow-other-keys)
f69e2034
MB
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
9d2749f6 343 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
8c011737
MB
344 (("/usr/share/zoneinfo")
345 (string-append (assoc-ref inputs "tzdata")
346 "/share/zoneinfo")))
347
cbb5d2e1
EF
348 ;; Don't phone home to check for updates.
349 (substitute* "system/addon-manifest.xml"
2c17bd7b
EF
350 (("<addon optional=\\\"true\\\">service.xbmc.versioncheck</addon>")
351 ""))
352
f69e2034
MB
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.
34f5618b
DT
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\\)")
f69e2034 362 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
f69e2034
MB
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 _
93ab9a5d 372 (invoke "make" "kodi-test"))))))
34f5618b 373 ;; TODO: Add dependencies for:
34f5618b 374 ;; - nfs
f69e2034
MB
375 ;; - cec
376 ;; - plist
377 ;; - shairplay
34f5618b
DT
378 (native-inputs
379 `(("autoconf" ,autoconf)
380 ("automake" ,automake)
b94a6ca0 381 ("gettext" ,gettext-minimal)
d2540f80 382 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
f69e2034
MB
383 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
384 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
385 ("libdvdread-bootstrapped" ,libdvdread/kodi)
34f5618b
DT
386 ("libtool" ,libtool)
387 ("pkg-config" ,pkg-config)
388 ("swig" ,swig)
34f5618b
DT
389 ("yasm" ,yasm)))
390 (inputs
391 `(("alsa-lib" ,alsa-lib)
392 ("avahi" ,avahi)
393 ("bluez" ,bluez)
9ced12de 394 ("crossguid" ,crossguid)
34f5618b 395 ("curl" ,curl)
9ced12de 396 ("dcadec" ,dcadec)
34f5618b 397 ("dbus" ,dbus)
34f5618b
DT
398 ("eudev" ,eudev)
399 ("ffmpeg" ,ffmpeg)
400 ("flac" ,flac)
e3407254 401 ("flatbuffers" ,flatbuffers)
f69e2034 402 ("fmt" ,fmt)
34f5618b
DT
403 ("fontconfig" ,fontconfig)
404 ("freetype" ,freetype)
405 ("fribidi" ,fribidi)
e3407254 406 ("fstrcmp" ,fstrcmp)
f69e2034 407 ("giflib" ,giflib)
34f5618b
DT
408 ("glew" ,glew)
409 ("gnutls" ,gnutls)
34f5618b 410 ("lame" ,lame)
f69e2034 411 ("lcms" ,lcms)
34f5618b
DT
412 ("libass" ,libass)
413 ("libbluray" ,libbluray)
414 ("libcap" ,libcap)
415 ("libcdio" ,libcdio)
f69e2034 416 ("libdrm" ,libdrm)
34f5618b
DT
417 ("libgcrypt" ,libgcrypt)
418 ("libjpeg" ,libjpeg)
419 ("libltdl" ,libltdl)
420 ("libmad" ,libmad)
421 ("libmicrohttpd" ,libmicrohttpd)
34f5618b
DT
422 ("libmpeg2" ,libmpeg2)
423 ("libogg" ,libogg)
424 ("libpng" ,libpng)
34f5618b
DT
425 ("libssh" ,libssh)
426 ("libtiff" ,libtiff)
427 ("libva" ,libva)
428 ("libvorbis" ,libvorbis)
429 ("libxml2" ,libxml2)
34f5618b
DT
430 ("libxrandr" ,libxrandr)
431 ("libxrender" ,libxrender)
432 ("libxslt" ,libxslt)
34f5618b 433 ("lzo" ,lzo)
66b9c643 434 ("mariadb" ,mariadb)
34f5618b
DT
435 ("openssl" ,openssl)
436 ("pcre" ,pcre)
437 ("pulseaudio" ,pulseaudio)
438 ("python" ,python-2)
2513aac1 439 ("rapidjson" ,rapidjson)
34f5618b 440 ("samba" ,samba)
34f5618b
DT
441 ("sqlite" ,sqlite)
442 ("taglib" ,taglib)
443 ("tinyxml" ,tinyxml)
8c011737 444 ("tzdata" ,tzdata)
9ced12de 445 ("util-linux" ,util-linux)
34f5618b
DT
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,
450music, games, etc. Kodi is highly customizable and features a theme and
451plug-in system.")
9d2749f6 452 (home-page "https://kodi.tv")
f69e2034
MB
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
e3407254 460 license:bsd-2)))) ;xbmc/freebsd
72df48db
OP
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
503server using JSON RPC.
504
505Features:
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+))))