1# this package was called gimp-print in the past
2{
3 stdenv,
4 lib,
5 fetchurl,
6 makeWrapper,
7 pkg-config,
8 ijs,
9 zlib,
10 gimp2Support ? false,
11 gimp,
12 cupsSupport ? true,
13 cups,
14 libusb1,
15 perl,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "gutenprint";
20 version = "5.3.5";
21
22 src = fetchurl {
23 url = "mirror://sourceforge/gimp-print/gutenprint-${version}.tar.xz";
24 hash = "sha256-9an0feKFMLGuIGnPvGR6mmQbruq+gJuw7ys+xblmjXA=";
25 };
26
27 strictDeps = true;
28 nativeBuildInputs = [
29 makeWrapper
30 pkg-config
31 ]
32 ++ lib.optionals cupsSupport [
33 cups
34 perl
35 ]; # for cups-config
36 buildInputs = [
37 ijs
38 zlib
39 ]
40 ++ lib.optionals gimp2Support [
41 gimp.gtk
42 gimp
43 ]
44 ++ lib.optionals cupsSupport [
45 cups
46 libusb1
47 perl
48 ];
49
50 configureFlags = lib.optionals cupsSupport [
51 "--disable-static-genppd" # should be harmless on NixOS
52 ];
53
54 # FIXME: hacky because we modify generated configure, but I haven't found a better way.
55 # makeFlags doesn't change this everywhere (e.g. in cups-genppdupdate).
56 preConfigure =
57 lib.optionalString cupsSupport ''
58 sed -i \
59 -e "s,cups_conf_datadir=.*,cups_conf_datadir=\"$out/share/cups\",g" \
60 -e "s,cups_conf_serverbin=.*,cups_conf_serverbin=\"$out/lib/cups\",g" \
61 -e "s,cups_conf_serverroot=.*,cups_conf_serverroot=\"$out/etc/cups\",g" \
62 configure
63 ''
64 + lib.optionalString gimp2Support ''
65 sed -i \
66 -e "s,gimp2_plug_indir=.*,gimp2_plug_indir=\"$out/lib/gimp/${gimp.majorVersion}\",g" \
67 configure
68 '';
69
70 enableParallelBuilding = true;
71
72 # Testing is very, very long.
73 # doCheck = true;
74
75 meta = with lib; {
76 description = "Ghostscript and cups printer drivers";
77 homepage = "https://sourceforge.net/projects/gimp-print/";
78 license = licenses.gpl2Plus;
79 platforms = platforms.linux;
80 isGutenprint = true;
81 };
82}