summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 36eafc64e35a85bd385cd942993e6b98daa1f347 (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
# Maintainer: andmars <andreas.marschall @ unitybox.de>
# Contributor: PyroPeter <googlemail.com @ abi1789>
# Contributor: Ivan Shapovalov <intelfx@intelfx.name>

pkgname=hplip-plugin
pkgver=3.18.7
pkgrel=1
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=("https://developers.hp.com/sites/default/files/hplip-$pkgver-plugin.run")
md5sums=('fddbdf819b0f5ba467b22e6e29fcbd68')

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

package(){
    cd "$srcdir/hplip-$pkgver-plugin"

    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
    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
    find "$pkgdir/usr/share/hplip" -type f -name "*.so" | while read f; do
        lib_dir="${f%/*}"
        lib_name="${f##*/}"
        ln -vsf "$lib_name" "$lib_dir/${lib_name%%-*}.so"
    done
}

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