### this file is sourced not run
PKGVER=1.0.32
PKGBUILD=1
PKGARCH=x86_64

# source: BLFS 11.3
TARBALL=sane-backends-$PKGVER.tar.gz
MD5SUM=51ff581b911fc9b7b6b5ae6959f9089b
SRC_URL=https://anduin.linuxfromscratch.org/BLFS/sane/$TARBALL
BUNDLE=

SLACKREQ='cups libjpeg-turbo libtiff libusb avahi'
SLACKDESC="sane-backend: sane-backend $PKGVER (Generic Scanner Driver)  
sane-backend:  
sane-backend: SANE is short for Scanner Access Now Easy. Scanner access; 
sane-backend: however, is far from easy, since every vendor has their own 
sane-backend: protocols. The only known protocol that should bring some unity 
sane-backend: into this chaos is the TWAIN interface, but this is too 
sane-backend: imprecise to allow a stable scanning framework. Therefore, SANE 
sane-backend: comes with its own protocol, and the vendor drivers can't be 
sane-backend: used. This package contains drivers for the supported scanners 
sane-backend: and cameras.  
sane-backend: https://gitlab.com/sane-project
"

### default pkg_download
### default pkg_prepare
### default pkg_package

### build
pkg_build() {
	echo "scanner::130:" >> /etc/group # make sure "scanner" group is defined
	
	CONFFLAGS="$CONFFLAGS    \
		--with-group=scanner \
		--enable-avahi       \
		--with-usb=yes       \
		--enable-libusb_1_0  \
		--docdir=/usr/share/doc/sane-backend-$PKGVER \
		--with-systemd=no    \
	" &&
		
	pkg_build_autoconf &&
	pkg_build_slackdesc &&

	# install udev rules
	install -m 644 -v tools/udev/libsane.rules \
                  /etc/udev/rules.d/65-scanner.rules &&
    
    # multilib
	mv -v /usr/bin/sane-config{,-64} &&
	ln -sfv multiarch_wrapper /usr/bin/sane-config &&

	# remove temporary group
	rm -f etc/group
}


