gnu: nftables: Update to 0.8.
[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>
34f5618b
DT
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)
1e3fbf3c 26 #:use-module (guix git-download)
f69e2034 27 #:use-module (guix build-system cmake)
34f5618b 28 #:use-module (guix build-system gnu)
72df48db 29 #:use-module (guix build-system trivial)
34f5618b
DT
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)
72df48db 35 #:use-module (gnu packages bash)
34f5618b
DT
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)
99828fa7 41 #:use-module (gnu packages documentation)
34f5618b
DT
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)
f69e2034 59 #:use-module (gnu packages pretty-print)
34f5618b
DT
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)
148585c2 74 #:use-module (gnu packages assembly))
34f5618b 75
1e3fbf3c
DT
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)))
7c776ddc 87 (file-name (string-append name "-" version "-checkout"))
1e3fbf3c
DT
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")
7c49ab5b 121 (description "CrossGuid is a minimal GUID/UUID
1e3fbf3c
DT
122generator library for C++.")
123 (home-page "https://github.com/graeme-hill/crossguid")
124 (license license:expat))))
125
f69e2034
MB
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 "981488f7f27554b103cca10c1fbeba027396c94a"))
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 "089pswc51l3avh95zl4cpsh7gh1innh7b2y4xgx840mcmy46ycr8"))))
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 "17d99db97e7b8f23077b342369d3c22a6250affd"))
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 "1gr5aq1cjr3as9mnwrw29cxn4m6f6pfrxdahkdcjy70q3ldg90sl"))))
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 "2f12236bc1c92f73c21e973363f79eb300de603f"))
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 "198r0q73i55ga1dvyqq9nfcri0zq08b94hy8671lg14i3izx44dd"))))
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
34f5618b 241(define-public kodi
f69e2034
MB
242 ;; We package the git version because the current released
243 ;; version was cut while the cmake transition was in turmoil.
2c320d51
MB
244 (let ((commit "f22d62dc3f6e811a538dda9c434e1804abb8b95f")
245 (revision "6"))
34f5618b
DT
246 (package
247 (name "kodi")
f69e2034 248 (version (string-append "18.0_alpha-" revision "-" (string-take commit 7)))
34f5618b 249 (source (origin
f69e2034
MB
250 (method git-fetch)
251 (uri (git-reference
252 (url "https://github.com/xbmc/xbmc.git")
253 (commit commit)))
254 (file-name (string-append name "-" version "-checkout"))
34f5618b
DT
255 (sha256
256 (base32
2c320d51 257 "0x8fqvid8b8qra327z615r2ygfkdca2p7wccdj5nfb4i5gy0sr09"))
34f5618b 258 (snippet
34f5618b
DT
259 '(begin
260 (use-modules (guix build utils))
f69e2034
MB
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"
f69e2034
MB
268 ;; "lib/gtest"
269 ;; "lib/cpluff"
270 ;; "lib/libexif"
271 ;; "lib/libUPnP"
272 "lib/libUPnP/Neptune/ThirdParty"
273 "project/Win32BuildSetup/tools/7z"))
274 #t))
34f5618b 275 (modules '((guix build utils)))))
f69e2034 276 (build-system cmake-build-system)
34f5618b 277 (arguments
f69e2034
MB
278 '(#:modules ((srfi srfi-1)
279 (guix build cmake-build-system)
280 (guix build utils))
281 #:configure-flags
282 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
283 "-DENABLE_INTERNAL_CROSSGUID=OFF"
284 (string-append "-Dlibdvdread_URL="
285 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
286 (string-append "-Dlibdvdnav_URL="
287 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
288 (string-append "-Dlibdvdcss_URL="
289 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
4951d2f3 290 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
4ec1f82c 291 (assoc-ref %build-inputs "curl") "/lib"))
34f5618b
DT
292 #:phases
293 (modify-phases %standard-phases
f69e2034
MB
294 ;; The build system tries to bootstrap these bundled components
295 ;; during the regular build phase, which causes serious issues
34f5618b
DT
296 ;; because there's no time for shebangs to be patched. So, we
297 ;; bootstrap it on our own instead.
f69e2034
MB
298 (add-after 'unpack 'bootstrap-bundled-software
299 (lambda _
300 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
301 "lib/cpluff")))
302 (every (lambda (third-party)
303 (with-directory-excursion third-party
304 (zero? (system* "autoreconf" "-vif"))))
305 dirs))))
306 (add-after 'bootstrap-bundled-software 'patch-stuff
8c011737 307 (lambda* (#:key inputs #:allow-other-keys)
f69e2034
MB
308 ;; Prevent the build scripts from calling autoreconf in the
309 ;; build stage. Otherwise, it would undo the bootstrapping
310 ;; and shebang patching that we worked so hard for.
311 (substitute* "cmake/modules/FindCpluff.cmake"
312 (("autoreconf -vif") "true"))
313 (substitute* "lib/cpluff/po/Makefile.in.in"
314 (("/bin/sh") (which "sh")))
315 (substitute* "cmake/modules/FindLibDvd.cmake"
316 ;; The libdvd* sources that we bootstrapped separately are
317 ;; unpacked in the build phase. This is our best opportunity
318 ;; to make them writable before the build process starts.
319 (("autoreconf -vif") "chmod -R u+w ."))
320
8c011737
MB
321 (substitute* "xbmc/linux/LinuxTimezone.cpp"
322 (("/usr/share/zoneinfo")
323 (string-append (assoc-ref inputs "tzdata")
324 "/share/zoneinfo")))
325
f69e2034
MB
326 ;; Let's disable some tests that are known not to work here.
327 ;; Doing this later while in the cmake "../build" directory
328 ;; is trickier.
34f5618b
DT
329 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
330 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
331 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
332 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
333 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
334 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
f69e2034 335 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
f69e2034
MB
336 #t))
337 (add-before 'build 'set-build-environment
338 (lambda _
339 ;; Some bundled build scripts fall back to /bin/sh
340 ;; if this is not set.
341 (setenv "CONFIG_SHELL" (which "sh"))
342 #t))
343 (add-before 'check 'build-kodi-test
344 (lambda _
4951d2f3 345 (zero? (system* "make" "kodi-test")))))))
34f5618b 346 ;; TODO: Add dependencies for:
34f5618b 347 ;; - nfs
f69e2034
MB
348 ;; - cec
349 ;; - plist
350 ;; - shairplay
34f5618b
DT
351 (native-inputs
352 `(("autoconf" ,autoconf)
353 ("automake" ,automake)
b94a6ca0 354 ("gettext" ,gettext-minimal)
d2540f80 355 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
f69e2034
MB
356 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
357 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
358 ("libdvdread-bootstrapped" ,libdvdread/kodi)
34f5618b
DT
359 ("libtool" ,libtool)
360 ("pkg-config" ,pkg-config)
361 ("swig" ,swig)
34f5618b
DT
362 ("yasm" ,yasm)))
363 (inputs
364 `(("alsa-lib" ,alsa-lib)
365 ("avahi" ,avahi)
366 ("bluez" ,bluez)
9ced12de 367 ("crossguid" ,crossguid)
34f5618b 368 ("curl" ,curl)
9ced12de 369 ("dcadec" ,dcadec)
34f5618b 370 ("dbus" ,dbus)
34f5618b
DT
371 ("eudev" ,eudev)
372 ("ffmpeg" ,ffmpeg)
373 ("flac" ,flac)
f69e2034 374 ("fmt" ,fmt)
34f5618b
DT
375 ("fontconfig" ,fontconfig)
376 ("freetype" ,freetype)
377 ("fribidi" ,fribidi)
f69e2034 378 ("giflib" ,giflib)
34f5618b
DT
379 ("glew" ,glew)
380 ("gnutls" ,gnutls)
34f5618b 381 ("lame" ,lame)
f69e2034 382 ("lcms" ,lcms)
34f5618b
DT
383 ("libass" ,libass)
384 ("libbluray" ,libbluray)
385 ("libcap" ,libcap)
386 ("libcdio" ,libcdio)
f69e2034 387 ("libdrm" ,libdrm)
34f5618b
DT
388 ("libgcrypt" ,libgcrypt)
389 ("libjpeg" ,libjpeg)
390 ("libltdl" ,libltdl)
391 ("libmad" ,libmad)
392 ("libmicrohttpd" ,libmicrohttpd)
34f5618b
DT
393 ("libmpeg2" ,libmpeg2)
394 ("libogg" ,libogg)
395 ("libpng" ,libpng)
34f5618b
DT
396 ("libssh" ,libssh)
397 ("libtiff" ,libtiff)
398 ("libva" ,libva)
399 ("libvorbis" ,libvorbis)
400 ("libxml2" ,libxml2)
34f5618b
DT
401 ("libxrandr" ,libxrandr)
402 ("libxrender" ,libxrender)
403 ("libxslt" ,libxslt)
34f5618b 404 ("lzo" ,lzo)
34f5618b
DT
405 ("mysql" ,mysql)
406 ("openssl" ,openssl)
407 ("pcre" ,pcre)
408 ("pulseaudio" ,pulseaudio)
409 ("python" ,python-2)
2513aac1 410 ("rapidjson" ,rapidjson)
34f5618b 411 ("samba" ,samba)
34f5618b
DT
412 ("sqlite" ,sqlite)
413 ("taglib" ,taglib)
414 ("tinyxml" ,tinyxml)
8c011737 415 ("tzdata" ,tzdata)
9ced12de 416 ("util-linux" ,util-linux)
34f5618b
DT
417 ("zip" ,zip)
418 ("zlib" ,zlib)))
419 (synopsis "Media center for home theater computers")
420 (description "Kodi is a media center application for playing videos,
421music, games, etc. Kodi is highly customizable and features a theme and
422plug-in system.")
423 (home-page "http://kodi.tv")
f69e2034
MB
424 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
425 ;; there are some other licenses spread throughout.
426 (license (list license:gpl2+ license:lgpl2.1+
427 license:gpl3+ ;WiiRemote client
428 license:expat ;cpluff, dbwrappers
429 license:public-domain ;cpluff/examples
430 license:bsd-3 ;misc, gtest
431 license:bsd-2))))) ;xbmc/freebsd
72df48db
OP
432
433(define-public kodi-cli
434 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
435 (revision "1")) ; `$HOME/.kodirc'.
436 (package
437 (name "kodi-cli")
438 (version (string-append "1.1-" revision "." (string-take commit 7)))
439 (source (origin
440 (method git-fetch)
441 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
442 (commit commit)))
443 (sha256
444 (base32
445 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
446 (file-name (string-append name "-" version "-checkout"))))
447 (build-system trivial-build-system)
448 (inputs
449 `(("bash" ,bash)
450 ("curl" ,curl)
451 ("mps-youtube" ,mps-youtube)))
452 (arguments
453 `(#:modules ((guix build utils))
454 #:builder
455 (begin
456 (use-modules (guix build utils))
457 (copy-recursively (assoc-ref %build-inputs "source") ".")
458 (substitute* "kodi-cli"
459 (("/bin/bash") (string-append (assoc-ref %build-inputs "bash")
460 "/bin/bash"))
461 (("output=\\$\\((curl)" all curl)
462 (string-append "output=$("
463 (assoc-ref %build-inputs "curl")
464 "/bin/" curl))
465 (("play_youtube `(mpsyt)" all mpsyt)
466 (string-append "play_youtube `"
467 (assoc-ref %build-inputs "mps-youtube")
468 "/bin/" mpsyt)))
469 (install-file "kodi-cli" (string-append %output "/bin"))
470 #t)))
471 (home-page "https://github.com/nawar/kodi-cli")
472 (synopsis "Control Kodi from the command line")
473 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
474server using JSON RPC.
475
476Features:
477
478@itemize
479@item Play, pause, stop the currently playing item.
480@item Skip forward or backward in the currently playing item.
481@item Play or queue to the currently list of YouTube videos.
482@item Interactive and noninteractive volume control.
483@item Interactive navigation.
484@item Send text to the Kodi keyboard.
485@item Toggle fullscreen.
486@item Update or clean Kodi libraries.
487@end itemize\n")
488 (license license:gpl2+))))