gnu: Add Handbrake.
authorEric Bavier <bavier@member.fsf.org>
Sat, 26 Dec 2015 02:29:09 +0000 (20:29 -0600)
committerEric Bavier <bavier@member.fsf.org>
Thu, 17 Nov 2016 02:58:12 +0000 (20:58 -0600)
* gnu/packages/video.scm (handbrake): New variable.
* gnu/packages/patches/handbrake-pkg-config-path.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.

gnu/local.mk
gnu/packages/patches/handbrake-pkg-config-path.patch [new file with mode: 0644]
gnu/packages/video.scm

index a5b75c1..ff8586e 100644 (file)
@@ -594,6 +594,7 @@ dist_patch_DATA =                                           \
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch       \
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
+  %D%/packages/patches/handbrake-pkg-config-path.patch         \
   %D%/packages/patches/hdf4-architectures.patch                \
   %D%/packages/patches/hdf4-reproducibility.patch              \
   %D%/packages/patches/hdf4-shared-fortran.patch               \
diff --git a/gnu/packages/patches/handbrake-pkg-config-path.patch b/gnu/packages/patches/handbrake-pkg-config-path.patch
new file mode 100644 (file)
index 0000000..18f3953
--- /dev/null
@@ -0,0 +1,24 @@
+Do not clobber PKG_CONFIG_PATH during configure.
+
+--- HandBrake-0.10.5/gtk/module.rules.orig     2016-02-11 14:14:05.000000000 -0600
++++ HandBrake-0.10.5/gtk/module.rules  2016-10-29 22:27:50.550960848 -0500
+@@ -15,7 +15,7 @@
+       set -e; cd $(GTK.src/); NOCONFIGURE=1 ./autogen.sh
+       set -e; cd $(GTK.build/); $(call fn.ABSOLUTE,$(GTK.src/))configure \
+               $(GTK.CONFIGURE.extra) \
+-              PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig \
++              PKG_CONFIG_PATH=$(BUILD/)contrib/lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH) \
+           CFLAGS="$(call fn.ARGS,GTK.GCC,.g .O *D ?extra)" \
+           LDFLAGS="$(call fn.ARGS,GTK.GCC,?strip .g .O ?extra.exe)" \
+           --prefix=$(PREFIX) \
+--- Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs      1969-12-31 18:00:00.000000000 -0600
++++ Handbrake-0.10.5-0.77d09e9-checkout/make/include/contrib.defs      2016-11-01 13:11:43.826144311 -0500
+@@ -119,7 +119,7 @@
+     endif
+     $(1).CONFIGURE.env.CPPFLAGS = CPPFLAGS="-I$$(call fn.ABSOLUTE,$(CONTRIB.build/))include $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra *D)"
+     $(1).CONFIGURE.env.LDFLAGS  = LDFLAGS="-L$$(call fn.ABSOLUTE,$(CONTRIB.build/))lib $$(call fn.ARGS,$(1).GCC,*archs *sysroot *minver ?extra.exe *D)"
+-    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig"
++    $(1).CONFIGURE.env.PKG_CONFIG_PATH  = PKG_CONFIG_PATH="$$(call fn.ABSOLUTE,$$(CONTRIB.build/))lib/pkgconfig$(if $(PKG_CONFIG_PATH),:)$(PKG_CONFIG_PATH)"
+     $(1).CONFIGURE.env.args = !CC !CFLAGS !CXX !CXXFLAGS !CPPFLAGS !LD !LDFLAGS !PKG_CONFIG_PATH !LOCAL_PATH !CROSS
+     $(1).CONFIGURE.env = $$(call fn.ARGS,$(1).CONFIGURE.env,$$($(1).CONFIGURE.env.args))
index 4329d20..82ef017 100644 (file)
@@ -12,6 +12,7 @@
 ;;; Copyright © 2016 Dmitry Nikolaev <cameltheman@gmail.com>
 ;;; Copyright © 2016 Andy Patterson <ajpatter@uwaterloo.ca>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
+;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -51,6 +52,7 @@
   #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #: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 gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages m4)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages ocr)
@@ -85,6 +90,7 @@
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages webkit)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xml)
@@ -1715,3 +1721,106 @@ It can use either mpv or mplayer for playback, and for conversion of
 formats ffmpeg or libav is used.  Users should install one of the
 supported players in addition to this package.")
     (license license:gpl3+)))
