diff --git a/en_US.ISO8859-1/books/handbook/ports/chapter.sgml b/en_US.ISO8859-1/books/handbook/ports/chapter.sgml
index 476a626438..d1503f988c 100644
--- a/en_US.ISO8859-1/books/handbook/ports/chapter.sgml
+++ b/en_US.ISO8859-1/books/handbook/ports/chapter.sgml
@@ -1,999 +1,1138 @@
- Installing Applications: The Ports collection
-
- Rewritten by &a.jim;, 22 November 1999. Original work
- by various people.
+ Installing Applications: Packages and PortsSynopsis
- The FreeBSD Ports collection allows you to compile and install a
- very wide range of applications with a minimum amount of
- effort.
-
- In general, it is a group of skeletons
- which contain a minimal set of items needed to make an application
- compile and install cleanly on FreeBSD.
-
- Even with all the hype about open standards, getting a program
- to compile on various UNIX platforms can be a tricky task.
- Occasionally, you might be lucky enough to find that the program you
- want compiles cleanly on your system, install everything into all
- the right directories, and run flawlessly
- out-of-the-box, but this behavior is somewhat rare.
- Most of the time, you find yourself needing to make modifications in
- order to get the program to work. This is where the FreeBSD Ports
- collection comes to the rescue.
-
- The general idea behind the Ports collection is to eliminate all
- of the messy steps involved with making things work properly so that
- the installation is simple and very painless. With the Ports
- collection, all of the hard work has already been done for you, and
- you are able to install any of the Ports collection ports by simply
- typing make install.
+ There is only so much you can do with FreeBSD. If you are an
+ operating systems developer then the base system likely contains
+ everything you need. If that is not what you are planning to do with
+ FreeBSD then you will probably want to install additional
+ software—perhaps a web server, or a mail reader, or a graphical
+ environment such as KDE or GNOME.
+
+ If you have used a Unix system before you will know that the typical
+ procedure for installing third party software goes something like
+ this:
+
+
+
+ Download the software, which might be distributed in source code
+ format, or as a binary.
+
+
+
+ Unpack the software from its distribution format (typically a
+ tarball compressed with either &man.compress.1; or &man.gzip.1;).
+
+
+
+ Locate the documentation (perhaps a README
+ file, or some files in a doc/ subdirectory) and
+ read up on how to install the software.
+
+
+
+ If the software was distributed in source format, compile it.
+ This may involve editing a Makefile, or
+ running a configure script, and other work.
+
+
+
+ Test and install the software.
+
+
+
+ And that is only if everything goes well. If you are installing a
+ software package that was not deliberately ported to FreeBSD you may
+ even have to go in and edit the code to make it work properly.
+
+ Should you want to, you can continue to install software the
+ traditional way with FreeBSD. However, FreeBSD provides
+ two technologies which can save you a lot of effort; packages and
+ ports. At the time of writing, over 4,000 third party applications have
+ been made available in this way.
+
+ For any given application, the FreeBSD package for that application
+ is a single file which you must download. The package contains
+ pre-compiled copies of all the commands for the application, as well as
+ any configuration files or documentation. A downloaded package file can
+ be manipulated with FreeBSD pkg_* commands, such as
+ &man.pkg.add.1; &man.pkg.delete.1;, &man.pkg.info.1;, and so on.
+
+ Installing a new application can be carried out with a single
+ command.
+
+ A FreeBSD port for an application is a collection of files designed
+ to automate the process of compiling an application from source
+ code.
+
+ Remember that there are a number of steps you would normally carry
+ out if you compiled a program yourself (unpacking, patching, compiling,
+ installing). The files that make up a port contain all the necessary
+ information to alllow the system to do this for you. You run a handful
+ of simple commands and the source code for the application is
+ automatically downloaded, extracted, patched, compiled, and installed
+ for you.
+
+ In fact, the ports system can also be used to generate packages
+ which can later be manipulated with the pkg_*
+ commands.
+
+ Both packages and ports understand
+ dependencies. Suppose you want to install an
+ application that depends on a specific library being installed. Both
+ the application and the library have been made available as FreeBSD
+ ports and packages. If you use the pkg_add command
+ or the ports system to add the application, both will notice that the
+ library has not been installed, and the commands will install the
+ library first.
+
+ Given that the two technologies are quite similar, you might be
+ wondering why FreeBSD bothers with both. Packages and ports both have
+ their own strengths, and which one you use will depend on your own
+ preference.
+
+
+ Package benefits
+
+
+ A compressed package tarball is typically smaller than the
+ compressed tarball containing the source code for the application.
+
+
+
+ Packages do not require any additional compilation. For large
+ applications, such as Mozilla,
+ KDE, or GNOME
+ this can be important, particularly if you are on a slow system.
+
+
+
+ Packages do not require you to understand any of the process
+ involved in compiling software on FreeBSD.
+
+
+
+
+ Ports benefits
+
+
+ Packages are normally compiled with conservative options,
+ because they have to run on the maximum number of systems. By
+ installing from the port, you can tweak the compilation options to
+ (for example) generate code that is specific to a 686 processor.
+
+
+
+ Some packages have compile time options relating to what they
+ can and can't do. For example, Apache
+ can be configured with a wide variety of different builtin options.
+ By building from the port you do not have to accept the default
+ options, and can set them yourself.
+
+ In some cases, multiple packages will exist for the same
+ application to specify certain settings. For example,
+ Ghostscript is available as a
+ ghostscript package and a
+ ghostscript-nox11 package, depending on whether
+ or not you have installed an X11 server. This sort of rough
+ tweaking is possible with packages, but rapidly becomes impossible
+ if an application has more than one or two different compile time
+ options.
+
+
+
+ The licensing conditions of some software distributions forbid
+ binary distribution. They must be distributed as source
+ code.
+
+
+
+ Some people do not trust binary distributions. At least with
+ source code, you can (in theory) read through it and look for
+ potential problems yourself.
+
+
+
+ If you have local patches, you will need the source in order to
+ apply them.
+
+
+
+ Some people like having code around, so they can read it if they
+ get bored, hack it, borrow from it (license permitting, of course),
+ and so on.
+
+
+
+ The remainder of this chapter will explain how to use packages and
+ ports to install and manage third party software on FreeBSD.
+
+ Finding your application
+
+ Before you can install any applications you need to know what you
+ want, and what the application is called.
+
+ FreeBSD's list of available applications is growing all the time.
+ Currently there are over 4,000 applications available as packages or
+ ports. There are a number of ways to find what you want.
+
+
+
+ The FreeBSD web site maintains an up-to-date searchable list of
+ all the available applications, at
+ http://www.FreeBSD.org/ports/.
+ The name space is divided in to categories, and you may either
+ search for an application by name (if you know it), or you can list
+ all the applications available in a category.
+
+
+
+ Dan Langille maintains FreshPorts, at
+ http://www.freshports.org/.
+ FreshPorts tracks changes to the applications in the ports tree as
+ they happen, and allows you to watch one or more
+ ports, and will send you an e-mail when they are updated.
+
+
+
+ If you do not know the name of the application you want, try
+ using a site like FreshMeat
+ (http://www.freshmeat.net/)
+ or AppWatch
+ (http://www.appwatch.com/)
+ to find an application, then check back at the FreeBSD site to see
+ if the application has been ported yet.
+
+
+
+
+
+ * Using the Packages System
+
+
+ Installing a Package
+
+ After you have decided which application you want to install you
+ need to download the package file and install it.
+
+ There are several ways you can do this.
+
+
+ Downloading and installing in multiple steps
+
+
+
+
+
+
+ Deleting a Package
+
+
+
+
+
+ Updating a Package
+
+
+
+
+
+
+
+
+
+
+
Using the Ports CollectionThe following sections provide basic instructions on using the
ports collection to install or remove programs from your
system.Installing PortsThe first thing that should be explained
when it comes to the Ports collection is what is actually meant
by a skeleton. In a nutshell, a port skeleton is a
minimal set of files that are needed for a program to compile and
install cleanly on FreeBSD. Each port skeleton includes:A Makefile. The
Makefile contains various statements that
specify how the application should be compiled and where it
should be installed on your systemA distinfo file. This file contains
information about the files that must be downloaded to build the
port, and checksums, to ensure that that files have not been
corrupted during the download.A files directory. This directory
contains patches to make the program compile and install on
your FreeBSD system. Patches are basically small files that
specify changes to particular files. They are in plain text
format, and basically say Remove line 10 or
Change line 26 to this .... Patches are also
known as diffs because they are generated by the
diff program.This directory may also contain other files used in building
the port.A pkg-comment file. This is a one-line
description of the program.A pkg-descr file. This is a more
detailed, often multiple-line, description of the program.A pkg-plist file. This is a list of all
the files that will be installed by the port. It also tells the
ports system what files to remove upon deinstallation.Now that you have enough background information to know what
the Ports collection is used for, you are ready to install your
first port. There are two ways this can be done, and each is
explained below.Before we get into that however, you will need to choose a
port to install. There are a few ways to do this, with the
easiest method being the ports listing on the FreeBSD
web site. You can browse through the ports listed there
or use the search function on the site. Each port also includes
a description so you can read a bit about each port before
deciding to install it.Another method is to use the whereis
command. To use whereis, simply type
whereis <program you want to
install> at the prompt, and if it is found on
your system, you will be told where it is, like so:&prompt.root; whereis xchat
xchat: /usr/ports/irc/xchat
&prompt.root;This tells us that xchat (an irc client) can be found in the
/usr/ports/irc/xchat directory.Yet another way of finding a particular port is by using the
Ports collection's built-in search mechanism. To use the search
feature, you will need to be in the
/usr/ports directory. Once in that
directory, run make search key=program-name
where program-name is the name of the program you
want to find. For example, if you were looking for xchat:&prompt.root; cd /usr/ports
&prompt.root; make search key=xchat
Port: xchat-1.3.8
Path: /usr/ports/irc/xchat
Info: An X11 IRC client using the GTK+ toolkit, and optionally, GNOME
Maint: jim@FreeBSD.org
Index: irc
B-deps: XFree86-3.3.5 bzip2-0.9.5d gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gmake-3.77 gtk-1.2.6
imlib-1.9.8 jpeg-6b png-1.0.3 tiff-3.5.1
R-deps: XFree86-3.3.5 gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gtk-1.2.6 imlib-1.9.8 jpeg-6b
png-1.0.3 tiff-3.5.1The part of the output you want to pay particular attention
to is the Path: line, since that tells you where to
find it. The other information provided is not needed in order
to install the port directly, so it will not be covered
here.You must be the root user to install
ports.Now that you have found a port you would like to install, you
are ready to do the actual installation.Installing ports from a CDROMAs you may have guessed from the title, everything
described in this section assumes you have a FreeBSD CDROM set.
If you do not, you can order one from the FreeBSD Mall.Assuming that your FreeBSD CDROM is in the drive and is
mounted on /cdrom (and the mount point
must be /cdrom),
you are ready to install the port. To begin, change directories
to the directory where the port you want to install lives:&prompt.root; cd /usr/ports/irc/xchatOnce inside the xchat directory, you will see the port
skeleton. The next step is to compile (also called build) the
port. This is done by simply typing make at
the prompt. Once you have done so, you should see something
like this:&prompt.root; make
>> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.
>> Attempting to fetch from file:/cdrom/ports/distfiles/.
===> Extracting for xchat-1.3.8
>> Checksum OK for xchat-1.3.8.tar.bz2.
===> xchat-1.3.8 depends on executable: bzip2 - found
===> xchat-1.3.8 depends on executable: gmake - found
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
===> Patching for xchat-1.3.8
===> Applying FreeBSD patches for xchat-1.3.8
===> Configuring for xchat-1.3.8
...
[configure output snipped]
...
===> Building for xchat-1.3.8
...
[compilation snipped]
...
&prompt.root;Take notice that once the compile is complete you are
returned to your prompt. The next step is to install the
port. In order to install it, you simply need to tack one word
onto the make command, and that word is
install:&prompt.root; make install
===> Installing for xchat-1.3.8
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
...
[install routines snipped]
...
===> Generating temporary packing list
===> Installing xchat docs in /usr/X11R6/share/doc/xchat
===> Registering installation for xchat-1.3.8
&prompt.root;Once you are returned to your prompt, you should be able to
run the application you just installed.You can save an extra step by just running make
install instead of make and
make install as two separate steps.Please be aware that the licenses of a few ports do not
allow for inclusion on the CDROM. This could be for various
reasons, including things such as as registration form needs
to be filled out before downloading, if redistribution is not
allowed, and so on. If you wish to install a port not
included on the CDROM, you will need to be online in order to
do so (see the next
section).Installing ports from the InternetAs with the last section, this section makes an assumption
that you have a working Internet connection. If you do not,
you will need to do the CDROM
installation.Installing a port from the Internet is done exactly the same
way as it would be if you were installing from a CDROM. The
only difference between the two is that the program's source
code is downloaded from the Internet instead of pulled from the
CDROM.The steps involved are identical:&prompt.root; make install
>> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.
>> Attempting to fetch from http://xchat.org/files/v1.3/.
Receiving xchat-1.3.8.tar.bz2 (305543 bytes): 100%
305543 bytes transferred in 2.9 seconds (102.81 Kbytes/s)
===> Extracting for xchat-1.3.8
>> Checksum OK for xchat-1.3.8.tar.bz2.
===> xchat-1.3.8 depends on executable: bzip2 - found
===> xchat-1.3.8 depends on executable: gmake - found
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
===> Patching for xchat-1.3.8
===> Applying FreeBSD patches for xchat-1.3.8
===> Configuring for xchat-1.3.8
...
[configure output snipped]
...
===> Building for xchat-1.3.8
...
[compilation snipped]
...
===> Installing for xchat-1.3.8
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
...
[install routines snipped]
...
===> Generating temporary packing list
===> Installing xchat docs in /usr/X11R6/share/doc/xchat
===> Registering installation for xchat-1.3.8
&prompt.root;As you can see, the only difference is the line that tells
you where the system is fetching the port from.That about does it for installing ports onto your system.
In the section you will learn how to remove a port from your
system.Removing Installed PortsNow that you know how to install ports, you are probably
wondering how to remove them, just in case you install one and
later on you decide that you installed the wrong port. The next
few paragraphs will cover just that.Now we will remove our previous example (which was xchat for
those of you not paying attention). As with installing ports,
the first thing you must do is change to the port directory,
which if you remember was
/usr/ports/irc/xchat. After you change
directories, you are ready to uninstall xchat. This is done with
the make deinstall command (makes sense
right?):&prompt.root; cd /usr/ports/irc/xchat
&prompt.root; make deinstall
===> Deinstalling for xchat-1.3.8
&prompt.root;That was easy enough. You have now managed to remove xchat
from your system. If you would like to reinstall it, you can do
so by running make reinstall from the
/usr/ports/irc/xchat directory.TroubleshootingThe following sections cover some of the more frequently asked
questions about the Ports collection and some basic troubleshooting
techniques, and what do to if a port is broken.Some Questions and AnswersI thought this was going to be a discussion about
modems??!Ah, you must be thinking of the serial ports on the back
of your computer. We are using port here to
mean the result of porting a program from one
version of UNIX to another.
-
-
- I thought you were supposed to use packages to install
- extra programs?
-
-
-
- Yes, that is usually the quickest and easiest way of
- doing it.
-
-
-
-
-
- So why bother with ports then?
-
-
-
- Several reasons:
-
-
-
- The licensing conditions of some software
- distributions forbid binary distribution. They must be
- distributed as source code.
-
-
-
- Some people do not trust binary distributions. At
- least with source code, you can (in theory) read through
- it and look for potential problems yourself.
-
-
-
- If you have local patches, you will need the source in
- order to apply them.
-
-
-
- You might have opinions on how a program should be
- compiled that differ from the person who did the
- package—some people have strong views on what
- optimization settings should be used, whether to build
- debug versions and then strip them or not, and so on.
-
-
-
- Packages are normally built with quite conservative
- settings. If a port has a compilation option to use code
- for a specific processor, or a particular add-on board you
- can enable this yourself in the port, without the people
- making the package having to produce many, many different
- packaged versions.
-
- The most obvious exception to this rule is paper sizes.
- If a package can be provided with default support for
- different paper sizes we will often provide multiple
- packages, one per paper size.
-
-
-
- Some people like having code around, so they can read
- it if they get bored, hack it, borrow from it (license
- permitting, of course), and so on.
-
-
-
- If you ain't got the source, it ain't software!
- ;-)
-
-
-
-
-
What is a patch?A patch is a small file that specifies how to go from
one version of a file to another. It contains plain text,
and basically says things like delete line 23,
add these two lines after line 468, or
change line 197 to this. They are also known
as diffs because they are generated by the
diff program.What is all this about
tarballs?It is a file ending in .tar, or
with variations such as .tar.gz,
.tar.Z, .tar.bz2,
and even .tgz.Basically, it is a directory tree that has been archived
into a single file (.tar) and
optionally compressed (.gz). This
technique was originally used for Tape
ARchives (hence the name
tar), but it is a widely used way of
distributing program source code around the Internet.You can see what files are in them, or even extract them
yourself by using the standard UNIX tar program, which comes
with the base FreeBSD system, like this:&prompt.user; tar tvzf foobar.tar.gz
&prompt.user; tar xzvf foobar.tar.gz
&prompt.user; tar tvf foobar.tar
&prompt.user; tar xvf foobar.tarAnd a checksum?It is a number generated by adding up all the data in
the file you want to check. If any of the characters
change, the checksum will no longer be equal to the total,
so a simple comparison will allow you to spot the
difference.I did what you said for compiling ports from a CDROM and
it worked great until I tried to install the kermit
port.&prompt.root; make install
>> cku190.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch from ftp://kermit.columbia.edu/kermit/archives/.Why can it not be found? Have I got a dud CDROM?As was explained in the compiling ports from CDROM
section, some ports cannot be put on the CDROM set
due to licensing restrictions. Kermit is an example of
that. The licensing terms for kermit do not allow us to put
the tarball for it on the CDROM, so you will have to fetch
it by hand—sorry!The reason why you got all those error messages was
because you were not connected to the Internet at the time.
Once you have downloaded it from any of the MASTER_SITES
(listed in the Makefile), you can restart the install
process.I did that, but when I tried to put it into
/usr/ports/distfiles I got some error
about not having permission.The ports mechanism looks for the tarball in
/usr/ports/distfiles, but you will not
be able to copy anything there because it is symlinked to
the CDROM, which is read-only. You can tell it to look
somewhere else by doing:&prompt.root; make DISTDIR=/where/you/put/it installDoes the ports scheme only work if you have everything
in /usr/ports? My system administrator
says I must put everything under
/u/people/guests/wurzburger, but it
does not seem to work.You can use the PORTSDIR and
PREFIX variables to tell the ports
mechanism to use different directories. For
instance,&prompt.root; make PORTSDIR=/u/people/guests/wurzburger/ports installwill compile the port in
/u/people/guests/wurzburger/ports and
install everything under
/usr/local.&prompt.root; make PREFIX=/u/people/guests/wurzburger/local installwill compile it in /usr/ports and
install it in
/u/people/guests/wurzburger/local.And of course,&prompt.root; make PORTSDIR=../ports PREFIX=../local installwill combine the two (it is too long to write fully on
the page, but it should give you the general idea).Some ports that use &man.imake.1; (a part of the X Windows
System) don't work well with PREFIX, and will insist on
installing under /usr/X11R6. Similarly, some Perl ports
ignore PREFIX and install in the Perl tree. Making these
ports respect PREFIX is a difficult or impossible
job.If you do not fancy typing all that in every time you
install a port, it is a good idea to put these variables
into your environment. Read the man page for your shell for
instructions on doing so.I do not have a FreeBSD CDROM, but I would like to have
all the tarballs handy on my system so I do not have to wait
for a download every time I install a port. Is there any
way to get them all at once?To get every single tarball for the Ports collection,
do:&prompt.root; cd /usr/ports
&prompt.root; make fetchFor all the tarballs for a single ports directory,
do:&prompt.root; cd /usr/ports/directory
&prompt.root; make fetchand for just one port—well, I think you have
guessed already.I know it is probably faster to fetch the tarballs from
one of the FreeBSD mirror sites close by. Is there any way
to tell the port to fetch them from servers other than the
ones listed in the MASTER_SITES?Yes. If you know, for example, that ftp.FreeBSD.org is much closer to you
than the sites listed in MASTER_SITES,
do as follows:&prompt.root; cd /usr/ports/directory
&prompt.root; make MASTER_SITE_OVERRIDE= \
ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetchI want to know what files make is
going to need before it tries to pull them down.make fetch-list will display a list
of the files needed for a port.Is there any way to stop the port from compiling? I
want to do some hacking on the source before I install it,
but it is a bit tiresome to watch it and hit control-C every
time.Doing make extract will stop it
after it has fetched and extracted the source code.I am trying to make my own port and I want to be able
to stop it compiling until I have had a chance to see if my
patches worked properly. Is there something like
make extract, but for patches?Yep, make patch is what you want.
You will probably find the PATCH_DEBUG
option useful as well. And by the way, thank you for your
efforts!I have heard that some compiler options can cause bugs.
Is this true? How can I make sure that I compile ports
with the right settings?Yes, with version 2.6.3 of gcc (the
version shipped with FreeBSD 2.1.0 and 2.1.5), the
option could result in buggy code
unless you used the
option as well. (Most of the ports do not use
). You should be
able to specify the compiler options used by something
like:&prompt.root; make CFLAGS='-O2 -fno-strength-reduce' installor by editing /etc/make.conf, but
unfortunately not all ports respect this. The surest way
is to do make configure, then go into
the source directory and inspect the Makefiles by hand, but
this can get tedious if the source has lots of
sub-directories, each with their own Makefiles.The default FreeBSD compiler options are quite conservative,
so if you have not changed them you should not have any
problems.There are so many ports it is hard to find the one I
want. Is there a list anywhere of what ports are
available?Look in the INDEX file in
/usr/ports. If you would like to
search the ports collection for a keyword, you can do that
too. For example, you can find ports relevant to the LISP
programming language using:&prompt.user; cd /usr/ports
&prompt.user; make search key=lispI went to install the foo port but
the system suddenly stopped compiling it and starting
compiling the bar port. What is going
on?The foo port needs something that is
supplied with bar — for instance,
if foo uses graphics,
bar might have a library with useful
graphics processing routines. Or bar
might be a tool that is needed to compile the
foo port. I installed the
grizzle program from the ports and
frankly it is a complete waste of disk space. I want to
delete it but I do not know where it put all the files.
Any clues?No problem, just do:&prompt.root; pkg_delete grizzle-6.5Alternatively, you can do:&prompt.root; cd /usr/ports/somewhere/grizzle
&prompt.root; make deinstallHang on a minute, you have to know the version number
to use that command. You do not seriously expect me to
remember that, do you??Not at all, you can find it out by doing:&prompt.root; pkg_info -a | grep grizzle
Information for grizzle-6.5:
grizzle-6.5 - the combined piano tutorial, LOGO interpreter and shoot 'em up
arcade game.Talking of disk space, the ports directory seems to be
taking up an awful lot of room. Is it safe to go in there
and delete things?Yes, if you have installed the program and are fairly
certain you will not need the source again, there is no
point in keeping it hanging around. The best way to do
this is:&prompt.root; cd /usr/ports
&prompt.root; make cleanwhich will go through all the ports subdirectories and
delete everything except the skeletons for each
port.I tried that and it still left all those tarballs or
whatever you called them in the
distfiles directory. Can I delete
those as well?Yes, if you are sure you have finished with them,
those can go as well. They can be removed manually, or by
using make distclean.I like having lots and lots of programs to play with.
Is there any way of installing all the ports in one
go?Just do:&prompt.root; cd /usr/ports
&prompt.root; make installBe careful, as some ports may install files with the same
name. If you install two graphics ports and they both install
/usr/local/bin/plot then you will obviously
have problems.OK, I tried that, but I thought it would take a very
long time so I went to bed and left it to get on with it.
When I looked at the computer this morning, it had only
done three and a half ports. Did something go
wrong?No, the problem is that some of the ports need to ask
you questions that we cannot answer for you (e.g., Do
you want to print on A4 or US letter sized paper?)
and they need to have someone on hand to answer
them.I really do not want to spend all day staring at the
monitor. Any better ideas?OK, do this before you go to bed/work/the local
park:&prompt.root cd /usr/ports
&prompt.root; make -DBATCH installThis will install every port that does
not require user input. Then, when
you come back, do:&prompt.root; cd /usr/ports
&prompt.root; make -DIS_INTERACTIVE installto finish the job.At work, we are using frobble, which
is in your Ports collection, but we have altered it quite a
bit to get it to do what we need. Is there any way of making
our own packages, so we can distribute it more easily around
our sites?No problem, assuming you know how to make patches for
your changes:&prompt.root; cd /usr/ports/somewhere/frobble
&prompt.root; make extract
&prompt.root; cd work/frobble-2.8
[Apply your patches]
&prompt.root; cd ../..
&prompt.root; make packageThis ports stuff is really clever. I am desperate to
find out how you did it. What is the secret?Nothing secret about it at all, just look at the
bsd.port.mk and
bsd.port.subdir.mk files in your
makefiles
directory.(Readers with an aversion to intricate shell-scripts are
advised not to follow this link...)Help! This port is broken!If you come across a port that doesn't work for you, there are
a few things you can do, including:Fix it! The how to make a
port section should help you do this.Gripe—by email only! Send
email to the maintainer of the port first. Type make
maintainer or read the Makefile
to find the maintainer's email address. Remember to include
the name and version of the port (send the
$FreeBSD: line from the
Makefile) and the output leading up to the
error when you email the maintainer. If you do not get a
response from the maintainer, you can use
send-pr to submit a bug report.Forget about it. This is the easiest route—very
few ports can be classified as essential. There's
also a good chance any problems will be fixed in the next
version when the port is updated.Grab the package from an ftp site near you. The
master package collection is on ftp.FreeBSD.org in the packages
directory, but be sure to check your local mirror
first! These are more likely to work
than trying to compile from source and are a lot faster as
well. Use the &man.pkg.add.1; program to install the package
on your system.Advanced TopicsThe documentation that was here has been moved to its own Porter's Handbook for ease of
reference. Please go there if you wish to create and submit your own
ports.
diff --git a/en_US.ISO_8859-1/books/handbook/ports/chapter.sgml b/en_US.ISO_8859-1/books/handbook/ports/chapter.sgml
index 476a626438..d1503f988c 100644
--- a/en_US.ISO_8859-1/books/handbook/ports/chapter.sgml
+++ b/en_US.ISO_8859-1/books/handbook/ports/chapter.sgml
@@ -1,999 +1,1138 @@
- Installing Applications: The Ports collection
-
- Rewritten by &a.jim;, 22 November 1999. Original work
- by various people.
+ Installing Applications: Packages and PortsSynopsis
- The FreeBSD Ports collection allows you to compile and install a
- very wide range of applications with a minimum amount of
- effort.
-
- In general, it is a group of skeletons
- which contain a minimal set of items needed to make an application
- compile and install cleanly on FreeBSD.
-
- Even with all the hype about open standards, getting a program
- to compile on various UNIX platforms can be a tricky task.
- Occasionally, you might be lucky enough to find that the program you
- want compiles cleanly on your system, install everything into all
- the right directories, and run flawlessly
- out-of-the-box, but this behavior is somewhat rare.
- Most of the time, you find yourself needing to make modifications in
- order to get the program to work. This is where the FreeBSD Ports
- collection comes to the rescue.
-
- The general idea behind the Ports collection is to eliminate all
- of the messy steps involved with making things work properly so that
- the installation is simple and very painless. With the Ports
- collection, all of the hard work has already been done for you, and
- you are able to install any of the Ports collection ports by simply
- typing make install.
+ There is only so much you can do with FreeBSD. If you are an
+ operating systems developer then the base system likely contains
+ everything you need. If that is not what you are planning to do with
+ FreeBSD then you will probably want to install additional
+ software—perhaps a web server, or a mail reader, or a graphical
+ environment such as KDE or GNOME.
+
+ If you have used a Unix system before you will know that the typical
+ procedure for installing third party software goes something like
+ this:
+
+
+
+ Download the software, which might be distributed in source code
+ format, or as a binary.
+
+
+
+ Unpack the software from its distribution format (typically a
+ tarball compressed with either &man.compress.1; or &man.gzip.1;).
+
+
+
+ Locate the documentation (perhaps a README
+ file, or some files in a doc/ subdirectory) and
+ read up on how to install the software.
+
+
+
+ If the software was distributed in source format, compile it.
+ This may involve editing a Makefile, or
+ running a configure script, and other work.
+
+
+
+ Test and install the software.
+
+
+
+ And that is only if everything goes well. If you are installing a
+ software package that was not deliberately ported to FreeBSD you may
+ even have to go in and edit the code to make it work properly.
+
+ Should you want to, you can continue to install software the
+ traditional way with FreeBSD. However, FreeBSD provides
+ two technologies which can save you a lot of effort; packages and
+ ports. At the time of writing, over 4,000 third party applications have
+ been made available in this way.
+
+ For any given application, the FreeBSD package for that application
+ is a single file which you must download. The package contains
+ pre-compiled copies of all the commands for the application, as well as
+ any configuration files or documentation. A downloaded package file can
+ be manipulated with FreeBSD pkg_* commands, such as
+ &man.pkg.add.1; &man.pkg.delete.1;, &man.pkg.info.1;, and so on.
+
+ Installing a new application can be carried out with a single
+ command.
+
+ A FreeBSD port for an application is a collection of files designed
+ to automate the process of compiling an application from source
+ code.
+
+ Remember that there are a number of steps you would normally carry
+ out if you compiled a program yourself (unpacking, patching, compiling,
+ installing). The files that make up a port contain all the necessary
+ information to alllow the system to do this for you. You run a handful
+ of simple commands and the source code for the application is
+ automatically downloaded, extracted, patched, compiled, and installed
+ for you.
+
+ In fact, the ports system can also be used to generate packages
+ which can later be manipulated with the pkg_*
+ commands.
+
+ Both packages and ports understand
+ dependencies. Suppose you want to install an
+ application that depends on a specific library being installed. Both
+ the application and the library have been made available as FreeBSD
+ ports and packages. If you use the pkg_add command
+ or the ports system to add the application, both will notice that the
+ library has not been installed, and the commands will install the
+ library first.
+
+ Given that the two technologies are quite similar, you might be
+ wondering why FreeBSD bothers with both. Packages and ports both have
+ their own strengths, and which one you use will depend on your own
+ preference.
+
+
+ Package benefits
+
+
+ A compressed package tarball is typically smaller than the
+ compressed tarball containing the source code for the application.
+
+
+
+ Packages do not require any additional compilation. For large
+ applications, such as Mozilla,
+ KDE, or GNOME
+ this can be important, particularly if you are on a slow system.
+
+
+
+ Packages do not require you to understand any of the process
+ involved in compiling software on FreeBSD.
+
+
+
+
+ Ports benefits
+
+
+ Packages are normally compiled with conservative options,
+ because they have to run on the maximum number of systems. By
+ installing from the port, you can tweak the compilation options to
+ (for example) generate code that is specific to a 686 processor.
+
+
+
+ Some packages have compile time options relating to what they
+ can and can't do. For example, Apache
+ can be configured with a wide variety of different builtin options.
+ By building from the port you do not have to accept the default
+ options, and can set them yourself.
+
+ In some cases, multiple packages will exist for the same
+ application to specify certain settings. For example,
+ Ghostscript is available as a
+ ghostscript package and a
+ ghostscript-nox11 package, depending on whether
+ or not you have installed an X11 server. This sort of rough
+ tweaking is possible with packages, but rapidly becomes impossible
+ if an application has more than one or two different compile time
+ options.
+
+
+
+ The licensing conditions of some software distributions forbid
+ binary distribution. They must be distributed as source
+ code.
+
+
+
+ Some people do not trust binary distributions. At least with
+ source code, you can (in theory) read through it and look for
+ potential problems yourself.
+
+
+
+ If you have local patches, you will need the source in order to
+ apply them.
+
+
+
+ Some people like having code around, so they can read it if they
+ get bored, hack it, borrow from it (license permitting, of course),
+ and so on.
+
+
+
+ The remainder of this chapter will explain how to use packages and
+ ports to install and manage third party software on FreeBSD.
+
+ Finding your application
+
+ Before you can install any applications you need to know what you
+ want, and what the application is called.
+
+ FreeBSD's list of available applications is growing all the time.
+ Currently there are over 4,000 applications available as packages or
+ ports. There are a number of ways to find what you want.
+
+
+
+ The FreeBSD web site maintains an up-to-date searchable list of
+ all the available applications, at
+ http://www.FreeBSD.org/ports/.
+ The name space is divided in to categories, and you may either
+ search for an application by name (if you know it), or you can list
+ all the applications available in a category.
+
+
+
+ Dan Langille maintains FreshPorts, at
+ http://www.freshports.org/.
+ FreshPorts tracks changes to the applications in the ports tree as
+ they happen, and allows you to watch one or more
+ ports, and will send you an e-mail when they are updated.
+
+
+
+ If you do not know the name of the application you want, try
+ using a site like FreshMeat
+ (http://www.freshmeat.net/)
+ or AppWatch
+ (http://www.appwatch.com/)
+ to find an application, then check back at the FreeBSD site to see
+ if the application has been ported yet.
+
+
+
+
+
+ * Using the Packages System
+
+
+ Installing a Package
+
+ After you have decided which application you want to install you
+ need to download the package file and install it.
+
+ There are several ways you can do this.
+
+
+ Downloading and installing in multiple steps
+
+
+
+
+
+
+ Deleting a Package
+
+
+
+
+
+ Updating a Package
+
+
+
+
+
+
+
+
+
+
+
Using the Ports CollectionThe following sections provide basic instructions on using the
ports collection to install or remove programs from your
system.Installing PortsThe first thing that should be explained
when it comes to the Ports collection is what is actually meant
by a skeleton. In a nutshell, a port skeleton is a
minimal set of files that are needed for a program to compile and
install cleanly on FreeBSD. Each port skeleton includes:A Makefile. The
Makefile contains various statements that
specify how the application should be compiled and where it
should be installed on your systemA distinfo file. This file contains
information about the files that must be downloaded to build the
port, and checksums, to ensure that that files have not been
corrupted during the download.A files directory. This directory
contains patches to make the program compile and install on
your FreeBSD system. Patches are basically small files that
specify changes to particular files. They are in plain text
format, and basically say Remove line 10 or
Change line 26 to this .... Patches are also
known as diffs because they are generated by the
diff program.This directory may also contain other files used in building
the port.A pkg-comment file. This is a one-line
description of the program.A pkg-descr file. This is a more
detailed, often multiple-line, description of the program.A pkg-plist file. This is a list of all
the files that will be installed by the port. It also tells the
ports system what files to remove upon deinstallation.Now that you have enough background information to know what
the Ports collection is used for, you are ready to install your
first port. There are two ways this can be done, and each is
explained below.Before we get into that however, you will need to choose a
port to install. There are a few ways to do this, with the
easiest method being the ports listing on the FreeBSD
web site. You can browse through the ports listed there
or use the search function on the site. Each port also includes
a description so you can read a bit about each port before
deciding to install it.Another method is to use the whereis
command. To use whereis, simply type
whereis <program you want to
install> at the prompt, and if it is found on
your system, you will be told where it is, like so:&prompt.root; whereis xchat
xchat: /usr/ports/irc/xchat
&prompt.root;This tells us that xchat (an irc client) can be found in the
/usr/ports/irc/xchat directory.Yet another way of finding a particular port is by using the
Ports collection's built-in search mechanism. To use the search
feature, you will need to be in the
/usr/ports directory. Once in that
directory, run make search key=program-name
where program-name is the name of the program you
want to find. For example, if you were looking for xchat:&prompt.root; cd /usr/ports
&prompt.root; make search key=xchat
Port: xchat-1.3.8
Path: /usr/ports/irc/xchat
Info: An X11 IRC client using the GTK+ toolkit, and optionally, GNOME
Maint: jim@FreeBSD.org
Index: irc
B-deps: XFree86-3.3.5 bzip2-0.9.5d gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gmake-3.77 gtk-1.2.6
imlib-1.9.8 jpeg-6b png-1.0.3 tiff-3.5.1
R-deps: XFree86-3.3.5 gettext-0.10.35 giflib-4.1.0 glib-1.2.6 gtk-1.2.6 imlib-1.9.8 jpeg-6b
png-1.0.3 tiff-3.5.1The part of the output you want to pay particular attention
to is the Path: line, since that tells you where to
find it. The other information provided is not needed in order
to install the port directly, so it will not be covered
here.You must be the root user to install
ports.Now that you have found a port you would like to install, you
are ready to do the actual installation.Installing ports from a CDROMAs you may have guessed from the title, everything
described in this section assumes you have a FreeBSD CDROM set.
If you do not, you can order one from the FreeBSD Mall.Assuming that your FreeBSD CDROM is in the drive and is
mounted on /cdrom (and the mount point
must be /cdrom),
you are ready to install the port. To begin, change directories
to the directory where the port you want to install lives:&prompt.root; cd /usr/ports/irc/xchatOnce inside the xchat directory, you will see the port
skeleton. The next step is to compile (also called build) the
port. This is done by simply typing make at
the prompt. Once you have done so, you should see something
like this:&prompt.root; make
>> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.
>> Attempting to fetch from file:/cdrom/ports/distfiles/.
===> Extracting for xchat-1.3.8
>> Checksum OK for xchat-1.3.8.tar.bz2.
===> xchat-1.3.8 depends on executable: bzip2 - found
===> xchat-1.3.8 depends on executable: gmake - found
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
===> Patching for xchat-1.3.8
===> Applying FreeBSD patches for xchat-1.3.8
===> Configuring for xchat-1.3.8
...
[configure output snipped]
...
===> Building for xchat-1.3.8
...
[compilation snipped]
...
&prompt.root;Take notice that once the compile is complete you are
returned to your prompt. The next step is to install the
port. In order to install it, you simply need to tack one word
onto the make command, and that word is
install:&prompt.root; make install
===> Installing for xchat-1.3.8
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
...
[install routines snipped]
...
===> Generating temporary packing list
===> Installing xchat docs in /usr/X11R6/share/doc/xchat
===> Registering installation for xchat-1.3.8
&prompt.root;Once you are returned to your prompt, you should be able to
run the application you just installed.You can save an extra step by just running make
install instead of make and
make install as two separate steps.Please be aware that the licenses of a few ports do not
allow for inclusion on the CDROM. This could be for various
reasons, including things such as as registration form needs
to be filled out before downloading, if redistribution is not
allowed, and so on. If you wish to install a port not
included on the CDROM, you will need to be online in order to
do so (see the next
section).Installing ports from the InternetAs with the last section, this section makes an assumption
that you have a working Internet connection. If you do not,
you will need to do the CDROM
installation.Installing a port from the Internet is done exactly the same
way as it would be if you were installing from a CDROM. The
only difference between the two is that the program's source
code is downloaded from the Internet instead of pulled from the
CDROM.The steps involved are identical:&prompt.root; make install
>> xchat-1.3.8.tar.bz2 doesn't seem to exist on this system.
>> Attempting to fetch from http://xchat.org/files/v1.3/.
Receiving xchat-1.3.8.tar.bz2 (305543 bytes): 100%
305543 bytes transferred in 2.9 seconds (102.81 Kbytes/s)
===> Extracting for xchat-1.3.8
>> Checksum OK for xchat-1.3.8.tar.bz2.
===> xchat-1.3.8 depends on executable: bzip2 - found
===> xchat-1.3.8 depends on executable: gmake - found
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
===> Patching for xchat-1.3.8
===> Applying FreeBSD patches for xchat-1.3.8
===> Configuring for xchat-1.3.8
...
[configure output snipped]
...
===> Building for xchat-1.3.8
...
[compilation snipped]
...
===> Installing for xchat-1.3.8
===> xchat-1.3.8 depends on shared library: gtk12.2 - found
===> xchat-1.3.8 depends on shared library: Imlib.5 - found
===> xchat-1.3.8 depends on shared library: X11.6 - found
...
[install routines snipped]
...
===> Generating temporary packing list
===> Installing xchat docs in /usr/X11R6/share/doc/xchat
===> Registering installation for xchat-1.3.8
&prompt.root;As you can see, the only difference is the line that tells
you where the system is fetching the port from.That about does it for installing ports onto your system.
In the section you will learn how to remove a port from your
system.Removing Installed PortsNow that you know how to install ports, you are probably
wondering how to remove them, just in case you install one and
later on you decide that you installed the wrong port. The next
few paragraphs will cover just that.Now we will remove our previous example (which was xchat for
those of you not paying attention). As with installing ports,
the first thing you must do is change to the port directory,
which if you remember was
/usr/ports/irc/xchat. After you change
directories, you are ready to uninstall xchat. This is done with
the make deinstall command (makes sense
right?):&prompt.root; cd /usr/ports/irc/xchat
&prompt.root; make deinstall
===> Deinstalling for xchat-1.3.8
&prompt.root;That was easy enough. You have now managed to remove xchat
from your system. If you would like to reinstall it, you can do
so by running make reinstall from the
/usr/ports/irc/xchat directory.TroubleshootingThe following sections cover some of the more frequently asked
questions about the Ports collection and some basic troubleshooting
techniques, and what do to if a port is broken.Some Questions and AnswersI thought this was going to be a discussion about
modems??!Ah, you must be thinking of the serial ports on the back
of your computer. We are using port here to
mean the result of porting a program from one
version of UNIX to another.
-
-
- I thought you were supposed to use packages to install
- extra programs?
-
-
-
- Yes, that is usually the quickest and easiest way of
- doing it.
-
-
-
-
-
- So why bother with ports then?
-
-
-
- Several reasons:
-
-
-
- The licensing conditions of some software
- distributions forbid binary distribution. They must be
- distributed as source code.
-
-
-
- Some people do not trust binary distributions. At
- least with source code, you can (in theory) read through
- it and look for potential problems yourself.
-
-
-
- If you have local patches, you will need the source in
- order to apply them.
-
-
-
- You might have opinions on how a program should be
- compiled that differ from the person who did the
- package—some people have strong views on what
- optimization settings should be used, whether to build
- debug versions and then strip them or not, and so on.
-
-
-
- Packages are normally built with quite conservative
- settings. If a port has a compilation option to use code
- for a specific processor, or a particular add-on board you
- can enable this yourself in the port, without the people
- making the package having to produce many, many different
- packaged versions.
-
- The most obvious exception to this rule is paper sizes.
- If a package can be provided with default support for
- different paper sizes we will often provide multiple
- packages, one per paper size.
-
-
-
- Some people like having code around, so they can read
- it if they get bored, hack it, borrow from it (license
- permitting, of course), and so on.
-
-
-
- If you ain't got the source, it ain't software!
- ;-)
-
-
-
-
-
What is a patch?A patch is a small file that specifies how to go from
one version of a file to another. It contains plain text,
and basically says things like delete line 23,
add these two lines after line 468, or
change line 197 to this. They are also known
as diffs because they are generated by the
diff program.What is all this about
tarballs?It is a file ending in .tar, or
with variations such as .tar.gz,
.tar.Z, .tar.bz2,
and even .tgz.Basically, it is a directory tree that has been archived
into a single file (.tar) and
optionally compressed (.gz). This
technique was originally used for Tape
ARchives (hence the name
tar), but it is a widely used way of
distributing program source code around the Internet.You can see what files are in them, or even extract them
yourself by using the standard UNIX tar program, which comes
with the base FreeBSD system, like this:&prompt.user; tar tvzf foobar.tar.gz
&prompt.user; tar xzvf foobar.tar.gz
&prompt.user; tar tvf foobar.tar
&prompt.user; tar xvf foobar.tarAnd a checksum?It is a number generated by adding up all the data in
the file you want to check. If any of the characters
change, the checksum will no longer be equal to the total,
so a simple comparison will allow you to spot the
difference.I did what you said for compiling ports from a CDROM and
it worked great until I tried to install the kermit
port.&prompt.root; make install
>> cku190.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch from ftp://kermit.columbia.edu/kermit/archives/.Why can it not be found? Have I got a dud CDROM?As was explained in the compiling ports from CDROM
section, some ports cannot be put on the CDROM set
due to licensing restrictions. Kermit is an example of
that. The licensing terms for kermit do not allow us to put
the tarball for it on the CDROM, so you will have to fetch
it by hand—sorry!The reason why you got all those error messages was
because you were not connected to the Internet at the time.
Once you have downloaded it from any of the MASTER_SITES
(listed in the Makefile), you can restart the install
process.I did that, but when I tried to put it into
/usr/ports/distfiles I got some error
about not having permission.The ports mechanism looks for the tarball in
/usr/ports/distfiles, but you will not
be able to copy anything there because it is symlinked to
the CDROM, which is read-only. You can tell it to look
somewhere else by doing:&prompt.root; make DISTDIR=/where/you/put/it installDoes the ports scheme only work if you have everything
in /usr/ports? My system administrator
says I must put everything under
/u/people/guests/wurzburger, but it
does not seem to work.You can use the PORTSDIR and
PREFIX variables to tell the ports
mechanism to use different directories. For
instance,&prompt.root; make PORTSDIR=/u/people/guests/wurzburger/ports installwill compile the port in
/u/people/guests/wurzburger/ports and
install everything under
/usr/local.&prompt.root; make PREFIX=/u/people/guests/wurzburger/local installwill compile it in /usr/ports and
install it in
/u/people/guests/wurzburger/local.And of course,&prompt.root; make PORTSDIR=../ports PREFIX=../local installwill combine the two (it is too long to write fully on
the page, but it should give you the general idea).Some ports that use &man.imake.1; (a part of the X Windows
System) don't work well with PREFIX, and will insist on
installing under /usr/X11R6. Similarly, some Perl ports
ignore PREFIX and install in the Perl tree. Making these
ports respect PREFIX is a difficult or impossible
job.If you do not fancy typing all that in every time you
install a port, it is a good idea to put these variables
into your environment. Read the man page for your shell for
instructions on doing so.I do not have a FreeBSD CDROM, but I would like to have
all the tarballs handy on my system so I do not have to wait
for a download every time I install a port. Is there any
way to get them all at once?To get every single tarball for the Ports collection,
do:&prompt.root; cd /usr/ports
&prompt.root; make fetchFor all the tarballs for a single ports directory,
do:&prompt.root; cd /usr/ports/directory
&prompt.root; make fetchand for just one port—well, I think you have
guessed already.I know it is probably faster to fetch the tarballs from
one of the FreeBSD mirror sites close by. Is there any way
to tell the port to fetch them from servers other than the
ones listed in the MASTER_SITES?Yes. If you know, for example, that ftp.FreeBSD.org is much closer to you
than the sites listed in MASTER_SITES,
do as follows:&prompt.root; cd /usr/ports/directory
&prompt.root; make MASTER_SITE_OVERRIDE= \
ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/distfiles/ fetchI want to know what files make is
going to need before it tries to pull them down.make fetch-list will display a list
of the files needed for a port.Is there any way to stop the port from compiling? I
want to do some hacking on the source before I install it,
but it is a bit tiresome to watch it and hit control-C every
time.Doing make extract will stop it
after it has fetched and extracted the source code.I am trying to make my own port and I want to be able
to stop it compiling until I have had a chance to see if my
patches worked properly. Is there something like
make extract, but for patches?Yep, make patch is what you want.
You will probably find the PATCH_DEBUG
option useful as well. And by the way, thank you for your
efforts!I have heard that some compiler options can cause bugs.
Is this true? How can I make sure that I compile ports
with the right settings?Yes, with version 2.6.3 of gcc (the
version shipped with FreeBSD 2.1.0 and 2.1.5), the
option could result in buggy code
unless you used the
option as well. (Most of the ports do not use
). You should be
able to specify the compiler options used by something
like:&prompt.root; make CFLAGS='-O2 -fno-strength-reduce' installor by editing /etc/make.conf, but
unfortunately not all ports respect this. The surest way
is to do make configure, then go into
the source directory and inspect the Makefiles by hand, but
this can get tedious if the source has lots of
sub-directories, each with their own Makefiles.The default FreeBSD compiler options are quite conservative,
so if you have not changed them you should not have any
problems.There are so many ports it is hard to find the one I
want. Is there a list anywhere of what ports are
available?Look in the INDEX file in
/usr/ports. If you would like to
search the ports collection for a keyword, you can do that
too. For example, you can find ports relevant to the LISP
programming language using:&prompt.user; cd /usr/ports
&prompt.user; make search key=lispI went to install the foo port but
the system suddenly stopped compiling it and starting
compiling the bar port. What is going
on?The foo port needs something that is
supplied with bar — for instance,
if foo uses graphics,
bar might have a library with useful
graphics processing routines. Or bar
might be a tool that is needed to compile the
foo port. I installed the
grizzle program from the ports and
frankly it is a complete waste of disk space. I want to
delete it but I do not know where it put all the files.
Any clues?No problem, just do:&prompt.root; pkg_delete grizzle-6.5Alternatively, you can do:&prompt.root; cd /usr/ports/somewhere/grizzle
&prompt.root; make deinstallHang on a minute, you have to know the version number
to use that command. You do not seriously expect me to
remember that, do you??Not at all, you can find it out by doing:&prompt.root; pkg_info -a | grep grizzle
Information for grizzle-6.5:
grizzle-6.5 - the combined piano tutorial, LOGO interpreter and shoot 'em up
arcade game.Talking of disk space, the ports directory seems to be
taking up an awful lot of room. Is it safe to go in there
and delete things?Yes, if you have installed the program and are fairly
certain you will not need the source again, there is no
point in keeping it hanging around. The best way to do
this is:&prompt.root; cd /usr/ports
&prompt.root; make cleanwhich will go through all the ports subdirectories and
delete everything except the skeletons for each
port.I tried that and it still left all those tarballs or
whatever you called them in the
distfiles directory. Can I delete
those as well?Yes, if you are sure you have finished with them,
those can go as well. They can be removed manually, or by
using make distclean.I like having lots and lots of programs to play with.
Is there any way of installing all the ports in one
go?Just do:&prompt.root; cd /usr/ports
&prompt.root; make installBe careful, as some ports may install files with the same
name. If you install two graphics ports and they both install
/usr/local/bin/plot then you will obviously
have problems.OK, I tried that, but I thought it would take a very
long time so I went to bed and left it to get on with it.
When I looked at the computer this morning, it had only
done three and a half ports. Did something go
wrong?No, the problem is that some of the ports need to ask
you questions that we cannot answer for you (e.g., Do
you want to print on A4 or US letter sized paper?)
and they need to have someone on hand to answer
them.I really do not want to spend all day staring at the
monitor. Any better ideas?OK, do this before you go to bed/work/the local
park:&prompt.root cd /usr/ports
&prompt.root; make -DBATCH installThis will install every port that does
not require user input. Then, when
you come back, do:&prompt.root; cd /usr/ports
&prompt.root; make -DIS_INTERACTIVE installto finish the job.At work, we are using frobble, which
is in your Ports collection, but we have altered it quite a
bit to get it to do what we need. Is there any way of making
our own packages, so we can distribute it more easily around
our sites?No problem, assuming you know how to make patches for
your changes:&prompt.root; cd /usr/ports/somewhere/frobble
&prompt.root; make extract
&prompt.root; cd work/frobble-2.8
[Apply your patches]
&prompt.root; cd ../..
&prompt.root; make packageThis ports stuff is really clever. I am desperate to
find out how you did it. What is the secret?Nothing secret about it at all, just look at the
bsd.port.mk and
bsd.port.subdir.mk files in your
makefiles
directory.(Readers with an aversion to intricate shell-scripts are
advised not to follow this link...)Help! This port is broken!If you come across a port that doesn't work for you, there are
a few things you can do, including:Fix it! The how to make a
port section should help you do this.Gripe—by email only! Send
email to the maintainer of the port first. Type make
maintainer or read the Makefile
to find the maintainer's email address. Remember to include
the name and version of the port (send the
$FreeBSD: line from the
Makefile) and the output leading up to the
error when you email the maintainer. If you do not get a
response from the maintainer, you can use
send-pr to submit a bug report.Forget about it. This is the easiest route—very
few ports can be classified as essential. There's
also a good chance any problems will be fixed in the next
version when the port is updated.Grab the package from an ftp site near you. The
master package collection is on ftp.FreeBSD.org in the packages
directory, but be sure to check your local mirror
first! These are more likely to work
than trying to compile from source and are a lot faster as
well. Use the &man.pkg.add.1; program to install the package
on your system.Advanced TopicsThe documentation that was here has been moved to its own Porter's Handbook for ease of
reference. Please go there if you wish to create and submit your own
ports.