summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO30
-rw-r--r--PKGBUILD276
-rw-r--r--brother-dcp7040.install13
-rw-r--r--cupswrapper-license.txt2
-rw-r--r--lpr-license.txt8
5 files changed, 252 insertions, 77 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 735c29a8f7e9..30da43eca7da 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,23 +1,37 @@
# Generated by mksrcinfo v8
-# Wed Feb 1 10:40:52 UTC 2017
+# Sun Oct 21 20:42:51 UTC 2018
pkgbase = brother-dcp7040
- pkgdesc = LPR and CUPS driver for the Brother DCP7040
- pkgver = 2.0.2
- pkgrel = 2
- url = http://solutions.brother.com/linux/en_us/
+ pkgdesc = LPR and CUPS driver for the Brother DCP-7040 printer
+ pkgver = 2.0.2_1
+ pkgrel = 1
+ url = https://solutions.brother.com/linux/en_us/
install = brother-dcp7040.install
arch = i686
arch = x86_64
- license = custom:brother commercial license
+ license = GPL
+ license = custom
depends = cups
+ depends = ghostscript
+ depends = psutils
+ depends = a2ps
+ depends = sed
+ depends = grep
+ optdepends = ttf-dejavu: printing text files from lpr
+ optdepends = brscan3: Scanner support
+ options = !strip
source = http://www.brother.com/pub/bsc/linux/dlf/brdcp7040lpr-2.0.2-1.i386.rpm
source = http://www.brother.com/pub/bsc/linux/dlf/cupswrapperDCP7040-2.0.2-1.i386.rpm
source = cupswrapper-license.txt
source = lpr-license.txt
md5sums = 418e58699d90a16e62059ba49fb51ad5
md5sums = ca4a32afe0a30b4edbe2b26a8330f5d9
- md5sums = 97ad0cffd216059e9d1d3121899d8646
- md5sums = 5e87a3dc0f3e3438c088eda0f3565f0d
+ md5sums = 809c64563dbd89f89ca68f9218c59cf5
+ md5sums = 4f14b328317aac0d22c7f7f73c581628
+ sha256sums = 013958c343c3aa336138bab87a8b1b9c7266e5c59715636e2025b63815c216ce
+ sha256sums = 04a515ed2a1a35eaf01d158fd8a0149d45b0a6167713b3fe424ffeffddcd94f0
+ sha256sums = c52eb0091a2854b031cc923bdd7c18e7fe09d2f26b679d804aec4e6c9567bb7d
+ sha256sums = b604def129534d245fa576f8cd7d01df1d2856b9bff6c1d2002404f77f7d4bb3
+ depends_x86_64 = lib32-glibc
pkgname = brother-dcp7040
diff --git a/PKGBUILD b/PKGBUILD
index 83a1a60b47f2..8598f748e10d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,69 +1,225 @@
-# Maintainer: Frederic Bezies <fredbezies at gmail dot com>
+# Maintainer: Chris Severance aur.severach aATt spamgourmet dott com
+# Contributor: Frederic Bezies <fredbezies at gmail dot com>
# Contributor: Libernux <dutchman55@gmx.com>
# Contributor: Roland Singer <roland@manjaro.org>
-pkgname=brother-dcp7040
-pkgver=2.0.2
-pkgrel=2
-pkgdesc="LPR and CUPS driver for the Brother DCP7040"
+
+# TODO: Add cupswrapper compile from source
+# TODO: Check _rcfile A4 -> Letter fix
+# TODO: Check printer autodetect
+
+set -u
+_brothern='7040'
+_brotheru="DCP-${_brothern}"
+_brotherl="${_brotheru,,}" # mfc-0000dw
+_brotherlnd="${_brotherl//-/}" # mfc0000dw
+_brotherund="${_brotheru//-/}" # MFC0000DW
+pkgname="brother-${_brotherlnd}"
+pkgver='2.0.2_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 commercial license')
-depends=('cups')
-install="$pkgname.install"
-source=(
- "http://www.brother.com/pub/bsc/linux/dlf/brdcp7040lpr-$pkgver-1.i386.rpm"
- "http://www.brother.com/pub/bsc/linux/dlf/cupswrapperDCP7040-$pkgver-1.i386.rpm"
- 'cupswrapper-license.txt'
- 'lpr-license.txt'
+url='https://solutions.brother.com/linux/en_us/'
+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.
+# gs: lpr rendering
+# pdf2ps: cups rendering
+# a2ps: rendering ascii text files
+# pstops: pdf resizing
+# 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
+optdepends=(
+ 'ttf-dejavu: printing text files from lpr'
+ 'brscan3: Scanner support'
)
-md5sums=(
- '418e58699d90a16e62059ba49fb51ad5'
- 'ca4a32afe0a30b4edbe2b26a8330f5d9'
- '97ad0cffd216059e9d1d3121899d8646'
- '5e87a3dc0f3e3438c088eda0f3565f0d'
+options=('!strip')
+install="${pkgname}.install"
+#_brsource="brother-laser2-cups-driver-${pkgver//_/-}"
+_dlf="http://www.brother.com/pub/bsc/linux/dlf"
+source=(
+ "${_dlf}/brdcp7040lpr-${pkgver//_/-}.i386.rpm"
+ "${_dlf}/cupswrapperDCP7040-${pkgver//_/-}.i386.rpm"
+ #"${_dlf}/${_brsource}.tar.gz"
+ 'cupswrapper-license.txt'
+ 'lpr-license.txt'
)
-if test "$CARCH" == x86_64; then
- depends+=('lib32-glibc')
-fi
+md5sums=('418e58699d90a16e62059ba49fb51ad5'
+ 'ca4a32afe0a30b4edbe2b26a8330f5d9'
+ '809c64563dbd89f89ca68f9218c59cf5'
+ '4f14b328317aac0d22c7f7f73c581628')
+sha256sums=('013958c343c3aa336138bab87a8b1b9c7266e5c59715636e2025b63815c216ce'
+ '04a515ed2a1a35eaf01d158fd8a0149d45b0a6167713b3fe424ffeffddcd94f0'
+ 'c52eb0091a2854b031cc923bdd7c18e7fe09d2f26b679d804aec4e6c9567bb7d'
+ 'b604def129534d245fa576f8cd7d01df1d2856b9bff6c1d2002404f77f7d4bb3')
+
+# Conflicts with MFC-7340
+# Must be same length as
+# 'Brother'
+_conflict='bdc7040'
+
+# We can't modify .install but we can stop and force the user to fix it.
+_install_check() {
+ local _ckvar
+ local _ckline
+ local _pkgname="${pkgname}"
+ for _ckvar in '_conflict'; do
+ _ckline="${_ckvar}='${!_ckvar}'"
+ if ! grep -q "^${_ckline}"'$' "${startdir}/${install}"; then
+ msg "${install} must be fixed"
+ echo "${_ckline}"
+ set +u
+ false
+ fi
+ done
+}
+
prepare() {
-# do not install in '/usr/local'
- if [ -d $srcdir/usr/local/Brother ]; then
- install -d $srcdir/usr/share
- mv $srcdir/usr/local/Brother/ $srcdir/usr/share/brother
- rm -rf $srcdir/usr/local
- sed -i 's|/usr/local/Brother|/usr/share/brother|g' `grep -lr '/usr/local/Brother' ./`
- fi
-# setup cups-directories
- install -d $srcdir/usr/share/cups/model
- install -d $srcdir/usr/lib/cups/filter
-# go to the cupswrapper directory and find the source file from wich to generate a ppd- and wrapper-file
- cd `find . -type d -name 'cupswrapper'`
- if [ -f cupswrapper* ]; then
- _wrapper_source=`ls cupswrapper*`
- sed -i '/^\/etc\/init.d\/cups/d' $_wrapper_source
- sed -i '/^sleep/d' $_wrapper_source
- sed -i '/^lpadmin/d' $_wrapper_source
- sed -i 's|/usr|$srcdir/usr|g' $_wrapper_source
- sed -i 's|/opt|$srcdir/opt|g' $_wrapper_source
- sed -i 's|/model/Brother|/model|g' $_wrapper_source
- sed -i 's|lpinfo|echo|g' $_wrapper_source
- export srcdir=$srcdir
- ./$_wrapper_source
- sed -i 's|$srcdir||' $srcdir/usr/lib/cups/filter/*lpdwrapper*
- sed -i "s|$srcdir||" $srcdir/usr/lib/cups/filter/*lpdwrapper*
- rm $_wrapper_source
- fi
-# /etc/printcap is managed by cups
- rm `find $srcdir -type f -name 'setupPrintcap*'`
+ set -u
+
+ _install_check
+
+ # 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 -dm755 "${srcdir}/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
+
+ # from archasaurusrex comment
+ echo "${_brotherund}" > "usr/share/${_conflict}/inf/brPrintList"
+ set +u
+}
+
+build() {
+ set -u
+ # Get the dirs and the name of the wrapper. Either in /opt or /usr.
+ # This is set up to adapt or crash. Unlike false, ${} shows the line number.
+ cd 'opt' 2>/dev/null || cd 'usr'
+ local _rcfile
+ _rcfile="$(find "`pwd`" -type 'f' -ipath "*inf/br${_brotherund}rc")"
+ test -f "${_rcfile}" || echo "${}"
+
+ # go to the cupswrapper directory and find the source file from wich to generate a ppd- and wrapper-file
+ local _wrapdir="$(find . -type 'd' -name 'cupswrapper')"
+ test -d "${_wrapdir}" || echo "${}"
+ cd "${_wrapdir}"
+ echo "Wrapper dir: ${_wrapdir#./}"
+ local _wrapper_source
+ _wrapper_source=(cupswrapper*)
+ 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"
+
+ # Fix lpr driver.
+ 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 -e 's:^\(PaperType\)=.\+$:\1=Letter:g' -i "${_rcfile}"
+
+ # 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 '# 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 '# Fix a forgotten escape script error' \
+ -e 's: \$errorcode: \\$errorcode: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.
+ _srcdir="${srcdir}" \
+ sh -u -e "${_wrapper_source}" -i
+ chmod 644 "${srcdir}/usr/share/cups/model"/*.ppd # Some installers make ppd executable
+ rm -rf "${srcdir}/var"
+
+ # Remove srcdir from the generated wrapper file.
+ sed -e '# Remove the /home/... variety' \
+ -e "s:${srcdir}::" \
+ -i "${srcdir}/usr/lib/cups/filter"/*lpdwrapper*
+
+ # 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
+
+ # 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; 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() {
- cp -R $srcdir/usr $pkgdir
- if [ -d $srcdir/opt ]; then cp -R $srcdir/opt $pkgdir; fi
- install -m 644 -D cupswrapper-license.txt $pkgdir/usr/share/licenses/${pkgname}/cupswrapper-licence.txt
- install -m 644 -D lpr-license.txt $pkgdir/usr/share/licenses/${pkgname}/lpr-licence.txt
- #
- #Applying both commands from archasaurusrex comment
- #
- echo DCP7040 | sudo tee $pkgdir/usr/share/brother/inf/brPrintList
- chown daemon:lp $pkgdir/usr/share/brother/inf/brDCP7040rc
+ 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'
+ if [ -d "${srcdir}/${_dir}" ]; then
+ cp -pR "${srcdir}/${_dir}" "${pkgdir}"
+ fi
+ done
+
+ # Ensure we got a ppd and a filter for CUPS
+ test ! -z "$(find "${pkgdir}/usr/share/cups/model" -type f -name '*.ppd')"
+ test ! -z "$(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 -Dpm644 'cupswrapper-license.txt' 'lpr-license.txt' -t "${pkgdir}/usr/share/licenses/${pkgname}/"
+ set +u
}
+set +u
diff --git a/brother-dcp7040.install b/brother-dcp7040.install
index 3ddb04120f84..63c677537afd 100644
--- a/brother-dcp7040.install
+++ b/brother-dcp7040.install
@@ -1,9 +1,14 @@
+_conflict='bdc7040'
+
post_install() {
- post_upgrade;
+ post_upgrade
}
post_upgrade() {
-echo "Restart CUPS to load the new files"
-echo "You can now register your new printer using the web interface at:"
-echo " http://localhost:631/"
+ #echo "Restart CUPS to load the new files"
+ echo "You can now register your new printer using the web interface at:"
+ echo " http://localhost:631/"
+
+ # from archasaurusrex comment
+ chown 'daemon:lp' "/usr/share/${_conflict}/inf/brDCP7040rc"
}
diff --git a/cupswrapper-license.txt b/cupswrapper-license.txt
index 295bbc9c9fa5..6a8418ea0261 100644
--- a/cupswrapper-license.txt
+++ b/cupswrapper-license.txt
@@ -124,4 +124,4 @@ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
-This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. \ No newline at end of file
+This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
diff --git a/lpr-license.txt b/lpr-license.txt
index 0d32eb1475ce..f573d4d0f82a 100644
--- a/lpr-license.txt
+++ b/lpr-license.txt
@@ -1,4 +1,6 @@
-This Agreement provides terms and conditions for license grant from Brother Industries, Ltd ("Broher"). Brother, who owns all copyrights to the software that is distributed with this Agreement ("Software") to recipients thereof ("User"), for use of the Software. User shall have the right to use the Software only in accordance with the terms and conditions of this Agreement. Any use by User of the Software shall be deemed as its agreement hereto.
+License Agreement
+
+This Agreement provides terms and conditions for license grant from Brother Industries, Ltd ("Brother"). Brother, who owns all copyrights to the software that is distributed with this Agreement ("Software") to recipients thereof ("User"), for use of the Software. User shall have the right to use the Software only in accordance with the terms and conditions of this Agreement. Any use by User of the Software shall be deemed as its agreement hereto.
Note:
Please click on "I Accept" while holding down "Shift" or right click on "I Accept" and select "Save Target As,,," from the menu.
@@ -6,6 +8,4 @@ Brother retains any and all copyrights to the Software. In no case this Agreemen
Brother grants User a non-exclusive license: to reproduce and/or distribute (via Internet or in any other manner) the Software. Further, Brother grants User a non-exclusive license to modify, alter, translate or otherwise prepare derivative works of the Software and to reproduce and distribute (via Internet or in any other manner) such modification, alteration, translation or other derivative works for any purpose.
-The license of the Software from Brother hereunder is granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT.
-Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in the Software even if Brother has been advised of the possibility of such loss or damage.
-Further, Brother shall have no liability to disclose and/or distribute the source cord of the Software to User under any circumstances. In no case shall the above license by Brother to modify, alter, translate or otherwise prepare derivative works of the Software be construed as Brother's implied agreement or undertakings to disclose and/or distribute the source cord of the Software. \ No newline at end of file
+The license of the Software from Brother hereunder is granted "AS IS." BROTHER HEREBY DISCLAIMS ANY WARRANTIES WITH RESPECT TO THE SOFTWARE, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTY FOR THE QUALITY, MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE OR NON-INFRINGEMENT. Brother shall have no liability in contract, tort (including negligence or breach of statutory duty) or otherwise for any interruption of use, loss of data, or for any indirect, incidental, punitive or consequential loss or damage, or for any loss of profit, revenue, data, goodwill or anticipated savings that arises under, out of, or in contemplation of this Agreement or otherwise arises due to any error, inaccuracy or defect in the Software even if Brother has been advised of the possibility of such loss or damage. Further, Brother shall have no liability to disclose and/or distribute the source code of the Software to User under any circumstances. In no case shall the above license by Brother to modify, alter, translate or otherwise prepare derivative works of the Software be construed as Brother's implied agreement or undertakings to disclose and/or distribute the source code of the Software.