summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorChris Severance2018-12-09 03:53:43 -0500
committerChris Severance2018-12-09 03:53:43 -0500
commit69979badd57d096f8033697daab8078fdb551405 (patch)
treee220e4f4cdcb853ed1cb49efaed33f3bcc530aa6 /PKGBUILD
parente21bca1bbbb85286c15725f8e4867d205bf41b68 (diff)
downloadaur-69979badd57d096f8033697daab8078fdb551405.tar.gz
autu: Update to 1.0.1_0-1 use brother inf
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD271
1 files changed, 223 insertions, 48 deletions
diff --git a/PKGBUILD b/PKGBUILD
index a25ca86dec71..b8a79d1f54bc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,103 +1,282 @@
# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
-# The cups binary is 64 bit. Until Brother releases source for the 32 bit lpr
-# binary blobs, 64 bit users must enable multilib.
-
-# This has not been tested with non cups lprng.
+_brinf=(
+[MFC-J6935DW]
+PRN_CUP_RPM=mfcj6935dwcupswrapper-1.0.1-0.i386.rpm
+PRN_CUP_DEB=mfcj6935dwcupswrapper-1.0.1-0.i386.deb
+PRN_LPD_RPM=mfcj6935dwlpr-1.0.1-0.i386.rpm
+PRN_LPD_DEB=mfcj6935dwlpr-1.0.1-0.i386.deb
+PRINTERNAME=MFCJ6935DW
+SCANNER_DRV=brscan4
+SCANKEY_DRV=brscan-skey
+)
+_brinf+=(
+REQUIRE32LIB=yes
+)
-# NOTE 1: Remember to add user to lp group using
-# gpasswd -a USER lp
-# NOTE 2: Remember to logout after adding groups
-# NOTE 3: Set each printer default Media Size to Letter with
-# lpadmin -p BR7360 -o media=Letter
+_opt_DEB=0
set -u
_brotheru='MFC-J6935DW'
_brotherl="${_brotheru,,}" # mfc-0000dw
_brotherlnd="${_brotherl//-/}" # mfc0000dw
_brotherund="${_brotheru//-/}" # MFC0000DW
+_brotherxnd="${_brotherlnd}" # upper or lower as required by scripts
pkgname="brother-${_brotherl}"
pkgver='1.0.1_0'
pkgrel='1'
pkgdesc="LPR and CUPS driver for the Brother ${_brotheru} printer"
arch=('i686' 'x86_64')
-url='http://www.brother.com/'
+url='https://support.brother.com/g/s/id/linux/en/'
license=('GPL' 'custom')
-depends=('cups' 'ghostscript' 'psutils' 'sed' 'grep' 'perl' 'file')
-depends_x86_64=('lib32-glibc' 'lib32-gcc-libs')
+depends=('cups' 'ghostscript' 'psutils' 'sed' 'grep' 'file')
# We look at the scripts and find these programs from which we decide on the depends above.
# gs: lpr rendering
# pdf2ps: cups rendering
-# (not) a2ps: rendering ascii text files
-# (not) pstops: pdf resizing
-# (not) psnup: printing n-up pages
+# (no) a2ps: rendering ascii text files
+# (no) pstops: pdf resizing
+# (no) psnup: printing n-up pages
# 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
-# perl: cupswrapper
+depends+=('perl') # cupswrapper
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'
+options=('!strip')
+#install="${pkgname}.install"
+_dlf='http://www.brother.com/pub/bsc/linux'
+_inf="${_brotherlnd}-${pkgver}.inf"
source=(
- "http://download.brother.com/welcome/dlf103034/${_brotherlnd}cupswrapper-${pkgver//_/-}.i386.rpm"
- "http://download.brother.com/welcome/dlf103010/${_brotherlnd}lpr-${pkgver//_/-}.i386.rpm"
- 'lpr-license.txt' # Obtained from web download page
+ 'cupswrapper-license.txt'
+ "${_inf}::${_dlf}/infs/${_brotherund}"
+ 'lpr-license.txt'
)
-sha256sums=('9fedc880605dd9be74669f815468fc9d71b26fb8ff9f57291f9642e5e6e1afa6'
- '8f2321e529a6c8474f888a77bd2921cc16b19eae538c9752692316221a0600c5'
- 'b604def129534d245fa576f8cd7d01df1d2856b9bff6c1d2002404f77f7d4bb3')
+md5sums=('e42487a541573287fad544bafd1766c6'
+ '8079feed3720218a367c445b83d91023'
+ '4f14b328317aac0d22c7f7f73c581628'
+ '4a50af992473894335ab3410da2d7a1e'
+ 'ae75b7700d2d54287f081a66f89eb713')
+sha256sums=('65de8004f8d44a96b62f874a26a80b285f7f6b9f37a8b6c628d094e7f1986b2a'
+ '968a19f7cae9aee0c195347e0f115d7dfb490e721321619b4dd01b50e29e1d57'
+ 'b604def129534d245fa576f8cd7d01df1d2856b9bff6c1d2002404f77f7d4bb3'
+ '9fedc880605dd9be74669f815468fc9d71b26fb8ff9f57291f9642e5e6e1afa6'
+ '8f2321e529a6c8474f888a77bd2921cc16b19eae538c9752692316221a0600c5')
+
+_mismatch=0
+_brverchk() {
+ local _ver="$1"
+ _ver="${_ver%.*}"
+ _ver="${_ver%.*}"
+ local _vb="${_ver%-*}"
+ _vb="${_vb%-*}-"
+ _ver="${_ver#${_vb}}"
+ local _pv="$2"
+ if [ -z "${_pv}" ]; then
+ _pv="$3"
+ fi
+ if [ -z "${_pv}" ]; then
+ _pv="$4"
+ fi
+ if [ "${_ver}" != "${_pv//_/-}" ]; then
+ echo "Version mismatch: ${_ver} ${_pv//_/-}" 1>&2
+ _mismatch=$((_mismatch+1))
+ fi
+}
+
+_procinf() {
+ local _fd _fvar _fval
+ for _fd in "${_brinf[@]}"; do
+ _fvar="${_fd%%=*}="
+ _fval="${_fd##*=}"
+ if [ ! -z "${_fval}" ]; then
+ case "${_fvar}" in
+ '['*);;
+ PRN_CUP_RPM=)
+ _brverchk "${_fval}" "${_cuprpmver:-}" "${_cupver:-}" "${pkgver}"
+ if [ "${_opt_DEB}" -eq 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ PRN_CUP_DEB=)
+ _brverchk "${_fval}" "${_cupdebver:-}" "${_cupver:-}" "${pkgver}"
+ if [ "${_opt_DEB}" -ne 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ PRN_LPD_RPM=)
+ _brverchk "${_fval}" "${_lprrpmver:-}" "${_lprver:-}" "${pkgver}"
+ if [ "${_opt_DEB}" -eq 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ PRN_LPD_DEB=)
+ _brverchk "${_fval}" "${_lprdebver:-}" "${_lprver:-}" "${pkgver}"
+ if [ "${_opt_DEB}" -ne 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ PRN_DRV_RPM=)
+ _brverchk "${_fval}" "" "" "${pkgver}"
+ if [ "${_opt_DEB}" -eq 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ PRN_DRV_DEB=)
+ _brverchk "${_fval}" "" "" "${pkgver}"
+ if [ "${_opt_DEB}" -ne 0 ]; then
+ source+=("${_dlf}/packages/${_fval}")
+ fi
+ ;;
+ REQUIRE32LIB=)
+ if [ "${_fval}" = 'yes' ]; then
+ depends_x86_64+=('lib32-glibc')
+ fi
+ ;;
+ PRINTERNAME=);;
+ SCANNER_DRV=)optdepends+=("${_fval}: Scanner support");;
+ SCANKEY_DRV=)optdepends+=("${_fval}: Scanner button support");;
+ *) echo "Unrecognized line: ${_fd}" 1>&2; exit 1;;
+ esac
+ fi
+ done
+ test "${_mismatch}" -eq 0 || exit 1
+}
+_procinf
+unset -f _procinf _brverchk
+unset _mismatch _brinf
+
+# Must be same length as
+# 'Brother'
+_conflict='brother'
prepare() {
set -u
- # setup cups-directories
- install -dm755 "${srcdir}/usr/lib/cups/filter"
- install -dm755 "${srcdir}/usr/share/cups/model"
- #install -dm755 "${srcdir}/usr/share/ppd" # For cups we don't need the ppd file here.
+
+ shopt -s nullglob
+ local _deb
+ local _debn=1
+ for _deb in *.deb; do
+ local _dx="debextract.${_debn}"
+ mkdir "${_dx}"
+ bsdtar -C "${_dx}" -xf "${_deb}"
+ bsdtar -C "${_dx}" -xf "${_dx}"/control.tar.?z
+ bsdtar -xf "${_dx}"/data.tar.?z
+ rm "${_dx}"/*.tar.?z
+ _debn=$((_debn+1))
+ done
+ shopt -u nullglob
+
+ # Do not Install in '/usr/local'. Does not apply to all Brother models.
+ # This may modify binary blobs which only
+ # works when the old and new strings are exactly the same length.
+ if [ -d 'usr/local' ]; then
+ install -d 'usr/share'
+ mv 'usr/local/Brother' "usr/share/${_conflict}"
+ rmdir 'usr/local'
+ sed -e "s:/usr/local/Brother:/usr/share/${_conflict}:g" -i $(grep -lare '/usr/local/Brother' ./)
+ fi
+
+ # setup cups-directories, some installers create these for us
+ install -d 'usr/lib/cups/filter'
+ install -d 'usr/share/cups/model'
+ #install -d 'usr/share/ppd' # For cups we don't need the ppd file here.
+
+ # /etc/printcap is managed by cups
+ find . -type 'f' -name 'setupPrintcap*' -delete
+
+ set +u
+}
+
+build() {
+ set -u
+
+ local _basedir="opt/brother/Printers/${_brotherxnd}"
+ #local _basedir="usr/share/${_conflict}"
+ #local _basedir="usr/share/${_conflict}/Printer/${_brotherxnd}"
+ shopt -s nullglob
+ local _wrapper_source=("${_basedir}/cupswrapper/cupswrapper${_brotherxnd}"*)
+ shopt -u nullglob
+ test "${#_wrapper_source[@]}" -eq 1 || echo "${}"
+ _wrapper_source="${_wrapper_source[0]}"
+ test -x "${_wrapper_source}" || echo "${}"
+ echo "Wrapper source: ${_wrapper_source}"
# Some Brother installers create files here
- mkdir -p "${srcdir}/var/tmp"
+ mkdir -p 'var/tmp'
+
+ # This generated wrapper isn't used. We just want to run the install commands.
- local _wrapper_source="${srcdir}/opt/brother/Printers/${_brotherlnd}/cupswrapper/cupswrapper${_brotherlnd}"
+ # Modify the installer so we can finish the install here in PKGBUILD.
#cp -p "${_wrapper_source}" "${_wrapper_source}.Arch" # debug: diff compare with Total Commander
sed -e '# Install to _srcdir. Some folders may not apply to this model.' \
+ -e '# quick fix for path that needs to be double quoted' \
+ -e "s:'/usr/share/ppd':"'"/usr/share/ppd":g' \
-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 '# Remove unwanted srcdir from the generated files' \
+ -e '/^cat <<ENDOFPPDFILE/,/^ENDOFPPDFILE/ s:"${_srcdir}"::g' \
+ -e '/^cat <<!ENDOFWFILTER/,/^!ENDOFWFILTER!/ s:"${_srcdir}"::g' \
+ -e '# Remove extra quotes where path was already quoted' \
+ -e 's:""\${_srcdir}":"${_srcdir}:g' \
+ -e '#s:/model/Brother:/model: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' \
+ -e '# Fix a forgotten escape script error' \
+ -e 's: \$errorcode: \\$errorcode:g' \
-e '# Fix symlinks' \
-e 's:brotherlpdwrapper="\${_srcdir}":brotherlpdwrapper=:g' \
-i "${_wrapper_source}"
- grep -lq "#Arch Linux Compatible$" "${_wrapper_source}" || echo "${}"
+ grep -lqe '#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.
_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"
+ local _ppdir='usr/share/cups/model/Brother'
+ chmod 644 "${_ppdir}"/*.ppd # Some installers make ppd executable
+ rm -rf 'var'
+
+ local _wrapgen="${_basedir}/cupswrapper/brother_lpdwrapper_${_brotherxnd}"
+ #local _wrapgen="usr/lib/cups/filter/brlpdwrapper${_brotherxnd}"
+ #local _wrapgen="usr/lib/cups/filter/brother_lpdwrapper_${_brotherxnd}"
+ test -s "${_wrapgen}" || echo "${}"
+
+ # Ensure all paths were removed
+ grep -qFe $'${_srcdir}\n'"${srcdir}" "${_wrapgen}" && echo "${}"
# We did everything in the installer so we can get rid of it.
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
- set +u
+ #sed -e "s:Brother ${_brotherund} :Brother ${_brotheru} :g" -i "${_ppdir}"/*.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}")" "${_ppdir}"/*.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() {
set -u
+
local _dir
# /var/spool is not used anywhere in this package. Maybe it's needed for non cups lprng.
for _dir in 'usr' 'opt'; do # 'var'
@@ -106,19 +285,15 @@ package() {
fi
done
- # /etc/printcap is managed by cups. This eliminates any need for a printcap helper.
- find "${pkgdir}" -type 'f' -name 'setupPrintcap*' -exec rm '{}' '+'
-
# 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 -o -type l ')')"
+ test ! -z "$(find "${pkgdir}/usr/share/cups/model" -type 'f' -name '*.ppd')" || echo "${}"
+ test ! -z "$(find "${pkgdir}/usr/lib/cups/filter/" '(' -type 'f' -o -type 'l' ')')" || echo "${}"
# Ensure there are no forbidden paths
! grep -alqr "/sbin" "${pkgdir}" || echo "${}"
! grep -alqr "/usr/tmp" "${pkgdir}" || echo "${}"
- #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"
+ install -Dpm644 'cupswrapper-license.txt' 'lpr-license.txt' -t "${pkgdir}/usr/share/licenses/${pkgname}/"
set +u
}
set +u