summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Severance2015-07-15 19:53:09 -0400
committerChris Severance2015-07-15 19:53:09 -0400
commit58bf58b33a9b5a1251d9a51b99bd193dd3f5c97f (patch)
tree62198e0513a1b39bd3ceb64aa60bb58937a04591
parentad47d0b7da6b22121719a788832035e724e70b3a (diff)
downloadaur-58bf58b33a9b5a1251d9a51b99bd193dd3f5c97f.tar.gz
Unified Brother MFC PKGBUILD
-rw-r--r--.SRCINFO3
-rw-r--r--PKGBUILD120
2 files changed, 86 insertions, 37 deletions
diff --git a/.SRCINFO b/.SRCINFO
index fdc2c2a94645..c0c4f69f24c2 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = brother-mfc7360n
- pkgdesc = CUPS and LPR driver for Brother MFC7360N printer
+ pkgdesc = LPR and CUPS driver for the Brother MFC-7360N printer
pkgver = 2.0.4
pkgrel = 2
url = http://solutions.brother.com/linux/en_us/
@@ -19,6 +19,7 @@ pkgbase = brother-mfc7360n
sha256sums = 0330ea2d74627026736842beade0b504816265cdd61b1b1b49a234a1e2c8011c
sha256sums = 358e37e1d8cfdce25b1ebe17f21fd2cf3abcdc45263c7e007e36c8be74ae2fbf
sha256sums = b3ffe2e882d08763795e2cc18b35e724e5157a57edf6c76696401c4c810af3a9
+ depends_x86_64 = lib32-glibc
pkgname = brother-mfc7360n
diff --git a/PKGBUILD b/PKGBUILD
index 5ee5e21a5ffc..53394362ba02 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,43 +18,48 @@
# lpadmin -p BR7360 -o media=Letter
set -u
-pkgname='brother-mfc7360n'
-_printername='MFC7360N'
+_brotheru='MFC-7360N'
+_brotherl="${_brotheru,,}" # mfc-0000dw
+_brotherlnd="${_brotherl//-/}" # mfc0000dw
+_brotherund="${_brotheru//-/}" # MFC0000DW
+pkgname="brother-${_brotherlnd}"
+# I'd like to add a dash to the package name and the printer driver but that
+# could invalidate a lot of cups settings and documents and make us different
+# from other distros.
pkgver='2.0.4'
-_lprpkgver='2.1.0'
pkgrel='2'
-pkgdesc="CUPS and LPR driver for Brother ${_printername} printer"
+_lprpkgver='2.1.0'
+_lprpkgrel='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')
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.
# gs: lpr rendering
# pdf2ps: cups rendering
# a2ps: rendering ascii text files
# pstops: pdf resizing
# psnup: printing n-up pages
-# sed grep
+# 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')
#install="${pkgname}.install"
# The cups wrapper uses the lpr driver.
+_brsource="br${_brotherlnd}cups_src-${pkgver}-${pkgrel}"
source=(
- "http://download.brother.com/welcome/dlf006760/brmfc7360ncups_src-${pkgver}-${pkgrel}.tar.gz"
- "http://download.brother.com/welcome/dlf006238/cupswrapper${_printername}-${pkgver}-${pkgrel}.i386.rpm"
- "http://www.brother.com/pub/bsc/linux/dlf/mfc7360nlpr-${_lprpkgver}-1.i386.rpm"
+ "http://download.brother.com/welcome/dlf006760/${_brsource}.tar.gz"
+ "http://download.brother.com/welcome/dlf006238/cupswrapper${_brotherund}-${pkgver}-${pkgrel}.i386.rpm"
+ "http://www.brother.com/pub/bsc/linux/dlf/${_brotherlnd}lpr-${_lprpkgver}-${_lprpkgrel}.i386.rpm"
#"http://download.brother.com/welcome/dlf101124/brgenml1lpr-3.1.0-1.i386.rpm"
)
sha256sums=('0330ea2d74627026736842beade0b504816265cdd61b1b1b49a234a1e2c8011c'
'358e37e1d8cfdce25b1ebe17f21fd2cf3abcdc45263c7e007e36c8be74ae2fbf'
'b3ffe2e882d08763795e2cc18b35e724e5157a57edf6c76696401c4c810af3a9')
-if [ "${CARCH:-}" = 'x86_64' ]; then
- # This will error out if multilib isn't enabled
- depends+=('lib32-glibc')
-fi
-
-prepare() {
+build() {
set -u
# Do not Install in '/usr/local'. Does not apply to all Brother models.
# This may modify binary blobs which only
@@ -72,31 +77,62 @@ prepare() {
#install -dm755 "${srcdir}/usr/share/ppd" # For cups we don't need the ppd file here.
# Get the dirs and the name of the wrapper. Either in /opt or /usr.
- local _bindir="$(find "${srcdir}/usr" -type d -name 'cupswrapper')"
- test -d "${_bindir}" # die if blank or invalid before we rm something we don't want to
+ # This is set up to adapt or crash. Unlike false, ${} shows the line number.
+ cd "${srcdir}/opt" 2>/dev/null || cd "${srcdir}/usr"
+ local _rcfile="$(find "`pwd`" -type f -ipath "*inf/br${_brotherund}rc")"
+ 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
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="$(find "${srcdir}" -maxdepth 1 -type d -name '*cups_src*')" # find avoids the link from PKGBUILD
- test -d "${_basedir}"
- local _wrapdir="${_basedir}" # /cupswrapper"
- test -d "${_wrapdir}"
+ local _basedir="${srcdir}/${_brsource}"
+ test -d "${_basedir}" || echo "${}"
+ cd "${_basedir}/cupswrapper" 2>/dev/null || cd "${_basedir}/scripts" 2>/dev/null || cd "${_basedir}"
+ local _wrapdir="$(pwd)"
cd "${_wrapdir}"
- local _wrapper_source="$(echo cupswrapper*)"
- test -f "${_wrapper_source}"
+ local _wrapper_source="$(echo cupswrapper${_brotherund}*)"
+ if ! test -f "${_wrapper_source}"; then
+ _wrapper_source="$(echo cupswrapper*)"
+ test -f "${_wrapper_source}" || echo "${}"
+ fi
cd "${_basedir}"/brcups*
local _makedir="$(pwd)"
+ if cd "${_basedir}/PPD" 2>/dev/null || cd "${_basedir}/ppd" 2>/dev/null; then
+ local _ppddir="$(pwd)"
+ fi
- # Source is available for the cups binary, not the lpr binaries
- # braddprinter brprintconflsr3 rawtobr3 so we can't get away from multilib
- # 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.
- # Brother forgot the makefile so I pulled some make options from mfc-j870dw
+ # Source is available for the cups binary, not the lpr binaries so we can't
+ # get away from multilib. Any usage of /opt is hardcoded into some binaries
+ # for which we can't find an equal length replacement so we can't easily get
+ # rid of that either.
cd "${_makedir}"
- gcc -pipe -Wall -W -O2 -s -o "${_bindir}/brcupsconfig4" "brcupsconfig.c"
+ if [ -s 'Makefile' ]; then
+ make -s
+ cp -p 'brcupsconfpt1' "${_bindir}"
+ 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 "${_bindir}/brcupsconfig4" "brcupsconfig.c"
+ fi
cd "${_bindir}"
- # Fix an sbin reference in the lpr driver. The cups driver uses bin.
+ if [ ! -z "${_ppddir:-}" ]; then
+ # Use the ppd supplied in the source
+ cp -p "${_ppddir}"/*.ppd "${_bindir}/"
+ chmod 644 "${_bindir}"/*.ppd
+ fi
+
+ # 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 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}"
+
# 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
@@ -105,21 +141,22 @@ prepare() {
-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\n&:g' \
+ -e 's:^if \[ -e /etc/init:exit 0 #Arch Linux Compatible\n&:g' \
"${_wrapper_source}"
- # Generate PPD and wrapper
+ 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 "${_wrapper_source}" -i
+ sh -e "${_wrapper_source}" -i
unset _srcdir
- # I'd like to add a dash to MFC7360N but that could invalidate a lot of cups
- # settings and documents and make us different from other distros.
+ 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}::' \
+ sed -i -e '# Remove the ${_srcdir} variety' \
+ -e 's:${_srcdir}::' \
-e '# Remove the /home/... variety' \
-e "s:${srcdir}::" "${srcdir}/usr/lib/cups/filter/"*lpdwrapper*
@@ -141,6 +178,17 @@ package() {
# /etc/printcap is managed by cups. This eliminates any need for a printcap helper.
rm -f "`find "${pkgdir}" -type f -name 'setupPrintcap*'`"
+ # Ensure we got a ppd and a filter for CUPS
+ test "$(find "${pkgdir}/usr/share/cups/model" -type f -name '*.ppd')"
+ test "$(find "${pkgdir}/usr/lib/cups/filter/" -type f)"
+
+ # Ensure there are no forbidden paths
+ 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"
+
# Change mode to avoid warning on reinstall
# This is no longer necessary. Running the installer here in PKGBUILD sets
# the proper permissions for the package.