From 01cb82366fcb3e6104e6e9736aac9c5a78b65bfb Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:53:50 +0100 Subject: [PATCH] vapoursynth: reformat plugin interface --- .../va/vapoursynth/plugin-interface.nix | 129 +++++++++--------- 1 file changed, 66 insertions(+), 63 deletions(-) diff --git a/pkgs/by-name/va/vapoursynth/plugin-interface.nix b/pkgs/by-name/va/vapoursynth/plugin-interface.nix index 2716c27225cf..dcc7b6c909eb 100644 --- a/pkgs/by-name/va/vapoursynth/plugin-interface.nix +++ b/pkgs/by-name/va/vapoursynth/plugin-interface.nix @@ -51,77 +51,80 @@ let ext = stdenv.hostPlatform.extensions.sharedLibrary; in -runCommand "${vapoursynth.name}-with-plugins" - { - nativeBuildInputs = [ makeWrapper ]; - passthru = { - inherit python3; - inherit (vapoursynth) src version; - withPlugins = plugins': withPlugins (plugins ++ plugins'); - }; - } - '' - mkdir -p \ - $out/bin \ - $out/lib/pkgconfig \ - $out/lib/vapoursynth \ - $out/${python3.sitePackages} +if false then + vapoursynth +else + runCommand "${vapoursynth.name}-with-plugins" + { + nativeBuildInputs = [ makeWrapper ]; + passthru = { + inherit python3; + inherit (vapoursynth) src version; + withPlugins = plugins': withPlugins (plugins ++ plugins'); + }; + } + '' + mkdir -p \ + $out/bin \ + $out/lib/pkgconfig \ + $out/lib/vapoursynth \ + $out/${python3.sitePackages} - for textFile in \ - lib/pkgconfig/vapoursynth{,-script}.pc \ - lib/libvapoursynth.la \ - lib/libvapoursynth-script.la \ - ${python3.sitePackages}/vapoursynth.la - do - substitute ${vapoursynth}/$textFile $out/$textFile \ - --replace "${vapoursynth}" "$out" - done + for textFile in \ + lib/pkgconfig/vapoursynth{,-script}.pc \ + lib/libvapoursynth.la \ + lib/libvapoursynth-script.la \ + ${python3.sitePackages}/vapoursynth.la + do + substitute ${vapoursynth}/$textFile $out/$textFile \ + --replace "${vapoursynth}" "$out" + done - for binaryPlugin in ${pluginsEnv}/lib/vapoursynth/*; do - ln -s $binaryPlugin $out/''${binaryPlugin#"${pluginsEnv}/"} - done + for binaryPlugin in ${pluginsEnv}/lib/vapoursynth/*; do + ln -s $binaryPlugin $out/''${binaryPlugin#"${pluginsEnv}/"} + done - for pythonPlugin in ${pythonEnvironment}/${python3.sitePackages}/*; do - ln -s $pythonPlugin $out/''${pythonPlugin#"${pythonEnvironment}/"} - done + for pythonPlugin in ${pythonEnvironment}/${python3.sitePackages}/*; do + ln -s $pythonPlugin $out/''${pythonPlugin#"${pythonEnvironment}/"} + done - for binaryFile in \ - lib/libvapoursynth${ext} \ - lib/libvapoursynth-script${ext}.0.0.0 - do - old_rpath=$(patchelf --print-rpath ${vapoursynth}/$binaryFile) - new_rpath="$old_rpath:$out/lib" - patchelf \ - --set-rpath "$new_rpath" \ - --output $out/$binaryFile \ - ${vapoursynth}/$binaryFile - patchelf \ - --add-needed libvapoursynth-nix-plugins${ext} \ - $out/$binaryFile - done - - for binaryFile in \ - ${python3.sitePackages}/vapoursynth${ext} \ - bin/.vspipe-wrapped - do + for binaryFile in \ + lib/libvapoursynth${ext} \ + lib/libvapoursynth-script${ext}.0.0.0 + do old_rpath=$(patchelf --print-rpath ${vapoursynth}/$binaryFile) - new_rpath="''${old_rpath//"${vapoursynth}"/"$out"}" + new_rpath="$old_rpath:$out/lib" patchelf \ --set-rpath "$new_rpath" \ --output $out/$binaryFile \ ${vapoursynth}/$binaryFile - done + patchelf \ + --add-needed libvapoursynth-nix-plugins${ext} \ + $out/$binaryFile + done - ln -s ${nixPlugins} $out/lib/libvapoursynth-nix-plugins${ext} - ln -s ${vapoursynth}/include $out/include - ln -s ${vapoursynth}/lib/vapoursynth/* $out/lib/vapoursynth - ln -s \ - libvapoursynth-script${ext}.0.0.0 \ - $out/lib/libvapoursynth-script${ext} - ln -s \ - libvapoursynth-script${ext}.0.0.0 \ - $out/lib/libvapoursynth-script${ext}.0 + for binaryFile in \ + ${python3.sitePackages}/vapoursynth${ext} \ + bin/.vspipe-wrapped + do + old_rpath=$(patchelf --print-rpath ${vapoursynth}/$binaryFile) + new_rpath="''${old_rpath//"${vapoursynth}"/"$out"}" + patchelf \ + --set-rpath "$new_rpath" \ + --output $out/$binaryFile \ + ${vapoursynth}/$binaryFile + done - makeWrapper $out/bin/.vspipe-wrapped $out/bin/vspipe \ - --prefix PYTHONPATH : $out/${python3.sitePackages} - '' + ln -s ${nixPlugins} $out/lib/libvapoursynth-nix-plugins${ext} + ln -s ${vapoursynth}/include $out/include + ln -s ${vapoursynth}/lib/vapoursynth/* $out/lib/vapoursynth + ln -s \ + libvapoursynth-script${ext}.0.0.0 \ + $out/lib/libvapoursynth-script${ext} + ln -s \ + libvapoursynth-script${ext}.0.0.0 \ + $out/lib/libvapoursynth-script${ext}.0 + + makeWrapper $out/bin/.vspipe-wrapped $out/bin/vspipe \ + --prefix PYTHONPATH : $out/${python3.sitePackages} + ''