Compiling and installing the software

This file documents the procedure for compiling and installing the HP OfficeJet Linux driver (hpoj) package.

Build process: quick version

If you haven't already, issue one of the following commands to extract the source code from the hpoj-0.X.tgz tarball:
	tar xvfz hpoj-0.X.tgz                 # For GNU tar
	zcat hpoj-0.X.tgz | tar xvf -         # For non-GNU tar
Enter the following commands at the shell prompt:
	./configure
	make
	su                      # When prompted, enter the root password.
	make install
By default, this causes the software to get installed under /usr/local. See the next section if you want to override this or if the configure script has trouble finding other packages it needs.

./configure script options

--prefix=DIR
Overrides the default installation path of /usr/local. The various components are stored in the bin, share/doc/hpoj-0.8, etc, include, lib, and sbin subdirectories under the specified path. Examples:
	--prefix=/usr
	--prefix=/opt/hpoj
Note that if you use this option, you may need to specify a --with-ptal=DIR option when you configure SANE.

--with-qt=DIR
Helps find the base of the QT tree. The specified directory should contain include, bin, and lib subdirectories which contain the corresponding components of QT. Examples:

	--with-qt=/opt/qt-2.1.0
	--with-qt=/usr/lib/qt-1.45
--with-snmp=DIR
Helps find the location of the SNMP include files. SNMP is needed to fully support peripherals connected to an HP JetDirect print server. You may need to install a package such as ucd-snmp-devel. It is assumed that the SNMP library libsnmp.so is accessible in standard places. Example:
	--with-snmp=/usr/include/ucd-snmp
The above --with-PACKAGE options may also take the form --without-PACKAGE to disable use of the selected package when it otherwise would have been used. Examples:
	--without-snmp
	--without-qt
Additionally, if you experience compilation problems with ptal-mlcd (the low-level I/O driver), you may give the --without-par or --without-usb switches to disable parallel-port or USB support, respectively. Note that these options prevent only a small amount of code from being compiled, so there's little value in specifying them except as a workaround for build problems.

If you use one of the --without-PACKAGE switches, or if the corresponding package can't be found, then the rest of the hpoj package should still build, minus the parts that depend on the missing functionality.

Troubleshooting

If during make or "make install" you get an error trying to create a symbolic link, then you are probably compiling and/or installing on a file system that doesn't support symlinks, such as MSDOS or VFAT. Try compiling and installing on a native Linux ext2 filesystem.

Post-installation steps

As long as you invoke "make install" as root, it should perform all of the necessary post-installation steps for you on most distributions. This section is provided for your information in case you can't install as root, or in case your distribution uses a different (non-LSB) file-system layout, such that the init script can't be installed.

"make install" invoked as root looks for the directory /etc/profile.d and adds the scripts hpoj.sh and hpoj.csh to this directory if it exists. These scripts add to the PATH environment variable the bin and sbin directories into which the hpoj software was installed. You'll need to log out and back in again for the new PATH to take effect. If for whatever reason these scripts couldn't be added, then enter the following command on the command line, or add it to /etc/profile (for all users) or to ~/.bash_profile (for individual users), and adjust /usr/local as necessary for the actual installation directory you specified:

	export PATH=/usr/local/sbin:/usr/local/bin:$PATH
If you don't run "make install" as root, then you will need to manually create the directories /dev/ptal-mlcd and /dev/ptal-printd, if you haven't already. Set the ownership and permissions as appropriate (probably 0755 and root:root).

"make install" as root tries to create a symlink to ptal-init in your system's init script directory, such as /etc/init.d, and run chkconfig to create the runlevel-specific symlinks. If init scripts are located in a directory not known to the Makefile, or if chkconfig isn't available on your system, then you will need to create these symlinks by hand to ensure that ptal-init gets started and stopped as appropriate. Alternatively, you might be able to add a line to some sort of "local" init script, such as /etc/rc.d/rc.local, that invokes "ptal-init start". You'll probably need to specify the full path to ptal-init in this case.

Caution: RedHat 7.x invokes a checkpc command in its lpd init script. This command will hang, particularly during bootup, if ptal-printd is not already running. For this reason, be sure that ptal-init runs before lpd gets started.

"make install" as root checks /etc/ld.so.conf for the directory into which libptal.so was installed, and adds it and runs ldconfig if necessary. If you build and install several times using --prefix=DIR switches that differ only in extra slashes in the path, then you run the risk of having redundant lines added to this file. It would probably be a good idea to inspect this file and make corrections if necessary, and re-run ldconfig to make your changes take effect.

As an alternative to modifying /etc/ld.so.conf, you can set the environment variable LD_LIBRARY_PATH to /usr/local/lib (or wherever the libraries were installed) before running any of the hpoj programs that depend on libptal.so.

Cleaning up from old hpoj versions

If you're upgrading from an older hpoj version, whether released or from CVS, then there may be outdated files on your system. "make install" checks for these under the installation directory and prints a message asking you to delete any that it finds. However, it will not find them if you install into a different directory from previous versions; in this case, it would be a good idea to delete all files installed by the previous version(s).

If you install the hpoj software into separate unique directories for different versions, then you should also check /etc/ld.so.conf and remove lines that point to old hpoj versions. However, be careful not to delete the line for the current version, or any line specifying a path containing other libraries on your system that you want to continue to be accessible. Run ldconfig (again, as root) to make your changes to this file take effect.

Next steps

In case you ever need to refer back to this documentation, it is by default installed under /usr/local/share/doc/hpoj-0.8.

Now you're ready to set up basic device connectivity.