mastodon: 4.3.1 -> 4.3.2 (#361487)
[NixPkgs.git] / pkgs / by-name / pt / ptouch-driver / package.nix
blob851fb0862aa39624734f86efcb9a683a3bdaff04
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cups
5 , cups-filters
6 , foomatic-db-engine
7 , fetchpatch
8 , ghostscript
9 , libpng
10 , libxml2
11 , autoreconfHook
12 , perl
13 , patchPpdFilesHook
16 stdenv.mkDerivation rec {
17   pname = "ptouch-driver";
18   version = "1.7";
20   src = fetchFromGitHub {
21     owner = "philpem";
22     repo = "printer-driver-ptouch";
23     rev = "v${version}";
24     hash = "sha256-3ZotSHn7lERp53hAzx47Ct/k565rEoensCcltwX/Xls=";
25   };
27   patches = [
28     # Fixes some invalid XML file that otherwise causes a build failure
29     (fetchpatch {
30       name = "fix-brother-ql-600.patch";
31       url = "https://github.com/philpem/printer-driver-ptouch/commit/b3c53b3bc4dd98ed172f2c79405c7c09b3b3836a.patch";
32       hash = "sha256-y5bHKFeRXx8Wdl1++l4QNGgiY41LY5uzrRdOlaZyF9I=";
33     })
34   ];
36   buildInputs = [ cups cups-filters ghostscript libpng libxml2 ];
37   nativeBuildInputs = [
38     autoreconfHook
39     foomatic-db-engine
40     patchPpdFilesHook
41     (perl.withPackages (pp: with pp; [ XMLLibXML ]))
42   ];
44   postPatch = ''
45     patchShebangs ./foomaticalize
46   '';
48   postInstall = ''
49     export FOOMATICDB="${placeholder "out"}/share/foomatic"
50     mkdir -p "${placeholder "out"}/share/cups/model"
51     foomatic-compiledb -j "$NIX_BUILD_CORES" -d "${placeholder "out"}/share/cups/model/ptouch-driver"
52   '';
54   # compress ppd files
55   postFixup = ''
56     echo 'compressing ppd files'
57     find -H "${placeholder "out"}/share/cups/model/ptouch-driver" -type f -iname '*.ppd' -print0  \
58       | xargs -0r -n 4 -P "$NIX_BUILD_CORES" gzip -9n
59   '';
61   # Comments indicate the respective
62   # package the command is contained in.
63   ppdFileCommands = [
64     "rastertoptch" # ptouch-driver
65     "gs" # ghostscript
66     "foomatic-rip" # cups-filters
67   ];
69   meta = with lib; {
70     changelog = "https://github.com/philpem/printer-driver-ptouch/releases/tag/v${version}";
71     description = "Printer Driver for Brother P-touch and QL Label Printers";
72     downloadPage = "https://github.com/philpem/printer-driver-ptouch";
73     homepage = "https://github.com/philpem/printer-driver-ptouch";
74     license = licenses.gpl2Plus;
75     maintainers = with maintainers; [ sascha8a ];
76     platforms = platforms.linux;
77     longDescription = ''
78       This is ptouch-driver, a printer driver based on CUPS and foomatic,
79       for the Brother P-touch and QL label printer families.
80     '';
81   };