Contents

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: http://localhost:631/

or using the command line:

URL=$(lpinfo -v | grep -i 'Brother') # if you have more than one Brother printer, you must be more precise in grep
lpadmin -p HL2030 -E -v $URL -P

Look at this Samsung driver from the AUR: samsung2010pAUR. It is quite simple. It does not even have automatic printer registration, but that AUR package shows exactly what is being referred to.

About Brother drivers

Three problems with Brother drivers are:

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.

Preparing PKGBUILD

Extract the lpr driver's RPM file. You do not have to mimic the lpr driver installation procedure in your PKGBUILD because it is not needed. The cups driver just needs the files in place.

Extract the cups driver's RPM. There should be single shell script. If you look in the patch of my HL-2030 driver (brother-hl2030AUR), you can see that I have made three kinds of changes in this script:

I have changed the paths.

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.

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.

This is optional if you do not care about the Arch Packaging Standards. Just change all of the paths. You can use sed on all text files unpacked from both the lpr and cups Brother drivers. Look at the patch in the brother-hl2030AUR 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 the proper CUPS directories in $stardir/pkg: