btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / by-name / fo / foomatic-db-nonfree / package.nix
bloba433b58a0ac92b2df5c520d497c8595eee577256
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , autoconf
5 , automake
6 , perl
7 }:
9 stdenv.mkDerivation (finalAttrs: {
10   pname = "foomatic-db-nonfree";
11   version = "unstable-2015-06-05";
13   src = fetchFromGitHub {
14     # there is also a daily snapshot at the `downloadPage`,
15     # but it gets deleted quickly and would provoke 404 errors
16     owner = "OpenPrinting";
17     repo = "foomatic-db-nonfree";
18     rev = "6ddae02ac89240c019f8b5026cfe70e30fd2b3db";
19     hash = "sha256-cRZH0CXg03FEqUJdxaNnPVXjf8+ct86PjhL59WQbw60=";
20   };
22   nativeBuildInputs = [ autoconf automake perl ];
24   # sed-substitute indirection is more robust against
25   # characters in paths that might need escaping
26   postPatch = ''
27     sed -Ei -e 's|^(S?BINSEARCHPATH=).+$|\1"@PATH@"|g'  \
28       -e 's|^(DATASEARCHPATH=).+$|\1"@DATA@"|g' configure.ac
29     substituteInPlace configure.ac  \
30       --subst-var PATH  \
31       --subst-var-by DATA "${placeholder "out"}/share"
32   '';
34   preConfigure = ''
35     mkdir -p "${placeholder "out"}/share/foomatic/db/source"
36     ./make_configure
37   '';
39   # make ppd files available to cups,
40   # use a package-specific subdirectory to avoid
41   # conflicts with other ppd-containing packages
42   postInstall = ''
43     if ! [[ -d "${placeholder "out"}/share/foomatic/db/source/PPD" ]]; then
44         echo "failed to create share/foomatic/db/source/PPD"
45         exit 1
46     fi
47     mkdir -p "${placeholder "out"}/share/cups/model"
48     ln -s "${placeholder "out"}/share/foomatic/db/source/PPD"  \
49       "${placeholder "out"}/share/cups/model/foomatic-db-nonfree"
50   '';
52   # we might patch ppd file commands with `patchPpdFilesHook`,
53   # but the only command "rastertophaser6100" isn't packaged yet
55   # compress ppd files
56   postFixup = ''
57     echo 'compressing ppd files'
58     find -H "${placeholder "out"}/share/cups/model/foomatic-db-nonfree" -type f -iname '*.ppd' -print0  \
59       | xargs -0r -n 64 -P "$NIX_BUILD_CORES" gzip -9n
60   '';
62   meta = {
63     changelog = "https://github.com/OpenPrinting/foomatic-db-nonfree/blob/${finalAttrs.src.rev}/ChangeLog";
64     description = "OpenPrinting printer support database (unfree content)";
65     downloadPage = "https://www.openprinting.org/download/foomatic/";
66     homepage = "https://openprinting.github.io/projects/02-foomatic/";
67     license = lib.licenses.unfree;
68     maintainers = [ lib.maintainers.yarny ];
69     # list printer manufacturers here so people
70     # searching for ppd files can find this package
71     longDescription = ''
72       The collected knowledge about printers,
73       drivers, and driver options in XML files,
74       used by `foomatic-db-engine` to generate PPD files.
75       This is a package of PPD and Foomatic XML files
76       that may have restrictions that keep them
77       from being used on a variety of machines
78       for licensing and other non-technical reasons.
79       The XML files in this package enable `foomatic-db-ppds`
80       to create about 120 additional PPD files, for printer from
81       Dell, Genicom, Lexmark, Oce, Tektronix and Xerox.
82       Besides the XML files, this package contains
83       about 130 PPD files, for printers from
84       Dell, Genicom, Lexmark, Oce and Xerox.
85     '';
86   };