Add Handbrake 0.9.9: DVD ripper

This packaging splices off the unfree faac library and forces handbrake
to use the (more recent/patched) versions of libraries in Nixpkgs.
Produces the CLI HandbrakeCLI and optionally the GTK+ version ghb.
This commit is contained in:
Wout Mertens 2014-05-04 01:55:36 +02:00
parent 3a7b7a8499
commit d93b1f80c0
3 changed files with 202 additions and 0 deletions

View File

@ -0,0 +1,99 @@
# Handbrake normally uses its own copies of the libraries it uses, for better
# control over library patches.
#
# This derivation patches HB so it doesn't do that. The relevant patches
# are added to the Nix packages and proposed upstream instead. In several cases
# upstream already incorporated these patches.
# This has the benefits of providing improvements to other packages,
# making licenses more clear and reducing compile time/install size.
#
# For compliance, the unfree codec faac is optionally spliced out.
#
# Only tested on Linux
#
# TODO: package and use libappindicator
{ stdenv, config, fetchurl,
python, pkgconfig, yasm,
autoconf, automake, libtool, m4,
libass, libsamplerate, fribidi, libxml2, bzip2,
libogg, libtheora, libvorbis, libdvdcss, a52dec, fdk_aac,
lame, faac, ffmpeg, libdvdread, libdvdnav, libbluray,
mp4v2, mpeg2dec, x264, libmkv,
fontconfig, freetype,
glib, gtk, webkitgtk, intltool, libnotify,
gst_all_1, dbus_glib, udev,
useGtk ? true,
useWebKitGtk ? false # This prevents ghb from starting in my tests
}:
stdenv.mkDerivation rec {
version = "0.9.9";
name = "handbrake-${version}";
allowUnfree = config.allowUnfree or false;
buildInputsX = stdenv.lib.optionals useGtk [
glib gtk intltool libnotify
gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus_glib udev
] ++ stdenv.lib.optionals useWebKitGtk [ webkitgtk ];
# Did not test compiling with it
unfreeInputs = stdenv.lib.optionals allowUnfree [ faac ];
nativeBuildInputs = [ python pkgconfig yasm autoconf automake libtool m4 ];
buildInputs = [
fribidi fontconfig freetype
libass libsamplerate libxml2 bzip2
libogg libtheora libvorbis libdvdcss a52dec libmkv fdk_aac
lame ffmpeg libdvdread libdvdnav libbluray mp4v2 mpeg2dec x264
] ++ buildInputsX ++ unfreeInputs;
src = fetchurl {
name = "HandBrake-${version}.tar.bz2";
url = "http://handbrake.fr/rotation.php?file=HandBrake-${version}.tar.bz2";
sha256 = "1crmm1c32vx60jfl2bqzg59q4qqx6m83b08snp7h1njc21sdf7d7";
};
patches = stdenv.lib.optionals (! allowUnfree) [ ./disable-unfree.patch ];
preConfigure = ''
# Fake wget to prevent downloads
mkdir wget
echo "#!/bin/sh" > wget/wget
echo "echo ===== Not fetching \$*" >> wget/wget
echo "exit 1" >> wget/wget
chmod +x wget/wget
export PATH=$PATH:$PWD/wget
# Force using nixpkgs dependencies
sed -i '/MODULES += contrib/d' make/include/main.defs
sed -i '/PKG_CONFIG_PATH=/d' gtk/module.rules
# disable faac if non-free
if [ -z "$allowUnfree" ]; then
rm libhb/encfaac.c
fi
'';
configureFlags = "--enable-fdk-aac ${if useGtk then "--disable-gtk-update-checks" else "--disable-gtk"}";
preBuild = ''
cd build
'';
meta = {
homepage = http://handbrake.fr/;
description = "A tool for ripping DVDs into video files";
longDescription = ''
Handbrake is a versatile transcoding DVD ripper. This package
provides the cli HandbrakeCLI and the GTK+ version ghb.
The faac library is disabled if you're compiling free-only.
'';
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.wmertens ];
# Not tested on anything else
platforms = stdenv.lib.platforms.linux;
};
}

View File

