diff --git a/srcpkgs/brother-brscan4/INSTALL b/srcpkgs/brother-brscan4/INSTALL new file mode 100644 index 00000000000..0576a2c04c2 --- /dev/null +++ b/srcpkgs/brother-brscan4/INSTALL @@ -0,0 +1,9 @@ +case "${ACTION}" in + post) + # Add brother driver to sane configuration + _SANE_CONF='/etc/sane.d/dll.conf' + if [ "$(grep brother4 ${_SANE_CONF})" = '' ]; then + echo brother4 >> ${_SANE_CONF} + fi; + ;; +esac diff --git a/srcpkgs/brother-brscan4/INSTALL.msg b/srcpkgs/brother-brscan4/INSTALL.msg new file mode 100644 index 00000000000..80233435e7b --- /dev/null +++ b/srcpkgs/brother-brscan4/INSTALL.msg @@ -0,0 +1,3 @@ +In order to access networked scanners and multifunctionals, the SANE backend +must be configured using 'brsaneconfig4'. +See http://support.brother.com/g/s/id/linux/en/instruction_scn1b.html diff --git a/srcpkgs/brother-brscan4/REMOVE b/srcpkgs/brother-brscan4/REMOVE new file mode 100644 index 00000000000..b29366a5db6 --- /dev/null +++ b/srcpkgs/brother-brscan4/REMOVE @@ -0,0 +1,10 @@ +case "${ACTION}" in + pre) + # remove brother driver from sane configuration + _TEMPFILE=`mktemp sane_dll_conf_XXXXXXXXXXX` + _SANE_CONF='/etc/sane.d/dll.conf' + + ( cat ${_SANE_CONF} | sed -e '/brother4/d' > ${_TEMPFILE} ) && cat ${_TEMPFILE} > ${_SANE_CONF} + rm ${_TEMPFILE} + ;; +esac diff --git a/srcpkgs/brother-brscan4/template b/srcpkgs/brother-brscan4/template new file mode 100644 index 00000000000..11ccd35364f --- /dev/null +++ b/srcpkgs/brother-brscan4/template @@ -0,0 +1,73 @@ +# Template file for 'brother-brscan4' +pkgname=brother-brscan4 +version=0.4.4 +revision=1 +only_for_archs="i686 x86_64" +depends="sane" +short_desc="SANE scanner driver for brscan4-compatible printers" +maintainer="Martijn van Buul " +license="custom" +homepage="http://support.brother.com/" +repository="nonfree" +nopie=yes +_mylibrary="libsane-brother4.so.1.0.7" +conf_files="/etc/opt/brother/scanner/brscan4/Brsane4.ini /etc/opt/brother/scanner/brscan4/brsanenetdevice4.cfg /etc/opt/brother/scanner/brscan4/models4/*.ini" + +if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then + _debpkgid="4.amd64" + distfiles="http://download.brother.com/welcome/dlf006645/brscan4-${version}-${_debpkgid}.deb" + checksum=cd255c56e4b10125223315b64eb1205864ab8c759b6f8068c24a076f52bfc577 + _deblibdir="usr/lib64" +else + _debpkgid="4.i386" + distfiles="http://download.brother.com/welcome/dlf006646/brscan4-${version}-${_debpkgid}.deb" + checksum=6292feb076a97004c5a73ce8fecd7933d29309322869c1f26f77dbe4fe92b08e + _deblibdir="usr/lib" +fi + +# append shrinkwrap license +distfiles+=" http://www.brother.com/agreement/English_sane/agree.html>LICENSE.html" +checksum+=" 3434bca1936d6a5fd6afd810cde7e1876dd4d1496722b09af180278480f464f2" + +do_extract() { + ar x ${XBPS_SRCDISTDIR}/${pkgname}-${version}/brscan4-${version}-${_debpkgid}.deb + tar xzpf data.tar.gz +} + +do_install() { + # binary package makes a fine mess of things, and installs stuff in very + # unwieldly locations. Some of this cannot be avoided. + + # deb package installs 64-bit libraries in /usr/lib64; fix this + vinstall ./${_deblibdir}/sane/${_mylibrary} 755 usr/lib/sane + ln -sf /usr/lib/sane/${_mylibrary} ${DESTDIR}/usr/lib/sane/$(echo ${_mylibrary} | sed -e 's/\.[0-9]\.[0-9]$//') + ln -sf /usr/lib/sane/${_mylibrary} ${DESTDIR}/usr/lib/sane/$(echo ${_mylibrary} | sed -e 's/\.[0-9]\.[0-9]\.[0-9]$//') + + # The binary library has hard-coded paths to + # + # /etc/opt/brother/scanner/brscan4 + # + # This is very unfortunate, but cannot be avoided without the source to + # recompile the binary - which is not available. + # + # The deb package then goes ahead and installs symlinks to the actual + # files in /opt/brother/scanner/brscan4. Limit the mess by actually + # installing these files to /etc/opt/brother/scanner/brscan4 so there + # are no configuration files in /opt + + vmkdir etc/opt/brother/scanner/brscan4 755 + vinstall opt/brother/scanner/brscan4/Brsane4.ini 644 etc/opt/brother/scanner/brscan4 + vinstall opt/brother/scanner/brscan4/brsanenetdevice4.cfg 644 etc/opt/brother/scanner/brscan4 + vcopy opt/brother/scanner/brscan4/models4 etc/opt/brother/scanner/brscan4 + + # Install the licenses. + vlicense "${XBPS_SRCDISTDIR}/${pkgname}-${version}/LICENSE.html" + vlicense opt/brother/scanner/brscan4/doc/brscan4/readme.txt # Independent JPEG blurb. + + # config helper - installed by the deb package as a symlink. + vbin opt/brother/scanner/brscan4/brsaneconfig4 + + # The only file in the deb package that has *not* been installed is a + # setup script to modify the SANE configuration. This will be performed + # by INSTALL and REMOVE instead. +}