summary refs log tree commit diff
path: root/gnu/packages/kodi.scm
blob: 5710e1fd48b8c2b4fa97609ef82d4dc52bc47620 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages kodi)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix utils)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages algebra)
  #:use-module (gnu packages audio)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages avahi)
  #:use-module (gnu packages base)
  #:use-module (gnu packages boost)
  #:use-module (gnu packages cdrom)
  #:use-module (gnu packages cmake)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages doxygen)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages fribidi)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages ghostscript)
  #:use-module (gnu packages gawk)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gperf)
  #:use-module (gnu packages gnunet)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages image)
  #:use-module (gnu packages java)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mp3)
  #:use-module (gnu packages pcre)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages python)
  #:use-module (gnu packages samba)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages ssh)
  #:use-module (gnu packages swig)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages video)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xiph)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages xorg)
  #:use-module (gnu packages yasm)
  #:use-module (gnu packages zip))

(define-public crossguid
  (let ((commit "8f399e8bd4252be9952f3dfa8199924cc8487ca4"))
    (package
      (name "crossguid")
      (version (string-append "0.0-1." (string-take commit 7)))
      ;; There's no official release.  Just a Git repository.
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/graeme-hill/crossguid.git")
                      (commit commit)))
                (sha256
                 (base32
                  "1i29y207qqddvaxbn39pk2fbh3gx8zvdprfp35wasj9rw2wjk3s9"))))
      (build-system gnu-build-system)
      (arguments
       '(#:phases
         (modify-phases %standard-phases
           (delete 'configure) ; no configure script
           ;; There's no build system here, so we have to do it ourselves.
           (replace 'build
             (lambda _
               (and (zero? (system* "g++" "-c" "guid.cpp" "-o" "guid.o"
                                    "-std=c++11" "-DGUID_LIBUUID"))
                    (zero? (system* "ar" "rvs" "libcrossguid.a" "guid.o")))))
           (replace 'check
             (lambda _
               (and (zero? (system* "g++" "-c" "test.cpp" "-o" "test.o"
                                    "-std=c++11"))
                    (zero? (system* "g++" "-c" "testmain.cpp" "-o" "testmain.o"
                                    "-std=c++11"))
                    (zero? (system* "g++" "test.o" "guid.o" "testmain.o"
                                    "-o" "test" "-luuid"))
                    (zero? (system* (string-append (getcwd) "/test"))))))
           (replace 'install
             (lambda* (#:key outputs #:allow-other-keys)
               (let ((out (assoc-ref outputs "out")))
                 (install-file "guid.h" (string-append out "/include"))
                 (install-file "libcrossguid.a"
                               (string-append out "/lib"))
                 #t))))))
      (inputs
       `(("util-linux" ,util-linux)))
      (synopsis "Lightweight universal identifier library")
      (description "CrossGuid is a minimal @acronym{GUID}/@acronym{UUID}
generator library for C++.")
      (home-page "https://github.com/graeme-hill/crossguid")
      (license license:expat))))

(define-public kodi
  (package
    (name "kodi")
    (version "16.0")
    (source (origin
              (method url-fetch)
              (uri (string-append "http://mirrors.kodi.tv/releases/source/"
                                  version "-Jarvis.tar.gz"))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "0iirspvv7czf785l2lqf232dvdaj87srbn9ni97ngvnd6w9yl884"))
              (snippet
               ;; Delete bundled ffmpeg.
               ;; TODO: Delete every other bundled library.
               '(begin
                  (use-modules (guix build utils))
                  (delete-file-recursively "tools/depends/target/ffmpeg")))
              (modules '((guix build utils)))))
    (build-system gnu-build-system)
    (arguments
     '(#:configure-flags '("--with-ffmpeg=shared") ; don't use bundled ffmpeg
       #:phases
       (modify-phases %standard-phases
         ;; JsonSchemaBuilder is a small tool needed by the build system that
         ;; comes bundled with the source.  The build system tries to build it
         ;; during the bootstrapping phase, which causes serious issues
         ;; because there's no time for shebangs to be patched.  So, we
         ;; bootstrap it on our own instead.
         (add-after 'unpack 'bootstrap-jsonschemabuilder
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((dir "tools/depends/native/JsonSchemaBuilder/src"))
               (with-directory-excursion dir
                 (zero? (system* "sh" "autogen.sh"))))))
         ;; Now we can do the regular bootstrapping process, but only after
         ;; the first round of shebang patching.  We must repeat the patching
         ;; after bootstrapping so that all of the files generated by the
         ;; Autotools et al. are patched appropriately.
         (add-after 'patch-source-shebangs 'bootstrap
           (lambda* (#:key inputs #:allow-other-keys)
             ;; We bootstrapped JsonSchemaBuilder in the previous phase, so we
             ;; need to make sure it isn't done a second time.  Otherwise, it
             ;; would undo the shebang patching that we worked so hard for.
             (substitute* '("tools/depends/native/JsonSchemaBuilder/Makefile")
               (("\\./autogen\\.sh") ""))
             ;; This essentially does what their 'bootstrap' script does, but
             ;; additionally passes the correct CONFIG_SHELL.
             (let ((bash (string-append (assoc-ref inputs "bash") "/bin/sh")))
               (define (run-make makefile)
                 (zero? (system* "make" "-f" makefile
                                 "BOOTSTRAP_STANDALONE=1"
                                 (string-append "CONFIG_SHELL=" bash))))
               (and (run-make "bootstrap.mk")
                    (run-make "codegenerator.mk")))))
         (add-after 'bootstrap 'patch-source-shebangs-again
           (assoc-ref %standard-phases 'patch-source-shebangs))
         ;; 3 tests fail that appear harmless, so we disable them.
         (add-before 'check 'disable-some-tests
           (lambda _
             (substitute* '("xbmc/utils/test/TestSystemInfo.cpp")
               (("TEST_F\\(TestSystemInfo, GetOsPrettyNameWithVersion\\)")
                "TEST_F(TestSystemInfo, DISABLED_GetOsPrettyNameWithVersion)")
               (("TEST_F\\(TestSystemInfo, GetOsName\\)")
                "TEST_F(TestSystemInfo, DISABLED_GetOsName)")
               (("TEST_F\\(TestSystemInfo, GetOsVersion\\)")
                "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)")))))))
    ;; TODO: Add dependencies for:
    ;; - vdpau
    ;; - nfs
    ;;
    ;; FIXME: libusb detection fails.
    ;;
    ;; FIXME: As you can see, we use a lot of external libraries, but it seems
    ;; that a few bundled ones are still being used.
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("cmake" ,cmake)
       ("doxygen" ,doxygen)
       ("gawk" ,gawk)
       ("gettext" ,gnu-gettext)
       ("icedtea" ,icedtea) ; needed at build-time only, mandatory
       ("libtool" ,libtool)
       ("pkg-config" ,pkg-config)
       ("swig" ,swig)
       ("which" ,which)
       ("yasm" ,yasm)))
    (inputs
     `(("alsa-lib" ,alsa-lib)
       ("avahi" ,avahi)
       ("bluez" ,bluez)
       ("boost" ,boost)
       ("bzip2" ,bzip2)
       ("crossguid" ,crossguid)
       ("curl" ,curl)
       ("dcadec" ,dcadec)
       ("dbus" ,dbus)
       ("enca" ,enca)
       ("eudev" ,eudev)
       ("ffmpeg" ,ffmpeg)
       ("flac" ,flac)
       ("fontconfig" ,fontconfig)
       ("freetype" ,freetype)
       ("fribidi" ,fribidi)
       ("glew" ,glew)
       ("gnutls" ,gnutls)
       ("gperf" ,gperf)
       ("jasper" ,jasper)
       ("lame" ,lame)
       ("libass" ,libass)
       ("libbluray" ,libbluray)
       ("libcap" ,libcap)
       ("libcdio" ,libcdio)
       ("libgcrypt" ,libgcrypt)
       ("libjpeg" ,libjpeg)
       ("libltdl" ,libltdl)
       ("libmad" ,libmad)
       ("libmicrohttpd" ,libmicrohttpd)
       ("libmodplug" ,libmodplug)
       ("libmpeg2" ,libmpeg2)
       ("libogg" ,libogg)
       ("libpng" ,libpng)
       ("libsamplerate" ,libsamplerate)
       ("libssh" ,libssh)
       ("libtiff" ,libtiff)
       ("libva" ,libva)
       ("libvorbis" ,libvorbis)
       ("libxml2" ,libxml2)
       ("libxmu" ,libxmu)
       ("libxrandr" ,libxrandr)
       ("libxrender" ,libxrender)
       ("libxslt" ,libxslt)
       ("libxt" ,libxt)
       ("libyajl" ,libyajl)
       ("lzo" ,lzo)
       ("mesa-utils" ,mesa-utils)
       ("mysql" ,mysql)
       ("openssl" ,openssl)
       ("pcre" ,pcre)
       ("pulseaudio" ,pulseaudio)
       ("python" ,python-2)
       ("samba" ,samba)
       ("sdl2" ,sdl2)
       ("sqlite" ,sqlite)
       ("taglib" ,taglib)
       ("tinyxml" ,tinyxml)
       ("unzip" ,unzip)
       ("util-linux" ,util-linux)
       ("zip" ,zip)
       ("zlib" ,zlib)))
    (synopsis "Media center for home theater computers")
    (description "Kodi is a media center application for playing videos,
music, games, etc.  Kodi is highly customizable and features a theme and
plug-in system.")
    (home-page "http://kodi.tv")
    (license license:gpl2+)))