SliTaz Packages

Community Doc Forum Pro Shop Bugs Hg
.

Receipt for package "hplip"

# SliTaz package receipt.

PACKAGE="hplip"
VERSION="3.20.5"
CATEGORY="system-tools"
TAGS="printer driver printing"
SHORT_DESC="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet."
MAINTAINER="jozee@slitaz.org"
LICENSE="GPL2"
WEB_SITE="https://hplipopensource.com/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"

DEPENDS="cups dbus-python gcc-lib-base ghostscript jpeg libexif
    libgphoto2 libltdl libusb libv4l net-snmp python3
    python3-distro python3-pillow sane-backends tiff"
BUILD_DEPENDS="cups-dev dbus-dev dbus-python dbus-python-dev gawk
    ghostscript-dev jpeg-dev libexif-dev libgphoto2-dev libtool
    libusb-dev net-snmp-dev openssl-dev pkg-config python3
    python3-dev Qt4-dev sane-backends-dev tiff-dev"

# Take long long time for recompress, need check why
COOKOPTS="!gz !menus"

BUGS="Unable to delete hplip.desktop from $fs.  Using hack in post_install."

# What is the latest version available today?
current_version()
{
    wget -O - https://sourceforge.net/projects/hplip/files/hplip/ 2>/dev/null | \
    sed '/scope="row/!d;/\/[0-9]/!d;s|.*href="|"https://sourceforge.net|;q' | xargs wget -O - 2>/dev/null | \
    sed '/scope="row/!d;s|.*/hplip/||;s|/.*||;q'
}

# Rules to configure and make the package.
compile_rules()
{
    grep -lr 'uname -m' . | xargs sed -i 's|uname -m|echo i686|'

    # Patch from slackware
    patch -p1 < $stuff/hplip.no.upgrade.diff
    patch -p1 < $stuff/setup.py.lc_all.c.diff
    patch -p1 < $stuff/hplip.python3.shebang.diff
    patch -p1 < $stuff/hplip.is_alive.diff
    patch -p1 < $stuff/hplip.python3.10.diff

    find -name '*.py' -print0 | xargs -0 \
            sed -i.env-python -e 's,^#!/usr/bin/env python,#!/usr/bin/python3,'
    sed -i.env-python -e 's,^#!/usr/bin/env python,#!/usr/bin/python3,' \
            prnt/filters/hpps fax/filters/pstotiff

    patch -p1 < $stuff/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
    patch -p1 < $stuff/0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch

    # autoreconf will fail if these files do not exist:
    for file in NEWS README AUTHORS ChangeLog ; do
      if [ ! -r $file ]; then
            touch $file
       fi
    done

    # Needed because Makefile.am was patched:
    autoreconf -vif

    PYTHON=/usr/bin/python3                    \
    ./configure                        \
        --prefix=/usr                    \
        --with-cupsbackenddir=/usr/lib/cups/backend \
        --with-cupsfilterdir=/usr/lib/cups/filter   \
        --sysconfdir=/etc                \
        --disable-doc-build                \
        --enable-qt4                    \
        $CONFIGURE_ARGS &&
    make &&
    make -j 1 DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
    mkdir -p $fs/etc
    mkdir -p $fs/usr/lib
    mkdir -p $fs/usr/share

    cp -a $install/etc        $fs
    #cp -a $install/var        $fs
    cp -a $install/usr/bin        $fs/usr
    cp -a $install/usr/lib/cups    $fs/usr/lib
    cp -a $install/usr/lib/python*    $fs/usr/lib
    cp -a $install/usr/lib/sane    $fs/usr/lib
    #cp -a $install/usr/lib/hal    $fs/usr/lib
    cp -a $install/usr/lib/*so*    $fs/usr/lib
    cp -a $install/usr/share/cups    $fs/usr/share
    cp -a $install/usr/share/hplip    $fs/usr/share
    cp -a $install/usr/share/ppd    $fs/usr/share
    cp -a $install/usr/share/app*    $fs/usr/share

    # compress non-zipped ppd files
    find $fs/usr/share/ppd/HP -name "*.ppd" -exec gzip -n9 {} \;

    # Split UI to hplip-gui
        for file in $(cat $WOK/hplip-gui/stuff/wanted-files.list)
        do
                rm ${fs}$file
        done
    # Remove desktop files
    rm -rf $fs/usr/share/applications

    # remove hp-uninstall / hp-upgrade
    rm $fs/usr/bin/hp-uninstall $fs/usr/bin/hp-upgrade
    rm $fs/usr/share/hplip/uninstall.py
    rm $fs/usr/share/hplip/upgrade.py

    # remove autostart of hp-daemon
    rm -rf                $fs/etc/sane.d
 
    # remove xdg
    rm -rf                $fs/etc/xdg
}

post_install()
{
    tazpkg reconfigure udev --root="$1"
}
6025 packages and 203154 files in current database (Thu Apr 25 06:17:47 2024)