summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ca7c8253c3afde17ec044df8fb58b5831aeba17c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Maintainer: andmars < andreas.marschall @ unitybox.de >
# Contributor: PyroPeter < googlemail.com @ abi1789 >

pkgname=hplip-plugin
pkgver=3.15.9
pkgrel=2
pkgdesc="Binary plugin for HPs hplip printer driver library"
arch=('i686' 'x86_64')
url="http://hplipopensource.com/node/309"
license=('custom:proprietary')
depends=("hplip>=$pkgver") 
backup=(var/lib/hp/hplip.state)
#source=("http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-$pkgver-plugin.run")
source=("http://hplipopensource.com/hplip-web/plugin/hplip-$pkgver-plugin.run")
md5sums=('1a4954e7d654641edbf5823947f60cf4')

prepare() {
	sh hplip-$pkgver-plugin.run --target "$srcdir/hplip-$pkgver-plugin" --noexec
}

build(){
    # Untargziping the makeself selfextracting archive
    cd $srcdir
    sh hplip-$pkgver-plugin.run --tar xvf
}

package(){
    if [ $CARCH = "i686" ]; then
        _arch='x86_32'
    elif [ $CARCH = "x86_64" ]; then
        _arch='x86_64'
    fi

    # Create folders
    install -d $pkgdir/usr/share/hplip/data/firmware
    install -d $pkgdir/usr/share/hplip/fax/plugins
    install -d $pkgdir/usr/share/hplip/prnt/plugins
    install -d $pkgdir/usr/share/hplip/scan/plugins
    install -d $pkgdir/usr/share/licenses/hplip-plugin
    install -d $pkgdir/var/lib/hp

    # Copy files
    cd $srcdir
    install -m644 plugin.spec                  $pkgdir/usr/share/hplip/
    install -m644 hp_laserjet_*.fw.gz          $pkgdir/usr/share/hplip/data/firmware/
    install -m755 fax_marvell-"$_arch".so      $pkgdir/usr/share/hplip/fax/plugins/
    install -m755 hbpl1-"$_arch".so            $pkgdir/usr/share/hplip/prnt/plugins/
    install -m755 lj-"$_arch".so               $pkgdir/usr/share/hplip/prnt/plugins/
    install -m755 bb_*-"$_arch".so             $pkgdir/usr/share/hplip/scan/plugins/
    install -m644 license.txt                  $pkgdir/usr/share/licenses/hplip-plugin/

    # Create hplip.state used by hplip-tools
    cat << EOF > hplip.state
[plugin]
installed = 1
eula = 1
version = $pkgver
EOF
    install -m644 hplip.state $pkgdir/var/lib/hp

    # Create symlinks
    for f in $(find $pkgdir/usr/share/hplip -type f -name "*.so"); do
        cd $pkgdir/usr/share/hplip
        cd $(dirname $f)
        link_name="$(basename $f | cut -d- -f1).so"
        ln -s $(basename $f) $link_name
    done
}

# Note: to check the install, perform: hp-diagnose_plugin