summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorChris Severance2017-06-05 21:12:28 -0400
committerChris Severance2017-06-05 21:12:28 -0400
commit7c62c95501eef0a87e3d982b3c827b88a69272a3 (patch)
tree5c04609f73e354fdc692ec6ed59c771d92729d8d /PKGBUILD
parentdd65dead52b7aadfc2827ea47474df48c4079dab (diff)
downloadaur-7c62c95501eef0a87e3d982b3c827b88a69272a3.tar.gz
Improvements
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD127
1 files changed, 79 insertions, 48 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 0983fba45da7..009d7b07c2a4 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,5 +1,4 @@
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
-# Category: system
# The cups binary is 64 bit. Until Brother releases source for the 32 bit lpr
# binary blobs, 64 bit users must enable multilib.
@@ -18,13 +17,12 @@ _brotherl="${_brotheru,,}" # mfc-0000dw
_brotherlnd="${_brotherl//-/}" # mfc0000dw
_brotherund="${_brotheru//-/}" # MFC0000DW
pkgname="brother-${_brotherl}"
-pkgver='3.0.1'
-_brpkgrel='1'
-pkgrel='2'
+pkgver='3.0.1_1'
+pkgrel='1'
pkgdesc="LPR and CUPS driver for the Brother ${_brotheru} printer"
arch=('i686' 'x86_64')
-url='http://solutions.brother.com/linux/en_us/'
-license=('custom:Brother Industries')
+url='http://www.brother.com/'
+license=('GPL' 'custom')
depends=('cups' 'ghostscript' 'psutils' 'a2ps' 'sed' 'grep')
depends_x86_64=('lib32-glibc')
# We look at the scripts and find these programs from which we decide on the depends above.
@@ -36,25 +34,24 @@ depends_x86_64=('lib32-glibc')
# sed grep awk
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670055
# Printing a text file fails when Liberation is the only TrueType font available
-optdepends=('ttf-dejavu: printing text files from lpr'
- 'brscan4: Scanner support')
-#install="${pkgname}.install"
-# The cups wrapper uses the lpr driver.
-_brsource="brother_${_brotherlnd}_GPL_source_${pkgver}-${_brpkgrel}"
+optdepends=(
+ 'ttf-dejavu: printing text files from lpr'
+ 'brscan4: Scanner support'
+)
+_brsource="brother_${_brotherlnd}_GPL_source_${pkgver//_/-}"
+#_dlf='http://www.brother.com/pub/bsc/linux/dlf'
source=(
- "http://download.brother.com/welcome/dlf101196/${_brotherlnd}lpr-${pkgver}-${_brpkgrel}.i386.rpm"
- "http://download.brother.com/welcome/dlf101197/${_brotherlnd}cupswrapper-${pkgver}-${_brpkgrel}.i386.rpm"
+ "http://download.brother.com/welcome/dlf101196/${_brotherlnd}lpr-${pkgver//_/-}.i386.rpm"
+ "http://download.brother.com/welcome/dlf101197/${_brotherlnd}cupswrapper-${pkgver//_/-}.i386.rpm"
"http://download.brother.com/welcome/dlf101201/${_brsource}.tar.gz"
- 'cupswrapper-license.txt'
'lpr-license.txt'
)
sha256sums=('91f54f5a34ff2e288f295008e5826ea6beb887c24c573b682d859206bd420267'
'488494f80797e4dcbab67123f2aa483e8e0fef5dfeda0d11c49067ea300d3f84'
'0a7981a735bf79e797582abc08c684ad06fc9b84438cbb95eaf8f38ee9abf3ff'
- '2c6aa6a641332e5c87e971ac2a8beae13b059747bdba331bbd515914770d72d9'
'9d85a8aafdaac8fac80e04234ad2acf5642bbf0b91ee582d2a89519a55f6dd67')
-build() {
+prepare() {
set -u
# Do not Install in '/usr/local'. Does not apply to all Brother models.
# This may modify binary blobs which only
@@ -63,7 +60,7 @@ build() {
install -dm755 "${srcdir}/usr/share"
mv "${srcdir}/usr/local/Brother/" "${srcdir}/usr/share/brother"
rm -rf "${srcdir}/usr/local"
- sed -i -e 's:/usr/local/Brother:/usr/share/brother:g' $(grep -lr '/usr/local/Brother' ./)
+ sed -e 's:/usr/local/Brother:/usr/share/brother:g' -i $(grep -lr '/usr/local/Brother' ./)
fi
# setup cups-directories
@@ -78,9 +75,10 @@ build() {
test -f "${_rcfile}" || echo "${}"
local _bindir="$(find "`pwd`" -type d -name 'cupswrapper')"
test -d "${_bindir}" || echo "${}" # die if blank or invalid before we rm something we don't want to
- local _binname="$(find "${_bindir}/" -type 'f' -name 'brcupscon*' -print -quit)"
- test -x "${_binname}" || echo "${}"
- rm -f "${_bindir}"/* # We download the cups driver only to throw it all away. All I want is the dir and bin name without hunting for it in the installer.
+ pushd "${_bindir}" > /dev/null
+ local _brcupsconf=(brcupsconf*); _brcupsconf="${_brcupsconf[0]}"
+ test -x "${_brcupsconf}" || echo "${}"
+ rm -f "${_bindir}"/* # We download the cups driver only to throw it all away. All I want is the dir name without hunting for it in the installer.
local _basedir="${srcdir}/${_brsource}"
test -d "${_basedir}" || echo "${}"
cd "${_basedir}/cupswrapper" 2>/dev/null || cd "${_basedir}/scripts" 2>/dev/null || cd "${_basedir}"
@@ -103,15 +101,14 @@ build() {
# rid of that either.
cd "${_makedir}"
if [ -s 'Makefile' ]; then
- make -s
- cp -p 'brcupsconfig' "${_binname}"
+ 'ma''ke' -s
+ cp -p 'brcupsconfig' "${_bindir}/${_brcupsconf}"
else
- # Not sure why it's called brcupsconfig3 some places and brcupsconfig4 in others.
- # The version in their binary matches the version in the source so it looks good to me.
# gcc options are pulled from other Brother makefiles.
- gcc -pipe -Wall -W -O2 -s -o "${_binname}" 'brcupsconfig.c'
+ gcc -pipe -Wall -W -O2 -s -o "${_bindir}/${_brcupsconf}" "brcupsconfig.c"
fi
+ # Some models supply the ppd in the install script
cd "${_bindir}"
if [ ! -z "${_ppddir:-}" ]; then
# Use the ppd supplied in the source
@@ -122,44 +119,78 @@ build() {
# Some Brother installers create files here
mkdir -p "${srcdir}/var/tmp"
- # Fix any sbin reference in the lpr driver. The cups driver uses bin.
- #sed -i -e 's:/sbin/:/bin/:g' $(find "${srcdir}/usr" -type f -name 'psconvert2')
+ # Fix lpr driver.
+ true sed -e '# Fix sbin reference' \
+ -e 's:/sbin/:/bin/:g' \
+ -e '#Fix hash bang' \
+ -e 's:#/bin/sh:#!/bin/sh:g' \
+ -i $(find "${srcdir}/usr" -type f -name 'psconvert2')
# Fix page shifted off center that affects some printers
# Letter prints off center shifted down and right with PaperType=A4
# I can only test printing A4 on Letter paper. A4 appears to print correctly with PaperType=Letter
- sed -i -e 's:^\(PaperType\)=.\+$:\1=Letter:g' "${_rcfile}"
+ sed -e 's:^\(PaperType\)=.\+$:\1=Letter:g' -i "${_rcfile}"
# Modify the installer so we can finish the install here in PKGBUILD.
cp -p "${_wrapdir}/${_wrapper_source}" "${_bindir}/"
#cp -p "${_wrapper_source}" "${_wrapper_source}.Arch" # debug: diff compare with Total Commander
- sed -i -e '# Install to _srcdir. Some folders may not apply to this model.' \
- -e 's:/usr:${_srcdir}&:g' \
- -e 's:/opt:${_srcdir}&:g' \
- -e 's:/var:${_srcdir}&:g' \
- -e "# Stop the Install script after the files are generated. cups doesn't require a reload to see the printer driver." \
- -e 's:^if \[ -e /etc/init:exit 0 #Arch Linux Compatible\n&:g' \
- "${_wrapper_source}"
- grep -lq "#Arch Linux Compatible" "${_wrapper_source}" || echo "${}"
+ sed -e '# Install to _srcdir. Some folders may not apply to this model.' \
+ -e 's:/usr:"${_srcdir}"&:g' \
+ -e 's:/opt:"${_srcdir}"&:g' \
+ -e 's:/var:"${_srcdir}"&:g' \
+ -e 's:/etc:"${_srcdir}"&:g' \
+ -e 's:""${_srcdir}":"${_srcdir}:g' \
+ -e "# Stop the Install script after the files are generated. cups doesn't require a reload to see the printer driver." \
+ -e 's:^sleep.*$:exit 0 # & #Arch Linux Compatible:g' \
+ -e '# not using set -u allows bugs like this to slip by' \
+ -e '#/Nup=/ s:`:\\`:g' \
+ -e 's: $errorcode: \\$errorcode:g' \
+ -e '# This printer requires the permissions fix that isnt multi user compatible.' \
+ -e 's:/usr/local/Brother:/usr/share/brother:g' \
+ -i "${_wrapper_source}"
+ grep -lq "#Arch Linux Compatible$" "${_wrapper_source}" || echo "${}"
test -f "${_wrapper_source}.Arch" && echo "${}" # Halt for debugging
# Generate PPD and wrapper. Use sh -x to debug
# Possible bug: copying to /usr/share/ppd is disabled.
- export _srcdir="${srcdir}"
- sh -e "${_wrapper_source}" -i
- unset _srcdir
-
+ _srcdir="${srcdir}" \
+ sh -u -e "${_wrapper_source}" -i
+ find "${srcdir}" -type 'f' -name '*.ppd' -exec chmod 644 '{}' '+' # Some installers make ppd executable
rm -rf "${srcdir}/var"
# Remove srcdir from the generated wrapper file.
# No paths in the generated ppd.
- sed -i -e '# Remove the ${_srcdir} variety' \
- -e 's:${_srcdir}::' \
- -e '# Remove the /home/... variety' \
- -e "s:${srcdir}::" "${srcdir}/usr/lib/cups/filter"/*lpdwrapper*
+ sed -e '# Remove the ${_srcdir} variety' \
+ -e 's:${_srcdir}::' \
+ -e '# Remove the /home/... variety' \
+ -e "s:${srcdir}::" \
+ -e '# Remove surplus quotes' \
+ -e 's:""/:/:g' \
+ -i "${srcdir}/usr/lib/cups/filter"/*lpdwrapper*
# We did everything in the installer so we can get rid of it.
- rm -f "${_wrapper_source}"
- set +u
+ rm "${_wrapper_source}"
+
+ cd "${srcdir}"
+ # Misnamed printer does not sort or autodetect properly
+ #sed -e "s:Brother ${_brotherund} :Brother ${_brotheru} :g" -i 'usr/share/cups/model'/*.ppd
+
+ # Check to see if the lpd wrapper is referenced by the ppd
+ # Check to see if our compiled code is referenced by the lpd wrapper
+ local _nppdfound=0
+ local _ncodefound=0
+ local _lwrapper
+ for _lwrapper in 'usr/lib/cups/filter'/*; do
+ if grep -q "$(basename "${_lwrapper}")" 'usr/share/cups/model'/*.ppd || grep -q "$(basename "${_lwrapper}")" 'usr/share/cups/model/Brother'/*.ppd; then
+ _nppdfound=$((_nppdfound+1))
+ fi
+ if grep -q "${_brcupsconf}" "${_lwrapper}"; then
+ _ncodefound=$((_ncodefound+1))
+ fi
+ done
+ test "${_nppdfound}" -ne 0 || echo "${}"
+ test "${_ncodefound}" -ne 0 || echo "${}"
+
+ set +u
}
package() {
@@ -183,8 +214,8 @@ package() {
! grep -alqr "/sbin" "${pkgdir}" || echo "${}"
! grep -alqr "/usr/tmp" "${pkgdir}" || echo "${}"
- install -Dm644 'cupswrapper-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/cupswrapper-licence.txt"
- install -Dm644 'lpr-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/lpr-licence.txt"
+ install -Dpm644 <(sed -e 's:\r::g' "${_brsource}/Copying") "${pkgdir}/usr/share/licenses/${pkgname}/cupswrapper-licence.txt"
+ install -Dpm644 'lpr-license.txt' "${pkgdir}/usr/share/licenses/${pkgname}/lpr-licence.txt"
set +u
}
set +u