summaryrefslogtreecommitdiff
path: root/user/sane/APKBUILD
blob: a2f2c3a3a7e25b3a74ea26ee53dffeb34a36f503 (plain) (blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Contributor: Fabio Riga <rifabio@dpersonam.me>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=sane
_pkgname=sane-backends
pkgver=1.0.27
pkgrel=5
pkgdesc="Scanner access library"
url="http://www.sane-project.org/"
arch="all"
license="GPL-2.0+ AND GPL-2.0+-with-sane-exception AND Public-Domain"
depends=""
makedepends="diffutils file libtool libusb-dev v4l-utils-dev net-snmp-dev
	libpng-dev libjpeg-turbo-dev tiff-dev libgphoto2-dev libieee1284-dev
	linux-headers ncurses-dev"
install="saned.pre-install $pkgname.pre-install"
pkgusers="saned"
pkggroups="scanner"
_backends="abaton agfafocus apple artec artec_eplus48u as6e avision bh canon
	canon630u canon_dr canon_pp cardscan coolscan coolscan2 coolscan3 dc25
	dc210 dc240 dell1600n_net dmc epjitsu epson epson2 epsonds fujitsu
	genesys gphoto2 gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpsj5s
	hpljm1005 hs2p ibm kodak kodakaio kvs1025 kvs20xx kvs40xx leo lexmark
	ma1509 magicolor matsushita microtek microtek2 mustek mustek_pp
	mustek_usb mustek_usb2 nec net niash p5 pie pieusb pixma plustek
	plustek_pp ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 snapscan
	sp15c st400 stv680 tamarack teco1 teco2 teco3 test u12 umax umax_pp
	umax1220u v4l xerox_mfp"
case "$CARCH" in
x86*) _backends="$_backends qcam";;
esac

_pkgdesc_dell1600n_net="SANE backend for Dell 1600n that supports colour and monochrome scans over ethernet, usb not supported"
for _backend in $_backends; do
	subpackages="$subpackages $pkgname-backend-$_backend:_backend"
done
subpackages="$pkgname-doc $pkgname-dev $subpackages $pkgname-utils saned
	saned-openrc:openrc:noarch $pkgname-udev::noarch $_pkgname::noarch
	$pkgname-lang"
source="http://distfiles.gentoo.org/distfiles/$_pkgname-$pkgver.tar.gz
	saned.initd
	include.patch
	network.patch
	pidfile.patch
	check.patch
	"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	cd "$builddir"
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--with-docdir=/usr/share/doc/$pkgname \
		--with-usb \
		--disable-rpath \
		--disable-locking
	make
}

check() {
	cd "$builddir"
	make check
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	printf "" > "$pkgdir"/etc/sane.d/dll.conf
	install -Dm644 backend/dll.aliases "$pkgdir"/etc/sane.d/dll.aliases
}

doc() {
	default_doc
	mkdir -p "$subpkgdir"/usr/share/licenses/$_pkgname
	mv "$subpkgdir"/usr/share/doc/$_pkgname/LICENSE \
		"$subpkgdir"/usr/share/licenses/$_pkgname
}

saned() {
	pkgdesc="Network scanner server"
	mkdir -p "$subpkgdir"/etc/sane.d "$subpkgdir"/usr
	mv "$pkgdir"/etc/sane.d/saned.conf "$subpkgdir"/etc/sane.d
	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
}

openrc() {
	pkgdesc="Network scanner server (OpenRC runscripts)"
	depends="saned"
	install_if="saned=$pkgver-r$pkgrel openrc"
	install -Dm755 "$srcdir"/saned.initd "$subpkgdir"/etc/init.d/saned
}

utils() {
	pkgdesc="$pkgdesc (utilities)"
	mkdir -p "$subpkgdir"/usr
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr
}

udev() {
	pkgdesc="$pkgdesc (udev rules)"
	install_if="$pkgname=$pkgver-r$pkgrel udev"
	install -Dm644 "$builddir"/tools/udev/libsane.rules \
		"$subpkgdir"/usr/lib/udev/rules.d/49-sane.rules
	sed -i 's|NAME="%k", ||g' "$subpkgdir"/usr/lib/udev/rules.d/49-sane.rules
}

backends() {
	local _backend;
	pkgdesc="$pkgdesc (metapackage)"
	depends="$pkgname-utils saned"
	for _backend in $_backends; do
		[ "$_backend" = "test" ] && continue
		depends="$depends $pkgname-backend-$_backend"
	done
	mkdir -p "$subpkgdir"
}

_backend() {
	local name="${subpkgname#$pkgname-backend-}"
	depends="$pkgname"
	pkgdesc=$(eval echo \$_pkgdesc_$name)
	if [ ! "$pkgdesc" ]; then
		# cut description from man-page
		pkgdesc=$(tr '\n' ' ' < "$builddir"/doc/$pkgname-$name.man)
		pkgdesc=${pkgdesc#*\- }
		pkgdesc=${pkgdesc%% .SH *};
	fi
	mkdir -p "$subpkgdir"/usr/lib/$pkgname \
		"$subpkgdir"/etc/$pkgname.d/dll.d
	mv "$pkgdir"/usr/lib/sane/lib$pkgname-$name.* \
		"$subpkgdir"/usr/lib/sane
	echo "$name" > "$subpkgdir"/etc/sane.d/dll.d/$name
	if [ -f "$pkgdir"/etc/sane.d/$name.conf ]; then
		mv "$pkgdir"/etc/sane.d/$name.conf \
			"$subpkgdir"/etc/sane.d
	fi
	if [ -f "$pkgdir"/usr/bin/$name ]; then
		mkdir -p "$subpkgdir"/usr/bin
		mv "$pkgdir"/usr/bin/$name "$subpkgdir"/usr/bin
	fi
}

sha512sums="c6552768bfc10216730fc11011c82f74ca0952182019ded3916072147ec09be5c975ce1d37dc3ccea050c488dbdf983c2ca17dcd702644060ba796ae2591f9c5  sane-backends-1.0.27.tar.gz
0a06eaa28b345202f2bdf8361e06f843bb7a010b7d8f80132f742672c94249c43f64031cefa161e415e2e2ab3a53b23070fb63854283f9e040f5ff79394ac7d1  saned.initd
1779ff8beb1ba5f9238c25d819a7f0045f7e257c19b511315feb85650e445ca86450a9e1d7ff8650499d3dae808589a6c2e358d5f3f39a3f40ce4999179b86d6  include.patch
9cb595841f59b5105ecc85e4c0ad8781c52caa2354fb823c920ec467e88afbe47f2b3f4a7a3980bef5dbf22983c5786f051a9d10aea97b4bf7c4a05378592029  network.patch
09505943f9441854a6c333f19e2535b4a646a8cc060fe82c6261e7d29c72773ebe98d43a91acc951f4336a3c8b4c84ab7c7b0763426136b4b59d9546bc2fa8c0  pidfile.patch
cfa327209efd9a2a2db7cbcf571852959823aaa19b43d5f6415834cd5ae38b6324ecae16779f6f896aa0d7ac890fe23244100b7d6a68e5e9d52cd38ec82bfac8  check.patch"