handbrake: fix Darwin build (#89674)

- Omit the numactl dependency under Darwin.
- Prevent the configure script from checking for xcodebuild. This check
  always failed (because xcodebuild isn't available in the build
  context) but xcodebuild isn't actually needed for the build, which
  uses --disable-xcode.
- Use the Nix-provided libxml2 under Darwin like we already do under
  Linux.
This commit is contained in:
Benjamin Esham 2020-10-03 05:13:50 -07:00 committed by GitHub
parent cb4ca87504
commit 0e60d79f2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
# Upstream distributes HandBrake with bundle of according versions of libraries and patches to them.
#
# Derivation patches HandBrake to use Nix closure dependencies.
# Upstream distributes HandBrake with bundle of according versions of libraries
# and patches to them. This derivation patches HandBrake to use Nix closure
# dependencies.
#
# NOTE: 2019-07-19: This derivation does not currently support the native macOS
# GUI--it produces the "HandbrakeCLI" CLI version only. In the future it would
@ -44,11 +44,6 @@
useFdk ? false, fdk_aac ? null
}:
assert stdenv.isDarwin -> AudioToolbox != null
&& Foundation != null
&& libobjc != null
&& VideoToolbox != null;
stdenv.mkDerivation rec {
pname = "handbrake";
version = "1.3.3";
@ -76,15 +71,26 @@ _EOF
patchShebangs scripts
substituteInPlace libhb/module.defs \
--replace /usr/include/libxml2 ${libxml2.dev}/include/libxml2
# Force using nixpkgs dependencies
sed -i '/MODULES += contrib/d' make/include/main.defs
sed -e 's/^[[:space:]]*\(meson\|ninja\|nasm\)[[:space:]]*= ToolProbe.*$//g' \
-e '/ ## Additional library and tool checks/,/ ## MinGW specific library and tool checks/d' \
-i make/configure.py
'';
'' + (lib.optionalString stdenv.isDarwin ''
# Use the Nix-provided libxml2 instead of the patched version available on
# the Handbrake website.
substituteInPlace libhb/module.defs \
--replace '$(CONTRIB.build/)include/libxml2' ${libxml2.dev}/include/libxml2
# Prevent the configure script from failing if xcodebuild isn't available,
# which it isn't in the Nix context. (The actual build goes fine without
# xcodebuild.)
sed -e '/xcodebuild = ToolProbe/s/abort=.\+)/abort=False)/' -i make/configure.py
'') + (lib.optionalString stdenv.isLinux ''
# Use the Nix-provided libxml2 instead of the system-provided one.
substituteInPlace libhb/module.defs \
--replace /usr/include/libxml2 ${libxml2.dev}/include/libxml2
'');
nativeBuildInputs = [
pkgconfig autoconf automake libtool m4 python3
@ -94,8 +100,9 @@ _EOF
ffmpeg-full libogg libtheora x264 x265 libvpx dav1d
libopus lame libvorbis a52dec speex libsamplerate
libiconv fribidi fontconfig freetype libass jansson libxml2 harfbuzz
libdvdread libdvdnav libdvdcss libbluray lzma numactl
] ++ lib.optionals useGtk [
libdvdread libdvdnav libdvdcss libbluray lzma
] ++ lib.optional (!stdenv.isDarwin) numactl
++ lib.optionals useGtk [
glib gtk3 libappindicator-gtk3 libnotify
gst_all_1.gstreamer gst_all_1.gst-plugins-base dbus-glib udev
libgudev hicolor-icon-theme