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
|
|
|
|
|
2017-03-18 09:44:45 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub,
|
|
|
|
python2, pkgconfig, yasm, harfbuzz, zlib,
|
|
|
|
autoconf, automake, cmake, libtool, m4, jansson,
|
|
|
|
libass, libiconv, libsamplerate, fribidi, libxml2, bzip2,
|
|
|
|
libogg, libopus, libtheora, libvorbis, libdvdcss, a52dec, fdk_aac,
|
2016-08-29 08:03:41 +02:00
|
|
|
lame, ffmpeg, libdvdread, libdvdnav, libbluray,
|
|
|
|
mp4v2, mpeg2dec, x264, x265, libmkv,
|
2016-07-09 13:06:14 +02:00
|
|
|
fontconfig, freetype, hicolor_icon_theme,
|
2016-08-29 08:03:41 +02:00
|
|
|
glib, gtk3, intltool, libnotify,
|
|
|
|
gst_all_1, dbus_glib, udev, libgudev, libvpx,
|
2017-03-18 09:44:45 +01:00
|
|
|
useGtk ? true, wrapGAppsHook ? null, libappindicator-gtk3 ? null
|
2014-05-04 01:55:36 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2017-04-16 13:42:25 +02:00
|
|
|
version = "1.0.7";
|
2014-05-04 01:55:36 +02:00
|
|
|
name = "handbrake-${version}";
|
|
|
|
|
2017-03-18 09:44:45 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "HandBrake";
|
|
|
|
repo = "HandBrake";
|
|
|
|
rev = "${version}";
|
2017-04-16 13:42:25 +02:00
|
|
|
sha256 = "1pdrvicq40s8n23n6k8k097kkjs3ah5wbz1mvxnfy3h2mh5rwk57";
|
2017-03-18 09:44:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake python2 pkgconfig yasm autoconf automake libtool m4
|
|
|
|
] ++ (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
|
|
|
|
libogg libopus libtheora libvorbis libdvdcss a52dec libmkv fdk_aac
|
2016-08-29 08:03:41 +02:00
|
|
|
lame ffmpeg libdvdread libdvdnav libbluray mp4v2 mpeg2dec x264 x265 libvpx
|
2017-03-18 09:44:45 +01:00
|
|
|
] ++ (lib.optionals useGtk [
|
|
|
|
glib gtk3 libappindicator-gtk3 libnotify
|
|
|
|
gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus_glib udev
|
|
|
|
libgudev
|
|
|
|
]);
|
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
|
|
|
|
|
|
|
|
echo 'TAG=${version}' > version.txt
|
|
|
|
|
|
|
|
# `configure` errors out when trying to read the current year which is too low
|
|
|
|
substituteInPlace make/configure.py \
|
|
|
|
--replace developer release \
|
|
|
|
--replace 'repo.date.strftime("%Y-%m-%d %H:%M:%S")' '""'
|
|
|
|
|
|
|
|
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
|
|
|
"--enable-fdk-aac"
|
|
|
|
(if useGtk then "--disable-gtk-update-checks" else "--disable-gtk")
|
|
|
|
];
|
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/;
|
|
|
|
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.
|
|
|
|
'';
|
2017-03-18 09:44:45 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ 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
|
|
|
};
|
|
|
|
}
|