Difference between revisions of "Packaging Brother printer drivers"

From ArchWiki
Jump to navigation Jump to search
m
m (Corrected intro (added .DEB))
 
(28 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category: Printers (English)]][[Category: HOWTOs (English)]]
+
[[Category:Printers]]
 +
Brother supplies Linux drivers for its printers, however they are provided as .RPM and/or .DEB packages only.
 +
This article explains what adjustments to the contents of the DEB and RPM packages supplied by Brother will need to be made to create a [[PKGBUILD]] for the printer driver.
 +
Additional example PKGBUILDs for Brother printers can be found by searching in the [[AUR]].
 +
 
 
== Really short overview of CUPS ==
 
== Really short overview of CUPS ==
  
Basically CUPS needs two things to handle printers properly: a .ppd file and a filter binary. If you have those two in the right places then you must register the printer in CUPS. You can do this in the CUPS web interface at:
+
[[CUPS]] handles printers using a {{ic|.ppd}} file and a filter binary. Once those two files are installed, the printer can be [[CUPS#Usage|added]] in CUPS. A simple example PKGBUILD that does this is {{AUR|samsung2010p}}{{Broken package link|{{aur-mirror|samsung2010p}}}}.
 +
 
 +
 
 +
== Preparing a PKGBUILD for .DEB ==
 +
 
 +
Brother is offering a "Driver Install Tool" as well as two .DEB packages, one being the LPR driver and the other one being a cups wrapper (running on top of lpr driver). Both can be found on brothers "Support & Downloads" page, e.g. for HL-L9200CDW this would be  https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn . It is possible to create a PKGBUILD file that will automatically download and install the .DEB packages directly from the URL provided by brother. Therefore you will need to obtain the direct download links for both .DEB packages from brothers website, e.g. for HL-L9200CDW these would be: https://download.brother.com/welcome/dlf101047/hll9200cdwlpr-1.1.2-1.i386.deb and https://download.brother.com/welcome/dlf101045/hll9200cdwcupswrapper-1.1.3-1.i386.deb
 +
 
 +
Once you have obtained the download URLs for both .DEB packages, use existing PKGBUILD files from {{AUR|brother-hll8360cdw-lpr-bin}} and {{AUR|brother-hll8360cdw-cups-bin}} as templates. You will need to adjust the package name, probably to a new name for your specific printer model. Change url= to the URL of brothers support page for your specific printer model (for HL-L9200CDW this would be https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn ), source= needs to be adjusted to the URL of the .DEB package. The following PKGBUILD example has been based on {{AUR|brother-hll8360cdw-cups-bin}} but has been adjusted for HL-L9200CDW lpr printer driver:
 +
 
 +
# Maintainer: ''John Doe <joe@example.com>''
 +
pkgname=''brother-hll9200cdw-lpr-bin''
 +
pkgver=''1.1.2''
 +
pkgrel=1
 +
pkgdesc="''LPR driver for Brother HL-L9200CDW(T) printer''"
 +
arch=("i686" "x86_64")
 +
url="''https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn''"
 +
license=("EULA")
 +
groups=("base-devel")
 +
source=("''http://www.brother.com/pub/bsc/linux/packages/hll9200cdwlpr-1.1.2-1.i386.deb''")
 +
md5sums=("''30124df7d49362906a2a118eff3c710e''")
 +
package() {
 +
        tar -xf data.tar.gz -C "${pkgdir}"
 +
}
 +
 
 +
Don't forget to update the md5sum and pkgver version should be the same version as brother's printer drivers (please note versions might differ for lpr and cups wrapper). Create the PKGBUILD file for the cups wrapper, too:
  
  http://localhost:631/
+
# Maintainer: ''John Doe <joe@example.com>''
 +
pkgname=''brother-hll9200cdw-cups-bin''
 +
pkgver=''1.1.3''
 +
pkgrel=1
 +
pkgdesc="''CUPS wrapper for Brother HL-L9200CDW(T) printer''"
 +
arch=("i686" "x86_64")
 +
url="''https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn''"
 +
license=("EULA")
 +
groups=("base-devel")
 +
source=("''http://www.brother.com/pub/bsc/linux/packages/hll9200cdwcupswrapper-1.1.3-1.i386.deb''")
 +
md5sums=("''0a802088aac7236a3c309b2b46b37f11''")
 +
package() {
 +
        tar -xf data.tar.gz -C "${pkgdir}"
 +
}
  
or using the command line:
 
  
  URL=$(lpinfo -v | grep -i 'Brother') # if you got more Brother printers you must be more precise in grep
+
Finally, use [[makepkg]] to test/install your newly created PKGBUILD file(s). If everything works, don't forget to push your new driver to AUR. In order to create a new AUR repository for your printer driver, register an account with https://aur.archlinux.org then git clone a new non-existing repo that matches your newly chosen package names, e.g.:
  lpadmin -p HL2030 -E -v $URL -P
+
 +
git clone ''https://aur.archlinux.org/''brother-hll9200cdw-lpr-bin.git''
 +
  git clone ''https://aur.archlinux.org/''brother-hll9200cdw-cups-bin.git''
  
Look at this samsung driver. It is quite simple, it doesn't even have automatic printer registration, but shows exactly what I am talking about.
+
Put your previously created PKGBUILD file into the according folder. To submit your driver to AUR, finally run:
  
http://aur.archlinux.org/packages.php?ID=16423
+
cd ''brother-hll9200cdw-cups-bin''
 +
makepkg --printsrcinfo > .SRCINFO
 +
git add PKGBUILD .SRCINFO
 +
git commit -a -m "Updating the package"
 +
git push -f origin master
 +
cd ..
  
== About Brother drivers ==
+
cd ''brother-hll9200cdw-lpr-bin''
 +
makepkg --printsrcinfo > .SRCINFO
 +
git add PKGBUILD .SRCINFO
 +
git commit -a -m "Updating the package"
 +
git push -f origin master
 +
cd ..
  
Three problems with Brother drivers are:
+
== Preparing a PKGBUILD for .RPM ==
# The cups driver is built on top of the lpr driver.
 
# The cups driver package contains a single installation shell script with an embedded *.ppd and a filter. It is executed by rpm during installation. It extracts *.ppd and a filter and performs some installation procedures in a Red-Hat specific way.
 
# It uses paths that are not compliant to [[Arch Packaging Standards]]
 
  
== Preparing PKGBUILD ==
+
Unfortunately, Brother's drivers have some issues:
 +
* The CUPS driver is built on top of the lpr driver.
 +
* The CUPS driver package contains a single installation shell script with an embedded ppd and filter. It is executed by rpm during installation. It extracts the ppd and filter, and performs some installation procedures in a Red Hat-specific way.
 +
* The CUPS driver package uses paths that are not compliant with the [[Arch packaging standards]].
  
You can deal with each of the above problems as follows:
+
These issues can be worked around.
# Simply extract the lpr driver rpm. You don't have to mimic the lpr driver installation procedure in your PKGBUILD because it is not needed. Cups driver just needs the files in place.
+
* The lpr driver does not need to be installed, so the PKGBUILD can just extract the files in the lpr driver's RPM package.
# Extract the cups driver rpm. There should be single shell script. If you look in the patch of my HL2030 driver (http://aur.archlinux.org/packages.php?ID=14131) you can see that I have made three kinds of changes in this script:
+
* The CUPS driver's RPM should contain a single shell script. For instance, for the {{AUR|brother-hl2030}} package, the PKGBUILD changes three things:
## I have changed the paths.
+
*# The paths are changed.
## I have disabled all commands except "<tt>cat <<EOF</tt>" or "<tt>echo > ...</tt>" or whatever there is that emits *.ppd or filter to separate file. It was done by wrapping irrelevant instructions by <tt>if false; then ... fi</tt>.
+
*# All commands are disabled except "{{ic|cat <<EOF}}" or "{{ic|echo > ...}}" or whatever there is that emits *.ppd or filter to separate file. It was done by wrapping irrelevant instructions by {{ic|if false; then ... fi}}.
## I have changed target file names for *.ppd and filter so they are emitted to the directory your PKGBUILD is working in (relative path not absolute). Note that paths were changed also in the source of the embedded filter.
+
*# The target file names for the ppd and filter are changed so they are installed into the same directory as the PKGBUILD. Note that paths to the embedded filter where also changed.
# This is optional if you don't care about the arch packaging standard. Just change all paths. You can use sed - i believe - on all text files unpacked from both lpr and cups brother drivers. Look at the patch in my HL2030 package to check which files are affected.
+
* To fix the paths to conform to the [[Arch packaging standards]], {{Pkg|sed}} or similar can be used on all text files unpacked from both the lpr and CUPS drivers. Look at the patch in the {{AUR|brother-hl2030}} package to check which files are affected.
  
Effectively after changes described above you will receive a script that will just emit embedded *.ppd and filter to some known location. All you need to do is to copy them to proper CUPS directories in $stardir/pkg:
+
Effectively after the changes described above the script will just output a ppd and a filter to some known location. The PKGBUILD will then copy them to the proper directories in {{ic|$pkgdir}}:
  
   install -m 644 -D ppd_file "$pkgdir/usr/share/cups/model/HL2030.ppd"
+
   install -m 644 -D ppd "${pkgdir}/usr/share/cups/model/HL2030.ppd"
   install -m 755 -D wrapper "$pkgdir/usr/lib/cups/filter/brlpdwrapperHL2030"
+
   install -m 755 -D filter "${pkgdir}/usr/lib/cups/filter/brlpdwrapperHL2030"
  
Remember also to copy lpr driver files to "<tt>$pkgdir</tt>"!
+
The lpr driver files will also need to be copied into {{ic|$pkgdir}}!
  
 
=== Other changes ===
 
=== Other changes ===
Below are shows some other changes you may need in your patch.
 
  
Change:
+
Edit the installation script:
 
   -#PSTOPSFILTER=`which pstops`
 
   -#PSTOPSFILTER=`which pstops`
 
   +PSTOPSFILTER='/usr/lib/cups/filter/pstops'
 
   +PSTOPSFILTER='/usr/lib/cups/filter/pstops'
I have just hardcoded path to "pstops", because it won't be find by the algorithm that is present there.
+
As pstops is not installed in a standard location, the path will need to be hard-coded.
  
There is also such change:
+
{{Accuracy|The original author "could not remember" why this is needed, or whether it was required at all}}
 +
This may also need to be added.
 
   +[psconvert2]
 
   +[psconvert2]
 
   +pstops=/usr/lib/cups/filter/pstops
 
   +pstops=/usr/lib/cups/filter/pstops
I cannot tell you what it does because i don't remember. Probably I have encountered some problem during tests and found solution in the net. You also may need it.
 
  
== Arch64 ==
+
== x86_64 ==
  
The driver can be used on Arch64 as long as the 32 bit version of glibc (libc32-glibc) is installed.
+
Because some of the supplied binaries are 32 bit only, on an x86_64 system some additional [[multilib]] packages such as a 32 bit version of glibc ({{Pkg|lib32-glibc}}) may need to be installed.

Latest revision as of 18:08, 18 February 2019

Brother supplies Linux drivers for its printers, however they are provided as .RPM and/or .DEB packages only. This article explains what adjustments to the contents of the DEB and RPM packages supplied by Brother will need to be made to create a PKGBUILD for the printer driver. Additional example PKGBUILDs for Brother printers can be found by searching in the AUR.

Really short overview of CUPS

CUPS handles printers using a .ppd file and a filter binary. Once those two files are installed, the printer can be added in CUPS. A simple example PKGBUILD that does this is samsung2010pAUR[broken link: archived in aur-mirror].


Preparing a PKGBUILD for .DEB

Brother is offering a "Driver Install Tool" as well as two .DEB packages, one being the LPR driver and the other one being a cups wrapper (running on top of lpr driver). Both can be found on brothers "Support & Downloads" page, e.g. for HL-L9200CDW this would be https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn . It is possible to create a PKGBUILD file that will automatically download and install the .DEB packages directly from the URL provided by brother. Therefore you will need to obtain the direct download links for both .DEB packages from brothers website, e.g. for HL-L9200CDW these would be: https://download.brother.com/welcome/dlf101047/hll9200cdwlpr-1.1.2-1.i386.deb and https://download.brother.com/welcome/dlf101045/hll9200cdwcupswrapper-1.1.3-1.i386.deb

Once you have obtained the download URLs for both .DEB packages, use existing PKGBUILD files from brother-hll8360cdw-lpr-binAUR and brother-hll8360cdw-cups-binAUR as templates. You will need to adjust the package name, probably to a new name for your specific printer model. Change url= to the URL of brothers support page for your specific printer model (for HL-L9200CDW this would be https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn ), source= needs to be adjusted to the URL of the .DEB package. The following PKGBUILD example has been based on brother-hll8360cdw-cups-binAUR but has been adjusted for HL-L9200CDW lpr printer driver:

# Maintainer: John Doe <joe@example.com>
pkgname=brother-hll9200cdw-lpr-bin
pkgver=1.1.2
pkgrel=1
pkgdesc="LPR driver for Brother HL-L9200CDW(T) printer"
arch=("i686" "x86_64")
url="https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn"
license=("EULA")
groups=("base-devel")
source=("http://www.brother.com/pub/bsc/linux/packages/hll9200cdwlpr-1.1.2-1.i386.deb")
md5sums=("30124df7d49362906a2a118eff3c710e")
package() {
        tar -xf data.tar.gz -C "${pkgdir}"
}

Don't forget to update the md5sum and pkgver version should be the same version as brother's printer drivers (please note versions might differ for lpr and cups wrapper). Create the PKGBUILD file for the cups wrapper, too:

# Maintainer: John Doe <joe@example.com>
pkgname=brother-hll9200cdw-cups-bin
pkgver=1.1.3
pkgrel=1
pkgdesc="CUPS wrapper for Brother HL-L9200CDW(T) printer"
arch=("i686" "x86_64")
url="https://support.brother.com/g/b/producttop.aspx?c=ca&lang=en&prod=hll9200cdw_us_as_cn"
license=("EULA")
groups=("base-devel")
source=("http://www.brother.com/pub/bsc/linux/packages/hll9200cdwcupswrapper-1.1.3-1.i386.deb")
md5sums=("0a802088aac7236a3c309b2b46b37f11")
package() {
       tar -xf data.tar.gz -C "${pkgdir}"
}


Finally, use makepkg to test/install your newly created PKGBUILD file(s). If everything works, don't forget to push your new driver to AUR. In order to create a new AUR repository for your printer driver, register an account with https://aur.archlinux.org then git clone a new non-existing repo that matches your newly chosen package names, e.g.:

git clone https://aur.archlinux.org/brother-hll9200cdw-lpr-bin.git
git clone https://aur.archlinux.org/brother-hll9200cdw-cups-bin.git

Put your previously created PKGBUILD file into the according folder. To submit your driver to AUR, finally run:

cd brother-hll9200cdw-cups-bin
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -a -m "Updating the package"
git push -f origin master
cd ..
cd brother-hll9200cdw-lpr-bin
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -a -m "Updating the package"
git push -f origin master
cd ..

Preparing a PKGBUILD for .RPM

Unfortunately, Brother's drivers have some issues:

  • The CUPS driver is built on top of the lpr driver.
  • The CUPS driver package contains a single installation shell script with an embedded ppd and filter. It is executed by rpm during installation. It extracts the ppd and filter, and performs some installation procedures in a Red Hat-specific way.
  • The CUPS driver package uses paths that are not compliant with the Arch packaging standards.

These issues can be worked around.

  • The lpr driver does not need to be installed, so the PKGBUILD can just extract the files in the lpr driver's RPM package.
  • The CUPS driver's RPM should contain a single shell script. For instance, for the brother-hl2030AUR package, the PKGBUILD changes three things:
    1. The paths are changed.
    2. All commands are disabled except "cat <<EOF" or "echo > ..." or whatever there is that emits *.ppd or filter to separate file. It was done by wrapping irrelevant instructions by if false; then ... fi.
    3. The target file names for the ppd and filter are changed so they are installed into the same directory as the PKGBUILD. Note that paths to the embedded filter where also changed.
  • To fix the paths to conform to the Arch packaging standards, sed or similar can be used on all text files unpacked from both the lpr and CUPS drivers. Look at the patch in the brother-hl2030AUR package to check which files are affected.

Effectively after the changes described above the script will just output a ppd and a filter to some known location. The PKGBUILD will then copy them to the proper directories in $pkgdir:

 install -m 644 -D ppd "${pkgdir}/usr/share/cups/model/HL2030.ppd"
 install -m 755 -D filter  "${pkgdir}/usr/lib/cups/filter/brlpdwrapperHL2030"

The lpr driver files will also need to be copied into $pkgdir!

Other changes

Edit the installation script:

 -#PSTOPSFILTER=`which pstops`
 +PSTOPSFILTER='/usr/lib/cups/filter/pstops'

As pstops is not installed in a standard location, the path will need to be hard-coded.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: The original author "could not remember" why this is needed, or whether it was required at all (Discuss in Talk:Packaging Brother printer drivers#)

This may also need to be added.

 +[psconvert2]
 +pstops=/usr/lib/cups/filter/pstops

x86_64

Because some of the supplied binaries are 32 bit only, on an x86_64 system some additional multilib packages such as a 32 bit version of glibc (lib32-glibc) may need to be installed.