gnu: groff: Disable relocatability.
[jackhill/guix/guix.git] / gnu / packages / kodi.scm
CommitLineData
34f5618b
DT
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <davet@gnu.org>
f69e2034 3;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
72df48db 4;;; Copyright © 2017 Oleg Pykhalov <go.wigust@gmail.com>
2aa137e2 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
988b78ba 6;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
34f5618b
DT
7;;;
8;;; This file is part of GNU Guix.
9;;;
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.
14;;;
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.
19;;;
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/>.
22
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)
1e3fbf3c 28 #:use-module (guix git-download)
f69e2034 29 #:use-module (guix build-system cmake)
34f5618b 30 #:use-module (guix build-system gnu)
72df48db 31 #:use-module (guix build-system trivial)
39ad752c 32 #:use-module (gnu packages)
34f5618b
DT
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages audio)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages avahi)
37 #:use-module (gnu packages base)
72df48db 38 #:use-module (gnu packages bash)
34f5618b
DT
39 #:use-module (gnu packages cdrom)
40 #:use-module (gnu packages cmake)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages curl)
43 #:use-module (gnu packages databases)
99828fa7 44 #:use-module (gnu packages documentation)
34f5618b
DT
45 #:use-module (gnu packages fontutils)
46 #:use-module (gnu packages fribidi)
47 #:use-module (gnu packages gettext)
48 #:use-module (gnu packages ghostscript)
49 #:use-module (gnu packages gawk)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages gperf)
988b78ba 53 #:use-module (gnu packages groff)
34f5618b
DT
54 #:use-module (gnu packages gnunet)
55 #:use-module (gnu packages gnupg)
56 #:use-module (gnu packages image)
57 #:use-module (gnu packages java)
58 #:use-module (gnu packages libusb)
59 #:use-module (gnu packages linux)
60 #:use-module (gnu packages mp3)
61 #:use-module (gnu packages pcre)
62 #:use-module (gnu packages pkg-config)
f69e2034 63 #:use-module (gnu packages pretty-print)
34f5618b
DT
64 #:use-module (gnu packages pulseaudio)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages samba)
67 #:use-module (gnu packages sdl)
e3407254 68 #:use-module (gnu packages serialization)
34f5618b
DT
69 #:use-module (gnu packages ssh)
70 #:use-module (gnu packages swig)
71 #:use-module (gnu packages textutils)
72 #:use-module (gnu packages tls)
73 #:use-module (gnu packages video)
74 #:use-module (gnu packages web)
75 #:use-module (gnu packages xdisorg)
76 #:use-module (gnu packages xiph)
77 #:use-module (gnu packages xml)
78 #:use-module (gnu packages xorg)
148585c2 79 #:use-module (gnu packages assembly))
34f5618b 80
1e3fbf3c 81(define-public crossguid
e3407254
EF
82 (let ((commit "fef89a4174a7bf8cd99fa9154864ce9e8e3bf989")
83 (revision "2"))
1e3fbf3c
DT
84 (package
85 (name "crossguid")
e3407254
EF
86 (version (string-append "0.0-" revision "." (string-take commit 7)))
87 ;; This is the commit that Kodi wants.
1e3fbf3c
DT
88 (source (origin
89 (method git-fetch)
90 (uri (git-reference
91 (url "https://github.com/graeme-hill/crossguid.git")
92 (commit commit)))
7c776ddc 93 (file-name (string-append name "-" version "-checkout"))
1e3fbf3c
DT
94 (sha256
95 (base32
e3407254 96 "1blrkc7zcqrqcr5msvhyhm98s2jvm9hr0isqs4288q2r4mdnrfq0"))))
1e3fbf3c
DT
97 (build-system gnu-build-system)
98 (arguments
99 '(#:phases
100 (modify-phases %standard-phases
2aa137e2 101 (delete 'configure) ; no configure script
1e3fbf3c
DT
102 (replace 'build
103 (lambda _
2aa137e2
TGR
104 (invoke "g++" "-c" "guid.cpp" "-o" "guid.o"
105 "-std=c++11" "-DGUID_LIBUUID")
106 (invoke "ar" "rvs" "libcrossguid.a" "guid.o")))
1e3fbf3c
DT
107 (replace 'check
108 (lambda _
2aa137e2
TGR
109 (invoke "g++" "-c" "test.cpp" "-o" "test.o"
110 "-std=c++11")
111 (invoke "g++" "-c" "testmain.cpp" "-o" "testmain.o"
112 "-std=c++11")
113 (invoke "g++" "test.o" "guid.o" "testmain.o"
114 "-o" "test" "-luuid")
115 (invoke (string-append (getcwd) "/test"))))
1e3fbf3c
DT
116 (replace 'install
117 (lambda* (#:key outputs #:allow-other-keys)
118 (let ((out (assoc-ref outputs "out")))
119 (install-file "guid.h" (string-append out "/include"))
120 (install-file "libcrossguid.a"
121 (string-append out "/lib"))
122 #t))))))
123 (inputs
124 `(("util-linux" ,util-linux)))
125 (synopsis "Lightweight universal identifier library")
7c49ab5b 126 (description "CrossGuid is a minimal GUID/UUID
1e3fbf3c
DT
127generator library for C++.")
128 (home-page "https://github.com/graeme-hill/crossguid")
129 (license license:expat))))
130
f69e2034
MB
131;; Kodi requires using their own special forks of these libraries.
132;; In addition, it insists on downloading and building these as part
133;; of the standard build process. To make things easier, we bootstrap
134;; and patch shebangs here, so we don't have to worry about it later.
135(define libdvdnav/kodi
e3407254 136 (let ((commit "6.0.0-Leia-Alpha-3"))
f69e2034
MB
137 (package
138 (name "libdvdnav-bootstrapped")
139 (version commit)
140 (source (origin
141 (method git-fetch)
142 (uri (git-reference
143 (url "https://github.com/xbmc/libdvdnav.git")
144 (commit commit)))
145 (file-name (string-append name "-" version "-checkout"))
146 (sha256
147 (base32
e3407254 148 "0qwlf4lgahxqxk1r2pzl866mi03pbp7l1fc0rk522sc0ak2s9jhb"))))
f69e2034
MB
149 (build-system gnu-build-system)
150 (arguments
151 '(#:tests? #f
152 #:phases
153 (modify-phases %standard-phases
f69e2034
MB
154 (delete 'configure)
155 (delete 'build)
156 (replace 'install
157 (lambda* (#:key outputs #:allow-other-keys)
158 (copy-recursively "." (assoc-ref outputs "out"))
159 #t)))))
160 (native-inputs
161 `(("autoconf" ,autoconf)
162 ("automake" ,automake)
163 ("libtool" ,libtool)
164 ("pkg-config" ,pkg-config)))
165 (home-page "https://github.com/xbmc/libdvdnav")
166 (synopsis (package-synopsis libdvdnav))
167 (description (package-description libdvdnav))
168 (license license:gpl2+))))
169
170(define libdvdread/kodi
e3407254 171 (let ((commit "6.0.0-Leia-Alpha-3"))
f69e2034
MB
172 (package
173 (name "libdvdread-bootstrapped")
174 (version commit)
175 (source (origin
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://github.com/xbmc/libdvdread.git")
179 (commit commit)))
180 (file-name (string-append name "-" version "-checkout"))
181 (sha256
182 (base32
e3407254 183 "1xxn01mhkdnp10cqdr357wx77vyzfb5glqpqyg8m0skyi75aii59"))))
f69e2034
MB
184 (build-system gnu-build-system)
185 (arguments
186 '(#:tests? #f
187 #:phases
188 (modify-phases %standard-phases
f69e2034
MB
189 (delete 'configure)
190 (delete 'build)
191 (replace 'install
192 (lambda* (#:key outputs #:allow-other-keys)
193 (copy-recursively "." (assoc-ref outputs "out"))
194 #t)))))
195 (native-inputs
196 `(("autoconf" ,autoconf)
197 ("automake" ,automake)
198 ("libtool" ,libtool)
199 ("pkg-config" ,pkg-config)))
200 (home-page "https://github.com/xbmc/libdvdread")
201 (synopsis (package-synopsis libdvdread))
202 (description (package-description libdvdread))
203 (license (list license:gpl2+ license:lgpl2.1+)))))
204
205(define libdvdcss/kodi
e3407254 206 (let ((commit "1.4.2-Leia-Beta-5"))
f69e2034
MB
207 (package
208 (name "libdvdcss-bootstrapped")
209 (version commit)
210 (source (origin
211 (method git-fetch)
212 (uri (git-reference
213 (url "https://github.com/xbmc/libdvdcss.git")
214 (commit commit)))
215 (file-name (string-append name "-" version "-checkout"))
216 (sha256
217 (base32
e3407254 218 "0j41ydzx0imaix069s3z07xqw9q95k7llh06fc27dcn6f7b8ydyl"))))
f69e2034
MB
219 (build-system gnu-build-system)
220 (arguments
221 '(#:tests? #f
222 #:phases
223 (modify-phases %standard-phases
f69e2034
MB
224 (delete 'configure)
225 (delete 'build)
226 (replace 'install
227 (lambda* (#:key outputs #:allow-other-keys)
228 (copy-recursively "." (assoc-ref outputs "out"))
229 #t)))))
230 (native-inputs
231 `(("autoconf" ,autoconf)
232 ("automake" ,automake)
233 ("libtool" ,libtool)
234 ("pkg-config" ,pkg-config)))
235 (home-page "https://github.com/xbmc/libdvdcss")
236 (synopsis (package-synopsis libdvdcss))
237 (description (package-description libdvdcss))
238 (license license:gpl2+))))
239
988b78ba
EF
240(define-public fstrcmp
241 (package
242 (name "fstrcmp")
243 (version "0.7.D001")
244 (source
245 (origin
246 (method url-fetch)
247 (uri (string-append "http://fstrcmp.sourceforge.net/fstrcmp-"
248 version ".tar.gz"))
249 (sha256
250 (base32
251 "0xilghiy3mz78bjmfldi39qyy7jvw5b6wafsx370lw401y2qw0g4"))))
252 (build-system gnu-build-system)
253 (home-page "http://fstrcmp.sourceforge.net/")
254 (arguments
255 '(#:configure-flags '("SH=sh")))
256 (native-inputs
257 `(("ghostscript" ,ghostscript) ; ps2pdf
258 ("groff" ,groff)
259 ("libtool" ,libtool)
260 ("which" ,which)))
261 (synopsis "fuzzy comparison of strings")
262 (description
263 "The fstrcmp project provides a library that is used to make fuzzy
264comparisons of strings and byte arrays, including multi-byte character strings.
265This can be useful in error messages, enabling the suggestion of likely valid
266alternatives. In compilers, this can reduce the cascade of secondary errors.")
267 (license license:gpl3+)))
268
34f5618b
DT
269(define-public kodi
270 (package
271 (name "kodi")
d037353c 272 (version "18.0rc3")
34f5618b 273 (source (origin
f69e2034
MB
274 (method git-fetch)
275 (uri (git-reference
276 (url "https://github.com/xbmc/xbmc.git")
e3407254 277 (commit (string-append version "-Leia"))))
9d2749f6 278 (file-name (git-file-name name version))
34f5618b
DT
279 (sha256
280 (base32
d037353c 281 "0bwi4gwmwppjw6bf0zihyg42zwnd0imq0aw4xxsgnacqakhxzii0"))
39ad752c 282 (patches (search-patches "kodi-skip-test-449.patch"))
34f5618b 283 (snippet
34f5618b
DT
284 '(begin
285 (use-modules (guix build utils))
f69e2034 286 (for-each delete-file-recursively
e3407254 287 '("project/BuildDependencies/"
f69e2034
MB
288 ;; TODO: Purge these jars.
289 ;;"tools/codegenerator/groovy"
290 ;; And these sources:
291 ;; "tools/depend/native/JsonSchemaBuilder"
292 ;; "tools/depend/native/TexturePacker"
f69e2034
MB
293 ;; "lib/gtest"
294 ;; "lib/cpluff"
f69e2034
MB
295 ;; "lib/libUPnP"
296 "lib/libUPnP/Neptune/ThirdParty"
297 "project/Win32BuildSetup/tools/7z"))
298 #t))
34f5618b 299 (modules '((guix build utils)))))
f69e2034 300 (build-system cmake-build-system)
34f5618b 301 (arguments
f69e2034
MB
302 '(#:modules ((srfi srfi-1)
303 (guix build cmake-build-system)
304 (guix build utils))
305 #:configure-flags
306 (list "-DENABLE_INTERNAL_FFMPEG=OFF"
307 "-DENABLE_INTERNAL_CROSSGUID=OFF"
308 (string-append "-Dlibdvdread_URL="
309 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
310 (string-append "-Dlibdvdnav_URL="
311 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
312 (string-append "-Dlibdvdcss_URL="
313 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
4951d2f3 314 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
4ec1f82c 315 (assoc-ref %build-inputs "curl") "/lib"))
34f5618b
DT
316 #:phases
317 (modify-phases %standard-phases
f69e2034
MB
318 ;; The build system tries to bootstrap these bundled components
319 ;; during the regular build phase, which causes serious issues
34f5618b
DT
320 ;; because there's no time for shebangs to be patched. So, we
321 ;; bootstrap it on our own instead.
f69e2034
MB
322 (add-after 'unpack 'bootstrap-bundled-software
323 (lambda _
324 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src"
325 "lib/cpluff")))
326 (every (lambda (third-party)
327 (with-directory-excursion third-party
93ab9a5d 328 (invoke "autoreconf" "-vif")))
f69e2034
MB
329 dirs))))
330 (add-after 'bootstrap-bundled-software 'patch-stuff
8c011737 331 (lambda* (#:key inputs #:allow-other-keys)
f69e2034
MB
332 ;; Prevent the build scripts from calling autoreconf in the
333 ;; build stage. Otherwise, it would undo the bootstrapping
334 ;; and shebang patching that we worked so hard for.
335 (substitute* "cmake/modules/FindCpluff.cmake"
336 (("autoreconf -vif") "true"))
337 (substitute* "lib/cpluff/po/Makefile.in.in"
338 (("/bin/sh") (which "sh")))
339 (substitute* "cmake/modules/FindLibDvd.cmake"
340 ;; The libdvd* sources that we bootstrapped separately are
341 ;; unpacked in the build phase. This is our best opportunity
342 ;; to make them writable before the build process starts.
343 (("autoreconf -vif") "chmod -R u+w ."))
344
9d2749f6 345 (substitute* "xbmc/platform/linux/LinuxTimezone.cpp"
8c011737
MB
346 (("/usr/share/zoneinfo")
347 (string-append (assoc-ref inputs "tzdata")
348 "/share/zoneinfo")))
349
cbb5d2e1
EF
350 ;; Don't phone home to check for updates.
351 (substitute* "system/addon-manifest.xml"
2c17bd7b
EF
352 (("<addon optional=\\\"true\\\">service.xbmc.versioncheck</addon>")
353 ""))
354
f69e2034
MB
355 ;; Let's disable some tests that are known not to work here.
356 ;; Doing this later while in the cmake "../build" directory
357 ;; is trickier.
34f5618b
DT
358 (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
359 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
360 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
361 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
362 "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
363 (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
f69e2034 364 "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)"))
f69e2034
MB
365 #t))
366 (add-before 'build 'set-build-environment
367 (lambda _
368 ;; Some bundled build scripts fall back to /bin/sh
369 ;; if this is not set.
370 (setenv "CONFIG_SHELL" (which "sh"))
371 #t))
372 (add-before 'check 'build-kodi-test
373 (lambda _
93ab9a5d 374 (invoke "make" "kodi-test"))))))
34f5618b 375 ;; TODO: Add dependencies for:
34f5618b 376 ;; - nfs
f69e2034
MB
377 ;; - cec
378 ;; - plist
379 ;; - shairplay
34f5618b
DT
380 (native-inputs
381 `(("autoconf" ,autoconf)
382 ("automake" ,automake)
b94a6ca0 383 ("gettext" ,gettext-minimal)
d2540f80 384 ("icedtea" ,icedtea) ; needed at build-time only, mandatory
f69e2034
MB
385 ("libdvdcss-bootstrapped" ,libdvdcss/kodi)
386 ("libdvdnav-bootstrapped" ,libdvdnav/kodi)
387 ("libdvdread-bootstrapped" ,libdvdread/kodi)
34f5618b
DT
388 ("libtool" ,libtool)
389 ("pkg-config" ,pkg-config)
390 ("swig" ,swig)
34f5618b
DT
391 ("yasm" ,yasm)))
392 (inputs
393 `(("alsa-lib" ,alsa-lib)
394 ("avahi" ,avahi)
395 ("bluez" ,bluez)
9ced12de 396 ("crossguid" ,crossguid)
34f5618b 397 ("curl" ,curl)
9ced12de 398 ("dcadec" ,dcadec)
34f5618b 399 ("dbus" ,dbus)
34f5618b
DT
400 ("eudev" ,eudev)
401 ("ffmpeg" ,ffmpeg)
402 ("flac" ,flac)
e3407254 403 ("flatbuffers" ,flatbuffers)
f69e2034 404 ("fmt" ,fmt)
34f5618b
DT
405 ("fontconfig" ,fontconfig)
406 ("freetype" ,freetype)
407 ("fribidi" ,fribidi)
e3407254 408 ("fstrcmp" ,fstrcmp)
f69e2034 409 ("giflib" ,giflib)
34f5618b
DT
410 ("glew" ,glew)
411 ("gnutls" ,gnutls)
34f5618b 412 ("lame" ,lame)
f69e2034 413 ("lcms" ,lcms)
34f5618b
DT
414 ("libass" ,libass)
415 ("libbluray" ,libbluray)
416 ("libcap" ,libcap)
417 ("libcdio" ,libcdio)
f69e2034 418 ("libdrm" ,libdrm)
34f5618b
DT
419 ("libgcrypt" ,libgcrypt)
420 ("libjpeg" ,libjpeg)
421 ("libltdl" ,libltdl)
422 ("libmad" ,libmad)
423 ("libmicrohttpd" ,libmicrohttpd)
34f5618b
DT
424 ("libmpeg2" ,libmpeg2)
425 ("libogg" ,libogg)
426 ("libpng" ,libpng)
34f5618b
DT
427 ("libssh" ,libssh)
428 ("libtiff" ,libtiff)
429 ("libva" ,libva)
430 ("libvorbis" ,libvorbis)
431 ("libxml2" ,libxml2)
34f5618b
DT
432 ("libxrandr" ,libxrandr)
433 ("libxrender" ,libxrender)
434 ("libxslt" ,libxslt)
34f5618b 435 ("lzo" ,lzo)
66b9c643 436 ("mariadb" ,mariadb)
34f5618b
DT
437 ("openssl" ,openssl)
438 ("pcre" ,pcre)
439 ("pulseaudio" ,pulseaudio)
440 ("python" ,python-2)
2513aac1 441 ("rapidjson" ,rapidjson)
34f5618b 442 ("samba" ,samba)
34f5618b
DT
443 ("sqlite" ,sqlite)
444 ("taglib" ,taglib)
445 ("tinyxml" ,tinyxml)
8c011737 446 ("tzdata" ,tzdata)
9ced12de 447 ("util-linux" ,util-linux)
34f5618b
DT
448 ("zip" ,zip)
449 ("zlib" ,zlib)))
450 (synopsis "Media center for home theater computers")
451 (description "Kodi is a media center application for playing videos,
452music, games, etc. Kodi is highly customizable and features a theme and
453plug-in system.")
9d2749f6 454 (home-page "https://kodi.tv")
f69e2034
MB
455 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
456 ;; there are some other licenses spread throughout.
457 (license (list license:gpl2+ license:lgpl2.1+
458 license:gpl3+ ;WiiRemote client
459 license:expat ;cpluff, dbwrappers
460 license:public-domain ;cpluff/examples
461 license:bsd-3 ;misc, gtest
e3407254 462 license:bsd-2)))) ;xbmc/freebsd
72df48db
OP
463
464(define-public kodi-cli
465 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
466 (revision "1")) ; `$HOME/.kodirc'.
467 (package
468 (name "kodi-cli")
469 (version (string-append "1.1-" revision "." (string-take commit 7)))
470 (source (origin
471 (method git-fetch)
472 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
473 (commit commit)))
474 (sha256
475 (base32
476 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
477 (file-name (string-append name "-" version "-checkout"))))
478 (build-system trivial-build-system)
479 (inputs
480 `(("bash" ,bash)
481 ("curl" ,curl)
482 ("mps-youtube" ,mps-youtube)))
483 (arguments
484 `(#:modules ((guix build utils))
485 #:builder
486 (begin
487 (use-modules (guix build utils))
488 (copy-recursively (assoc-ref %build-inputs "source") ".")
489 (substitute* "kodi-cli"
490 (("/bin/bash") (string-append (assoc-ref %build-inputs "bash")
491 "/bin/bash"))
492 (("output=\\$\\((curl)" all curl)
493 (string-append "output=$("
494 (assoc-ref %build-inputs "curl")
495 "/bin/" curl))
496 (("play_youtube `(mpsyt)" all mpsyt)
497 (string-append "play_youtube `"
498 (assoc-ref %build-inputs "mps-youtube")
499 "/bin/" mpsyt)))
500 (install-file "kodi-cli" (string-append %output "/bin"))
501 #t)))
502 (home-page "https://github.com/nawar/kodi-cli")
503 (synopsis "Control Kodi from the command line")
504 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
505server using JSON RPC.
506
507Features:
508
509@itemize
510@item Play, pause, stop the currently playing item.
511@item Skip forward or backward in the currently playing item.
512@item Play or queue to the currently list of YouTube videos.
513@item Interactive and noninteractive volume control.
514@item Interactive navigation.
515@item Send text to the Kodi keyboard.
516@item Toggle fullscreen.
517@item Update or clean Kodi libraries.
518@end itemize\n")
519 (license license:gpl2+))))