@@ -1,5 +1,5 @@
11{ config, stdenv, fetchurl, fetchFromGitHub, makeWrapper
2−, addOpenGLRunpath, docutils, perl, pkgconfig, python3, which
2+, addOpenGLRunpath, docutils, perl, pkgconfig, python3, wafHook, which
33, ffmpeg_4, freefont_ttf, freetype, libass, libpthreadstubs, mujs
44, nv-codec-headers, lua, libuchardet, libiconv ? null, darwin
55
@@ -93,14 +93,6 @@ assert youtubeSupport -> available youtube-dl;
9393assert zimgSupport -> available zimg;
9494
9595let
96− # Purity: Waf is normally downloaded by bootstrap.py, but
97− # for purity reasons this behavior should be avoided.
98− wafVersion = "2.0.9";
99− waf = fetchurl {
100− urls = [ "https://waf.io/waf-${wafVersion}"
101− "http://www.freehackers.org/~tnagy/release/waf-${wafVersion}" ];
102− sha256 = "0j7sbn3w6bgslvwwh5v9527w3gi2sd08kskrgxamx693y0b0i3ia";
103− };
10496 luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
10597
10698in stdenv.mkDerivation rec {
@@ -121,7 +113,7 @@ in stdenv.mkDerivation rec {
121113 NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext "
122114 + optionalString stdenv.isDarwin "-framework CoreFoundation";
123115
124− configureFlags = [
116+ wafConfigureFlags = [
125117 "--enable-libmpv-shared"
126118 "--enable-manpage-build"
127119 "--disable-libmpv-static"
@@ -140,12 +132,8 @@ in stdenv.mkDerivation rec {
140132 (enableFeature stdenv.isLinux "dvbin")
141133 ];
142134
143− configurePhase = ''
144− python3 ${waf} configure --prefix=$out $configureFlags
145− '';
146−
147135 nativeBuildInputs = [
148− addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 which
136+ addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 wafHook which
149137 ];
150138
151139 buildInputs = [
@@ -189,9 +177,7 @@ in stdenv.mkDerivation rec {
189177
190178 enableParallelBuilding = true;
191179
192− buildPhase = ''
193− python3 ${waf} build
194− '' + optionalString stdenv.isDarwin ''
180+ postBuild = optionalString stdenv.isDarwin ''
195181 python3 TOOLS/osxbundle.py -s build/mpv
196182 '';
197183
@@ -204,9 +190,7 @@ in stdenv.mkDerivation rec {
204190 --prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"
205191 '';
206192
207− installPhase = ''
208− python3 ${waf} install
209−
193+ postInstall = ''
210194 # Use a standard font
211195 mkdir -p $out/share/mpv
212196 ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf