Полезная информация

Chapter 4. Installing Applications: The Ports collection

Table of Contents
4.1. Why Have a Ports Collection?
4.2. How Does the Ports Collection Work?
4.3. Getting a FreeBSD Port
4.4. Skeletons
4.5. What to do when a port does not work.
4.6. Some Questions and Answers
4.7. Making a port yourself

Contributed by James Raynard .

The FreeBSD Ports collection allows you to compile and install a very wide range of applications with a minimum of effort.

For all the hype about open standards, getting a program to work on different versions of Unix in the real world can be a tedious and tricky business, as anyone who has tried it will know. You may be lucky enough to find that the program you want will compile cleanly on your system, install itself in all the right places and run flawlessly ``out of the box'', but this is unfortunately rather rare. With most programs, you will find yourself doing a fair bit of head-scratching, and there are quite a few programs that will result in premature greying, or even chronic alopecia...

Some software distributions have attacked this problem by providing configuration scripts. Some of these are very clever, but they have an unfortunate tendency to triumphantly announce that your system is something you have never heard of and then ask you lots of questions that sound like a final exam in system-level Unix programming (Does your system's gethitlist function return a const pointer to a fromboz or a pointer to a const fromboz? Do you have Foonix style unacceptable exception handling? And if not, why not?).

Fortunately, with the Ports collection, all the hard work involved has already been done, and you can just type make install and get a working program.

4.1. Why Have a Ports Collection?

The base FreeBSD system comes with a very wide range of tools and system utilities, but a lot of popular programs are not in the base system, for good reasons:-

  1. Programs that some people cannot live without and other people cannot stand, such as a certain Lisp-based editor.

  2. Programs which are too specialised to put in the base system (CAD, databases).

  3. Programs which fall into the ``I must have a look at that when I get a spare minute'' category, rather than system-critical ones (some languages, perhaps).

  4. Programs that are far too much fun to be supplied with a serious operating system like FreeBSD ;-)

  5. However many programs you put in the base system, people will always want more, and a line has to be drawn somewhere (otherwise FreeBSD distributions would become absolutely enormous).

Obviously it would be unreasonable to expect everyone to port their favourite programs by hand (not to mention a tremendous amount of duplicated work), so the FreeBSD Project came up with an ingenious way of using standard tools that would automate the process.

Incidentally, this is an excellent illustration of how ``the Unix way'' works in practice by combining a set of simple but very flexible tools into something very powerful.