nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
fork

Configure Feed

Select the types of activity you want to include in your feed.

cups-brother-dcpt310: init at 1.0.1

+152
+152
pkgs/by-name/cu/cups-brother-dcpt310/package.nix
··· 1 + { 2 + stdenv, 3 + stdenvNoCC, 4 + lib, 5 + fetchurl, 6 + perl, 7 + gnused, 8 + dpkg, 9 + makeWrapper, 10 + autoPatchelfHook, 11 + libredirect, 12 + gnugrep, 13 + coreutils, 14 + ghostscript, 15 + file, 16 + pkgsi686Linux, 17 + }: 18 + 19 + stdenvNoCC.mkDerivation (finalAttrs: { 20 + pname = "cups-brother-dcpt310"; 21 + version = "1.0.1"; 22 + 23 + src = fetchurl { 24 + url = "https://download.brother.com/welcome/dlf103618/dcpt310pdrv-${finalAttrs.version}-0.i386.deb"; 25 + sha256 = "0g9hylmpgmzd6k9lxjy32c7pxbzj6gr9sfaahxj3xzqyar05amdx"; 26 + }; 27 + 28 + nativeBuildInputs = [ 29 + dpkg 30 + makeWrapper 31 + autoPatchelfHook 32 + ]; 33 + 34 + buildInputs = [ 35 + perl 36 + gnused 37 + libredirect 38 + pkgsi686Linux.stdenv.cc.cc.lib 39 + ]; 40 + 41 + unpackPhase = '' 42 + runHook preUnpack 43 + 44 + dpkg-deb -x $src . 45 + 46 + runHook postUnpack 47 + ''; 48 + 49 + installPhase = '' 50 + runHook preInstall 51 + 52 + mkdir -p "$out" 53 + cp -pr opt "$out" 54 + cp -pr usr/bin "$out/bin" 55 + rm "$out/opt/brother/Printers/dcpt310/cupswrapper/cupswrapperdcpt310" 56 + 57 + mkdir -p "$out/lib/cups/filter" "$out/share/cups/model" 58 + 59 + ln -s "../../../opt/brother/Printers/dcpt310/cupswrapper/brother_lpdwrapper_dcpt310" \ 60 + "$out/lib/cups/filter/brother_lpdwrapper_dcpt310" 61 + ln -s "../../../opt/brother/Printers/dcpt310/cupswrapper/brother_dcpt310_printer_en.ppd" \ 62 + "$out/share/cups/model/brother_dcpt310_printer_en.ppd" 63 + 64 + runHook postInstall 65 + ''; 66 + 67 + # Fix global references and replace auto discovery mechanism 68 + # with hardcoded values. 69 + # 70 + # The configuration binary 'brprintconf_dcpt310' and lpd filter 71 + # 'brdcpt310filter' has hardcoded /opt format strings. There isn't 72 + # sufficient space in the binaries to substitute a path in the store, so use 73 + # libredirect to get it to see the correct path. The configuration binary 74 + # also uses this format string to print configuration locations. Here the 75 + # wrapper output is processed to point into the correct location in the 76 + # store. 77 + 78 + postFixup = '' 79 + interpreter=${pkgsi686Linux.glibc.out}/lib/ld-linux.so.2 80 + 81 + substituteInPlace $out/opt/brother/Printers/dcpt310/lpd/filter_dcpt310 \ 82 + --replace "my \$BR_PRT_PATH =" "my \$BR_PRT_PATH = \"$out/opt/brother/Printers/dcpt310/\"; #" \ 83 + --replace /usr/bin/pdf2ps "${ghostscript}/bin/pdf2ps" \ 84 + --replace "my \$GHOST_SCRIPT" "my \$GHOST_SCRIPT = \"${ghostscript}/bin/gs\"; #" \ 85 + --replace "PRINTER =~" "PRINTER = \"dcpt310\"; #" 86 + 87 + substituteInPlace $out/opt/brother/Printers/dcpt310/cupswrapper/brother_lpdwrapper_dcpt310 \ 88 + --replace "PRINTER =~" "PRINTER = \"dcpt310\"; #" \ 89 + --replace "my \$basedir = \`readlink \$0\`" "my \$basedir = \"$out/opt/brother/Printers/dcpt310/\"" \ 90 + --replace "my \$lpdconf = \$LPDCONFIGEXE.\$PRINTER;" "my \$lpdconf = \"$out/bin/brprintconf_dcpt310\";" 91 + 92 + 93 + patchelf --set-interpreter "$interpreter" "$out/opt/brother/Printers/dcpt310/lpd/brdcpt310filter" \ 94 + --set-rpath ${lib.makeLibraryPath [ pkgsi686Linux.stdenv.cc.cc ]} 95 + patchelf --set-interpreter "$interpreter" "$out/bin/brprintconf_dcpt310" 96 + 97 + 98 + wrapProgram $out/bin/brprintconf_dcpt310 \ 99 + --set LD_PRELOAD "${pkgsi686Linux.libredirect}/lib/libredirect.so" \ 100 + --set NIX_REDIRECTS /opt=$out/opt 101 + 102 + wrapProgram $out/opt/brother/Printers/dcpt310/lpd/brdcpt310filter \ 103 + --set PATH ${ 104 + lib.makeBinPath [ 105 + coreutils 106 + gnugrep 107 + gnused 108 + ghostscript 109 + ] 110 + } \ 111 + --set LD_PRELOAD "${pkgsi686Linux.libredirect}/lib/libredirect.so" \ 112 + --set NIX_REDIRECTS /opt=$out/opt 113 + 114 + for f in \ 115 + $out/opt/brother/Printers/dcpt310/cupswrapper/brother_lpdwrapper_dcpt310 \ 116 + $out/opt/brother/Printers/dcpt310/lpd/filter_dcpt310 \ 117 + ; do 118 + wrapProgram $f \ 119 + --set PATH ${ 120 + lib.makeBinPath [ 121 + coreutils 122 + ghostscript 123 + gnugrep 124 + gnused 125 + file 126 + ] 127 + } 128 + done 129 + 130 + substituteInPlace $out/bin/brprintconf_dcpt310 \ 131 + --replace \"\$"@"\" \"\$"@\" | LD_PRELOAD= ${gnused}/bin/sed -E '/^(function list :|resource file :).*/{s#/opt#$out/opt#}'" 132 + ''; 133 + 134 + meta = { 135 + description = "Brother DCP-T310 printer driver"; 136 + license = with lib.licenses; [ 137 + unfree 138 + gpl2Plus 139 + ]; 140 + sourceProvenance = with lib.sourceTypes; [ 141 + binaryNativeCode 142 + fromSource 143 + ]; 144 + maintainers = with lib.maintainers; [ inexcode ]; 145 + platforms = [ 146 + "x86_64-linux" 147 + "i686-linux" 148 + ]; 149 + homepage = "https://www.brother.com/"; 150 + downloadPage = "https://support.brother.com/g/b/downloadhowto.aspx?c=us_ot&lang=en&prod=dcpt310_all&os=128&dlid=dlf103618_000&flang=4&type3=10283"; 151 + }; 152 + })