2014-05-04 01:55:36 +02:00
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# Only tested on Linux
|
|
|
|
|
2018-04-26 23:37:40 +02:00
|
|
|
{ stdenv, lib, fetchurl,
|
2017-03-18 09:44:45 +01:00
|
|
|
python2, pkgconfig, yasm, harfbuzz, zlib,
|
|
|
|
autoconf, automake, cmake, libtool, m4, jansson,
|
|
|
|
libass, libiconv, libsamplerate, fribidi, libxml2, bzip2,
|
2018-04-12 11:50:28 +02:00
|
|
|
libogg, libopus, libtheora, libvorbis, libdvdcss, a52dec,
|
2018-04-17 21:00:23 +02:00
|
|
|
lame, libdvdread, libdvdnav, libbluray,
|
2016-08-29 08:03:41 +02:00
|
|
|
mp4v2, mpeg2dec, x264, x265, libmkv,
|
2018-02-25 03:23:58 +01:00
|
|
|
fontconfig, freetype, hicolor-icon-theme,
|
2016-08-29 08:03:41 +02:00
|
|
|
glib, gtk3, intltool, libnotify,
|
2018-02-25 03:23:58 +01:00
|
|
|
gst_all_1, dbus-glib, udev, libgudev, libvpx,
|
2018-04-17 21:00:23 +02:00
|
|
|
useGtk ? true, wrapGAppsHook ? null, libappindicator-gtk3 ? null,
|
|
|
|
useFfmpeg ? false, libav_12 ? null, ffmpeg ? null,
|
|
|
|
useFdk ? false, fdk_aac ? null
|
2014-05-04 01:55:36 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2018-04-26 23:37:40 +02:00
|
|
|
version = "1.1.0";
|
2014-05-04 01:55:36 +02:00
|
|
|
name = "handbrake-${version}";
|
|
|
|
|
2018-04-26 23:37:40 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = ''https://download2.handbrake.fr/${version}/HandBrake-${version}-source.tar.bz2'';
|
|
|
|
sha256 = "1nj0ihflisxcfkmsk7fm3b5cn7cpnpg66dk2lkp2ip6qidppqbm0";
|
2017-03-18 09:44:45 +01:00
|
|
|
};
|
|
|
|
|
2018-04-26 23:37:40 +02:00
|
|
|
patched_libav_12 = libav_12.overrideAttrs (super: {
|
|
|
|
# 2018-04-26: HandBrake compilation (1.1.0) requires a patch of LibAV (12.3) from HandBrake team. This patch not went LibAV upstream.
|
|
|
|
patches = (super.patches or []) ++ [(
|
|
|
|
fetchurl {
|
|
|
|
url = ''https://raw.githubusercontent.com/HandBrake/HandBrake/9e1f245708a157231c427c0ef9b91729d59a30e1/contrib/ffmpeg/A21-mp4-sdtp.patch'';
|
|
|
|
sha256 = "14grzyvb1qbb90k31ibabnwmwnrc48ml6h2z0rjamdv83q45jq4g";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
});
|
|
|
|
|
2017-03-18 09:44:45 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake python2 pkgconfig yasm autoconf automake libtool m4
|
2018-04-18 19:23:27 +02:00
|
|
|
] ++ lib.optionals useGtk [ intltool wrapGAppsHook ];
|
2014-05-04 01:55:36 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
2017-03-18 09:44:45 +01:00
|
|
|
fribidi fontconfig freetype jansson zlib
|
|
|
|
libass libiconv libsamplerate libxml2 bzip2
|
2018-04-12 11:50:28 +02:00
|
|
|
libogg libopus libtheora libvorbis libdvdcss a52dec libmkv
|
2018-04-18 19:23:27 +02:00
|
|
|
lame libdvdread libdvdnav libbluray mp4v2 mpeg2dec x264 x265 libvpx
|
2018-04-17 21:00:23 +02:00
|
|
|
] ++ lib.optionals useGtk [
|
2017-03-18 09:44:45 +01:00
|
|
|
glib gtk3 libappindicator-gtk3 libnotify
|
2018-02-25 03:23:58 +01:00
|
|
|
gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus-glib udev
|
2017-03-18 09:44:45 +01:00
|
|
|
libgudev
|
2018-04-26 23:37:40 +02:00
|
|
|
] ++ (if useFfmpeg then [ ffmpeg ] else [ patched_libav_12 ])
|
2018-04-17 21:00:23 +02:00
|
|
|
++ lib.optional useFdk fdk_aac;
|
2014-05-04 01:55:36 +02:00
|
|
|
|
2017-03-18 09:44:45 +01:00
|
|
|
dontUseCmakeConfigure = true;
|
2014-05-04 01:55:36 +02:00
|
|
|
|
2017-04-16 13:42:25 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2014-05-04 01:55:36 +02:00
|
|
|
preConfigure = ''
|
2017-03-18 09:44:45 +01:00
|
|
|
patchShebangs scripts
|
|
|
|
|
|
|
|
substituteInPlace libhb/module.defs \
|
|
|
|
--replace /usr/include/libxml2 ${libxml2.dev}/include/libxml2
|
2014-05-04 01:55:36 +02:00
|
|
|
|
|
|
|
# Force using nixpkgs dependencies
|
|
|
|
sed -i '/MODULES += contrib/d' make/include/main.defs
|
|
|
|
sed -i '/PKG_CONFIG_PATH=/d' gtk/module.rules
|
|
|
|
'';
|
|
|
|
|
2016-08-29 08:03:41 +02:00
|
|
|
configureFlags = [
|
2017-03-18 09:44:45 +01:00
|
|
|
"--disable-df-fetch"
|
|
|
|
"--disable-df-verify"
|
2016-08-29 08:03:41 +02:00
|
|
|
(if useGtk then "--disable-gtk-update-checks" else "--disable-gtk")
|
2018-04-12 11:50:28 +02:00
|
|
|
(if useFdk then "--enable-fdk-aac" else "")
|
2016-08-29 08:03:41 +02:00
|
|
|
];
|
2014-05-04 01:55:36 +02:00
|
|
|
|
2017-03-21 11:28:50 +01:00
|
|
|
NIX_LDFLAGS = [
|
|
|
|
"-lx265"
|
|
|
|
];
|
|
|
|
|
2014-05-04 01:55:36 +02:00
|
|
|
preBuild = ''
|
|
|
|
cd build
|
|
|
|
'';
|
|
|
|
|
2017-04-16 13:42:25 +02:00
|
|
|
# icon-theme.cache belongs in the icon theme, not in individual packages
|
|
|
|
postInstall = ''
|
|
|
|
rm $out/share/icons/hicolor/icon-theme.cache
|
|
|
|
'';
|
|
|
|
|
2017-03-18 09:44:45 +01:00
|
|
|
meta = with stdenv.lib; {
|
2014-05-04 01:55:36 +02:00
|
|
|
homepage = http://handbrake.fr/;
|
2018-04-18 19:23:27 +02:00
|
|
|
description = "A tool for converting video files and ripping DVDs";
|
2014-05-04 01:55:36 +02:00
|
|
|
longDescription = ''
|
2018-04-18 19:23:27 +02:00
|
|
|
Tool for converting and remuxing video files
|
|
|
|
into selection of modern and widely supported codecs
|
|
|
|
and containers. Very versatile and customizable.
|
|
|
|
Package provides:
|
|
|
|
CLI - `HandbrakeCLI`
|
|
|
|
GTK+ GUI - `ghb`
|
2014-05-04 01:55:36 +02:00
|
|
|
'';
|
2017-03-18 09:44:45 +01:00
|
|
|
license = licenses.gpl2;
|
2018-04-18 19:23:27 +02:00
|
|
|
maintainers = with maintainers; [ Anton-Latukha wmertens ];
|
2014-05-04 01:55:36 +02:00
|
|
|
# Not tested on anything else
|
2017-03-18 09:44:45 +01:00
|
|
|
platforms = platforms.linux;
|
2014-05-04 01:55:36 +02:00
|
|
|
};
|
|
|
|
}
|