1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages kodi)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix utils)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix build-system gnu)
28 #:use-module (gnu packages algebra)
29 #:use-module (gnu packages audio)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages avahi)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages cdrom)
34 #:use-module (gnu packages cmake)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages documentation)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages fribidi)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages ghostscript)
43 #:use-module (gnu packages gawk)
44 #:use-module (gnu packages gl)
45 #:use-module (gnu packages glib)
46 #:use-module (gnu packages gperf)
47 #:use-module (gnu packages gnunet)
48 #:use-module (gnu packages gnupg)
49 #:use-module (gnu packages image)
50 #:use-module (gnu packages java)
51 #:use-module (gnu packages libusb)
52 #:use-module (gnu packages linux)
53 #:use-module (gnu packages mp3)
54 #:use-module (gnu packages pcre)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages pretty-print)
57 #:use-module (gnu packages pulseaudio)
58 #:use-module (gnu packages python)
59 #:use-module (gnu packages samba)
60 #:use-module (gnu packages sdl)
61 #:use-module (gnu packages ssh)
62 #:use-module (gnu packages swig)
63 #:use-module (gnu packages textutils)
64 #:use-module (gnu packages tls)
65 #:use-module (gnu packages video)
66 #:use-module (gnu packages web)
67 #:use-module (gnu packages xdisorg)
68 #:use-module (gnu packages xiph)
69 #:use-module (gnu packages xml)
70 #:use-module (gnu packages xorg)
71 #:use-module (gnu packages assembly)
72 #:use-module (gnu packages zip))
74 (define-public crossguid
75 (let ((commit "8f399e8bd4252be9952f3dfa8199924cc8487ca4"))
78 (version (string-append "0.0-1." (string-take commit 7)))
79 ;; There's no official release. Just a Git repository.
83 (url "https://github.com/graeme-hill/crossguid.git")
85 (file-name (string-append name "-" version "-checkout"))
88 "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9"))))
89 (build-system gnu-build-system)
92 (modify-phases %standard-phases
93 (delete 'configure) ; no configure script
94 ;; There's no build system here, so we have to do it ourselves.
97 (and (zero? (system* "g++" "-c" "guid.cpp" "-o" "guid.o"
98 "-std=c++11" "-DGUID_LIBUUID"))
99 (zero? (system* "ar" "rvs" "libcrossguid.a" "guid.o")))))
102 (and (zero? (system* "g++" "-c" "test.cpp" "-o" "test.o"
104 (zero? (system* "g++" "-c" "testmain.cpp" "-o" "testmain.o"
106 (zero? (system* "g++" "test.o" "guid.o" "testmain.o"
107 "-o" "test" "-luuid"))
108 (zero? (system* (string-append (getcwd) "/test"))))))
110 (lambda* (#:key outputs #:allow-other-keys)
111 (let ((out (assoc-ref outputs "out")))
112 (install-file "guid.h" (string-append out "/include"))
113 (install-file "libcrossguid.a"
114 (string-append out "/lib"))
117 `(("util-linux" ,util-linux)))
118 (synopsis "Lightweight universal identifier library")
119 (description "CrossGuid is a minimal GUID/UUID
120 generator library for C++.")
121 (home-page "https://github.com/graeme-hill/crossguid")
122 (license license:expat))))
124 ;; Kodi requires using their own special forks of these libraries.
125 ;; In addition, it insists on downloading and building these as part
126 ;; of the standard build process. To make things easier, we bootstrap
127 ;; and patch shebangs here, so we don't have to worry about it later.
128 (define libdvdnav/kodi
129 (let ((commit "981488f7f27554b103cca10c1fbeba027396c94a"))
131 (name "libdvdnav-bootstrapped")
136 (url "https://github.com/xbmc/libdvdnav.git")
138 (file-name (string-append name "-" version "-checkout"))
141 "089pswc51l3avh95zl4cpsh7gh1innh7b2y4xgx840mcmy46ycr8"))))
142 (build-system gnu-build-system)
146 (modify-phases %standard-phases
147 (add-after 'unpack 'bootstrap
148 (lambda _ (zero? (system* "autoreconf" "-vif"))))
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 "17d99db97e7b8f23077b342369d3c22a6250affd"))
168 (name "libdvdread-bootstrapped")
173 (url "https://github.com/xbmc/libdvdread.git")
175 (file-name (string-append name "-" version "-checkout"))
178 "1gr5aq1cjr3as9mnwrw29cxn4m6f6pfrxdahkdcjy70q3ldg90sl"))))
179 (build-system gnu-build-system)
183 (modify-phases %standard-phases
184 (add-after 'unpack 'bootstrap
185 (lambda _ (zero? (system* "autoreconf" "-vif"))))
189 (lambda* (#:key outputs #:allow-other-keys)
190 (copy-recursively "." (assoc-ref outputs "out"))
193 `(("autoconf" ,autoconf)
194 ("automake" ,automake)
196 ("pkg-config" ,pkg-config)))
197 (home-page "https://github.com/xbmc/libdvdread")
198 (synopsis (package-synopsis libdvdread))
199 (description (package-description libdvdread))
200 (license (list license:gpl2+ license:lgpl2.1+)))))
202 (define libdvdcss/kodi
203 (let ((commit "2f12236bc1c92f73c21e973363f79eb300de603f"))
205 (name "libdvdcss-bootstrapped")
210 (url "https://github.com/xbmc/libdvdcss.git")
212 (file-name (string-append name "-" version "-checkout"))
215 "198r0q73i55ga1dvyqq9nfcri0zq08b94hy8671lg14i3izx44dd"))))
216 (build-system gnu-build-system)
220 (modify-phases %standard-phases
221 (add-after 'unpack 'bootstrap
222 (lambda _ (zero? (system* "autoreconf" "-vif"))))
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+))))
240 ;; We package the git version because the current released
241 ;; version was cut while the cmake transition was in turmoil.
242 (let ((commit "f22d62dc3f6e811a538dda9c434e1804abb8b95f")
246 (version (string-append "18.0_alpha-" revision "-" (string-take commit 7)))
250 (url "https://github.com/xbmc/xbmc.git")
252 (file-name (string-append name "-" version "-checkout"))
255 "0x8fqvid8b8qra327z615r2ygfkdca2p7wccdj5nfb4i5gy0sr09"))
258 (use-modules (guix build utils))
259 (for-each delete-file-recursively
260 '("project/BuildDependencies/bin/"
261 ;; TODO: Purge these jars.
262 ;;"tools/codegenerator/groovy"
263 ;; And these sources:
264 ;; "tools/depend/native/JsonSchemaBuilder"
265 ;; "tools/depend/native/TexturePacker"
270 "lib/libUPnP/Neptune/ThirdParty"
271 "project/Win32BuildSetup/tools/7z"))
273 (modules '((guix build utils)))))
274 (build-system cmake-build-system)
276 '(#:modules ((srfi srfi-1)
277 (guix build cmake-build-system)
280 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
281 "-DENABLE_INTERNAL_CROSSGUID=OFF"
282 (string-append "-Dlibdvdread_URL="
283 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
284 (string-append "-Dlibdvdnav_URL="
285 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
286 (string-append "-Dlibdvdcss_URL="
287 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
288 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
289 (assoc-ref %build-inputs "curl") "/lib"))
291 (modify-phases %standard-phases
292 ;; The build system tries to bootstrap these bundled components
293 ;; during the regular build phase, which causes serious issues
294 ;; because there's no time for shebangs to be patched. So, we
295 ;; bootstrap it on our own instead.
296 (add-after 'unpack 'bootstrap-bundled-software
298 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
300 (every (lambda (third-party)
301 (with-directory-excursion third-party
302 (zero? (system* "autoreconf" "-vif"))))
304 (add-after 'bootstrap-bundled-software 'patch-stuff
305 (lambda* (#:key inputs #:allow-other-keys)
306 ;; Prevent the build scripts from calling autoreconf in the
307 ;; build stage. Otherwise, it would undo the bootstrapping
308 ;; and shebang patching that we worked so hard for.
309 (substitute* "cmake/modules/FindCpluff.cmake"
310 (("autoreconf -vif") "true"))
311 (substitute* "lib/cpluff/po/Makefile.in.in"
312 (("/bin/sh") (which "sh")))
313 (substitute* "cmake/modules/FindLibDvd.cmake"
314 ;; The libdvd* sources that we bootstrapped separately are
315 ;; unpacked in the build phase. This is our best opportunity
316 ;; to make them writable before the build process starts.
317 (("autoreconf -vif") "chmod -R u+w ."))
319 (substitute* "xbmc/linux/LinuxTimezone.cpp"
320 (("/usr/share/zoneinfo")
321 (string-append (assoc-ref inputs "tzdata")
324 ;; Let's disable some tests that are known not to work here.
325 ;; Doing this later while in the cmake "../build" directory
327 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
328 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
329 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
330 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
331 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
332 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
333 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
335 (add-before 'build 'set-build-environment
337 ;; Some bundled build scripts fall back to /bin/sh
338 ;; if this is not set.
339 (setenv "CONFIG_SHELL" (which "sh"))
341 (add-before 'check 'build-kodi-test
343 (zero? (system* "make" "kodi-test")))))))
344 ;; TODO: Add dependencies for:
350 `(("autoconf" ,autoconf)
351 ("automake" ,automake)
352 ("gettext" ,gettext-minimal)
353 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
354 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
355 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
356 ("libdvdread-bootstrapped" ,libdvdread/kodi)
358 ("pkg-config" ,pkg-config)
362 `(("alsa-lib" ,alsa-lib)
365 ("crossguid" ,crossguid)
373 ("fontconfig" ,fontconfig)
374 ("freetype" ,freetype)
382 ("libbluray" ,libbluray)
386 ("libgcrypt" ,libgcrypt)
390 ("libmicrohttpd" ,libmicrohttpd)
391 ("libmpeg2" ,libmpeg2)
397 ("libvorbis" ,libvorbis)
399 ("libxrandr" ,libxrandr)
400 ("libxrender" ,libxrender)
406 ("pulseaudio" ,pulseaudio)
408 ("rapidjson" ,rapidjson)
414 ("util-linux" ,util-linux)
417 (synopsis "Media center for home theater computers")
418 (description "Kodi is a media center application for playing videos,
419 music, games, etc. Kodi is highly customizable and features a theme and
421 (home-page "http://kodi.tv")
422 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
423 ;; there are some other licenses spread throughout.
424 (license (list license:gpl2+ license:lgpl2.1+
425 license:gpl3+ ;WiiRemote client
426 license:expat ;cpluff, dbwrappers
427 license:public-domain ;cpluff/examples
428 license:bsd-3 ;misc, gtest
429 license:bsd-2))))) ;xbmc/freebsd