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