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`.
This commit is contained in:
parent
9f61b23c01
commit
542d758956
@ -1,5 +1,5 @@
|
|||||||
{ config, stdenv, fetchurl, fetchFromGitHub, makeWrapper
|
{ 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
|
, ffmpeg_4, freefont_ttf, freetype, libass, libpthreadstubs, mujs
|
||||||
, nv-codec-headers, lua, libuchardet, libiconv ? null, darwin
|
, nv-codec-headers, lua, libuchardet, libiconv ? null, darwin
|
||||||
|
|
||||||
@ -93,14 +93,6 @@ assert youtubeSupport -> available youtube-dl;
|
|||||||
assert zimgSupport -> available zimg;
|
assert zimgSupport -> available zimg;
|
||||||
|
|
||||||
let
|
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 ]);
|
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
@ -121,7 +113,7 @@ in stdenv.mkDerivation rec {
|
|||||||
NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext "
|
NIX_LDFLAGS = optionalString x11Support "-lX11 -lXext "
|
||||||
+ optionalString stdenv.isDarwin "-framework CoreFoundation";
|
+ optionalString stdenv.isDarwin "-framework CoreFoundation";
|
||||||
|
|
||||||
configureFlags = [
|
wafConfigureFlags = [
|
||||||
"--enable-libmpv-shared"
|
"--enable-libmpv-shared"
|
||||||
"--enable-manpage-build"
|
"--enable-manpage-build"
|
||||||
"--disable-libmpv-static"
|
"--disable-libmpv-static"
|
||||||
@ -140,12 +132,8 @@ in stdenv.mkDerivation rec {
|
|||||||
(enableFeature stdenv.isLinux "dvbin")
|
(enableFeature stdenv.isLinux "dvbin")
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePhase = ''
|
|
||||||
python3 ${waf} configure --prefix=$out $configureFlags
|
|
||||||
'';
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 which
|
addOpenGLRunpath docutils makeWrapper perl pkgconfig python3 wafHook which
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
@ -189,9 +177,7 @@ in stdenv.mkDerivation rec {
|
|||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
buildPhase = ''
|
postBuild = optionalString stdenv.isDarwin ''
|
||||||
python3 ${waf} build
|
|
||||||
'' + optionalString stdenv.isDarwin ''
|
|
||||||
python3 TOOLS/osxbundle.py -s build/mpv
|
python3 TOOLS/osxbundle.py -s build/mpv
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -204,9 +190,7 @@ in stdenv.mkDerivation rec {
|
|||||||
--prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"
|
--prefix PYTHONPATH : "${vapoursynth}/lib/${python3.libPrefix}/site-packages:$PYTHONPATH"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
postInstall = ''
|
||||||
python3 ${waf} install
|
|
||||||
|
|
||||||
# Use a standard font
|
# Use a standard font
|
||||||
mkdir -p $out/share/mpv
|
mkdir -p $out/share/mpv
|
||||||
ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf
|
ln -s ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mpv/subfont.ttf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user