guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCHES] Add Kodi


From: David Thompson
Subject: [PATCHES] Add Kodi
Date: Tue, 24 Nov 2015 19:35:45 -0500
User-agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-unknown-linux-gnu)

This one was a real hairball, but here is a patch set that adds the Kodi
media center!  I hope that I've explained all the craziness relatively
well in the comments.

>From d708d0c36e202bbad7255c3b8a55ca0afdd18cb3 Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
Date: Tue, 24 Nov 2015 13:35:44 -0500
Subject: [PATCH 1/3] gnu: Add tinyxml.

* gnu/packages/xml.scm (tinyxml): New variable.
* gnu/packages/patches/tinyxml-use-stl.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
---
 gnu-system.am                              |  1 +
 gnu/packages/patches/tinyxml-use-stl.patch | 38 +++++++++++++++++
 gnu/packages/xml.scm                       | 67 ++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 gnu/packages/patches/tinyxml-use-stl.patch

diff --git a/gnu-system.am b/gnu-system.am
index 61dfced..c97430f 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -695,6 +695,7 @@ dist_patch_DATA =                                           
\
   gnu/packages/patches/texi2html-document-encoding.patch       \
   gnu/packages/patches/texi2html-i18n.patch                    \
   gnu/packages/patches/tidy-CVE-2015-5522+5523.patch           \
+  gnu/packages/patches/tinyxml-use-stl.patch                   \
   gnu/packages/patches/torsocks-dns-test.patch                 \
   gnu/packages/patches/tvtime-gcc41.patch                      \
   gnu/packages/patches/tvtime-pngoutput.patch                  \
diff --git a/gnu/packages/patches/tinyxml-use-stl.patch 
b/gnu/packages/patches/tinyxml-use-stl.patch
new file mode 100644
index 0000000..ddc21d8
--- /dev/null
+++ b/gnu/packages/patches/tinyxml-use-stl.patch
@@ -0,0 +1,38 @@
+From a53b6ee4519a7657164610ac14a82c57b1273bf6 Mon Sep 17 00:00:00 2001
+From: David Thompson <address@hidden>
+Date: Mon, 23 Nov 2015 06:54:36 -0500
+Subject: [PATCH] Use STL.
+
+---
+ tinyxml.h   | 2 ++
+ xmltest.cpp | 1 +
+ 2 files changed, 3 insertions(+)
+
+diff --git a/tinyxml.h b/tinyxml.h
+index a3589e5..6cbfc7d 100644
+--- a/tinyxml.h
++++ b/tinyxml.h
+@@ -43,6 +43,8 @@ distribution.
+ #define DEBUG
+ #endif
+ 
++#define TIXML_USE_STL 1
++
+ #ifdef TIXML_USE_STL
+       #include <string>
+       #include <iostream>
+diff --git a/xmltest.cpp b/xmltest.cpp
+index 663c157..057dbfe 100644
+--- a/xmltest.cpp
++++ b/xmltest.cpp
+@@ -2,6 +2,7 @@
+    Test program for TinyXML.
+ */
+ 
++#define TIXML_USE_STL 1
+ 
+ #ifdef TIXML_USE_STL
+       #include <iostream>
+-- 
+2.5.0
+
diff --git a/gnu/packages/xml.scm b/gnu/packages/xml.scm
index a296e0a..7d7e167 100644
--- a/gnu/packages/xml.scm
+++ b/gnu/packages/xml.scm
@@ -511,3 +511,70 @@ Libxml2).")
 UTF-8 and UTF-16 encoding.")
     ;; LGPL 2.0+ with additional exceptions for static linking
     (license license:lgpl2.0+)))
