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>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
8 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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)
28 #:use-module (guix git-download)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system trivial)
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)
37 #:use-module (gnu packages bash)
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)
43 #:use-module (gnu packages documentation)
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)
52 #:use-module (gnu packages groff)
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)
62 #:use-module (gnu packages pretty-print)
63 #:use-module (gnu packages pulseaudio)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages samba)
66 #:use-module (gnu packages sdl)
67 #:use-module (gnu packages serialization)
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)
78 #:use-module (gnu packages assembly))
80 (define-public crossguid
81 (let ((commit "fef89a4174a7bf8cd99fa9154864ce9e8e3bf989")
85 (version (string-append "0.0-" revision "." (string-take commit 7)))
86 ;; This is the commit that Kodi wants.
90 (url "https://github.com/graeme-hill/crossguid.git")
92 (file-name (string-append name "-" version "-checkout"))
95 "1blrkc7zcqrqcr5msvhyhm98s2jvm9hr0isqs4288q2r4mdnrfq0"))))
96 (build-system gnu-build-system)
99 (modify-phases %standard-phases
100 (delete 'configure) ; no configure script
103 (invoke "g++" "-c" "guid.cpp" "-o" "guid.o"
104 "-std=c++11" "-DGUID_LIBUUID")
105 (invoke "ar" "rvs" "libcrossguid.a" "guid.o")))
108 (invoke "g++" "-c" "test.cpp" "-o" "test.o"
110 (invoke "g++" "-c" "testmain.cpp" "-o" "testmain.o"
112 (invoke "g++" "test.o" "guid.o" "testmain.o"
113 "-o" "test" "-luuid")
114 (invoke (string-append (getcwd) "/test"))))
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"))
123 `(("util-linux" ,util-linux)))
124 (synopsis "Lightweight universal identifier library")
125 (description "CrossGuid is a minimal GUID/UUID
126 generator library for C++.")
127 (home-page "https://github.com/graeme-hill/crossguid")
128 (license license:expat))))
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
135 (let ((commit "6.0.0-Leia-Alpha-3"))
137 (name "libdvdnav-bootstrapped")
142 (url "https://github.com/xbmc/libdvdnav.git")
144 (file-name (string-append name "-" version "-checkout"))
147 "0qwlf4lgahxqxk1r2pzl866mi03pbp7l1fc0rk522sc0ak2s9jhb"))))
148 (build-system gnu-build-system)
152 (modify-phases %standard-phases
156 (lambda* (#:key outputs #:allow-other-keys)
157 (copy-recursively "." (assoc-ref outputs "out"))
160 `(("autoconf" ,autoconf)
161 ("automake" ,automake)
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+))))
169 (define libdvdread/kodi
170 (let ((commit "6.0.0-Leia-Alpha-3"))
172 (name "libdvdread-bootstrapped")
177 (url "https://github.com/xbmc/libdvdread.git")
179 (file-name (string-append name "-" version "-checkout"))
182 "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59"))))
183 (build-system gnu-build-system)
187 (modify-phases %standard-phases
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.2-Leia-Beta-5"))
207 (name "libdvdcss-bootstrapped")
212 (url "https://github.com/xbmc/libdvdcss.git")
214 (file-name (string-append name "-" version "-checkout"))
217 "0j41ydzx0imaix069s3z07xqw9q95k7llh06fc27dcn6f7b8ydyl"))))
218 (build-system gnu-build-system)
222 (modify-phases %standard-phases
226 (lambda* (#:key outputs #:allow-other-keys)
227 (copy-recursively "." (assoc-ref outputs "out"))
230 `(("autoconf" ,autoconf)
231 ("automake" ,automake)
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+))))
239 (define-public fstrcmp
246 (uri (string-append "http://fstrcmp.sourceforge.net/fstrcmp-"
250 "0xilghiy3mz78bjmfldi39qyy7jvw5b6wafsx370lw401y2qw0g4"))))
251 (build-system gnu-build-system)
252 (home-page "http://fstrcmp.sourceforge.net/")
254 '(#:configure-flags '("SH=sh")))
256 `(("ghostscript" ,ghostscript) ; ps2pdf
260 (synopsis "fuzzy comparison of strings")
262 "The fstrcmp project provides a library that is used to make fuzzy
263 comparisons of strings and byte arrays, including multi-byte character strings.
264 This can be useful in error messages, enabling the suggestion of likely valid
265 alternatives. In compilers, this can reduce the cascade of secondary errors.")
266 (license license:gpl3+)))
275 (url "https://github.com/xbmc/xbmc.git")
276 (commit (string-append version "-Leia"))))
277 (file-name (git-file-name name version))
280 "0xzzp4x8l0ywx8aq93a1323il6wwslmgdbhasv0r8zp3w1c0wqf1"))
283 (use-modules (guix build utils))
284 (for-each delete-file-recursively
285 '("project/BuildDependencies/"
286 ;; TODO: Purge these jars.
287 ;;"tools/codegenerator/groovy"
288 ;; And these sources:
289 ;; "tools/depend/native/JsonSchemaBuilder"
290 ;; "tools/depend/native/TexturePacker"
294 "lib/libUPnP/Neptune/ThirdParty"
295 "project/Win32BuildSetup/tools/7z"))
297 (modules '((guix build utils)))))
298 (build-system cmake-build-system)
300 '(#:modules ((srfi srfi-1)
301 (guix build cmake-build-system)
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"))
312 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
313 (assoc-ref %build-inputs "curl") "/lib"))
315 (modify-phases %standard-phases
316 ;; The build system tries to bootstrap these bundled components
317 ;; during the regular build phase, which causes serious issues
318 ;; because there's no time for shebangs to be patched. So, we
319 ;; bootstrap it on our own instead.
320 (add-after 'unpack 'bootstrap-bundled-software
322 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
324 (every (lambda (third-party)
325 (with-directory-excursion third-party
326 (invoke "autoreconf" "-vif")))
328 (add-after 'bootstrap-bundled-software 'patch-stuff
329 (lambda* (#:key inputs #:allow-other-keys)
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 ."))
343 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
344 (("/usr/share/zoneinfo")
345 (string-append (assoc-ref inputs "tzdata")
348 ;; Don't phone home to check for updates.
349 (substitute* "system/addon-manifest.xml"
350 (("<addon optional=\\\"true\\\">service.xbmc.versioncheck</addon>")
353 ;; Let's disable some tests that are known not to work here.
354 ;; Doing this later while in the cmake "../build" directory
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\\)")
362 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
364 (add-before 'build 'set-build-environment
366 ;; Some bundled build scripts fall back to /bin/sh
367 ;; if this is not set.
368 (setenv "CONFIG_SHELL" (which "sh"))
370 (add-before 'check 'build-kodi-test
372 (invoke "make" "kodi-test"))))))
373 ;; TODO: Add dependencies for:
379 `(("autoconf" ,autoconf)
380 ("automake" ,automake)
381 ("gettext" ,gettext-minimal)
382 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
383 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
384 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
385 ("libdvdread-bootstrapped" ,libdvdread/kodi)
387 ("pkg-config" ,pkg-config)
391 `(("alsa-lib" ,alsa-lib)
394 ("crossguid" ,crossguid)
401 ("flatbuffers" ,flatbuffers)
403 ("fontconfig" ,fontconfig)
404 ("freetype" ,freetype)
413 ("libbluray" ,libbluray)
417 ("libgcrypt" ,libgcrypt)
421 ("libmicrohttpd" ,libmicrohttpd)
422 ("libmpeg2" ,libmpeg2)
428 ("libvorbis" ,libvorbis)
430 ("libxrandr" ,libxrandr)
431 ("libxrender" ,libxrender)
437 ("pulseaudio" ,pulseaudio)
439 ("rapidjson" ,rapidjson)
445 ("util-linux" ,util-linux)
448 (synopsis "Media center for home theater computers")
449 (description "Kodi is a media center application for playing videos,
450 music, games, etc. Kodi is highly customizable and features a theme and
452 (home-page "https://kodi.tv")
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
460 license:bsd-2)))) ;xbmc/freebsd
462 (define-public kodi-cli
463 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
464 (revision "1")) ; `$HOME/.kodirc'.
467 (version (string-append "1.1-" revision "." (string-take commit 7)))
470 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
474 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
475 (file-name (string-append name "-" version "-checkout"))))
476 (build-system trivial-build-system)
480 ("mps-youtube" ,mps-youtube)))
482 `(#:modules ((guix build utils))
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")
490 (("output=\\$\\((curl)" all curl)
491 (string-append "output=$("
492 (assoc-ref %build-inputs "curl")
494 (("play_youtube `(mpsyt)" all mpsyt)
495 (string-append "play_youtube `"
496 (assoc-ref %build-inputs "mps-youtube")
498 (install-file "kodi-cli" (string-append %output "/bin"))
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
503 server using JSON RPC.
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.
517 (license license:gpl2+))))