Matt McHenry 9692553cb5
epson-escpr: restore correct install layout (#373003)
in 75ad85225676171bb0743533f156b58b5023c35c, some new patches were
added (to deal with gcc 14, among other things).  these patches
disagree with the source tarball about the line endings of the files
being patches.  in that commit, the solution was to run dos2unix
across the entire source tree.

however, that produced this failure:

WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.

so in that same commit, automake and autoconf were added to
nativeBuildInputs.  this fixed that error, but it meant that the
'configure' script was regenerated.  and that's a problem, because
cups-filter-ppd-dirs.patch patches the 'configure' script to ensure
that the installPhase doesn't introduce weird partial store paths
under $out.

as it turns out, there is only one file that is both touched by the
new patches and comes with dos line endings in the source tarball.
so, we can be much more focused with our invocation of dos2unix.  this
prevents the build from seeing unexpected modifications and deciding
to try to clobber our patch to the 'configure' script.

further, if we shift our invocation of dos2unix from the unpack phase
to the patch phase, we've already cd'd into the unpacked source
directory, so we don't need any obscure bash voodoo to figure out its
name.
2025-01-11 22:00:57 +01:00

80 lines
2.6 KiB
Nix

{
lib,
stdenv,
fetchurl,
cups,
fetchpatch,
dos2unix,
}:
let
version = "1.8.6-1";
in
stdenv.mkDerivation {
pname = "epson-escpr";
inherit version;
src = fetchurl {
# To find new versions, visit
# http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX and search for
# some printer like for instance "WF-7110" to get to the most recent
# version.
# NOTE: Don't forget to update the webarchive link too!
urls = [
"https://download3.ebz.epson.net/dsc/f/03/00/16/21/81/74d098a47c3a616713079c9cd5904b468bb33dea/epson-inkjet-printer-escpr-${version}.tar.gz"
"https://web.archive.org/web/https://download3.ebz.epson.net/dsc/f/03/00/16/21/81/74d098a47c3a616713079c9cd5904b468bb33dea/epson-inkjet-printer-escpr-${version}.tar.gz"
];
sha256 = "sha256-hVbX4OXPe4y37Szju3uVdXlVdjX4DFSN/A2Emz3eCcQ=";
};
# the patches above are expecting unix line endings, but one of the files
# being patched has dos line endings in the source tarball
prePatch = ''
${dos2unix}/bin/dos2unix lib/epson-escpr-api.h
'';
patches = [
./cups-filter-ppd-dirs.patch
(fetchpatch {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-print/epson-inkjet-printer-escpr/files/epson-inkjet-printer-escpr-1.8-missing-include.patch";
hash = "sha256-L4WhaxPQnJYyqCH00wiKIlFNMmCEXoGe5d7hJ5TMyEI=";
})
(fetchpatch {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/net-print/epson-inkjet-printer-escpr/files/1.8.6-warnings.patch";
hash = "sha256-wSY0LZv2b+1kF7TfPolt554g79y2Ce6N/JqgjJyd3Ag=";
})
];
# To suppress error (Stripping trailing CRs from patch; use --binary to disable.)
patchFlags = [
"-p1"
];
buildInputs = [ cups ];
meta = with lib; {
homepage = "http://download.ebz.epson.net/dsc/search/01/search/";
description = "ESC/P-R Driver (generic driver)";
longDescription = ''
Epson Inkjet Printer Driver (ESC/P-R) for Linux and the
corresponding PPD files. The list of supported printers
can be found at http://www.openprinting.org/driver/epson-escpr/ .
To use the driver adjust your configuration.nix file:
services.printing = {
enable = true;
drivers = [ pkgs.epson-escpr ];
};
To setup a wireless printer, enable Avahi which provides
printer's hostname to CUPS and nss-mdns to make this
hostname resolvable:
services.avahi = {
enable = true;
nssmdns4 = true;
};'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ artuuge ];
platforms = platforms.linux;
};
}