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
152 (lambda* (#:key outputs #:allow-other-keys)
153 (copy-recursively "." (assoc-ref outputs "out"))
156 `(("autoconf" ,autoconf)
157 ("automake" ,automake)
159 ("pkg-config" ,pkg-config)))
160 (home-page "https://github.com/xbmc/libdvdnav")
161 (synopsis (package-synopsis libdvdnav))
162 (description (package-description libdvdnav))
163 (license license:gpl2+))))
165 (define libdvdread/kodi
166 (let ((commit "6.0.0-Leia-Alpha-1"))
168 (name "libdvdread-bootstrapped")
173 (url "https://github.com/xbmc/libdvdread.git")
175 (file-name (string-append name "-" version "-checkout"))
178 "1c3g18n2vwhgcfz3dka1pmw58bnv2ram7xjvizfiykb3sgi9zfwp"))))
179 (build-system gnu-build-system)
183 (modify-phases %standard-phases
187 (lambda* (#:key outputs #:allow-other-keys)
188 (copy-recursively "." (assoc-ref outputs "out"))
191 `(("autoconf" ,autoconf)
192 ("automake" ,automake)
194 ("pkg-config" ,pkg-config)))
195 (home-page "https://github.com/xbmc/libdvdread")
196 (synopsis (package-synopsis libdvdread))
197 (description (package-description libdvdread))
198 (license (list license:gpl2+ license:lgpl2.1+)))))
200 (define libdvdcss/kodi
201 (let ((commit "1.4.1-Leia-Alpha-1"))
203 (name "libdvdcss-bootstrapped")
208 (url "https://github.com/xbmc/libdvdcss.git")
210 (file-name (string-append name "-" version "-checkout"))
213 "0adafwsawxssj3nilkql447v0l4a2584rdpmy5rfjmznh91lykgh"))))
214 (build-system gnu-build-system)
218 (modify-phases %standard-phases
222 (lambda* (#:key outputs #:allow-other-keys)
223 (copy-recursively "." (assoc-ref outputs "out"))
226 `(("autoconf" ,autoconf)
227 ("automake" ,automake)
229 ("pkg-config" ,pkg-config)))
230 (home-page "https://github.com/xbmc/libdvdcss")
231 (synopsis (package-synopsis libdvdcss))
232 (description (package-description libdvdcss))
233 (license license:gpl2+))))
236 ;; We package the git version because the current released
237 ;; version was cut while the cmake transition was in turmoil.
238 (let ((commit "ec16dbca4dcf2923f53f819695a6d47c52e68d74")
242 (version (git-version "18.0_alpha" revision commit))
246 (url "https://github.com/xbmc/xbmc.git")
248 (file-name (git-file-name name version))
251 "1rxg752cl59124cfpfwmyjldn6qpq5jginxddpzvgagfadf10i4d"))
254 (use-modules (guix build utils))
255 (for-each delete-file-recursively
256 '("project/BuildDependencies/bin/"
257 ;; TODO: Purge these jars.
258 ;;"tools/codegenerator/groovy"
259 ;; And these sources:
260 ;; "tools/depend/native/JsonSchemaBuilder"
261 ;; "tools/depend/native/TexturePacker"
265 "lib/libUPnP/Neptune/ThirdParty"
266 "project/Win32BuildSetup/tools/7z"))
268 (modules '((guix build utils)))))
269 (build-system cmake-build-system)
271 '(#:modules ((srfi srfi-1)
272 (guix build cmake-build-system)
275 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
276 "-DENABLE_INTERNAL_CROSSGUID=OFF"
277 (string-append "-Dlibdvdread_URL="
278 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
279 (string-append "-Dlibdvdnav_URL="
280 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
281 (string-append "-Dlibdvdcss_URL="
282 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
283 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
284 (assoc-ref %build-inputs "curl") "/lib"))
286 (modify-phases %standard-phases
287 ;; The build system tries to bootstrap these bundled components
288 ;; during the regular build phase, which causes serious issues
289 ;; because there's no time for shebangs to be patched. So, we
290 ;; bootstrap it on our own instead.
291 (add-after 'unpack 'bootstrap-bundled-software
293 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
295 (every (lambda (third-party)
296 (with-directory-excursion third-party
297 (zero? (system* "autoreconf" "-vif"))))
299 (add-after 'bootstrap-bundled-software 'patch-stuff
300 (lambda* (#:key inputs #:allow-other-keys)
301 ;; Prevent the build scripts from calling autoreconf in the
302 ;; build stage. Otherwise, it would undo the bootstrapping
303 ;; and shebang patching that we worked so hard for.
304 (substitute* "cmake/modules/FindCpluff.cmake"
305 (("autoreconf -vif") "true"))
306 (substitute* "lib/cpluff/po/Makefile.in.in"
307 (("/bin/sh") (which "sh")))
308 (substitute* "cmake/modules/FindLibDvd.cmake"
309 ;; The libdvd* sources that we bootstrapped separately are
310 ;; unpacked in the build phase. This is our best opportunity
311 ;; to make them writable before the build process starts.
312 (("autoreconf -vif") "chmod -R u+w ."))
314 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
315 (("/usr/share/zoneinfo")
316 (string-append (assoc-ref inputs "tzdata")
319 ;; Let's disable some tests that are known not to work here.
320 ;; Doing this later while in the cmake "../build" directory
322 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
323 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
324 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
325 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
326 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
327 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
328 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
330 (add-before 'build 'set-build-environment
332 ;; Some bundled build scripts fall back to /bin/sh
333 ;; if this is not set.
334 (setenv "CONFIG_SHELL" (which "sh"))
336 (add-before 'check 'build-kodi-test
338 (zero? (system* "make" "kodi-test")))))))
339 ;; TODO: Add dependencies for:
345 `(("autoconf" ,autoconf)
346 ("automake" ,automake)
347 ("gettext" ,gettext-minimal)
348 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
349 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
350 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
351 ("libdvdread-bootstrapped" ,libdvdread/kodi)
353 ("pkg-config" ,pkg-config)
357 `(("alsa-lib" ,alsa-lib)
360 ("crossguid" ,crossguid)
368 ("fontconfig" ,fontconfig)
369 ("freetype" ,freetype)
377 ("libbluray" ,libbluray)
381 ("libgcrypt" ,libgcrypt)
385 ("libmicrohttpd" ,libmicrohttpd)
386 ("libmpeg2" ,libmpeg2)
392 ("libvorbis" ,libvorbis)
394 ("libxrandr" ,libxrandr)
395 ("libxrender" ,libxrender)
401 ("pulseaudio" ,pulseaudio)
403 ("rapidjson" ,rapidjson)
409 ("util-linux" ,util-linux)
412 (synopsis "Media center for home theater computers")
413 (description "Kodi is a media center application for playing videos,
414 music, games, etc. Kodi is highly customizable and features a theme and
416 (home-page "https://kodi.tv")
417 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
418 ;; there are some other licenses spread throughout.
419 (license (list license:gpl2+ license:lgpl2.1+
420 license:gpl3+ ;WiiRemote client
421 license:expat ;cpluff, dbwrappers
422 license:public-domain ;cpluff/examples
423 license:bsd-3 ;misc, gtest
424 license:bsd-2))))) ;xbmc/freebsd
426 (define-public kodi-cli
427 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
428 (revision "1")) ; `$HOME/.kodirc'.
431 (version (string-append "1.1-" revision "." (string-take commit 7)))
434 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
438 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
439 (file-name (string-append name "-" version "-checkout"))))
440 (build-system trivial-build-system)
444 ("mps-youtube" ,mps-youtube)))
446 `(#:modules ((guix build utils))
449 (use-modules (guix build utils))
450 (copy-recursively (assoc-ref %build-inputs "source") ".")
451 (substitute* "kodi-cli"
452 (("/bin/bash") (string-append (assoc-ref %build-inputs "bash")
454 (("output=\\$\\((curl)" all curl)
455 (string-append "output=$("
456 (assoc-ref %build-inputs "curl")
458 (("play_youtube `(mpsyt)" all mpsyt)
459 (string-append "play_youtube `"
460 (assoc-ref %build-inputs "mps-youtube")
462 (install-file "kodi-cli" (string-append %output "/bin"))
464 (home-page "https://github.com/nawar/kodi-cli")
465 (synopsis "Control Kodi from the command line")
466 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
467 server using JSON RPC.
472 @item Play, pause, stop the currently playing item.
473 @item Skip forward or backward in the currently playing item.
474 @item Play or queue to the currently list of YouTube videos.
475 @item Interactive and noninteractive volume control.
476 @item Interactive navigation.
477 @item Send text to the Kodi keyboard.
478 @item Toggle fullscreen.
479 @item Update or clean Kodi libraries.
481 (license license:gpl2+))))