Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jun 1996 19:17:36 -0700 (PDT)
From:      Annelise Anderson <ANDRSN@HOOVER.STANFORD.EDU>
To:        freebsd-doc@freebsd.org
Cc:        fdocs@jraynard.demon.co.uk
Subject:   Re: Revised ports entry for handbook
Message-ID:  <01I67XXHPFB600AE9A@HOOVER.STANFORD.EDU>

next in thread | raw e-mail | index | archive | help
Here are a few comments on the port installation document, just
quoting the parts of it on which I have questions/comments.
   
>   Fear not, gentle reader, all will become clear (hopefully). Let's see
>   what happens if we try and install a port. I've chose `bash', also
>   known as the Bourne-Again Shell, as that seems fairly typical.
>   
>   Note if you're trying this at home, you'll need to be root.
   
># make install

Before you get this far, you might want to explain that all ports
involve two parts, the skeleton files and the source file (also known
as the distfile), and possibly even that the skeleton files look
(by default) for the distfile in /usr/ports/distfiles; and that the
skeleton files include a Makefile; and finally that "make install" is
the basic command for making a port, and that it's invoked in the
directory of the skeleton files that includes the Makefile (and this
directory must be writable).  

>    8. Register the installation in the packages database. This means
>       that, if you don't like the program, you can cleanly remove all
>       traces of it from your system.

Interesting, there's no evidence in my packages database for any port
I've ever done, except for those done using lndir.
   
>1.3.1. Compiling ports from CDROM
  
>   This is pretty straightforward. First make sure the FreeBSD CDROM is
>   in the drive and mounted on, say, /cdrom. Then, if you're interested
>   in, say, the gnats port in the databases directory, do

># mkdir /usr/ports
># cd /usr/ports
># ln -s /cdrom/ports distfiles distfiles

Once this symbolic link is established (assuming a / between ports
and distfiles instead of a space), attempts to ftp for the source
tarball will fail, because the write will be to the cdrom.  Nor will
it be possible (I think) to get the distfile and put it in
/usr/ports/distfiles, as a user without (yet) access to the Internet
from FreeBSD might try to do (or one who wants the "latest" port).

Script started on Sat Jun 22 13:54:07 1996
andrsn: {1} make
>> cku190.tar.gz doesn't seem to exist on this system.
>> Attempting to fetch from ftp://kermit.columbia.edu/kermit/archives/.
NcFTP:  and . (30): Read-only file system
....
>> Couldn't fetch it - please try to retreive this
>> port manually into /usr/ports/distfiles and try again.
*** Error code 1
Stop.
....
andrsn: {2} exit

On the other hand if the symbolic link isn't there, the program won't
find any tarball on the cdrom and it won't be able to get the other
programs that might be needed--e.g., xv needs jpeg and tiff but won't
get them.  

># cd /usr/ports
># mkdir databases
># cp -R /cdrom/ports/databases/gnats databases
># cd databases/gnats
># make install

Sometimes "make all install" is suggested.  This is unnecessary or
identical?
   
>   If you don't like the above methods, here's a completely different way
>   of doing it:-

There are good reasons why I shouldn't like the above methods!  Definitely
inferior.
   
   >The ports collection is easy to use from CDROM, and all you need to do
   >is to create a "link tree" to it using the lndir(1) command that comes
   >with the XFree86 distribution. Find a location with some free space
   >and create a directory there, and make a symbolic link from /usr/ports

This symbolic link has no purpose unless one has two /usr partitions?

>   to that directory. Then invoke the lndir(1) command with the full
>   pathname of the ``ports'' directory on the CDROM as an argument (this
>   might be, for example, something like: lndir /cdrom/ports). Then you
>   can build ports directly off the CDROM by building them in the link
>   tree you have created.

You might want to provide the full command here--
lndir /cdrom/ports /usr/ports
or lndir /cdrom/ports /usr/local/xxx, where /usr/local/xxx is the
directory to which /usr/ports is symbolically linked (??? not so
simple and obvious, is it) rather than depending on the user being 
in the right place and knowing that the second argument to lndir is 
the present working directory.

When lndir is used, /usr/ports/distfiles is checked first for the
distfile.  This is a writable directory, so if the user has gotten
the distfile in some round-about way, it can be put there.  (I wanted
MIT's "distfile" for pgp, for example, because I trust this site more
than the default location in the Makefile.)

Also if the Makefile for a particular port needs to be edited (as
does the Makefile for pgp), the symbolic link to the Makefile on the
cdrom can be deleted and the Makefile itself copied to the appropriate
directory, where it can be edited.  (It might need to be explained
that lndir creates symbolic links to files, so that the use of
lndir is not confused with the symbolic-link approach described
earlier.)

Furthermore when using lndir any other ports needed will be found, e.g.,
xv will be able to find jpeg and tiff.

It seems to me the lndir approach to ports is so obviously superior to
a symbolic link to the distfiles on the cdrom or not using a symbolic
link or lndir that it's worth explaining, and worth explaining how to
get lndir if X-Windows isn't installed (is it on the live file system?
or could one do a minimal X-Windows installation, copy lndir to
/usr/local/bin or elsewhere, and zap X-Windows if one doesn't want it?
why not include lndir in the basic distribution?).

Presumably an alternative is to copy the entire /cdrom/ports structure
to /usr/ports.  This takes maybe 3 megabytes, whereas the lndir link
takes almost nothing?
   
>   With half a dozen straightforward commands, we have now got a set of
>   database programs on our FreeBSD machine! All we did that was
>   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?

Unless the port needs something else that's not available...in which
case it will just quit, and the user will have to get what it needs and
install it first.  [The paragraph deals with porting without the cdrom.]
   
>     * Q. I want to know what files make is going to need before it tries
>       to pull them down.
>       
>       A. 'make fetch-list' will display a list of the files needed for a
>       port.

Whether one gets the skeleton files by ftp or from the cdrom, where is
the make fetch-list command issued?  I can't make it work on freefall.
       
>     * Q. There's so many ports it's hard to find the one I want. Is
>       there a list anywhere of what ports are available?
>       
>       A. Look in the INDEX file in /usr/ports.
>       
>     * Q. I'm in the gronkulators directory in ports, and I'd like to see
>       a brief summary of each port. Is this possible?
>       
>       A. Yes. The ``official'' way to do this is 'make describe', but I
>       prefer the output from
       
>for i in *; do echo -n $i": "; cat $i/pkg/COMMENT; done

One could substitute DESCR for COMMENT in the above and get a more
complete description?  Could one send this to a file?  (And where should
the make describe command be invoked?)
   
>       or the equivalent in the C and tcsh shells (sorry guys, you'll
>       have to work that out for yourselves).

I have used the following to get, for example, all the descriptions
of the ports or packages for printing.  The /cdrom/ports/*/*/pkg/DESCR
is the only place, as far as I know, that these more complete descriptions
are available.  I think "make describe" uses the COMMENT text.
       
#!/bin/csh
foreach f ( /cdrom/ports/print/*/pkg/DESCR )
cat $f >> /usr/local/print.txt
end

In any event the new write-up is a great improvement over what was
there before!  

Annelise



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01I67XXHPFB600AE9A>