recoll: factor out dependency list

This commit factors out a long repetitive list of `wrapProgram`
invocations into a Nix list which can be iterated upon for other
purposes.
This commit is contained in:
Adam Joseph 2023-06-07 12:45:25 -07:00 committed by Emery Hemingway
parent f09cd3b7de
commit 8d2530ece4

View File

@ -36,6 +36,34 @@
, withPython ? with stdenv; buildPlatform.canExecute hostPlatform
}:
let filters = {
# "binary-name = package" where:
# - "${package}/bin/${binary-name}" is the full path to the binary
# - occurrences of `"${binary-name}"` in recoll's filters should be fixed up
awk = gawk;
antiword = antiword;
catppt = catdoc;
djvused = djvulibre;
djvutxt = djvulibre;
egrep = gnugrep;
groff = groff;
gunzip = gzip;
iconv = libiconv;
pdftotext = poppler_utils;
ps2ascii = ghostscript;
sed = gnused;
tar = gnutar;
unzip = unzip;
xls2csv = catdoc;
xsltproc = libxslt;
unrtf = unrtf;
untex = untex;
wpd2html = libwpd;
perl = perl.passthru.withPackages (p: [ p.ImageExifTool ]);
};
filterPath = lib.makeBinPath (map lib.getBin (builtins.attrValues filters));
in
mkDerivation rec {
pname = "recoll";
version = "1.33.4";
@ -109,26 +137,11 @@ mkDerivation rec {
substituteInPlace $out/share/recoll/filters/rclconfig.py --replace /usr/share/recoll $out/share/recoll
for f in $out/share/recoll/filters/* ; do
if [[ ! "$f" =~ \.zip$ ]]; then
substituteInPlace $f --replace '"antiword"' '"${lib.getBin antiword}/bin/antiword"'
substituteInPlace $f --replace '"awk"' '"${lib.getBin gawk}/bin/awk"'
substituteInPlace $f --replace '"catppt"' '"${lib.getBin catdoc}/bin/catppt"'
substituteInPlace $f --replace '"djvused"' '"${lib.getBin djvulibre}/bin/djvused"'
substituteInPlace $f --replace '"djvutxt"' '"${lib.getBin djvulibre}/bin/djvutxt"'
substituteInPlace $f --replace '"egrep"' '"${lib.getBin gnugrep}/bin/egrep"'
substituteInPlace $f --replace '"groff"' '"${lib.getBin groff}/bin/groff"'
substituteInPlace $f --replace '"gunzip"' '"${lib.getBin gzip}/bin/gunzip"'
substituteInPlace $f --replace '"iconv"' '"${lib.getBin libiconv}/bin/iconv"'
substituteInPlace $f --replace '"pdftotext"' '"${lib.getBin poppler_utils}/bin/pdftotext"'
'' + lib.concatStrings (lib.mapAttrsToList (k: v: (''
substituteInPlace $f --replace '"${k}"' '"${lib.getBin v}/bin/${k}"'
'')) filters) + ''
substituteInPlace $f --replace '"pstotext"' '"${lib.getBin ghostscript}/bin/ps2ascii"'
substituteInPlace $f --replace '"sed"' '"${lib.getBin gnused}/bin/sed"'
substituteInPlace $f --replace '"tar"' '"${lib.getBin gnutar}/bin/tar"'
substituteInPlace $f --replace '"unzip"' '"${lib.getBin unzip}/bin/unzip"'
substituteInPlace $f --replace '"xls2csv"' '"${lib.getBin catdoc}/bin/xls2csv"'
substituteInPlace $f --replace '"xsltproc"' '"${lib.getBin libxslt}/bin/xsltproc"'
substituteInPlace $f --replace '"unrtf"' '"${lib.getBin unrtf}/bin/unrtf"'
substituteInPlace $f --replace '"untex"' '"${lib.getBin untex}/bin/untex"'
substituteInPlace $f --replace '"wpd2html"' '"${lib.getBin libwpd}/bin/wpd2html"'
substituteInPlace $f --replace /usr/bin/perl ${lib.getBin perl}/bin/perl
substituteInPlace $f --replace /usr/bin/perl ${lib.getBin (perl.passthru.withPackages (p: [ p.ImageExifTool ]))}/bin/perl
fi
done
wrapProgram $out/share/recoll/filters/rclaudio.py \