@ -0,0 +1,101 @@
diff -ru HandBrake-0.9.9-orig/gtk/configure.ac HandBrake-0.9.9/gtk/configure.ac
--- HandBrake-0.9.9-orig/gtk/configure.ac 2014-05-02 22:50:00.047305795 +0200
+++ HandBrake-0.9.9/gtk/configure.ac 2014-05-02 22:48:57.119304020 +0200
@@ -203,7 +203,7 @@
;;
esac
-HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2"
+HB_LIBS="-lhb -la52 -lmkv -lavresample -lavformat -lavcodec -lavutil -ldvdnav -ldvdread -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheoraenc -ltheoradec -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -lxml2"
if test "x$use_fdk_aac" = "xyes" ; then
HB_LIBS+=" -lfdk-aac"
diff -ru HandBrake-0.9.9-orig/gtk/src/preset_xlat.c HandBrake-0.9.9/gtk/src/preset_xlat.c
--- HandBrake-0.9.9-orig/gtk/src/preset_xlat.c 2014-05-02 22:50:00.043305794 +0200
+++ HandBrake-0.9.9/gtk/src/preset_xlat.c 2014-05-02 22:42:20.987292846 +0200
@@ -260,7 +260,6 @@
static value_map_t acodec_xlat[] =
{
- {"AAC (faac)", "faac"},
{"AC3 Passthru", "ac3"},
{"MP3 (lame)", "lame"},
{"Vorbis (vorbis)", "vorbis"},
diff -ru HandBrake-0.9.9-orig/gtk/src/presets.c HandBrake-0.9.9/gtk/src/presets.c
--- HandBrake-0.9.9-orig/gtk/src/presets.c 2014-05-02 22:50:00.043305794 +0200
+++ HandBrake-0.9.9/gtk/src/presets.c 2014-05-02 22:42:41.283293419 +0200
@@ -2029,8 +2029,6 @@
static value_map_t acodec_xlat_compat[] =
{
- {"AAC (CoreAudio)", "faac"},
- {"HE-AAC (CoreAudio)", "faac"},
{"AC3 (ffmpeg)", "ac3"},
{"AC3", "ac3"},
{"MP3 Passthru", "mp3pass"},
diff -ru HandBrake-0.9.9-orig/libhb/common.c HandBrake-0.9.9/libhb/common.c
--- HandBrake-0.9.9-orig/libhb/common.c 2014-05-02 22:50:00.047305795 +0200
+++ HandBrake-0.9.9/libhb/common.c 2014-05-02 22:37:24.679284489 +0200
@@ -126,7 +126,6 @@
{ "AAC (CoreAudio)", "ca_aac", HB_ACODEC_CA_AAC, HB_MUX_MP4|HB_MUX_MKV },
{ "HE-AAC (CoreAudio)", "ca_haac", HB_ACODEC_CA_HAAC, HB_MUX_MP4|HB_MUX_MKV },
#endif
- { "AAC (faac)", "faac", HB_ACODEC_FAAC, HB_MUX_MP4|HB_MUX_MKV },
#ifdef USE_FDK_AAC
{ "AAC (FDK)", "fdk_aac", HB_ACODEC_FDK_AAC, HB_MUX_MP4|HB_MUX_MKV },
{ "HE-AAC (FDK)", "fdk_haac", HB_ACODEC_FDK_HAAC, HB_MUX_MP4|HB_MUX_MKV },
diff -ru HandBrake-0.9.9-orig/libhb/common.h HandBrake-0.9.9/libhb/common.h
--- HandBrake-0.9.9-orig/libhb/common.h 2014-05-02 22:50:00.047305795 +0200
+++ HandBrake-0.9.9/libhb/common.h 2014-05-02 22:39:37.839288245 +0200
@@ -945,7 +945,6 @@
extern hb_work_object_t hb_decavcodeca;
extern hb_work_object_t hb_decavcodecv;
extern hb_work_object_t hb_declpcm;
-extern hb_work_object_t hb_encfaac;
extern hb_work_object_t hb_enclame;
extern hb_work_object_t hb_encvorbis;
extern hb_work_object_t hb_muxer;
diff -ru HandBrake-0.9.9-orig/libhb/hb.c HandBrake-0.9.9/libhb/hb.c
--- HandBrake-0.9.9-orig/libhb/hb.c 2014-05-02 22:50:00.047305795 +0200
+++ HandBrake-0.9.9/libhb/hb.c 2014-05-02 22:39:02.287287242 +0200
@@ -487,7 +487,6 @@
hb_register( &hb_decavcodeca );
hb_register( &hb_decavcodecv );
hb_register( &hb_declpcm );
- hb_register( &hb_encfaac );
hb_register( &hb_enclame );
hb_register( &hb_encvorbis );
hb_register( &hb_muxer );
@@ -588,7 +587,6 @@
hb_register( &hb_decavcodeca );
hb_register( &hb_decavcodecv );
hb_register( &hb_declpcm );
- hb_register( &hb_encfaac );
hb_register( &hb_enclame );
hb_register( &hb_encvorbis );
hb_register( &hb_muxer );
diff -ru HandBrake-0.9.9-orig/libhb/module.defs HandBrake-0.9.9/libhb/module.defs
--- HandBrake-0.9.9-orig/libhb/module.defs 2014-05-02 22:50:00.047305795 +0200
+++ HandBrake-0.9.9/libhb/module.defs 2014-05-02 22:39:25.727287903 +0200
@@ -95,7 +95,7 @@
LIBHB.lib = $(LIBHB.build/)hb.lib
LIBHB.dll.libs = $(foreach n, \
- a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
+ a52 ass avcodec avformat avutil avresample dvdnav dvdread \
fontconfig freetype mkv mpeg2 mp3lame mp4v2 \
ogg samplerate swscale theora vorbis vorbisenc x264 xml2 bluray, \
$(CONTRIB.build/)lib/lib$(n).a )
Only in HandBrake-0.9.9: libhb-orig
diff -ru HandBrake-0.9.9orig/test/module.defs HandBrake-0.9.9/test/module.defs
--- HandBrake-0.9.9-orig/test/module.defs 2014-05-02 23:15:10.575348401 +0200
+++ HandBrake-0.9.9/test/module.defs 2014-05-02 23:17:00.523351502 +0200
@@ -14,7 +14,7 @@
TEST.libs = $(LIBHB.a)
TEST.GCC.l = \
- a52 ass avcodec avformat avutil avresample dvdnav dvdread faac \
+ a52 ass avcodec avformat avutil avresample dvdnav dvdread \
fontconfig freetype fribidi mkv mpeg2 mp3lame mp4v2 ogg \
samplerate swscale theoraenc theoradec vorbis vorbisenc x264 \
bluray xml2 bz2 z

View File

@ -8704,6 +8704,8 @@ let
lxdvdrip = callPackage ../applications/video/lxdvdrip { };
handbrake = callPackage ../applications/video/handbrake { };
lynx = callPackage ../applications/networking/browsers/lynx { };
lyx = callPackage ../applications/misc/lyx { };