From 542d7589568c2f3c6ac58c6e307ec2e62da3168f Mon Sep 17 00:00:00 2001 From: Benjamin Hipple Date: Sun, 2 Feb 2020 14:06:35 -0500 Subject: [PATCH] mpv: use waf from distribution and wafHook helper This cleans up our dependency footprint by ensuring a consistent version, and also avoids duplicating the logic for how to build a waf package by deferring to the `wafHook` helper for the `configurePhase`, `buildPhase`, and `installPhase`. --- pkgs/applications/video/mpv/default.nix | 26 +++++-------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/pkgs/applications/video/mpv/default.nix b/pkgs/applications/video/mpv/default.nix index 6a8c3df0f35b..f7ac5ef58cdf 100644 --- a/pkgs/applications/video/mpv/default.nix +++ b/pkgs/applications/video/mpv/default.nix @@ -1,5 +1,5 @@ { config, stdenv, fetchurl, fetchFromGitHub, makeWrapper -, addOpenGLRunpath, docutils, perl, pkgconfig, python3, which +, addOpenGLRunpath, docutils, perl, pkgconfig, python3, wafHook, which , ffmpeg_4, freefont_ttf, freetype, libass, libpthreadstubs, mujs , nv-codec-headers, lua, libuchardet, libiconv ? null, darwin @@ -93,14 +93,6 @@ assert youtubeSupport -> available youtube-dl; assert zimgSupport -> available zimg; let - # Purity: Waf is normally downloaded by bootstrap.py, but - # for purity reasons this behavior should be avoided. - wafVersion = "2.0.9"; - waf = fetchurl { - urls = [ "https://waf.io/waf-${wafVersion}" - "http://www.freehackers.org/~tnagy/release/waf-${wafVersion}" ]; - sha256 = "0j7sbn3w6bgslvwwh5v9527w3gi2sd08kskrgxamx693y0b0i3ia"; - }; luaEnv = lua.withPackages (ps: with ps; [ luasocket ]); in stdenv.mkDerivation rec { @@ -121,7 +113,7 @@ in stdenv.mkDerivation rec { NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext " + optionalString stdenv.isDarwin "-framework CoreFoundation"; - configureFlags = [ + wafConfigureFlags = [ "--enable-libmpv-shared" "--enable-manpage-build" "--disable-libmpv-static" @@ -140,12 +132,8 @@ in stdenv.mkDerivation rec { (enableFeature stdenv.isLinux "dvbin") ]; - configurePhase = '' - python3 ${waf} configure --prefix=$out $configureFlags - ''; - nativeBuildInputs = [ - addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 which + addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 wafHook which ]; buildInputs = [ @@ -189,9 +177,7 @@ in stdenv.mkDerivation rec { enableParallelBuilding = true; - buildPhase = '' - python3 ${waf} build - '' + optionalString stdenv.isDarwin '' + postBuild = optionalString stdenv.isDarwin '' python3 TOOLS/osxbundle.py -s build/mpv ''; @@ -204,9 +190,7 @@ in stdenv.mkDerivation rec { --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH" ''; - installPhase = '' - python3 ${waf} install - + postInstall = '' # Use a standard font mkdir -p $out/share/mpv ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf