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>
6 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)
26 #:use-module (guix git-download)
27 #:use-module (guix build-system cmake)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
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)
35 #:use-module (gnu packages bash)
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)
41 #:use-module (gnu packages documentation)
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)
59 #:use-module (gnu packages pretty-print)
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)
74 #:use-module (gnu packages assembly))
76 (define-public crossguid
77 (let ((commit "8f399e8bd4252be9952f3dfa8199924cc8487ca4"))
80 (version (string-append "0.0-1." (string-take commit 7)))
81 ;; There's no official release. Just a Git repository.
85 (url "https://github.com/graeme-hill/crossguid.git")
87 (file-name (string-append name "-" version "-checkout"))
90 "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9"))))
91 (build-system gnu-build-system)
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.
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")))))
104 (and (zero? (system* "g++" "-c" "test.cpp" "-o" "test.o"
106 (zero? (system* "g++" "-c" "testmain.cpp" "-o" "testmain.o"
108 (zero? (system* "g++" "test.o" "guid.o" "testmain.o"
109 "-o" "test" "-luuid"))
110 (zero? (system* (string-append (getcwd) "/test"))))))
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"))
119 `(("util-linux" ,util-linux)))
120 (synopsis "Lightweight universal identifier library")
121 (description "CrossGuid is a minimal GUID/UUID
122 generator library for C++.")
123 (home-page "https://github.com/graeme-hill/crossguid")
124 (license license:expat))))
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 "6.0.0-Leia-Alpha-1"))
133 (name "libdvdnav-bootstrapped")
138 (url "https://github.com/xbmc/libdvdnav.git")
140 (file-name (string-append name "-" version "-checkout"))
143 "1xiyfgf8v8aknlxlzsvk6pbzkhclz0hbh3s1b0w6ivkng2k310j9"))))
144 (build-system gnu-build-system)
148 (modify-phases %standard-phases
149 (add-after 'unpack 'bootstrap
150 (lambda _ (zero? (system* "autoreconf" "-vif"))))
154 (lambda* (#:key outputs #:allow-other-keys)
155 (copy-recursively "." (assoc-ref outputs "out"))
158 `(("autoconf" ,autoconf)
159 ("automake" ,automake)
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+))))
167 (define libdvdread/kodi
168 (let ((commit "6.0.0-Leia-Alpha-1"))
170 (name "libdvdread-bootstrapped")
175 (url "https://github.com/xbmc/libdvdread.git")
177 (file-name (string-append name "-" version "-checkout"))
180 "1c3g18n2vwhgcfz3dka1pmw58bnv2ram7xjvizfiykb3sgi9zfwp"))))
181 (build-system gnu-build-system)
185 (modify-phases %standard-phases
186 (add-after 'unpack 'bootstrap
187 (lambda _ (zero? (system* "autoreconf" "-vif"))))
191 (lambda* (#:key outputs #:allow-other-keys)
192 (copy-recursively "." (assoc-ref outputs "out"))
195 `(("autoconf" ,autoconf)
196 ("automake" ,automake)
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+)))))
204 (define libdvdcss/kodi
205 (let ((commit "1.4.1-Leia-Alpha-1"))
207 (name "libdvdcss-bootstrapped")
212 (url "https://github.com/xbmc/libdvdcss.git")
214 (file-name (string-append name "-" version "-checkout"))
217 "0adafwsawxssj3nilkql447v0l4a2584rdpmy5rfjmznh91lykgh"))))
218 (build-system gnu-build-system)
222 (modify-phases %standard-phases
223 (add-after 'unpack 'bootstrap
224 (lambda _ (zero? (system* "autoreconf" "-vif"))))
228 (lambda* (#:key outputs #:allow-other-keys)
229 (copy-recursively "." (assoc-ref outputs "out"))
232 `(("autoconf" ,autoconf)
233 ("automake" ,automake)
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+))))
242 ;; We package the git version because the current released
243 ;; version was cut while the cmake transition was in turmoil.
244 (let ((commit "ec16dbca4dcf2923f53f819695a6d47c52e68d74")
248 (version (git-version "18.0_alpha" revision commit))
252 (url "https://github.com/xbmc/xbmc.git")
254 (file-name (git-file-name name version))
257 "1rxg752cl59124cfpfwmyjldn6qpq5jginxddpzvgagfadf10i4d"))
260 (use-modules (guix build utils))
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"
271 "lib/libUPnP/Neptune/ThirdParty"
272 "project/Win32BuildSetup/tools/7z"))
274 (modules '((guix build utils)))))
275 (build-system cmake-build-system)
277 '(#:modules ((srfi srfi-1)
278 (guix build cmake-build-system)
281 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
282 "-DENABLE_INTERNAL_CROSSGUID=OFF"
283 (string-append "-Dlibdvdread_URL="
284 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
285 (string-append "-Dlibdvdnav_URL="
286 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
287 (string-append "-Dlibdvdcss_URL="
288 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
289 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
290 (assoc-ref %build-inputs "curl") "/lib"))
292 (modify-phases %standard-phases
293 ;; The build system tries to bootstrap these bundled components
294 ;; during the regular build phase, which causes serious issues
295 ;; because there's no time for shebangs to be patched. So, we
296 ;; bootstrap it on our own instead.
297 (add-after 'unpack 'bootstrap-bundled-software
299 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
301 (every (lambda (third-party)
302 (with-directory-excursion third-party
303 (zero? (system* "autoreconf" "-vif"))))
305 (add-after 'bootstrap-bundled-software 'patch-stuff
306 (lambda* (#:key inputs #:allow-other-keys)
307 ;; Prevent the build scripts from calling autoreconf in the
308 ;; build stage. Otherwise, it would undo the bootstrapping
309 ;; and shebang patching that we worked so hard for.
310 (substitute* "cmake/modules/FindCpluff.cmake"
311 (("autoreconf -vif") "true"))
312 (substitute* "lib/cpluff/po/Makefile.in.in"
313 (("/bin/sh") (which "sh")))
314 (substitute* "cmake/modules/FindLibDvd.cmake"
315 ;; The libdvd* sources that we bootstrapped separately are
316 ;; unpacked in the build phase. This is our best opportunity
317 ;; to make them writable before the build process starts.
318 (("autoreconf -vif") "chmod -R u+w ."))
320 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
321 (("/usr/share/zoneinfo")
322 (string-append (assoc-ref inputs "tzdata")
325 ;; Let's disable some tests that are known not to work here.
326 ;; Doing this later while in the cmake "../build" directory
328 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
329 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
330 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
331 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
332 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
333 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
334 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
336 (add-before 'build 'set-build-environment
338 ;; Some bundled build scripts fall back to /bin/sh
339 ;; if this is not set.
340 (setenv "CONFIG_SHELL" (which "sh"))
342 (add-before 'check 'build-kodi-test
344 (zero? (system* "make" "kodi-test")))))))
345 ;; TODO: Add dependencies for:
351 `(("autoconf" ,autoconf)
352 ("automake" ,automake)
353 ("gettext" ,gettext-minimal)
354 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
355 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
356 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
357 ("libdvdread-bootstrapped" ,libdvdread/kodi)
359 ("pkg-config" ,pkg-config)
363 `(("alsa-lib" ,alsa-lib)
366 ("crossguid" ,crossguid)
374 ("fontconfig" ,fontconfig)
375 ("freetype" ,freetype)
383 ("libbluray" ,libbluray)
387 ("libgcrypt" ,libgcrypt)
391 ("libmicrohttpd" ,libmicrohttpd)
392 ("libmpeg2" ,libmpeg2)
398 ("libvorbis" ,libvorbis)
400 ("libxrandr" ,libxrandr)
401 ("libxrender" ,libxrender)
407 ("pulseaudio" ,pulseaudio)
409 ("rapidjson" ,rapidjson)
415 ("util-linux" ,util-linux)
418 (synopsis "Media center for home theater computers")
419 (description "Kodi is a media center application for playing videos,
420 music, games, etc. Kodi is highly customizable and features a theme and
422 (home-page "https://kodi.tv")
423 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
424 ;; there are some other licenses spread throughout.
425 (license (list license:gpl2+ license:lgpl2.1+
426 license:gpl3+ ;WiiRemote client
427 license:expat ;cpluff, dbwrappers
428 license:public-domain ;cpluff/examples
429 license:bsd-3 ;misc, gtest
430 license:bsd-2))))) ;xbmc/freebsd
432 (define-public kodi-cli
433 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
434 (revision "1")) ; `$HOME/.kodirc'.
437 (version (string-append "1.1-" revision "." (string-take commit 7)))
440 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
444 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
445 (file-name (string-append name "-" version "-checkout"))))
446 (build-system trivial-build-system)
450 ("mps-youtube" ,mps-youtube)))
452 `(#:modules ((guix build utils))
455 (use-modules (guix build utils))
456 (copy-recursively (assoc-ref %build-inputs "source") ".")
457 (substitute* "kodi-cli"
458 (("/bin/bash") (string-append (assoc-ref %build-inputs "bash")
460 (("output=\\$\\((curl)" all curl)
461 (string-append "output=$("
462 (assoc-ref %build-inputs "curl")
464 (("play_youtube `(mpsyt)" all mpsyt)
465 (string-append "play_youtube `"
466 (assoc-ref %build-inputs "mps-youtube")
468 (install-file "kodi-cli" (string-append %output "/bin"))
470 (home-page "https://github.com/nawar/kodi-cli")
471 (synopsis "Control Kodi from the command line")
472 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
473 server using JSON RPC.
478 @item Play, pause, stop the currently playing item.
479 @item Skip forward or backward in the currently playing item.
480 @item Play or queue to the currently list of YouTube videos.
481 @item Interactive and noninteractive volume control.
482 @item Interactive navigation.
483 @item Send text to the Kodi keyboard.
484 @item Toggle fullscreen.
485 @item Update or clean Kodi libraries.
487 (license license:gpl2+))))