+
+;; TinyXML is an unmaintained piece of software, so the patches and build
+;; system massaging have no upstream potential.
+(define-public tinyxml
+  (package
+    (name "tinyxml")
+    (version "2.6.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://sourceforge/tinyxml/tinyxml_"
+                                  (string-join (string-split version #\.) "_")
+                                  ".tar.gz"))
+              (sha256
+               (base32
+                "14smciid19lvkxqznfig77jxn5s4iq3jpb47vh5a6zcaqp7gvg8m"))
+              (patches (list (search-patch "tinyxml-use-stl.patch")))))
+    (build-system gnu-build-system)
+    ;; This library is missing *a lot* of the steps to make it usable, so we
+    ;; have to add them here, like every other distro must do.
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'build 'build-shared-library
+           (lambda _
+             (zero? (system* "g++" "-Wall" "-O2" "-shared" "-fpic"
+                             "tinyxml.cpp" "tinyxmlerror.cpp"
+                             "tinyxmlparser.cpp" "tinystr.cpp"
+                             "-o" "libtinyxml.so"))))
+         (replace 'check
+           (lambda _ (zero? (system "./xmltest"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (include (string-append out "/include"))
+                    (lib (string-append out "/lib"))
+                    (pkgconfig (string-append out "/lib/pkgconfig"))
+                    (doc (string-append out "/share/doc")))
+               ;; Install libs and headers.
+               (install-file "libtinyxml.so" lib)
+               (install-file "tinystr.h" include)
+               (install-file "tinyxml.h" include)
+               ;; Generate and install pkg-config file.
+               (mkdir-p pkgconfig)
+               (call-with-output-file (string-append pkgconfig "/tinyxml.pc")
+                 (lambda (port)
+                   (format port "prefix=~a
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: TinyXML
+Description: A simple, small, C++ XML parser
+Version: ~a
+Libs: -L${libdir} -ltinyxml
+Cflags: -I${includedir}
+"
+                           out ,version)))
+               ;; Install docs.
+               (mkdir-p doc)
+               (copy-recursively "docs" (string-append doc "tinyxml"))
+               #t))))))
+    (synopsis "Small XML parser for C++")
+    (description "TinyXML is a small and simple XML parsing library for the
+C++ programming langauge.")
+    (home-page "http://www.grinninglizard.com/tinyxml/index.html";)
+    (license license:zlib)))
-- 
2.5.0

>From 11b1b337dbd3b245c314b1d22eaeb1331a34e729 Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
Date: Tue, 24 Nov 2015 13:37:34 -0500
Subject: [PATCH 2/3] gnu: Add jasper.

* gnu/packages/image.scm (jasper): New variable.
---
 gnu/packages/image.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 37221b0..8a4a42a 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -703,3 +703,24 @@ applications with support for many types of images.  DevIL 
can load, save,
 convert, manipulate, filter and display a wide variety of image formats.")
     (home-page "http://openil.sourceforge.net";)
     (license license:lgpl2.1+)))
+
+(define-public jasper
+  (package
+    (name "jasper")
+    (version "1.900.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.ece.uvic.ca/~frodo/jasper";
+                                  "/software/jasper-" version ".zip"))
+              (sha256
+               (base32
+                "154l7zk7yh3v8l2l6zm5s2alvd2fzkp6c9i18iajfbna5af5m43b"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (synopsis "JPEG-2000 library")
+    (description "The JasPer Project is an initiative to provide a reference
+implementation of the codec specified in the JPEG-2000 Part-1 standard (i.e.,
+ISO/IEC 15444-1).")
+    (home-page "https://www.ece.uvic.ca/~frodo/jasper/";)
+    (license (license:x11-style "file://LICENSE"))))
-- 
2.5.0

>From feb1a97e9d3c0e28ee265861bb34c90aa3e06265 Mon Sep 17 00:00:00 2001
From: David Thompson <address@hidden>
Date: Mon, 16 Nov 2015 22:31:26 -0500
Subject: [PATCH 3/3] gnu: Add kodi.

---
 gnu-system.am         |   1 +
 gnu/packages/kodi.scm | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 204 insertions(+)
 create mode 100644 gnu/packages/kodi.scm

diff --git a/gnu-system.am b/gnu-system.am
index c97430f..f1c629d 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -171,6 +171,7 @@ GNU_SYSTEM_MODULES =                                \
   gnu/packages/kde.scm                         \
   gnu/packages/kde-frameworks.scm              \
   gnu/packages/key-mon.scm                     \
+  gnu/packages/kodi.scm                                \
   gnu/packages/language.scm                    \
   gnu/packages/less.scm                                \
   gnu/packages/lesstif.scm                     \
diff --git a/gnu/packages/kodi.scm b/gnu/packages/kodi.scm
new file mode 100644
index 0000000..971acfb
--- /dev/null
+++ b/gnu/packages/kodi.scm
@@ -0,0 +1,203 @@
+(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 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 kodi
+  (package
+    (name "kodi")
+    (version "15.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://mirrors.kodi.tv/releases/source/";
+                                  version "-Isengard.tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "043i0f1crx9glwxil4xm45z5kxpkrx316gi4ir4d3rbd5safp2nx"))))
+    (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 ((cwd (getcwd)))
+               (dynamic-wind
+                 (const #t)
+                 (lambda ()
+                   (chdir "tools/depends/native/JsonSchemaBuilder/src")
+                   (zero? (system* "sh" "autogen.sh")))
+                 (lambda ()
+                   (chdir cwd))))))
+         ;; 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)
+       ("icedtea7" ,icedtea7)
+       ("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)
+       ("curl" ,curl)
+       ("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)
+       ("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+)))
-- 
2.5.0

-- 
David Thompson
GPG Key: 0FF1D807

reply via email to

[Prev in Thread] Current Thread [Next in Thread]