Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / kodi.scm
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 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
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.
11 ;;;
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.
16 ;;;
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/>.
19
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))
73
74 (define-public crossguid
75 (let ((commit "8f399e8bd4252be9952f3dfa8199924cc8487ca4"))
76 (package
77 (name "crossguid")
78 (version (string-append "0.0-1." (string-take commit 7)))
79 ;; There's no official release. Just a Git repository.
80 (source (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url "https://github.com/graeme-hill/crossguid.git")
84 (commit commit)))
85 (file-name (string-append name "-" version "-checkout"))
86 (sha256
87 (base32
88 "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9"))))
89 (build-system gnu-build-system)
90 (arguments
91 '(#:phases
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.
95 (replace 'build
96 (lambda _
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")))))
100 (replace 'check
101 (lambda _
102 (and (zero? (system* "g++" "-c" "test.cpp" "-o" "test.o"
103 "-std=c++11"))
104 (zero? (system* "g++" "-c" "testmain.cpp" "-o" "testmain.o"
105 "-std=c++11"))
106 (zero? (system* "g++" "test.o" "guid.o" "testmain.o"
107 "-o" "test" "-luuid"))
108 (zero? (system* (string-append (getcwd) "/test"))))))
109 (replace 'install
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"))
115 #t))))))
116 (inputs
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))))
123
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"))
130 (package
131 (name "libdvdnav-bootstrapped")
132 (version commit)
133 (source (origin
134 (method git-fetch)
135 (uri (git-reference
136 (url "https://github.com/xbmc/libdvdnav.git")
137 (commit commit)))
138 (file-name (string-append name "-" version "-checkout"))
139 (sha256
140 (base32
141 "089pswc51l3avh95zl4cpsh7gh1innh7b2y4xgx840mcmy46ycr8"))))
142 (build-system gnu-build-system)
143 (arguments
144 '(#:tests? #f
145 #:phases
146 (modify-phases %standard-phases
147 (add-after 'unpack 'bootstrap
148 (lambda _ (zero? (system* "autoreconf" "-vif"))))
149 (delete 'configure)
150 (delete 'build)
151 (replace 'install
152 (lambda* (#:key outputs #:allow-other-keys)
153 (copy-recursively "." (assoc-ref outputs "out"))
154 #t)))))
155 (native-inputs
156 `(("autoconf" ,autoconf)
157 ("automake" ,automake)
158 ("libtool" ,libtool)
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+))))
164
165 (define libdvdread/kodi
166 (let ((commit "17d99db97e7b8f23077b342369d3c22a6250affd"))
167 (package
168 (name "libdvdread-bootstrapped")
169 (version commit)
170 (source (origin
171 (method git-fetch)
172 (uri (git-reference
173 (url "https://github.com/xbmc/libdvdread.git")
174 (commit commit)))
175 (file-name (string-append name "-" version "-checkout"))
176 (sha256
177 (base32
178 "1gr5aq1cjr3as9mnwrw29cxn4m6f6pfrxdahkdcjy70q3ldg90sl"))))
179 (build-system gnu-build-system)
180 (arguments
181 '(#:tests? #f
182 #:phases
183 (modify-phases %standard-phases
184 (add-after 'unpack 'bootstrap
185 (lambda _ (zero? (system* "autoreconf" "-vif"))))
186 (delete 'configure)
187 (delete 'build)
188 (replace 'install
189 (lambda* (#:key outputs #:allow-other-keys)
190 (copy-recursively "." (assoc-ref outputs "out"))
191 #t)))))
192 (native-inputs
193 `(("autoconf" ,autoconf)
194 ("automake" ,automake)
195 ("libtool" ,libtool)
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+)))))
201
202 (define libdvdcss/kodi
203 (let ((commit "2f12236bc1c92f73c21e973363f79eb300de603f"))
204 (package
205 (name "libdvdcss-bootstrapped")
206 (version commit)
207 (source (origin
208 (method git-fetch)
209 (uri (git-reference
210 (url "https://github.com/xbmc/libdvdcss.git")
211 (commit commit)))
212 (file-name (string-append name "-" version "-checkout"))
213 (sha256
214 (base32
215 "198r0q73i55ga1dvyqq9nfcri0zq08b94hy8671lg14i3izx44dd"))))
216 (build-system gnu-build-system)
217 (arguments
218 '(#:tests? #f
219 #:phases
220 (modify-phases %standard-phases
221 (add-after 'unpack 'bootstrap
222 (lambda _ (zero? (system* "autoreconf" "-vif"))))
223 (delete 'configure)
224 (delete 'build)
225 (replace 'install
226 (lambda* (#:key outputs #:allow-other-keys)
227 (copy-recursively "." (assoc-ref outputs "out"))
228 #t)))))
229 (native-inputs
230 `(("autoconf" ,autoconf)
231 ("automake" ,automake)
232 ("libtool" ,libtool)
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+))))
238
239 (define-public kodi
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")
243 (revision "6"))
244 (package
245 (name "kodi")
246 (version (string-append "18.0_alpha-" revision "-" (string-take commit 7)))
247 (source (origin
248 (method git-fetch)
249 (uri (git-reference
250 (url "https://github.com/xbmc/xbmc.git")
251 (commit commit)))
252 (file-name (string-append name "-" version "-checkout"))
253 (sha256
254 (base32
255 "0x8fqvid8b8qra327z615r2ygfkdca2p7wccdj5nfb4i5gy0sr09"))
256 (snippet
257 '(begin
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"
266 ;; "lib/gtest"
267 ;; "lib/cpluff"
268 ;; "lib/libexif"
269 ;; "lib/libUPnP"
270 "lib/libUPnP/Neptune/ThirdParty"
271 "project/Win32BuildSetup/tools/7z"))
272 #t))
273 (modules '((guix build utils)))))
274 (build-system cmake-build-system)
275 (arguments
276 '(#:modules ((srfi srfi-1)
277 (guix build cmake-build-system)
278 (guix build utils))
279 #:configure-flags
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"))
290 #:phases
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
297 (lambda _
298 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
299 "lib/cpluff")))
300 (every (lambda (third-party)
301 (with-directory-excursion third-party
302 (zero? (system* "autoreconf" "-vif"))))
303 dirs))))
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 ."))
318
319 (substitute* "xbmc/linux/LinuxTimezone.cpp"
320 (("/usr/share/zoneinfo")
321 (string-append (assoc-ref inputs "tzdata")
322 "/share/zoneinfo")))
323
324 ;; Let's disable some tests that are known not to work here.
325 ;; Doing this later while in the cmake "../build" directory
326 ;; is trickier.
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)"))
334 #t))
335 (add-before 'build 'set-build-environment
336 (lambda _
337 ;; Some bundled build scripts fall back to /bin/sh
338 ;; if this is not set.
339 (setenv "CONFIG_SHELL" (which "sh"))
340 #t))
341 (add-before 'check 'build-kodi-test
342 (lambda _
343 (zero? (system* "make" "kodi-test")))))))
344 ;; TODO: Add dependencies for:
345 ;; - nfs
346 ;; - cec
347 ;; - plist
348 ;; - shairplay
349 (native-inputs
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)
357 ("libtool" ,libtool)
358 ("pkg-config" ,pkg-config)
359 ("swig" ,swig)
360 ("yasm" ,yasm)))
361 (inputs
362 `(("alsa-lib" ,alsa-lib)
363 ("avahi" ,avahi)
364 ("bluez" ,bluez)
365 ("crossguid" ,crossguid)
366 ("curl" ,curl)
367 ("dcadec" ,dcadec)
368 ("dbus" ,dbus)
369 ("eudev" ,eudev)
370 ("ffmpeg" ,ffmpeg)
371 ("flac" ,flac)
372 ("fmt" ,fmt)
373 ("fontconfig" ,fontconfig)
374 ("freetype" ,freetype)
375 ("fribidi" ,fribidi)
376 ("giflib" ,giflib)
377 ("glew" ,glew)
378 ("gnutls" ,gnutls)
379 ("lame" ,lame)
380 ("lcms" ,lcms)
381 ("libass" ,libass)
382 ("libbluray" ,libbluray)
383 ("libcap" ,libcap)
384 ("libcdio" ,libcdio)
385 ("libdrm" ,libdrm)
386 ("libgcrypt" ,libgcrypt)
387 ("libjpeg" ,libjpeg)
388 ("libltdl" ,libltdl)
389 ("libmad" ,libmad)
390 ("libmicrohttpd" ,libmicrohttpd)
391 ("libmpeg2" ,libmpeg2)
392 ("libogg" ,libogg)
393 ("libpng" ,libpng)
394 ("libssh" ,libssh)
395 ("libtiff" ,libtiff)
396 ("libva" ,libva)
397 ("libvorbis" ,libvorbis)
398 ("libxml2" ,libxml2)
399 ("libxrandr" ,libxrandr)
400 ("libxrender" ,libxrender)
401 ("libxslt" ,libxslt)
402 ("lzo" ,lzo)
403 ("mysql" ,mysql)
404 ("openssl" ,openssl)
405 ("pcre" ,pcre)
406 ("pulseaudio" ,pulseaudio)
407 ("python" ,python-2)
408 ("rapidjson" ,rapidjson)
409 ("samba" ,samba)
410 ("sqlite" ,sqlite)
411 ("taglib" ,taglib)
412 ("tinyxml" ,tinyxml)
413 ("tzdata" ,tzdata)
414 ("util-linux" ,util-linux)
415 ("zip" ,zip)
416 ("zlib" ,zlib)))
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
420 plug-in system.")
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