projects/guix·blob javascript-team · refs

577 lines · 22.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 David Thompson <[email protected]>
3;;; Copyright © 2017, 2019 Marius Bakke <[email protected]>
4;;; Copyright © 2017 Oleg Pykhalov <[email protected]>
5;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <[email protected]>
6;;; Copyright © 2018, 2020 Efraim Flashner <[email protected]>
7;;; Copyright © 2020 Michael Rohleder <[email protected]>
8;;; Copyright © 2021 Greg Hogan <[email protected]>
9;;; Copyright © 2022 Ricardo Wurmus <[email protected]>
10;;; Copyright © 2024 Nicolas Graves <[email protected]>
11;;; Copyright © 2025 André Batista <[email protected]>
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages kodi)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix utils)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix gexp)
34 #:use-module (guix git-download)
35 #:use-module (guix build-system cmake)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix build-system trivial)
38 #:use-module (gnu packages)
39 #:use-module (gnu packages algebra)
40 #:use-module (gnu packages audio)
41 #:use-module (gnu packages autotools)
42 #:use-module (gnu packages base)
43 #:use-module (gnu packages bash)
44 #:use-module (gnu packages cdrom)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages cmake)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages crypto)
49 #:use-module (gnu packages curl)
50 #:use-module (gnu packages databases)
51 #:use-module (gnu packages dns)
52 #:use-module (gnu packages documentation)
53 #:use-module (gnu packages file-systems)
54 #:use-module (gnu packages fontutils)
55 #:use-module (gnu packages freedesktop)
56 #:use-module (gnu packages fribidi)
57 #:use-module (gnu packages gettext)
58 #:use-module (gnu packages ghostscript)
59 #:use-module (gnu packages gawk)
60 #:use-module (gnu packages gl)
61 #:use-module (gnu packages glib)
62 #:use-module (gnu packages gperf)
63 #:use-module (gnu packages groff)
64 #:use-module (gnu packages groovy)
65 #:use-module (gnu packages gnunet)
66 #:use-module (gnu packages gnupg)
67 #:use-module (gnu packages image)
68 #:use-module (gnu packages java)
69 #:use-module (gnu packages libusb)
70 #:use-module (gnu packages linux)
71 #:use-module (gnu packages logging)
72 #:use-module (gnu packages mp3)
73 #:use-module (gnu packages pcre)
74 #:use-module (gnu packages pkg-config)
75 #:use-module (gnu packages pretty-print)
76 #:use-module (gnu packages pulseaudio)
77 #:use-module (gnu packages python)
78 #:use-module (gnu packages samba)
79 #:use-module (gnu packages sdl)
80 #:use-module (gnu packages serialization)
81 #:use-module (gnu packages sqlite)
82 #:use-module (gnu packages ssh)
83 #:use-module (gnu packages swig)
84 #:use-module (gnu packages textutils)
85 #:use-module (gnu packages tls)
86 #:use-module (gnu packages video)
87 #:use-module (gnu packages web)
88 #:use-module (gnu packages xdisorg)
89 #:use-module (gnu packages xiph)
90 #:use-module (gnu packages xml)
91 #:use-module (gnu packages xorg)
92 #:use-module (gnu packages assembly))
93
94(define-public crossguid
95 (let ((commit "ca1bf4b810e2d188d04cb6286f957008ee1b7681")
96 (revision "3"))
97 (package
98 (name "crossguid")
99 (version (string-append "0.0-" revision "." (string-take commit 7)))
100 ;; This is the commit that Kodi wants.
101 (source (origin
102 (method git-fetch)
103 (uri (git-reference
104 (url "https://github.com/graeme-hill/crossguid")
105 (commit commit)))
106 (file-name (string-append name "-" version "-checkout"))
107 (sha256
108 (base32
109 "1x3jc4q6di79x3nlx36394s03yv1j1j5k0x6zljyk5iq78y4mfyz"))))
110 (build-system cmake-build-system)
111 (arguments
112 '(#:tests? #f
113 #:phases (modify-phases %standard-phases
114 (add-before 'build
115 'patch-missing-include
116 (lambda _
117 (substitute* "../source/include/crossguid/guid.hpp"
118 (("#include <iomanip>")
119 "#include <iomanip>\n#include <cstdint>")))))))
120 (inputs
121 `(("libuuid" ,util-linux "lib")))
122 (synopsis "Lightweight universal identifier library")
123 (description "CrossGuid is a minimal GUID/UUID
124generator library for C++.")
125 (home-page "https://github.com/graeme-hill/crossguid")
126 (license license:expat))))
127
128;; Kodi requires using their own special forks of these libraries.
129;; In addition, it insists on downloading and building these as part
130;; of the standard build process. To make things easier, we bootstrap
131;; and patch shebangs here, so we don't have to worry about it later.
132(define libdvdnav/kodi
133 (let ((commit "6.1.1"))
134 (package
135 (name "libdvdnav-bootstrapped")
136 (version commit)
137 (source (origin
138 (method git-fetch)
139 (uri (git-reference
140 (url "https://github.com/xbmc/libdvdnav")
141 (commit commit)))
142 (file-name (string-append name "-" version "-checkout"))
143 (sha256
144 (base32
145 "190wp4czs4594496vc6ifswg24wijd7c1z0whdkjdaf26rff5xha"))))
146 (build-system gnu-build-system)
147 (arguments
148 '(#:tests? #f
149 #:phases
150 (modify-phases %standard-phases
151 (delete 'configure)
152 (delete 'build)
153 (replace 'install
154 (lambda* (#:key outputs #:allow-other-keys)
155 (copy-recursively "." (assoc-ref outputs "out"))
156 #t)))))
157 (native-inputs
158 `(("autoconf" ,autoconf)
159 ("automake" ,automake)
160 ("libtool" ,libtool)
161 ("pkg-config" ,pkg-config)))
162 (home-page "https://github.com/xbmc/libdvdnav")
163 (synopsis (package-synopsis libdvdnav))
164 (description (package-description libdvdnav))
165 (license license:gpl2+))))
166
167(define libdvdread/kodi
168 (let ((commit "6.1.3"))
169 (package
170 (name "libdvdread-bootstrapped")
171 (version commit)
172 (source (origin
173 (method git-fetch)
174 (uri (git-reference
175 (url "https://github.com/xbmc/libdvdread")
176 (commit commit)))
177 (file-name (string-append name "-" version "-checkout"))
178 (sha256
179 (base32
180 "0by70r55575xa9rl8dp8594lxhm475splslvafskqid30n9cpq8h"))))
181 (build-system gnu-build-system)
182 (arguments
183 '(#:tests? #f
184 #:phases
185 (modify-phases %standard-phases
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 "1.4.3"))
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")
211 (commit commit)))
212 (file-name (string-append name "-" version "-checkout"))
213 (sha256
214 (base32
215 "1xvs3vhdjjrm019rk907bd4lw7jh3wb7rh88zqd3xv8iq3apbcg6"))))
216 (build-system gnu-build-system)
217 (arguments
218 '(#:tests? #f
219 #:phases
220 (modify-phases %standard-phases
221 (delete 'configure)
222 (delete 'build)
223 (replace 'install
224 (lambda* (#:key outputs #:allow-other-keys)
225 (copy-recursively "." (assoc-ref outputs "out"))
226 #t)))))
227 (native-inputs
228 `(("autoconf" ,autoconf)
229 ("automake" ,automake)
230 ("libtool" ,libtool)
231 ("pkg-config" ,pkg-config)))
232 (home-page "https://github.com/xbmc/libdvdcss")
233 (synopsis (package-synopsis libdvdcss))
234 (description (package-description libdvdcss))
235 (license license:gpl2+))))
236
237(define-public fstrcmp
238 (package
239 (name "fstrcmp")
240 (version "0.7.D001")
241 (source
242 (origin
243 (method url-fetch)
244 (uri (string-append "http://fstrcmp.sourceforge.net/fstrcmp-"
245 version ".tar.gz"))
246 (sha256
247 (base32
248 "0xilghiy3mz78bjmfldi39qyy7jvw5b6wafsx370lw401y2qw0g4"))))
249 (build-system gnu-build-system)
250 (home-page "https://fstrcmp.sourceforge.net/")
251 (arguments
252 '(#:configure-flags '("SH=sh")))
253 (native-inputs
254 (list ghostscript ; ps2pdf
255 groff libtool which))
256 (synopsis "Fuzzy comparison of strings")
257 (description
258 "The fstrcmp project provides a library that is used to make fuzzy
259comparisons of strings and byte arrays, including multi-byte character
260strings. This can be useful in error messages, enabling the suggestion of
261likely valid alternatives. In compilers, this can reduce the cascade of
262secondary errors.")
263 (license license:gpl3+)))
264
265(define-public kodi
266 (package
267 (name "kodi")
268 (version "21.3")
269 (source (origin
270 (method git-fetch)
271 (uri (git-reference
272 (url "https://github.com/xbmc/xbmc")
273 (commit (string-append version "-Omega"))))
274 (file-name (git-file-name name version))
275 (sha256
276 (base32
277 "0acwg8d4ixv0a09ybaixd3na9z6w6hw82wnxw9cj8344l4103b6z"))
278 (modules '((guix build utils)))
279 (snippet
280 '(begin
281 (use-modules (guix build utils))
282 (for-each delete-file-recursively
283 '("project/BuildDependencies/"
284 ;; Purge these sources:
285 ;; "tools/depend/native/JsonSchemaBuilder"
286 ;; "tools/depend/native/TexturePacker"
287 ;; "lib/libUPnP"
288 "lib/libUPnP/Neptune/ThirdParty"
289 "lib/libUPnP/Platinum/ThirdParty"
290 "lib/win32"
291 "tools/android/packaging/gradle/wrapper/gradle-wrapper.jar"
292 "project/Win32BuildSetup/tools/7z"))))))
293 (build-system cmake-build-system)
294 (arguments
295 '(#:modules ((srfi srfi-1)
296 (guix build cmake-build-system)
297 (guix build utils))
298 #:configure-flags
299 (list "-DCORE_PLATFORM_NAME=x11"
300 "-DAPP_RENDER_SYSTEM=gl"
301 "-DENABLE_INTERNAL_FFMPEG=OFF"
302 "-DENABLE_INTERNAL_CROSSGUID=OFF"
303 (string-append "-Dlibdvdread_URL="
304 (assoc-ref %build-inputs "libdvdread-bootstrapped"))
305 (string-append "-Dlibdvdnav_URL="
306 (assoc-ref %build-inputs "libdvdnav-bootstrapped"))
307 (string-append "-Dlibdvdcss_URL="
308 (assoc-ref %build-inputs "libdvdcss-bootstrapped"))
309 (string-append "-DSYSTEM_LDFLAGS=-Wl,-rpath="
310 (assoc-ref %build-inputs "curl") "/lib"))
311 #:phases
312 (modify-phases %standard-phases
313 ;; The build system tries to bootstrap these bundled components
314 ;; during the regular build phase, which causes serious issues
315 ;; because there's no time for shebangs to be patched. So, we
316 ;; bootstrap it on our own instead.
317 (add-after 'unpack 'bootstrap-bundled-software
318 (lambda _
319 (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src")))
320 (every (lambda (third-party)
321 (with-directory-excursion third-party
322 (invoke "autoreconf" "-vif")))
323 dirs))))
324 (add-after 'bootstrap-bundled-software 'patch-stuff
325 (lambda* (#:key inputs #:allow-other-keys)
326 ;; Run groovy executable directly.
327 (substitute* "xbmc/interfaces/swig/CMakeLists.txt"
328 (("COMMAND \\$\\{Java_JAVA_EXECUTABLE\\}")
329 "COMMAND groovy")
330 (("ARGS \\$\\{JAVA_OPEN_OPTS\\} -cp \"\\$\\{classpath\\}\" groovy.ui.GroovyMain")
331 "ARGS -cp \"${classpath}\" ")
332 (("classpath \\$\\{groovy_SOURCE_DIR\\}")
333 (string-append "classpath " (assoc-ref inputs "groovy")))
334 (("\\$\\{apache-commons-lang_SOURCE_DIR\\}")
335 (dirname
336 (search-input-file
337 inputs
338 "/lib/m2/org/apache/commons/commons-lang3/3.20.0/commons-lang3-3.20.0.jar")))
339 (("\\$\\{apache-commons-text_SOURCE_DIR\\}")
340 (dirname
341 (search-input-file
342 inputs
343 "/lib/m2/org/apache/commons/commons-text/1.15.0/commons-text-1.15.0.jar")))
344 (("FetchContent_MakeAvailable\\(groovy\\)")
345 (string-append "set(groovy_SOURCE_DIR " (assoc-ref inputs "groovy") ")"))
346 (("FetchContent_MakeAvailable\\(apache-commons-lang\\)")
347 (string-append "set(apache-commons-lang_SOURCE_DIR "
348 (assoc-ref inputs "java-commons-lang3")
349 "/lib/m2/org/apache/commons/commons-lang3/3.20.0)"))
350 (("FetchContent_MakeAvailable\\(apache-commons-text\\)")
351 (string-append "set(apache-commons-text_SOURCE_DIR "
352 (assoc-ref inputs "java-commons-text")
353 "/lib/m2/org/apache/commons/commons-text/1.15.0)"))
354 (("^set\\(GROOVY_VER.*")
355 (string-append "set(GROOVY_VER 3.0.5)\n")))
356
357 ;; Prevent the build scripts from calling autoreconf in the
358 ;; build stage. Otherwise, it would undo the bootstrapping
359 ;; and shebang patching that we worked so hard for.
360 (substitute* "cmake/modules/FindLibDvdCSS.cmake"
361 ;; The libdvd* sources that we bootstrapped separately are
362 ;; unpacked in the build phase. This is our best opportunity
363 ;; to make them writable before the build process starts.
364 (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
365
366 (substitute* "cmake/modules/FindLibDvdNav.cmake"
367 (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
368
369 (substitute* "cmake/modules/FindLibDvdRead.cmake"
370 (("\\$\\{AUTORECONF\\} -vif") "chmod -R u+w ."))
371
372 (substitute* "xbmc/platform/posix/PosixTimezone.cpp"
373 (("/usr/share/zoneinfo")
374 (search-input-directory inputs "share/zoneinfo")))
375
376 ;; Don't phone home to check for updates.
377 (substitute* "system/addon-manifest.xml"
378 (("<addon optional=\\\"true\\\">service.xbmc.versioncheck</addon>")
379 ""))
380
381 ;; Let's disable some tests that are known not to work here.
382 ;; Doing this later while in the cmake "../build" directory
383 ;; is trickier.
384 (substitute* "xbmc/utils/test/TestSystemInfo.cpp"
385 (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
386 "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
387 (("TEST_F\\(TestSystemInfo, GetOsName\\)")
388 "TEST_F(TestSystemInfo, DISABLED_GetOsName)"))
389 (substitute* "xbmc/utils/test/TestCPUInfo.cpp"
390 (("TEST_F\\(TestCPUInfo, GetCPUFrequency\\)")
391 "TEST_F(TestCPUInfo, DISABLED_GetCPUFrequency)"))
392 (substitute* "xbmc/test/TestDateTime.cpp"
393 (("TEST_F\\(TestDateTime, TmOperators\\)")
394 "TEST_F(TestDateTime, DISABLED_TmOperators)")
395 (("TEST_F\\(TestDateTime, GetAsTm\\)")
396 "TEST_F(TestDateTime, DISABLED_GetAsTm)"))
397 (substitute* "xbmc/network/test/TestNetwork.cpp"
398 (("TEST_F\\(TestNetwork, PingHost\\)")
399 "TEST_F(TestNetwork, DISABLED_PingHost)"))))
400 (add-before 'build 'set-build-environment
401 (lambda _
402 ;; Some bundled build scripts fall back to /bin/sh
403 ;; if this is not set.
404 (setenv "CONFIG_SHELL" (which "sh"))))
405 (add-before 'check 'build-kodi-test
406 (lambda _
407 (invoke "make" "kodi-test"))))))
408 ;; TODO: Add dependencies for:
409 ;; - cec
410 ;; - plist
411 ;; - shairplay
412 (native-inputs
413 (list autoconf
414 automake
415 gettext-minimal
416 googletest
417 groovy
418 openjdk9 ;like groovy
419 java-commons-lang3
420 java-commons-text
421 libdvdcss/kodi
422 libdvdnav/kodi
423 libdvdread/kodi
424 libtool
425 pkg-config
426 swig-4.0
427 yasm))
428 (inputs
429 (list alsa-lib
430 avahi
431 bluez
432 crossguid
433 curl
434 dcadec
435 dbus
436 eudev
437 ffmpeg-6
438 flac
439 flatbuffers
440 fmt
441 fontconfig
442 freetype
443 fribidi
444 fstrcmp
445 giflib
446 glew
447 gnutls
448 lame
449 lcms
450 libass
451 libbluray
452 libcap
453 libcdio
454 libdrm
455 libgcrypt
456 libjpeg-turbo
457 libltdl
458 libmad
459 libmicrohttpd
460 libmpeg2
461 libnfs
462 libogg
463 libpng
464 libssh
465 libtiff
466 libudfread
467 libva
468 libvorbis
469 libxcrypt
470 libxml2
471 libxrandr
472 libxrender
473 libxslt
474 lzo
475 (list mariadb "lib")
476 (list mariadb "dev")
477 openssl
478 pcre
479 pulseaudio
480 python
481 rapidjson
482 samba
483 spdlog
484 sqlite
485 taglib
486 tinyxml
487 tinyxml2
488 tzdata
489 util-linux
490 zip
491 zlib))
492 (synopsis "Media center for home theater computers")
493 (description "Kodi is a media center application for playing videos,
494music, games, etc. Kodi is highly customizable and features a theme and
495plug-in system.")
496 (home-page "https://kodi.tv")
497 ;; XBMC is largely GPL2+, with some library components as LGPL2.1+, but
498 ;; there are some other licenses spread throughout.
499 (license (list license:gpl2+ license:lgpl2.1+
500 license:gpl3+ ;WiiRemote client
501 license:expat ;cpluff, dbwrappers
502 license:public-domain ;cpluff/examples
503 license:bsd-3 ;misc
504 license:bsd-2)))) ;xbmc/freebsd
505
506(define-public kodi/wayland
507 (package
508 (inherit kodi)
509 (name "kodi-wayland")
510 (arguments
511 (substitute-keyword-arguments arguments
512 ((#:configure-flags flags)
513 `(cons "-DCORE_PLATFORM_NAME=wayland"
514 (delete "-DCORE_PLATFORM_NAME=x11" ,flags)))))
515 (inputs
516 (modify-inputs inputs
517 (prepend libinput
518 libxkbcommon
519 waylandpp
520 wayland-protocols)))
521 (synopsis "Kodi with Wayland rendering backend")))
522
523(define-public kodi-cli
524 (let ((commit "104dc23b2a993c8e6db8c46f4f8bec24b146549b") ; Add support for
525 (revision "1")) ; `$HOME/.kodirc'.
526 (package
527 (name "kodi-cli")
528 (version (git-version "1.1" revision commit))
529 (source (origin
530 (method git-fetch)
531 (uri (git-reference (url "https://github.com/nawar/kodi-cli")
532 (commit commit)))
533 (sha256
534 (base32
535 "1xjhasc5gngfxpr1dlzy6q24w0wpdfjx12p43fanjppxw4i49n5p"))
536 (file-name (git-file-name name version))))
537 (build-system trivial-build-system)
538 (inputs
539 (list bash-minimal curl python-yewtube))
540 (arguments
541 (list
542 #:modules '((guix build utils))
543 #:builder
544 #~(begin
545 (use-modules (guix build utils))
546 (copy-recursively (assoc-ref %build-inputs "source") ".")
547 (substitute* "kodi-cli"
548 (("/bin/bash")
549 (search-input-file %build-inputs "/bin/bash"))
550 (("output=\\$\\((curl)" all curl)
551 (string-append "output=$("
552 #$(this-package-input "curl")
553 "/bin/" curl))
554 ;; Executable is just called yt with yewtube.
555 (("play_youtube `mpsyt")
556 (string-append "play_youtube `"
557 #$(this-package-input "python-yewtube")
558 "/bin/yt")))
559 (install-file "kodi-cli" (string-append %output "/bin")))))
560 (home-page "https://github.com/nawar/kodi-cli")
561 (synopsis "Control Kodi from the command line")
562 (description "@code{kodi-cli} is a tool for sending commands to a Kodi
563server using JSON RPC.
564
565Features:
566
567@itemize
568@item Play, pause, stop the currently playing item.
569@item Skip forward or backward in the currently playing item.
570@item Play or queue to the currently list of YouTube videos.
571@item Interactive and noninteractive volume control.
572@item Interactive navigation.
573@item Send text to the Kodi keyboard.
574@item Toggle fullscreen.
575@item Update or clean Kodi libraries.
576@end itemize\n")
577 (license license:gpl2+))))