From dc21c0c6786336643b765ba1c40b79eb3d9ff3db Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Fri, 3 Mar 2017 02:19:14 +0100 Subject: [PATCH 2/2] gnu: kodi: Update to 18.0_alpha-0-4912f8f. * gnu/packages/kodi.scm (libdvdnav/kodi, libdvdread/kodi, libdvdcss/kodi): New variables. (kodi): Update to 18.0_alpha-0-4912f8f. [source]: Download from git. Unbundle more stuff. [build-system]: Change to CMAKE-BUILD-SYSTEM. [arguments]: Add #:configure-flag to disable nonfree components. Rework phases to patch bundled software and bootstrap more libraries. [native-inputs]: Remove CMAKE. Add LIBDVDCSS/KODI, LIBDVDNAV/KODI and LIBDVDREAD/KODI. [inputs]: Remove BOOST, BZIP2, ENCA, GPERF, JASPER, LIBMODPLUG, LIBSAMPLERATE, MESA-UTILS and SDL2. Add FMT, GIFLIB, LCMS and LIBDRM. [license]: Update for remaining software bundles. --- gnu/packages/kodi.scm | 274 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 213 insertions(+), 61 deletions(-) diff --git a/gnu/packages/kodi.scm b/gnu/packages/kodi.scm index 929894d61..5843b99a6 100644 --- a/gnu/packages/kodi.scm +++ b/gnu/packages/kodi.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson +;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,13 +23,13 @@ #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) + #:use-module (guix build-system cmake) #: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) @@ -52,6 +53,7 @@ #:use-module (gnu packages mp3) #:use-module (gnu packages pcre) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages pretty-print) #:use-module (gnu packages pulseaudio) #:use-module (gnu packages python) #:use-module (gnu packages samba) @@ -119,88 +121,235 @@ generator library for C++.") (home-page "https://github.com/graeme-hill/crossguid") (license license:expat)))) +;; Kodi requires special forks of these libraries. In addition, +;; it insists on downloading and building these as part of the +;; standard build process. To make things easier, we bootstrap +;; them here, so we don't have to worry about it later. +(define libdvdnav/kodi + (let ((commit "981488f7f27554b103cca10c1fbeba027396c94a")) + (package + (name "libdvdnav-bootstrapped") + (version commit) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/xbmc/libdvdnav.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "089pswc51l3avh95zl4cpsh7gh1innh7b2y4xgx840mcmy46ycr8")))) + (build-system gnu-build-system) + (arguments + '(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'bootstrap + (lambda _ (zero? (system* "autoreconf" "-vif")))) + (delete 'configure) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (copy-recursively "." (assoc-ref outputs "out")) + #t))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("pkg-config" ,pkg-config))) + (home-page "https://github.com/xbmc/libdvdnav") + (synopsis (package-synopsis libdvdnav)) + (description (package-description libdvdnav)) + (license license:gpl2+)))) + +(define libdvdread/kodi + (let ((commit "17d99db97e7b8f23077b342369d3c22a6250affd")) + (package + (name "libdvdread-bootstrapped") + (version commit) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/xbmc/libdvdread.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "1gr5aq1cjr3as9mnwrw29cxn4m6f6pfrxdahkdcjy70q3ldg90sl")))) + (build-system gnu-build-system) + (arguments + '(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'bootstrap + (lambda _ (zero? (system* "autoreconf" "-vif")))) + (delete 'configure) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (copy-recursively "." (assoc-ref outputs "out")) + #t))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("pkg-config" ,pkg-config))) + (home-page "https://github.com/xbmc/libdvdread") + (synopsis (package-synopsis libdvdread)) + (description (package-description libdvdread)) + (license (list license:gpl2+ license:lgpl2.1+))))) + +(define libdvdcss/kodi + (let ((commit "2f12236bc1c92f73c21e973363f79eb300de603f")) + (package + (name "libdvdcss-bootstrapped") + (version commit) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/xbmc/libdvdcss.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) + (sha256 + (base32 + "198r0q73i55ga1dvyqq9nfcri0zq08b94hy8671lg14i3izx44dd")))) + (build-system gnu-build-system) + (arguments + '(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'bootstrap + (lambda _ (zero? (system* "autoreconf" "-vif")))) + (delete 'configure) + (delete 'build) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (copy-recursively "." (assoc-ref outputs "out")) + #t))))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool) + ("pkg-config" ,pkg-config))) + (home-page "https://github.com/xbmc/libdvdcss") + (synopsis (package-synopsis libdvdcss)) + (description (package-description libdvdcss)) + (license license:gpl2+)))) + (define-public kodi + ;; We package the git version since the current released + ;; version was cut while the cmake transition was in turmoil. + (let ((commit "4912f8f868e0847a8a26158e18185c43c2f0e197") + (revision "0")) (package (name "kodi") - (version "16.0") + (version (string-append "18.0_alpha-" revision "-" (string-take commit 7))) (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")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/xbmc/xbmc.git") + (commit commit))) + (file-name (string-append name "-" version "-checkout")) (sha256 (base32 - "0iirspvv7czf785l2lqf232dvdaj87srbn9ni97ngvnd6w9yl884")) + "1z5daiwjbij5df2fbxwnxfpprzr05f8fxmx0zjqd1r98ih6yc52r")) (snippet - ;; Delete bundled ffmpeg. - ;; TODO: Delete every other bundled library. '(begin (use-modules (guix build utils)) - (delete-file-recursively "tools/depends/target/ffmpeg"))) + (for-each delete-file-recursively + '("project/BuildDependencies/bin/" + ;; TODO: Purge these jars. + ;;"tools/codegenerator/groovy" + ;; And these sources: + ;; "tools/depend/native/JsonSchemaBuilder" + ;; "tools/depend/native/TexturePacker" + ;; "lib/LibUPnP" + ;; "lib/UnrarXlib" + ;; "lib/gtest" + ;; "lib/cpluff" + ;; "lib/libexif" + "project/Win32BuildSetup/tools/7z")) + #t)) (modules '((guix build utils))))) - (build-system gnu-build-system) + (build-system cmake-build-system) (arguments - '(#:configure-flags '("--with-ffmpeg=shared") ; don't use bundled ffmpeg + '(#:configure-flags + (list "-DENABLE_INTERNAL_FFMPEG=OFF" + "-DENABLE_INTERNAL_CROSSGUID=OFF" + (string-append "-Dlibdvdread_URL=" + (assoc-ref %build-inputs "libdvdread-bootstrapped")) + (string-append "-Dlibdvdnav_URL=" + (assoc-ref %build-inputs "libdvdnav-bootstrapped")) + (string-append "-Dlibdvdcss_URL=" + (assoc-ref %build-inputs "libdvdcss-bootstrapped")) + "-DENABLE_NONFREE=OFF") #: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 + ;; The build system tries to bootstrap these components + ;; during the build 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 + (add-after 'unpack 'bootstrap-bundled-software (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 + (let ((dirs '("tools/depends/native/JsonSchemaBuilder/src" + "lib/cpluff"))) + (for-each (lambda (third-party) + (with-directory-excursion third-party + (zero? (system* "autoreconf" "-vif")))) + dirs)))) + (add-after 'bootstrap-bundled-software 'patch-stuff (lambda _ + ;; Prevent the build scripts from calling autoreconf in + ;; the build stage. Otherwise, it would undo the careful + ;; bootstrapping that we've worked so hard for. + (substitute* "cmake/modules/FindLibDvd.cmake" + ;; Let's also use this opportunity to make the freshly + ;; unpackaged source directory writable. + (("autoreconf -vif") "chmod -R u+w .")) + (substitute* "cmake/modules/FindCpluff.cmake" + (("autoreconf -vif") "true")) + (substitute* "lib/cpluff/po/Makefile.in.in" + (("/bin/sh") (which "sh"))) + + ;; Let's disable some tests that are known not to work here. + ;; Doing this later while in the cmake "../build" directory + ;; is trickier. (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)"))))))) + "TEST_F(TestSystemInfo, DISABLED_GetOsVersion)")) + ;; FIXME: Why are these failing. + (substitute* "xbmc/network/test/TestWebServer.cpp" + (("TEST_F\\(TestWebServer, Can") + "TEST_F(TestWebServer, DISABLED_Can")) + #t)) + (add-before 'build 'set-build-environment + (lambda _ + ;; Some bundled build script falls back to /bin/sh + ;; if this is not set. + (setenv "CONFIG_SHELL" (which "sh")) + #t)) + (add-before 'check 'build-kodi-test + (lambda _ + (zero? (system* "make" "kodi-test"))))))) ;; 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. + ;; - cec + ;; - plist + ;; - shairplay (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) - ("cmake" ,cmake) ("doxygen" ,doxygen) ("gawk" ,gawk) ("gettext" ,gettext-minimal) ("icedtea" ,icedtea) ; needed at build-time only, mandatory + ("libdvdcss-bootstrapped" ,libdvdcss/kodi) + ("libdvdnav-bootstrapped" ,libdvdnav/kodi) + ("libdvdread-bootstrapped" ,libdvdread/kodi) ("libtool" ,libtool) ("pkg-config" ,pkg-config) ("swig" ,swig) @@ -210,38 +359,35 @@ generator library for C++.") `(("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) + ("fmt" ,fmt) ("fontconfig" ,fontconfig) ("freetype" ,freetype) ("fribidi" ,fribidi) + ("giflib" ,giflib) ("glew" ,glew) ("gnutls" ,gnutls) - ("gperf" ,gperf) - ("jasper" ,jasper) ("lame" ,lame) + ("lcms" ,lcms) ("libass" ,libass) ("libbluray" ,libbluray) ("libcap" ,libcap) ("libcdio" ,libcdio) + ("libdrm" ,libdrm) ("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) @@ -254,14 +400,12 @@ generator library for C++.") ("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) @@ -274,4 +418,12 @@ generator library for C++.") music, games, etc. Kodi is highly customizable and features a theme and plug-in system.") (home-page "http://kodi.tv") - (license license:gpl2+))) + ;; XBMC is largely GPL2+, with some library components as + ;; LGPL2.1+, but the source code is littered with one-off + ;; licensed files. + (license (list license:gpl2+ license:lgpl2.1+ + license:gpl3+ ;WiiRemote client + license:expat ;cpluff, dbwrappers + license:public-domain ;cpluff/examples + license:bsd-3 ;misc + license:bsd-2))))) ;xbmc/freebsd -- 2.12.0