base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / mf / mfcj470dw-cupswrapper / package.nix
blobc629a4918901db71a1a299a86ecdb594d22b5992
1 { lib, stdenv, fetchurl, mfcj470dwlpr, makeWrapper, bash }:
3 stdenv.mkDerivation rec {
4   pname = "mfcj470dw-cupswrapper";
5   version = "3.0.0-1";
7   src = fetchurl {
8     url = "https://download.brother.com/welcome/dlf006866/mfcj470dw_cupswrapper_GPL_source_${version}.tar.gz";
9     sha256 = "b88f9b592723a00c024129560367f40a560ca3cba06fd99512ab368dd6855853";
10   };
12   nativeBuildInputs = [ makeWrapper ];
13   buildInputs = [
14     bash # shebang
15   ];
17   makeFlags = [ "-C" "brcupsconfpt1" "all" ];
19   postPatch = ''
20     WRAPPER=cupswrapper/cupswrappermfcj470dw
22     substituteInPlace $WRAPPER \
23       --replace-fail /opt "${mfcj470dwlpr}/opt" \
24       --replace-fail /usr "${mfcj470dwlpr}/usr" \
25       --replace-fail /etc "$out/etc"
27     substituteInPlace $WRAPPER \
28       --replace-fail "cp " "cp -p "
29   '';
31   installPhase = ''
32     runHook preInstall
34     TARGETFOLDER=$out/opt/brother/Printers/mfcj470dw/cupswrapper/
35     PPDFOLDER=$out/share/cups/model/
36     FILTERFOLDER=$out/lib/cups/filter/
38     mkdir -p $TARGETFOLDER
39     mkdir -p $PPDFOLDER
40     mkdir -p $FILTERFOLDER
42     cp brcupsconfpt1/brcupsconfpt1 $TARGETFOLDER
43     cp cupswrapper/cupswrappermfcj470dw $TARGETFOLDER
44     cp PPD/brother_mfcj470dw_printer_en.ppd $PPDFOLDER
46     ln -s ${mfcj470dwlpr}/lib/cups/filter/brother_lpdwrapper_mfcj470dw $FILTERFOLDER/
48     runHook postInstall
49   '';
51   meta = {
52     homepage = "http://www.brother.com/";
53     description = "Brother MFC-J470DW CUPS wrapper driver";
54     license = lib.licenses.gpl2Plus;
55     platforms = lib.platforms.linux;
56     downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128";
57     maintainers = [ lib.maintainers.yochai ];
58   };