Reflect fact that ftp.freebsd.org no longer offers compression on the fly.

Also a little cleaning while I'm here.
This commit is contained in:
James Raynard 1997-12-06 01:35:40 +00:00
parent 5038e5588e
commit 76384386d9
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=2237

View file

@ -1,4 +1,4 @@
<!-- $Id: ports.sgml,v 1.27 1997-09-12 21:52:23 helbig Exp $ -->
<!-- $Id: ports.sgml,v 1.28 1997-12-06 01:35:40 jraynard Exp $ -->
<!-- The FreeBSD Documentation Project -->
<chapt><heading>Installing Applications: The Ports collection<label id="ports"></heading>
@ -38,20 +38,18 @@ system utilities, but a lot of popular programs are not in the base
system, for good reasons:-
<enum>
<item>``I can not live without x y and z on my system'' type programs
(eg a certain Lisp-based editor, or the mtools set of programs for
dealing with DOS floppy disks), because it is too subjective (many
people can not stand Emacs and/or never use DOS floppies and seem none
the worse for it).
<item>Programs that some people cannot live without and other people
cannot stand, such as a certain Lisp-based editor.
<item>Too specialised to put in the base system (CAD, databases).
<item>Programs which are too specialised to put in the base system
(CAD, databases).
<item>Programs which fall into the ``I would not mind having a look at
<item>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).
<item>``Wow fab this is way cool'' fun type programs that could not
possibly be supplied with a serious operating system like FreeBSD ;-)
<item>Programs that are far too much fun to be supplied with a serious
operating system like FreeBSD ;-)
<item>However many programs you put in the base system, people will
always want more, and a line has to be drawn somewhere (otherwise
@ -88,9 +86,9 @@ user to be able to work it out. They also supply their own customised
can be built in the same way.
<p>
If you look at a port skeleton (either on <htmlurl
url="file://localhost/usr/ports/shells/bash" name="your FreeBSD
url="file://localhost/usr/ports/devel/ElectricFence" name="your FreeBSD
system"> or <htmlurl
url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/shells/bash" name="the
url="ftp://ftp.freebsd.org/pub/FreeBSD/ports/devel/ElectricFence" name="the
FTP site">) and expect to find all sorts of pointy-headed rocket
science lurking there, you may be disappointed by the one or two
rather unexciting-looking files and directories you find there.
@ -98,54 +96,49 @@ rather unexciting-looking files and directories you find there.
name="Getting a port">).
<p>``How on earth can this do anything?'' I hear you cry. ``There
is not even any source code there!''
is no source code there!''
<p> Fear not, gentle reader, all will become clear (hopefully). Let's
see what happens if we try and install a port. I have chosen `bash', also
known as the Bourne-Again Shell, as that seems fairly typical.
see what happens if we try and install a port. I have chosen `ElectricFence',
a useful tool for developers, as the skeleton is more straightforward than
most.
<em>Note</em> if you are trying this at home, you will need to be root.
<verb>
# cd /usr/ports/shells/bash
# make install
Checksums OK.
===> Extracting for bash-1.14.5
===> Patching for bash-1.14.5
===> Applying FreeBSD patches for bash-1.14.5
===> Configuring for bash-1.14.5
===> Building for bash-1.14.5
[lots and lots of compiler output here...]
===> Installing for bash-1.14.5
make -f bash-Makefile bindir=/usr/local/bin prefix=/usr/local install
(cd ./documentation/; make )
rm -f builtins.txt
nroff -man builtins.1 > builtins.txt
install -c -o bin -g bin -m 555 bash /usr/local/bin/bash
install -c -o bin -g bin -m 555 bashbug /usr/local/bin/bashbug
( cd ./documentation/ ; make mandir=/usr/local/man/man1 man3dir=/usr/local/man/man3 infodir=/usr/local/info install )
[ -d /usr/local/man/man1 ] || mkdir /usr/local/man/man1
[ -d /usr/local/info ] || mkdir /usr/local/info
../support/install.sh -c -m 644 bash.1 /usr/local/man/man1
../support/install.sh -c -m 644 builtins.1 /usr/local/man/man1/bash_builtins.1
../support/install.sh -c -m 644 features.info /usr/local/info/bash.info
gzip -9nf /usr/local/man/man1/bash.1 /usr/local/man/man1/bash_builtins.1
===> Registering installation for bash-1.14.5
# cd /usr/ports/devel/ElectricFence
# make install
>> Checksum OK for ElectricFence-2.0.5.tar.gz.
===> Extracting for ElectricFence-2.0.5
===> Patching for ElectricFence-2.0.5
===> Applying FreeBSD patches for ElectricFence-2.0.5
===> Configuring for ElectricFence-2.0.5
===> Building for ElectricFence-2.0.5
[lots of compiler output...]
===> Installing for ElectricFence-2.0.5
===> Warning: your umask is "0002".
If this is not desired, set it to an appropriate value
and install this port again by ``make reinstall''.
install -c -o bin -g bin -m 444 /usr/ports/devel/ElectricFence/work/ElectricFence-2.0.5/libefence.a /usr/local/lib
install -c -o bin -g bin -m 444 /usr/ports/devel/ElectricFence/work/ElectricFence-2.0.5/libefence.3 /usr/local/man/man3
===> Compressing manual pages for ElectricFence-2.0.5
===> Registering installation for ElectricFence-2.0.5
</verb>
<p> To avoid confusing the issue, I have slightly pruned the install
output, as well as completely removing the build output. If you tried
this yourself, you may well have got something like this at the start:-
<p> To avoid confusing the issue, I have completely removed the build output.
<p>If you tried this yourself, you may well have got something like this at
the start:-
<label id="ports:fetch">
<verb>
>> bash-1.14.5.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch from ftp://slc2.ins.cwru.edu/pub/dist/.
# make install
>> ElectricFence-2.0.5.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch from ftp://ftp.doc.ic.ac.uk/Mirrors/sunsite.unc.edu/pub/Linux/devel/lang/c/.
</verb>
<p> The `make' program has noticed that you did not have a local copy
of the source code and tried to FTP it down so it could get the job
done (are you starting to feel impressed? 8-)). I already had the
done. I already had the
source handy in my example, so it did not need to fetch it.
<p> Let's go through this and see what the `make' program was doing.
@ -157,7 +150,7 @@ FTP site.
<item> Run a <ref id="ports:checksum" name="checksum"> test on the
tarball to make sure it has not been tampered with, accidentally
truncated, struck by neutrinos while in transit, etc.
truncated, downloaded in ASCII mode, struck by neutrinos while in transit, etc.
<item> Extract the tarball into a temporary work directory.
@ -181,8 +174,8 @@ id="ports:remove" name="remove"> all traces of it from your system.
</enum>
<p> See if you can match these steps to the make output. And if you
were not impressed before, you should be by now!
<p> Scroll up to the make output and see if you can match these steps to it.
And if you were not impressed before, you should be by now!
<sect><heading>Getting a FreeBSD Port<label id="ports:getting"></heading>
<p>
@ -208,7 +201,7 @@ say, /cdrom. Then do
to enable the ports make mechanism to find the tarballs (it expects to
find them in /usr/ports/distfiles, which is why we sym-linked the
CDROM's tarball directory to there).
CDROM's tarball directory to that directory).
<p>
Now, suppose you want to install the gnats program from the databases
directory. Here is how to do it:-
@ -264,13 +257,12 @@ If you do not have a CDROM, or you want to make sure you get the very
latest version of the port you want, you will need to download the
<ref id="ports:skeleton" name="skeleton"> for the port. Now this
might sound like rather a fiddly job
full of pitfalls, like downloading the patches into the pkg
sub-directory by mistake, but it is actually very easy.
full of pitfalls, but it is actually very easy.
<p>
The key to it is that the FreeBSD FTP server can create on-the-fly
<ref id="ports:tarball" name="tarballs"> for you. Here is how it works,
with the gnats program in the databases directory as an example (the
bits in square brackets are comments, do not type them in if you are
bits in square brackets are comments. Do not type them in if you are
trying this yourself!):-
<verb>
@ -279,21 +271,19 @@ trying this yourself!):-
# cd databases
# ftp ftp.freebsd.org
[log in as `ftp' and give your email address when asked for a
password. Remember to use binary (aka image) mode!]
password. Remember to use binary (also known as image) mode!]
> cd /pub/FreeBSD/ports/databases
> get gnats.tar.gz [tarballs up the gnats skeleton for us]
> get gnats.tar [tars up the gnats skeleton for us]
> quit
# tar xzf gnats.tar.gz [extract the gnats skeleton]
# tar xf gnats.tar [extract the gnats skeleton]
# cd gnats
# make install [build and install gnats]
</verb>
What happened here? We connected to the FTP server in the usual way
and went to its databases sub-directory. When we gave it the command
`get gnats.tar.gz', the FTP server <ref id="ports:tarball"
name="tarballed"> up the gnats directory for us and even went to the
trouble of compressing it before sending it so we could get our hands
on it a little quicker.
`get gnats.tar', the FTP server <ref id="ports:tarball"
name="tarred"> up the gnats directory for us.
<p>
We then extracted the gnats skeleton and went into the gnats directory
to build the port. As we explained <ref id="ports:fetch"
@ -309,11 +299,11 @@ database skeletons in the ports collection. It looks almost the same:-
# cd /usr/ports
# ftp ftp.freebsd.org
[log in as `ftp' and give your email address when asked for a
password. Remember to use binary (aka image) mode!]
password. Remember to use binary (also known as image) mode!]
> cd /pub/FreeBSD/ports
> get databases.tar.gz [tarballs up the databases directory for us]
> get databases.tar [tars up the databases directory for us]
> quit
# tar xzf databases.tar.gz [extract all the database skeletons]
# tar xf databases.tar [extract all the database skeletons]
# cd databases
# make install [build and install all the database ports]
</verb>
@ -324,12 +314,8 @@ different from getting a single port skeleton and building it was that
we got a whole directory at once, and compiled everything in it at
once. Pretty impressive, no?
<p>
If you expect to be installing more than one or two ports, it is
probably worth downloading all the ports directories - this involves
downloading 2 or 3MB, when they are compressed. However, don't get
carried away and type 'get ports.tar.gz' unless you are prepared to
download the distfiles directory as well - this contains the source
code for every single port and will take a very long time to download!
If you expect to be installing many ports, it is
probably worth downloading all the ports directories.
<sect><heading>Skeletons<label id="ports:skeleton"></heading>
<p>
@ -342,29 +328,31 @@ needed to make the ports magic work.
<p>
The most important component of a skeleton is the Makefile. This contains
various statements that specify how the port should be compiled and
installed. Here is the Makefile for bash:-
installed. Here is the Makefile for ElectricFence:-
<verb>
# New ports collection makefile for: bash
# Version required: 1.14.5
# Date created: 21 August 1994
# Whom: jkh
#
# Makefile,v 1.13 1995/10/04 14:45:01 asami Exp
#
DISTNAME= bash-1.14.5
CATEGORIES= shells
MASTER_SITES= ftp://slc2.ins.cwru.edu/pub/dist/
MAINTAINER= ache@FreeBSD.ORG
post-install:
.if !defined(NOMANCOMPRESS)
gzip -9nf ${PREFIX}/man/man1/bash.1 ${PREFIX}/man/man1/bash_builtins.1
.endif
.include &lt;bsd.port.mk>
# New ports collection makefile for: Electric Fence
# Version required: 2.0.5
# Date created: 13 November 1997
# Whom: jraynard
#
# $Id: ports.sgml,v 1.28 1997-12-06 01:35:40 jraynard Exp $
#
DISTNAME= ElectricFence-2.0.5
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SUNSITE}
MASTER_SITE_SUBDIR= devel/lang/c
MAINTAINER= jraynard@freebsd.org
MAN3= libefence.3
do-install:
${INSTALL_DATA} ${WRKSRC}/libefence.a ${PREFIX}/lib
${INSTALL_MAN} ${WRKSRC}/libefence.3 ${PREFIX}/man/man3
.include <bsd.port.mk>
</verb>
The lines beginning with a &quot;#&quot; sign are comments for the benefit
@ -373,7 +361,8 @@ of human readers (as in most Unix script files).
`DISTNAME&quot; specifies the name of the <ref id="ports:tarball"
name="tarball">, but without the extension.
<p>
`CATEGORIES&quot; states what kind of program this is.
`CATEGORIES&quot; states what kind of program this is. In this case, a
utility for developers.
<p>
`MASTER_SITES&quot; is the URL(s) of the master FTP site, which is
used to retrieve the <ref id="ports:tarball" name="tarball"> if it is not
@ -384,11 +373,7 @@ on the Internet).
<p>
`MAINTAINER&quot; is the email address of the person who is
responsible for updating the skeleton if, for example a new version
of the program comes out. (Note: The title of &quot;maintainer&quot;
is mainly an administrative one; it does <em /not/ mean the person
concerned is responsible for supporting the program. If you have any
<ref id="ports:kaput" name="problems with a port,"> please mail
&a.ports; and <em /not/ the maintainer. Thank you!)
of the program comes out.
<p>
Skipping over the next few lines for a minute, the line
<verb>
@ -401,10 +386,12 @@ no point in duplicating them all over the place, so they are kept in a
single standard file.
<p>
This is probably not the place to go into a detailed examination of
how Makefiles work; suffice it to say that the lines starting with
`post-install&quot; over-ride the instructions in bsd.port.mk
about what to do after installing the program, so that the man pages
can be compressed after they have been put in their final destination.
how Makefiles work; suffice it to say that the line starting with ``MAN3''
ensures that the ElectricFence man page is compressed after installation,
to help conserve your precious disk space. The original port did not
provide an ``install'' target, so the three lines from ``do-install''
ensure that the files produced by this port are placed in the correct
destination.
<sect1><heading>The files directory</heading>
<p>
@ -538,11 +525,11 @@ generated by a program of that name.
<item><label id="ports:tarball">
Q. What is all this about tarballs?
<p>
A. It is a file ending in .tar.gz (with variations like .tar.Z, or
A. It is a file ending in .tar or .tar.gz (with variations like .tar.Z, or
even .tgz if you are trying to squeeze the names into a DOS filesystem).
<p>
Basically, it is a directory tree that has been archived into a single
file (.tar) and then compressed (.gz). This technique was originally
file (.tar) and optionally compressed (.gz). This technique was originally
used for <em /T/ape <em /AR/chives (hence the name `tar'), but it is a
widely used way of distributing program source code around the
Internet.
@ -554,6 +541,8 @@ system, like this:-
<verb>
tar tvzf foobar.tar.gz # View contents of foobar.tar.gz
tar xzvf foobar.tar.gz # Extract contents into the current directory
tar tvf foobar.tar # View contents of foobar.tar
tar xvf foobar.tar # Extract contents into the current directory
</verb>
<item><label id="ports:checksum">
@ -609,14 +598,14 @@ A. You can use the PORTSDIR and PREFIX variables to tell the ports
mechanism to use different directories. For instance,
<verb>
PORTSDIR=/u/people/guests/wurzburger/ports make install
make PORTSDIR=/u/people/guests/wurzburger/ports install
</verb>
will compile the port in /u/people/guests/wurzburger/ports and install
everything under /usr/local.
<verb>
PREFIX=/u/people/guests/wurzburger/local make install
make PREFIX=/u/people/guests/wurzburger/local install
</verb>
will compile it in /usr/ports and install it in
@ -625,7 +614,7 @@ will compile it in /usr/ports and install it in
And of course
<verb>
PORTSDIR=.../ports PREFIX=.../local make install
make PORTSDIR=.../ports PREFIX=.../local install
</verb>
will combine the two (it is too long to fit on the page if I write it
@ -687,7 +676,8 @@ Q. 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?
<p>
A. Yep, 'make patch' is what you want. And by the way, thank you for
A. 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!
<item>
@ -701,11 +691,11 @@ use -O2). You <em /should/ be able to specify the compiler options
used by something like
<verb>
# CFLAGS='-O2 -fno-strength-reduce' make install
make CFLAGS='-O2 -fno-strength-reduce' install
</verb>
or by editing /etc/make.conf, but this does not always seem to get
picked up. The surest way is to do 'make configure', then go into the
or 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.
@ -718,7 +708,7 @@ A. Look in the INDEX file in /usr/ports.
<item>
Q. I went to install the 'foo' port but the system suddenly stopped
and starting compiling the 'bar' port. What's going on?
compiling it and starting compiling the 'bar' port. What's going on?
<p>
A. The 'foo' port needs something that is supplied with 'bar' - for
instance, if 'foo' uses graphics, 'bar' might have a library with
@ -793,7 +783,7 @@ computer this morning, it had only done three and a half ports. Did
something go wrong?
<p>
A. No, the problem is that some of the ports need to ask you questions
that we can not answer for you (eg ``Do you want to print on A4 or US
that we cannot answer for you (eg ``Do you want to print on A4 or US
letter sized paper?'') and they need to have someone on hand to answer
them.