diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-07-26 17:57:46 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-07-26 17:57:46 +0200 |
commit | b875ea5d2974c13cc61ea4e70aade83d71b89469 (patch) | |
tree | c34fe440364599368ac538f07c760d0643620888 /pkgs/misc | |
parent | 3465ffa8b0543d5c845c9f3a49689c41eca0ddc3 (diff) | |
parent | 3322c96a361c296fab2366b41e086a924f4baa81 (diff) | |
download | nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar.gz nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar.bz2 nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar.lz nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar.xz nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.tar.zst nixlib-b875ea5d2974c13cc61ea4e70aade83d71b89469.zip |
Merge branch 'master' into staging
Diffstat (limited to 'pkgs/misc')
-rw-r--r-- | pkgs/misc/drivers/hplip/default.nix | 153 |
1 files changed, 84 insertions, 69 deletions
diff --git a/pkgs/misc/drivers/hplip/default.nix b/pkgs/misc/drivers/hplip/default.nix index ba64b729393f..d173b0ac406e 100644 --- a/pkgs/misc/drivers/hplip/default.nix +++ b/pkgs/misc/drivers/hplip/default.nix @@ -1,24 +1,30 @@ { stdenv, fetchurl, automake, pkgconfig -, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus +, cups, zlib, libjpeg, libusb1, pythonPackages, saneBackends, dbus, usbutils , polkit, qtSupport ? true, qt4, pyqt4, net_snmp , withPlugin ? false, substituteAll, makeWrapper }: let - name = "hplip-3.15.6"; + version = "3.15.7"; + + name = "hplip-${version}"; src = fetchurl { url = "mirror://sourceforge/hplip/${name}.tar.gz"; - sha256 = "1jbnjw7vrn1qawrjfdv8j58w69q8ki1qkzvlh0nk8nxacpp17i9h"; + sha256 = "17flpl89lgwlbsy9mka910g530nnvlwqqnif8a9hyq7k90q9046k"; + }; + + plugin = fetchurl { + url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run"; + sha256 = "0fblh5m43jnws4vkwks0b4m9k3jg9kspaj1l8bic0r5swy97s41m"; }; hplip_state = substituteAll { + inherit version; src = ./hplip.state; - # evaluated this way, version is always up-to-date - version = (builtins.parseDrvName name).version; }; hplip_arch = @@ -29,16 +35,34 @@ let "arm7l-linux" = "arm32"; }."${stdenv.system}" or (abort "Unsupported platform ${stdenv.system}"); - plugin = fetchurl { - url = "http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/${name}-plugin.run"; - sha256 = "1rymxahz12s1s37rri5qyvka6q0yi0yai08kgspg24176ry3a3fx"; - }; - in stdenv.mkDerivation { inherit name src; + buildInputs = [ + libjpeg + cups + libusb1 + pythonPackages.python + pythonPackages.wrapPython + saneBackends + dbus + net_snmp + ] ++ stdenv.lib.optional qtSupport qt4; + nativeBuildInputs = [ + pkgconfig + ]; + + pythonPath = with pythonPackages; [ + dbus + pillow + pygobject + recursivePthLoader + reportlab + usbutils + ] ++ stdenv.lib.optional qtSupport pyqt4; + prePatch = '' # HPLIP hardcodes absolute paths everywhere. Nuke from orbit. find . -type f -exec sed -i \ @@ -51,50 +75,33 @@ stdenv.mkDerivation { {} + ''; - preConfigure = '' - export configureFlags="$configureFlags - --with-cupsfilterdir=$out/lib/cups/filter - --with-cupsbackenddir=$out/lib/cups/backend - --with-icondir=$out/share/applications - --with-systraydir=$out/xdg/autostart - --with-mimedir=$out/etc/cups - --enable-policykit - " - - export makeFlags=" - halpredir=$out/share/hal/fdi/preprobe/10osvendor - rulesdir=$out/etc/udev/rules.d - policykit_dir=$out/share/polkit-1/actions - policykit_dbus_etcdir=$out/etc/dbus-1/system.d - policykit_dbus_sharedir=$out/share/dbus-1/system-services - hplip_confdir=$out/etc/hp - hplip_statedir=$out/var/lib/hp - "; + configureFlags = '' + --with-cupsfilterdir=$(out)/lib/cups/filter + --with-cupsbackenddir=$(out)/lib/cups/backend + --with-icondir=$(out)/share/applications + --with-systraydir=$(out)/xdg/autostart + --with-mimedir=$(out)/etc/cups + --enable-policykit ''; + makeFlags = '' + halpredir=$(out)/share/hal/fdi/preprobe/10osvendor + rulesdir=$(out)/etc/udev/rules.d + policykit_dir=$(out)/share/polkit-1/actions + policykit_dbus_etcdir=$(out)/etc/dbus-1/system.d + policykit_dbus_sharedir=$(out)/share/dbus-1/system-services + hplip_confdir=$(out)/etc/hp + hplip_statedir=$(out)/var/lib/hp + ''; + + enableParallelBuilding = true; + postInstall = - '' - # Wrap the user-facing Python scripts in /bin without turning the ones - # in /share into shell scripts (they need to be importable). - # Complicated by the fact that /bin contains just symlinks to /share. - for bin in $out/bin/*; do - py=`readlink -m $bin` - rm $bin - cp $py $bin - wrapPythonProgramsIn $bin "$out $pythonPath" - sed -i "s@$(dirname $bin)/[^ ]*@$py@g" $bin - done - - # Remove originals. Knows a little too much about wrapPythonProgramsIn. - rm -f $out/bin/.*-wrapped - - wrapPythonPrograms $out/lib "$out $pythonPath" - '' - + (stdenv.lib.optionalString withPlugin + (stdenv.lib.optionalString withPlugin (let hplip_arch = if stdenv.system == "i686-linux" then "x86_32" else if stdenv.system == "x86_64-linux" then "x86_64" - else abort "Platform must be i686-linux or x86_64-linux!"; + else abort "Plugin platform must be i686-linux or x86_64-linux!"; in '' sh ${plugin} --noexec --keep @@ -129,31 +136,39 @@ stdenv.mkDerivation { mv $out/etc/sane.d/dll.conf $out/etc/sane.d/dll.d/hpaio.conf rm $out/etc/udev/rules.d/56-hpmud.rules - '')); + '')); + + fixupPhase = '' + # Wrap the user-facing Python scripts in $out/bin without turning the + # ones in $out /share into shell scripts (they need to be importable). + # Note that $out/bin contains only symlinks to $out/share. + for bin in $out/bin/*; do + py=`readlink -m $bin` + rm $bin + cp $py $bin + wrapPythonProgramsIn $bin "$out $pythonPath" + sed -i "s@$(dirname $bin)/[^ ]*@$py@g" $bin + done - buildInputs = [ - libjpeg - cups - libusb1 - pythonPackages.python - pythonPackages.wrapPython - saneBackends - dbus - net_snmp - ] ++ stdenv.lib.optional qtSupport qt4; - nativeBuildInputs = [ - pkgconfig - ]; + # Remove originals. Knows a little too much about wrapPythonProgramsIn. + rm -f $out/bin/.*-wrapped - pythonPath = with pythonPackages; [ - dbus - pillow - pygobject - recursivePthLoader - reportlab - ] ++ stdenv.lib.optional qtSupport pyqt4; + # Merely patching shebangs in $out/share does not cause trouble. + for i in $out/share/hplip{,/*}/*.py; do + substituteInPlace $i \ + --replace /usr/bin/python \ + ${pythonPackages.python}/bin/${pythonPackages.python.executable} \ + --replace "/usr/bin/env python" \ + ${pythonPackages.python}/bin/${pythonPackages.python.executable} + done + + wrapPythonProgramsIn $out/lib "$out $pythonPath" + + substituteInPlace $out/etc/hp/hplip.conf --replace /usr $out + ''; meta = with stdenv.lib; { + inherit version; description = "Print, scan and fax HP drivers for Linux"; homepage = http://hplipopensource.com/; license = if withPlugin |