jobextra/sane/PKGBUILD

111 lines
4.1 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobextra/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
_name=backends
pkgname=sane
pkgver=1.2.1
pkgrel=05
pkgdesc="Scanner Access Now Easy w/o systemd or avahi"
url="http://www.sane-project.org/"
# NOTE: libgphoto2 can be moved to makedepends once the package also provides
# libgphoto2_port.so
depends=(bash cairo gcc-libs glibc libpng libieee1284 net-snmp v4l-utils libgphoto2 libgphoto2.so libgphoto2_port.so)
makedepends=(autoconf-archive curl glib2 libgphoto2 libjpeg-turbo libtiff libxml2 libusb python texlive-latexextra)
optdepends=('sane-airscan: for scanners working in driverless mode')
provides=(libsane.so)
source=(https://gitlab.com/sane-project/$_name/-/archive/$pkgver/$_name-$pkgver.tar.gz
66-${pkgname}d.rules
$pkgname.sysusers)
# From initial build 1.1.1-02
# ==> WARNING: Library listed in 'depends' is not required by any files: libgobject-2.0.so
# ==> WARNING: Library listed in 'depends' is not required by any files: libpoppler-glib.so
#
prepare() {
cd $_name-$pkgver
# copy translation files so they become reproducible: https://gitlab.com/sane-project/backends/-/issues/647
cp -v po/en{_GB,@quot}.po
cp -v po/en{_GB,@boldquot}.po
# create version files, so that autotools macros can use them:
# https://gitlab.com/sane-project/backends/-/issues/440
printf "%s\n" "$pkgver" > .tarball-version
printf "%s\n" "$pkgver" > .version
autoreconf -fiv
}
build() {
cd "${_name}-${pkgver}"
./configure --prefix=/usr \
--disable-locking \
--disable-rpath \
--docdir="/usr/share/doc/${pkgname}" \
--enable-pthread \
--localstatedir=/var \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--without-avahi \
--with-libcurl \
--with-pic \
--without-poppler-glib \
--without-systemd \
--with-usb
# circumvent overlinking in libraries
sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool
make
}
package() {
depends+=(libgphoto2.so libtiff.so libusb-1.0.so
libjpeg-turbo libjpeg.so
curl libcurl.so )
cd $_name-$pkgver
make DESTDIR="$pkgdir" install
# generate udev udev+hwdb
install -vdm 755 "$pkgdir/usr/lib/udev/rules.d/"
tools/sane-desc -m udev+hwdb -s doc/descriptions/ > "$pkgdir/usr/lib/udev/rules.d/65-$pkgname.rules"
tools/sane-desc -m udev+hwdb -s doc/descriptions-external/ >> "$pkgdir/usr/lib/udev/rules.d/65-$pkgname.rules"
# generate udev hwdb
install -vdm 755 "$pkgdir/usr/lib/udev/hwdb.d/"
tools/sane-desc -m hwdb -s doc/descriptions/ > "$pkgdir/usr/lib/udev/hwdb.d/20-$pkgname.hwdb"
# NOTE: an empty new line is required between the two .desc collections
printf "\n" >> "$pkgdir/usr/lib/udev/hwdb.d/20-$pkgname.hwdb"
tools/sane-desc -m hwdb -s doc/descriptions-external/ >> "$pkgdir/usr/lib/udev/hwdb.d/20-$pkgname.hwdb"
# # systemd integration
# install -vDm 644 ../${pkgname}d.socket -t "$pkgdir/usr/lib/systemd/system/"
# install -vDm 644 ../${pkgname}d.service "$pkgdir/usr/lib/systemd/system/${pkgname}d@.service"
install -vDm 644 ../66-${pkgname}d.rules "$pkgdir/usr/lib/udev/rules.d/"
# sysusers.d
install -vDm 644 ../$pkgname.sysusers "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
# remove old ChangeLogs
rm -rvf "$pkgdir/usr/share/doc/$pkgname/ChangeLogs/"
# add files below /etc/sane.d to backup array
cd "$pkgdir"
# trick extract_function_variable() in makepkg into not detecting the
# backup array modification and adding remaining configuration files
[[ /usr/bin/true ]] && backup=( ${backup[@]} $(find "etc/${pkgname}.d/" -type f | sort) )
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=(GPL2)
sha256sums=(11be4ef05a61277d18698c2c9d86495dff97557bc8da7af44e3f6ef5154e9ea8 # backends-1.2.1.tar.gz
0e98982ff1550b16b098f7563569c203aab5f7b4172717bec0d42eab15fb875b # 66-saned.rules
ac9183a0f4379106550c972374b8e36277d8e7f480ca931f0af87550892942e7) # sane.sysusers
## bff88c5d51c202ac248202ad931cc19e9f50509b02a01cfc2bcfa3fbc6d03b28 sane-1.2.1-05-x86_64.pkg.tar.lz