# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # based on ebuilds from funtoo and flow overlay EAPI=8 RPM_COMPRESS_TYPE=none inherit rpm udev BUILD=2 MY_PN=brscan4 DESCRIPTION="Brother scanner tool version 4" HOMEPAGE="http://support.brother.com/g/s/id/linux/en/index.html" SRC_URI=" amd64? ( https://download.brother.com/welcome/dlf105203/${MY_PN}-${PV}-${BUILD}.x86_64.rpm ) x86? ( https://download.brother.com/welcome/dlf105202/${MY_PN}-${PV}-${BUILD}.i386.rpm ) http://download.brother.com/welcome/dlf006653/brother-udev-rule-type1-1.0.2-0.noarch.rpm " S="${WORKDIR}" LICENSE="GPL-2 brother-eula no-source-code" SLOT="0" KEYWORDS="-* ~amd64 ~x86" IUSE="gui usb +zeroconf" REQUIRED_USE="gui? ( zeroconf )" RESTRICT="mirror strip" RDEPEND=" media-gfx/sane-backends[usb?] sys-libs/glibc virtual/libusb:0 gui? ( dev-libs/glib:2 x11-libs/gtk+:2 ) zeroconf? ( net-dns/avahi sys-auth/nss-mdns ) " PATCHES=( "${FILESDIR}/${PN}-fix-udev-rules.patch" ) src_install() { local brscan4dir="opt/brother/scanner/brscan4" exeinto usr/$(get_libdir)/sane doexe usr/$(get_libdir)/sane/libsane-brother4.so.1.0.7 dosym libsane-brother4.so.1.0.7 /usr/$(get_libdir)/sane/libsane-brother4.so.1 dosym libsane-brother4.so.1.0.7 /usr/$(get_libdir)/sane/libsane-brother4.so udev_newrules opt/brother/scanner/udev-rules/type1/NN-brother-mfp-type1.rules 41-brother-mfp-type1.rules cd ${brscan4dir} || die insinto ${brscan4dir} doins -r Brsane4.ini brsanenetdevice4.cfg models4 exeinto ${brscan4dir} doexe brsaneconfig4 if use zeroconf; then use gui && doexe brscan_gnetconfig doexe brscan_cnetconfig fi # Install necessary symlinks (as found in rpm and used by brsaneconfig4) dosym ../../${brscan4dir}/brsaneconfig4 /usr/bin/brsaneconfig4 dodir etc/${brscan4dir} for config in Brsane4.ini brsanenetdevice4.cfg models4 ; do dosym ../../../../../${brscan4dir}/${config} /etc/${brscan4dir}/${config} done # Install sane configuration so it does not collide with other packages echo "brother4" > brscan4.conf || die insinto etc/sane.d/dll.d doins brscan4.conf echo 'CONFIG_PROTECT="/opt/brother/scanner/brscan4/brsanenetdevice4.cfg"' > "${T}/50brscan4" || die doenvd "${T}/50brscan4" } pkg_postinst() { udev_reload if ! has_version sys-auth/elogind[acl] && \ ! has_version sys-apps/systemd[acl] then elog "You may need to be in the scanner or plugdev group in order to use the scanner" fi elog "To add a network scanner to sane, run:" elog "brsaneconfig4 -a name=(name your device) model=(model name) ip=xx.xx.xx.xx" elog "or simply run brsaneconfig4 for more options" } pkg_postrm() { udev_reload }