foomatic-db-engine: init at unstable-2022-05-03

`foomatic-db-engine` contains several perl scripts to parse
and process XML files from the Foomatic database packages.
It can be used to extract ppd files,
which will be accomplished in a follow-up commit.

The package also contains scripts
to handle print queues and jobs.
It can -- optionally -- talk to the local cups server,
to network printers and to SMB print servers.
The build recipe contains switches to enable these features;
however, they are not needed when generating ppd files.

There is a daily snapshot of a source archive available at
https://www.openprinting.org/download/foomatic/ .
However, these files rotate daily and
cannot be used as a stable download source.
So we rely on OpenPrinting's Github repository
instead and pinpoint a fresh commit.
This commit is contained in:
Yarny0 2021-07-07 20:52:43 +02:00
parent bafefd7ae2
commit cd4c8d63f5
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,94 @@
{ lib
, perlPackages
, fetchFromGitHub
, withCupsAccess ? false # needed to access local cups server
, cups
, cups-filters
, curl
, withSocketAccess ? false # needed to access network printers
, netcat-gnu
, withSMBAccess ? false # needed to access SMB-connected printers
, samba
, autoconf
, automake
, file
, makeWrapper
}:
perlPackages.buildPerlPackage {
pname = "foomatic-db-engine";
version = "unstable-2022-05-03";
src = fetchFromGitHub {
# there is also a daily snapshot at the `downloadPage`,
# but it gets deleted quickly and would provoke 404 errors
owner = "OpenPrinting";
repo = "foomatic-db-engine";
rev = "2e6f14b54748fa121a4d2e3d480010e10b070c5a";
hash = "sha256-m7FQTxWmawbtm24h8UqznGKXgX41JhOtyyFMRwEhm5k=";
};
outputs = [ "out" ];
propagatedBuildInputs = [
perlPackages.Clone
perlPackages.DBI
perlPackages.XMLLibXML
];
buildInputs =
# provide some "cups-*" commands to `foomatic-{configure,printjob}`
# so that they can manage a local cups server (add queues, add jobs...)
lib.optionals withCupsAccess [ cups cups-filters curl ]
# the commands `foomatic-{configure,getpjloptions}` need
# netcat if they are used to query or alter a network
# printer via AppSocket/HP JetDirect protocol
++ lib.optional withSocketAccess netcat-gnu
# `foomatic-configure` can be used to access printers that are
# shared via the SMB protocol, but it needs the `smbclient` binary
++ lib.optional withSMBAccess samba
;
nativeBuildInputs = [ autoconf automake file makeWrapper ];
# sed-substitute indirection is more robust against
# characters in paths that might need escaping
prePatch = ''
sed -Ei 's|^(S?BINSEARCHPATH=).+$|\1"@PATH@"|g' configure.ac
substituteInPlace configure.ac --subst-var PATH
touch Makefile.PL # `buildPerlPackage` fails unless this exists
'';
preConfigure = ''
./make_configure
'';
configureFlags = [
"--sysconfdir=${placeholder "out"}/etc"
"LIBDIR=${placeholder "out"}/share/foomatic"
"PERLPREFIX=${placeholder "out"}"
];
postFixup = ''
for bin in "${placeholder "out"}/bin"/*; do
test '!' -L "$bin" || continue # skip symlink
wrapProgram "$bin" --set PERL5LIB "$PERL5LIB"
done
'';
doCheck = false; # no tests, would fail
meta = {
description = "OpenPrinting printer support database engine";
downloadPage = "https://www.openprinting.org/download/foomatic/";
homepage = "https://openprinting.github.io/projects/02-foomatic/";
license = lib.licenses.gpl2Only;
maintainers = [ lib.maintainers.yarny ];
longDescription = ''
Foomatic's database engine generates PPD files
from the data in Foomatic's XML database.
It also contains scripts to directly
generate print queues and handle jobs.
'';
};
}

View file

@ -36319,6 +36319,8 @@ with pkgs;
epson-workforce-635-nx625-series = callPackage ../misc/drivers/epson-workforce-635-nx625-series { };
foomatic-db-engine = callPackage ../misc/cups/drivers/foomatic-db-engine {};
gutenprint = callPackage ../misc/drivers/gutenprint { };
gutenprintBin = callPackage ../misc/drivers/gutenprint/bin.nix { };