@@ -1,72 +1,64 @@
11# Upstream distributes HandBrake with bundle of according versions of libraries and patches to them.
22#
3−# Derivation patches HandBrake to use our closure.
3+# Derivation patches HandBrake to use Nix closure dependencies.
44#
55
6−{ stdenv, lib, fetchurl,
7− python2, pkgconfig, yasm, zlib,
8− autoconf, automake, libtool, m4, jansson,
9− libass, libiconv, libsamplerate, fribidi, libxml2, bzip2,
10− libogg, libopus, libtheora, libvorbis, libdvdcss, a52dec,
11− lame, libdvdread, libdvdnav, libbluray,
12− mp4v2, mpeg2dec, x264, x265, libmkv,
13− fontconfig, freetype, hicolor-icon-theme,
14− glib, gtk3, intltool, libnotify,
15− gst_all_1, dbus-glib, udev, libgudev, libvpx,
16− useGtk ? true, wrapGAppsHook ? null, libappindicator-gtk3 ? null,
17− useFfmpeg ? false, libav_12 ? null, ffmpeg ? null,
6+{ stdenv, lib, fetchurl, callPackage,
7+ # Main build tools
8+ python2, pkgconfig, autoconf, automake, cmake, nasm, libtool, m4,
9+ # Processing, video codecs, containers
10+ ffmpeg-full, nv-codec-headers, libogg, x264, x265, libvpx, libtheora,
11+ # Codecs, audio
12+ libopus, lame, libvorbis, a52dec, speex, libsamplerate,
13+ # Text processing
14+ libiconv, fribidi, fontconfig, freetype, libass, jansson, libxml2,
15+ # Optical media
16+ libdvdread, libdvdnav, libdvdcss, libbluray,
17+ useGtk ? true, wrapGAppsHook ? null,
18+ intltool ? null,
19+ glib ? null,
20+ gtk3 ? null,
21+ libappindicator-gtk3 ? null,
22+ libnotify ? null,
23+ gst_all_1 ? null,
24+ dbus-glib ? null,
25+ udev ? null,
26+ libgudev ? null,
27+ hicolor-icon-theme ? null,
1828 useFdk ? false, fdk_aac ? null
1929}:
2030
2131stdenv.mkDerivation rec {
22− # TODO: Release 1.2.0 would switch LibAV to FFmpeg.
23− version = "1.1.2";
32+ version = "1.2.0";
2433 name = "handbrake-${version}";
2534
2635 src = fetchurl {
2736 url = ''https://download2.handbrake.fr/${version}/HandBrake-${version}-source.tar.bz2'';
28− sha256 = "0bny0hwlr55g2c69rsamv0xvwmfh1s4a582b9vq20xv5ly84m6ms";
37+ sha256 = "03clkknaq3mz84p85cvr21gsy9b8vv2g4vvyfz44hz8la253jfqi";
2938 };
3039
31− patched_libav_12 = libav_12.overrideAttrs (super: {
32− patches = (super.patches or []) ++ [(
33− # NOTE: 2018-04-26: HandBrake compilation (1.1.0) requires
34− # a patch of LibAV (12.3) from HandBrake team. This patch
35− # not went LibAV upstream.
36− fetchurl {
37− url = ''https://raw.githubusercontent.com/HandBrake/HandBrake/9e1f245708a157231c427c0ef9b91729d59a30e1/contrib/ffmpeg/A21-mp4-sdtp.patch'';
38− sha256 = "14grzyvb1qbb90k31ibabnwmwnrc48ml6h2z0rjamdv83q45jq4g";
39− })
40− # NOTE: 2018-11-11: Transcoding to MP4 can fail with:
41− #
42− # Tag avc1/0x31637661 incompatible with output codec id '28'
43− # muxavformat: avformat_write_header failed!
44− #
45− # Fix using Handbrake patch that is not upstream in libav.
46− (
47− fetchurl {
48− url = ''https://raw.githubusercontent.com/HandBrake/HandBrake/df6c26fa261423237ee2bec0bf784c32cbfda3fa/contrib/ffmpeg/A20-avc3-hvc1-override.patch'';
49− sha256 = "1vijd7bmkzp3sb6zhpcpdni8fz4h13wgglnml6cz9f44j41w2c3v";
50− })
51− ];
52− });
53−
5440 nativeBuildInputs = [
55− python2 pkgconfig yasm autoconf automake libtool m4
41+ python2 pkgconfig autoconf automake cmake nasm libtool m4
5642 ] ++ lib.optionals useGtk [ intltool wrapGAppsHook ];
5743
5844 buildInputs = [
59− fribidi fontconfig freetype jansson zlib
60− libass libiconv libsamplerate libxml2 bzip2
61− libogg libopus libtheora libvorbis libdvdcss a52dec libmkv
62− lame libdvdread libdvdnav libbluray mp4v2 mpeg2dec x264 x265 libvpx
45+ ffmpeg-full libogg libtheora x264 x265 libvpx
46+ libopus lame libvorbis a52dec speex libsamplerate
47+ libiconv fribidi fontconfig freetype libass jansson libxml2
48+ libdvdread libdvdnav libdvdcss libbluray
6349 ] ++ lib.optionals useGtk [
6450 glib gtk3 libappindicator-gtk3 libnotify
6551 gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus-glib udev
6652 libgudev hicolor-icon-theme
67− ] ++ (if useFfmpeg then [ ffmpeg ] else [ patched_libav_12 ])
68− ++ lib.optional useFdk fdk_aac;
53+ ] ++ lib.optional useFdk fdk_aac
54+ # NOTE: 2018-12-27: Handbrake supports nv-codec-headers for Linux only,
55+ # look at ./make/configure.py search "enable_nvenc"
56+ ++ lib.optional stdenv.isLinux nv-codec-headers;
6957
58+ # NOTE: 2018-12-25: v1.2.0 now requires cmake dep
59+ # (default distribution bundles&builds 3rd party libs),
60+ # don't trigger cmake build
61+ dontUseCmakeConfigure = true;
7062 enableParallelBuilding = true;
7163
7264 preConfigure = ''
@@ -87,6 +79,7 @@ stdenv.mkDerivation rec {
8779 (if useFdk then "--enable-fdk-aac" else "")
8880 ];
8981
82+ # NOTE: 2018-12-27: Check NixOS HandBrake test if changing
9083 NIX_LDFLAGS = [
9184 "-lx265"
9285 ];