summaryrefslogtreecommitdiffstats
path: root/makefu/5pkgs/foomatic-db-engine/default.nix
blob: 242232c888d53713c3007f74d0846fbd807eb87f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{ lib, stdenv
, fetchFromGitHub
, autoreconfHook
, gd
, libusb1
, cups
, libpng
, perl
, perlPackages
, libxml2
, ghostscript
, a2ps
, wget
, file
, foomatic-filters
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "foomatic-db-engine";
  version = "2020-01-31";

  src = fetchFromGitHub {
    owner = "OpenPrinting";
    repo = "foomatic-db-engine-4";
    rev = "bd265b77a9f66f672bf1e3f0803145f2eccabf06";
    sha256 = "1f53kd3b0sxgx7hg2dvw2624bpwdfcx0zh4dn0h89l84mirgw1bs";
  };

  nativeBuildInputs = [
    autoreconfHook
    perl
    makeWrapper
  ];
  postConfigure = ''
    sed -i "s#$ENV{BINDIR}#${placeholder "out"}/bin#" makeDefaults
  '';
  configureFlags = [
    #"PERL_INSTALLDIRS=vendor"
    "PERL_INSTALLDIRS=site"
    "--prefix=/"
    "PERLPREFIX=/"
    #"DESTDIR=$(out)"
    #"sysconfdir=/etc"
    "LIBDIR=/lib"
    #"PERL_INSTALLDIRS=site"
    #"PERL_INSTALLDIRS=perl"
    #PERL_INSTALLDIRS=perl"
    "PERL=${perl}/bin/perl"
    "FILEUTIL=${file}/bin/file"
    "SBINDIR=/bin"
  ];
  makeFlags = [ 
    "DESTDIR=${placeholder "out"}" 
    "PERLLIB=$(out)/${perlPackages.perl.libPrefix}"
  ];

  buildInputs = [
    cups
    ghostscript
    a2ps
    wget
    perl
    libxml2
    file
    foomatic-filters
  ];
  postFixup = ''
    echo cups > "$out"/etc/foomatic/defaultspooler

    for file in $out/bin/foomatic-*;do
        wrapProgram "$file" \
          --set PERL5LIB "$out/${perlPackages.perl.libPrefix}" \
          --prefix PATH : "$out/bin"
    done

  '';
  
  meta = with lib; {
    description = "Command line tool to print labels on Brother P-Touch printers on Linux";
    license = licenses.gpl3Plus;
    homepage = "https://mockmoon-cybernetics.ch/computer/p-touch2430pc/";
    maintainers = with maintainers; [ shamilton ];
    platforms = platforms.linux;
  };
}