# 7 - Distributing Printer Drivers

This chapter describes how to upload PPD files to the CUPS web site and package your printer drivers for Linux and Mac OS X.

## Uploading PPD Files to the CUPS Web Site

The easiest way to distribute your printer drivers is to upload your PPD files to the printer driver page on the CUPS web site (www.cups.org). This page provides an on-line printer driver database where CUPS users can search for and download PPD files for PostScript and CUPS/CUPS DDK-supported printers.

To upload PPD files for other CUPS users to download, click on the "Submit Printer Driver" link to start the registration process.

## Creating Printer Driver Packages

If you will be distributing printer drivers from your own web site or on physical media, or if your printer drivers require one or more custom filter, port monitor, or backend programs, create packages containing the drivers so that users can install and remove the drivers as needed.

Table 7-1, Installation Directories
Operating System | PPD Directory | Filter Directory
--- | --- | ---
Linux i386 | /usr/share/cups/model/vendor | /usr/lib/cups/filter
Linux x86_64 | /usr/share/cups/model/vendor | /usr/lib/cups/filter or /usr/lib64/cups/filter
Mac OS X | /Library/Printers/PPDs/ Contents/Resources/en.lproj | /usr/libexec/cups/filter

Printer drivers are typically distributed as RPM packages on Linux or Installer packages on Mac OS X. Each package typically installs PPD files (or driver information files , as described later) and filter/driver programs in the corresponding directories. Table 7-1 lists the directories to use on each operating system.

If you will be distributing drivers for the Linux x86_64 platform, please see the section on "Packaging Issues on Linux" later in this chapter as well.

### Tools for Creating Packages

Aside from the `rpmbuild(8)` and `PackageMaker` tools that come with Linux and Mac OS X, respectively, we recommend using our (free) ESP Package Manager (EPM) software to create your driver packages:

        http://www.easysw.com/epm

EPM creates both RPM and Installer format packages, as well as several other common formats. It can also insulate you from system-specific packaging details that can lead to inconsistent package quality.

### Creating Driver Packages with EPM

EPM works with "list" files. A list file literally lists the files you want to package along with common information such as the version of the package, a human-readable description of the package contents, and so forth. Listing 7-1 provides an example list file for a driver package consisting of one filter program called rastertofoo and three PPD files.

The list file starts with the common informations (lines 1-8). Lines 12-14 and 16-18 define the installation directories for Mac OS X and Linux, respectively. Lines 20-25 implement one of the suggested workarounds for supporting Linux on the x86_64 platform. Finally, lines 30-33 list the files we want in the package along with the permissions and ownership. The destination filename is listed first, followed by the source filename relative to the current directory.

You can then create the package using the `epm(1)` command. For example, type the following command to create a driver package called "foo" using the native packaging format on your system:

        epm -f native foo foo.list

### Packaging Drivers Using Standard CUPS Drivers

When packaging drivers that use the DDK or CUPS sample drivers, we recommend creating packages that depend on the corresponding CUPS or CUPS DDK software rather than bundling your own copies. For the CUPS DDK software, we recommend downloading and redistributing the packages from the CUPS web site (www.cups.org).

If you are using EPM to create your driver packages on Linux, add the following lines to your list file:

        %system linux
        %requires cupsddk-drivers
        %system

These will ensure that the CUPS DDK drivers are installed on the system.

### Packaging Issues on Linux

Because the CUPS packages provided on the Linux x86_64 platform can use one of two different directories for any filter programs, we recommend installing to /usr/lib/cups/filter and including the following pre-install command to ensure that at symlink is present from /usr/lib/cups to /usr/lib64/cups on systems that use /usr/lib64/cups/filter:

        if test -d /usr/lib64/cups -a ! -d /usr/lib/cups; then
            ln -s /usr/lib64/cups /usr/lib
        fi

Another option is to install your Linux drivers in /opt/vendor/filter and then reference that directory in the `cupsFilter` attributes of your PPD files, for example:

        // Attribute as it appears in the driver information file...
        Attribute cupsFilter "" ""
                  "application/vnd.cups-raster - /opt/vendor/filter"

        *% Attribute as it appears in the PPD file:
        *cupsFilter: "application/vnd.cups-raster - /opt/vendor/filter"

Listing 7-1, Sample EPM List File

     1  # Standard package information
     2  %product Foo Printer Drivers
     3  %copyright 2007 by Foo Industries, Inc.
     4  %vendor Foo Industries, Inc.
     5  %license license.txt
     6  %readme readme.txt
     7  %description Foo Printer Drivers for Foo 1000, 2000, and 3000.
     8  %version 1.0
     9
    10  # Define installation directories
    11
    12  %system osx
    13  $PPD=/Library/Printer/PPDs/Contents/Resources/en.lproj
    14  $FILTER=/usr/libexec/cups/filter
    15
    16  %system linux
    17  $PPD=/usr/share/cups/model/foo
    18  $FILTER=/usr/lib/cups/filter
    19
    20  # Workaround Linux x86_64 issues
    21  %preinstall << EOF
    22  if -d /usr/lib64/cups -a ! -d /usr/lib/cups; then
    23      ln -s /usr/lib64/cups /usr/lib
    24  fi
    25  EOF
    26
    27  # List files in package
    28  %system
    29
    30  f 0755 root sys $FILTER/rastertofoo rastertofoo
    31  f 0644 root sys $PPD/foo-1000.ppd.gz ppd/foo-1000.ppd.gz
    32  f 0644 root sys $PPD/foo-2000.ppd.gz ppd/foo-2000.ppd.gz
    33  f 0644 root sys $PPD/foo-3000.ppd.gz ppd/foo-3000.ppd.gz

### Distributing Driver Information Files Instead of PPDs

If you are supplying drivers that will only be used on systems running CUPS 1.2 or higher, and if the CUPS DDK drivers are also installed, you can distribute the driver information and message catalog files you use with the PPD compiler instead of the generated PPD files, often leading to noticeable reductions in package size.

Driver information and message catalog files are installed in a /usr/share/cups/drv/vendor subdirectory. The PPD compiler's driver interface to CUPS automatically sees the new files as soon as they are installed.