Let's say that a port catches your eye and you decide you want to install it. Here's where it gets fun. All you have to do is move into the port's directory (using cd) and type make. This compiles the software. Then, you type make install to install it. It's a simple process on the surface, but there's a lot that goes on under the hood. The make command actually executes a series of sequential make targets (described in Table 16.3). Each one depends on all the previous targets completing successfully. You can specify any of these targets directly; this will build all prerequisite targets up to and including the one you specify.
Typing make extract, for example, will download the source file, match its MD5 checksum, and unpack it. Although there are other targets (listed in /usr/ports/Mk/bsd.port.mk), you won't need to use any of them under most circumstances. After each step in the process is complete (except for fetch and checksum), a file is created in the work subdirectory of the form .extract_done. This is how the system keeps track of which steps are completed. (To see whether the fetch step is done, it simply checks for the existence of the tarball in /usr/ports/distfiles.) The exTRact step runs the checksum step implicitly. After that, the steps are sequential and independent, and they check for prerequisite steps by looking for the appropriate .*_done files. If you need to make any changes to the source before compiling, you can run make patch, thus bringing the source up to a state where it's ready to compile, and then make whatever changes you like to the code in the work directory. Then, you can complete the process with make. Dependencies are handled automatically by the ports, just as with the packages. Any dependencies are read from the makefile during the fetch or install phase and then downloaded, built, and installed. You will get feedback in the build output each time it encounters a dependency, regardless of whether that dependency is installed already. After a port is installed, an entry is made in the /var/db/pkg database; for all intents and purposes, it is now a package. You can use the pkg_* tools on it to gather information and compare its version, just as with packages installed from within Sysinstall. Tip There is a deinstall target in the ports (make deinstall). This target is used when the installed port version is the same as the one in the makefilein essence, you're deinstalling exactly the same software package you installed. If you update your ports so that the version of a port (in the makefile) is higher than the installed version, you can't use make deinstall to delete it. Instead you have to use pkg_delete, the same way as you would a package. |