Packaging Brother printer drivers

From ArchWiki
Revision as of 19:36, 25 February 2009 by Thebodzio (talk | contribs) (added info about arch64)
Jump to: navigation, search

Because I was asked few times how to create packages with drivers for Brother printers I have decided to write this HOWTO. It is an adaptation of an email I have written.

Really short overview of CUPS

Basically CUPS needs two things to handle printer properly: *.ppd file and a filter binary. If you got those two in right places then you must register printer in CUPS. You can do this in CUPS web gui at:


or using commands:

 URL=$(lpinfo -v | grep -i 'Brother')	#  if you got more Brother printers you must be more precise in grep
 lpadmin -p HL2030 -E -v $URL -P

Look at this samsung driver. It is quite simple, it don't even have automatic printer registration, but shows exactly what I am talking about.

About Brother drivers

There are three problems with Brother drivers:

  1. Cups driver is build on top od lpr driver.
  2. Cups driver package contains single installation shell script with embedded *.ppd and a filter. It is executed by rpm during installation. It extracts *.ppd and a filter and performs some installation procedure in a Red-Hat specific way.
  3. It uses paths that are not compliant to arch packaging standard.

Preparing PKGBUILD

You can deal with each of above problems as follows:

  1. Simply extract rpm with lpr driver. 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.
  2. Extract rpm with cups driver. There should be single shell script. If you look in the patch of my HL2030 driver ( you can see that I have made three kinds of changes in this script:
    1. I have changed the paths.
    2. I have disabled all commands 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. 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.
  3. 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.

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:

 install -m 644 -D ppd_file "$startdir/pkg/usr/share/cups/model/HL2030.ppd"
 install -m 755 -D wrapper  "$startdir/pkg/usr/lib/cups/filter/brlpdwrapperHL2030"

Remember also to copy lpr driver files to "$startdir/pkg"!

Other changes

Below are shows some other changes you may need in your patch.


 -#PSTOPSFILTER=`which pstops`

I have just hardcoded path to "pstops", because it won't be find by the algorithm that is present there.

There is also such change:


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.


This driver can also be used on Arch64 as long as 32 bit version of glibc is installed (driver is linked against it). 32bit version of glibc can be obtained and added to system by issuing as root:

 pacman -S libc32-glibc