+
+(define-public handbrake
+  (package
+    (name "handbrake")
+    (version "0.10.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://handbrake.fr/rotation.php?file="
+                                  "HandBrake-" version ".tar.bz2"))
+              (file-name (string-append "handbrake-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "1w720y3bplkz187wgvy4a4xm0vpppg45mlni55l6yi8v2bfk14pv"))
+              (patches (search-patches "handbrake-pkg-config-path.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; Remove bundled libraries and source not necessary for
+               ;; running under a GNU environment.
+               '(begin
+                  (for-each delete-file-recursively '("contrib" "macosx" "win"))
+                  #t))))
+    (build-system  glib-or-gtk-build-system)
+    (native-inputs
+     `(("automake" ,automake)           ;gui subpackage must be bootstrapped
+       ("autoconf" ,autoconf)
+       ("curl" ,curl)                   ;not actually used, but tested for
+       ("intltool" ,intltool)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-2)))           ;for configuration
+    (inputs
+     `(("bzip2" ,bzip2)
+       ("dbus-glib" ,dbus-glib)
+       ("ffmpeg" ,ffmpeg)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("glib" ,glib)
+       ("gstreamer" ,gstreamer)
+       ("gst-plugins-base" ,gst-plugins-base)
+       ("gtk+" ,gtk+)
+       ("lame" ,lame)
+       ("libass" ,libass)
+       ("libbluray" ,libbluray)
+       ("libdvdnav" ,libdvdnav)
+       ("libdvdread" ,libdvdread)
+       ("libgudev" ,libgudev)
+       ("libmpeg2" ,libmpeg2)
+       ("libnotify" ,libnotify)
+       ("libogg" ,libogg)
+       ("libsamplerate" ,libsamplerate)
+       ("libtheora" ,libtheora)
+       ("libvorbis" ,libvorbis)
+       ("libvpx" ,libvpx)
+       ("libxml2" ,libxml2)
+       ("libx264" ,libx264)
+       ("x265" ,x265)
+       ("zlib" ,zlib)))
+    (arguments
+     `(#:tests? #f             ;tests require Ruby and claim to be unsupported
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'patch-source-shebangs 'bootstrap-gtk
+           ;; Run bootstrap ahead of time so that shebangs get patched.
+           (lambda _
+             (setenv "CONFIG_SHELL" (which "sh"))
+             (setenv "NOCONFIGURE" "1")
+             ;; Patch the Makefile so that it doesn't bootstrap again.
+             (substitute* "gtk/module.rules"
+               ((".*autogen\\.sh.*") ""))
+             (zero? (system* "sh" "./gtk/autogen.sh"))))
+         (add-before 'configure 'disable-contrib
+           (lambda _
+             (substitute* "make/include/main.defs"
+               ;; Disable unconditional inclusion of some "contrib"
+               ;; libraries (ffmpeg, libvpx, libdvdread, libdvdnav,
+               ;; and libbluray), which would lead to fetching and
+               ;; building of these libraries.  Use our own instead.
+               (("MODULES \\+= contrib") "# MODULES += contrib"))
+             #t))
+         (add-before 'configure 'fix-x265-linking
+           (lambda _
+             (substitute* "test/module.defs"
+               ;; Fix missing library during linking error
+               (("TEST.GCC.l =") "TEST.GCC.l = x265"))
+             #t))
+         (replace 'configure
+           (lambda* (#:key outputs configure-flags #:allow-other-keys)
+             ;; 'configure' is not an autoconf-generated script, and
+             ;; errors on unrecognized arguments,
+             ;; e.g. --enable-fast-install
+             (let ((out (assoc-ref outputs "out")))
+               (zero? (apply system* "./configure"
+                             (string-append "--prefix=" out)
+                             (or configure-flags '()))))))
+         (add-after 'configure 'chdir-build
+           (lambda _ (chdir "./build") #t)))))
+    (home-page "https://handbrake.fr")
+    (synopsis "Video transcoder")
+    (description
+     "HandBrake is a tool for converting video from any format to a selection
+of modern, widely supported codecs.")
+    ;; Most under GPL version 2 or later, and portions under BSD 3 Clause
+    (license (list license:gpl2+ license:bsd-3))))