nixos/wyoming/{faster-whisper,piper}: drop download directory (#376447)
[NixPkgs.git] / pkgs / by-name / mf / mfcj470dw-cupswrapper / package.nix
blob393967c59acdcf619ced3cf9b528188726a7b760
2   lib,
3   stdenv,
4   fetchurl,
5   mfcj470dwlpr,
6   makeWrapper,
7   bash,
8 }:
10 stdenv.mkDerivation rec {
11   pname = "mfcj470dw-cupswrapper";
12   version = "3.0.0-1";
14   src = fetchurl {
15     url = "https://download.brother.com/welcome/dlf006866/mfcj470dw_cupswrapper_GPL_source_${version}.tar.gz";
16     sha256 = "b88f9b592723a00c024129560367f40a560ca3cba06fd99512ab368dd6855853";
17   };
19   nativeBuildInputs = [ makeWrapper ];
20   buildInputs = [
21     bash # shebang
22   ];
24   makeFlags = [
25     "-C"
26     "brcupsconfpt1"
27     "all"
28   ];
30   postPatch = ''
31     WRAPPER=cupswrapper/cupswrappermfcj470dw
33     substituteInPlace $WRAPPER \
34       --replace-fail /opt "${mfcj470dwlpr}/opt" \
35       --replace-fail /usr "${mfcj470dwlpr}/usr" \
36       --replace-fail /etc "$out/etc"
38     substituteInPlace $WRAPPER \
39       --replace-fail "cp " "cp -p "
40   '';
42   installPhase = ''
43     runHook preInstall
45     TARGETFOLDER=$out/opt/brother/Printers/mfcj470dw/cupswrapper/
46     PPDFOLDER=$out/share/cups/model/
47     FILTERFOLDER=$out/lib/cups/filter/
49     mkdir -p $TARGETFOLDER
50     mkdir -p $PPDFOLDER
51     mkdir -p $FILTERFOLDER
53     cp brcupsconfpt1/brcupsconfpt1 $TARGETFOLDER
54     cp cupswrapper/cupswrappermfcj470dw $TARGETFOLDER
55     cp PPD/brother_mfcj470dw_printer_en.ppd $PPDFOLDER
57     ln -s ${mfcj470dwlpr}/lib/cups/filter/brother_lpdwrapper_mfcj470dw $FILTERFOLDER/
59     runHook postInstall
60   '';
62   meta = {
63     homepage = "http://www.brother.com/";
64     description = "Brother MFC-J470DW CUPS wrapper driver";
65     license = lib.licenses.gpl2Plus;
66     platforms = lib.platforms.linux;
67     downloadPage = "http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=mfcj470dw_us_eu_as&os=128";
68     maintainers = [ lib.maintainers.yochai ];
69   };