python312Packages.lottie: 0.7.0 -> 0.7.1 (#361686)
[NixPkgs.git] / pkgs / by-name / cu / cups-brother-dcpt725dw / package.nix
blobb93e8e1fc32ff565694aa4ab1755e7322a0f11ec
2   stdenv,
3   lib,
4   fetchurl,
5   perl,
6   ghostscript,
7   coreutils,
8   gnugrep,
9   which,
10   file,
11   gnused,
12   dpkg,
13   makeWrapper,
14   libredirect,
15   debugLvl ? "0",
18 stdenv.mkDerivation rec {
19   pname = "cups-brother-dcpt725dw";
20   version = "3.5.0-1";
21   src = fetchurl {
22     url = "https://download.brother.com/welcome/dlf105181/dcpt725dwpdrv-${version}.i386.deb";
23     hash = "sha256-fK6RHaW/ej1nFgSaTbzWxVgjIW32YTbJbd1xD37ZE7c=";
24   };
26   nativeBuildInputs = [
27     dpkg
28     makeWrapper
29   ];
30   buildInputs = [ perl ];
32   dontUnpack = true;
34   installPhase = ''
35     runHook preInstall
37     mkdir -p $out
38     dpkg-deb -x $src $out
40     LPDDIR=$out/opt/brother/Printers/dcpt725dw/lpd
41     WRAPPER=$out/opt/brother/Printers/dcpt725dw/cupswrapper/brother_lpdwrapper_dcpt725dw
43     ln -s $LPDDIR/${stdenv.hostPlatform.linuxArch}/* $LPDDIR/
45     substituteInPlace $WRAPPER \
46       --replace-fail "PRINTER =~" "PRINTER = \"dcpt725dw\"; #" \
47       --replace-fail "basedir =~" "basedir = \"$out/opt/brother/Printers/dcpt725dw/\"; #" \
48       --replace-fail "lpdconf = " "lpdconf = \$lpddir.'/'.\$LPDCONFIGEXE.\$PRINTER; #" \
49       --replace-fail "\$DEBUG=0;" "\$DEBUG=${debugLvl};"
51     substituteInPlace $LPDDIR/filter_dcpt725dw \
52       --replace-fail "BR_PRT_PATH =~" "BR_PRT_PATH = \"$out/opt/brother/Printers/dcpt725dw/\"; #" \
53       --replace-fail "PRINTER =~" "PRINTER = \"dcpt725dw\"; #"
55     wrapProgram $WRAPPER \
56       --prefix PATH : ${
57         lib.makeBinPath [
58           coreutils
59           gnugrep
60           gnused
61         ]
62       }
64     wrapProgram $LPDDIR/filter_dcpt725dw \
65       --prefix PATH : ${
66         lib.makeBinPath [
67           coreutils
68           ghostscript
69           gnugrep
70           gnused
71           which
72           file
73         ]
74       }
76     patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
77       $LPDDIR/brdcpt725dwfilter
79     patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
80       $LPDDIR/brprintconf_dcpt725dw
82     wrapProgram $LPDDIR/brprintconf_dcpt725dw \
83       --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
84       --set NIX_REDIRECTS /opt=$out/opt
86     wrapProgram $LPDDIR/brdcpt725dwfilter \
87       --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \
88       --set NIX_REDIRECTS /opt=$out/opt
90     mkdir -p "$out/lib/cups/filter" "$out/share/cups/model"
92     ln -s $out/opt/brother/Printers/dcpt725dw/cupswrapper/brother_lpdwrapper_dcpt725dw \
93       $out/lib/cups/filter/brother_lpdwrapper_dcpt725dw
95     ln -s "$out/opt/brother/Printers/dcpt725dw/cupswrapper/brother_dcpt725dw_printer_en.ppd" \
96       "$out/share/cups/model/"
98     runHook postInstall
99   '';
101   meta = with lib; {
102     description = "Brother DCP-T725DW printer driver";
103     license = licenses.unfree;
104     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
105     maintainers = with maintainers; [ u2x1 ];
106     platforms = [
107       "x86_64-linux"
108       "i686-linux"
109     ];
110     downloadPage = "https://support.brother.com/g/b/downloadtop.aspx?c=cn_ot&lang=en&prod=dcpt725dw_cn";
111     homepage = "http://www.brother.com/";
112   };