vapoursynth: reformat plugin interface

This commit is contained in:
Weijia Wang 2024-11-26 17:53:50 +01:00
parent 199697f54e
commit 01cb82366f

View File

@ -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}
''