diff --git a/FAQ/preface.sgml b/FAQ/preface.sgml index 40466d0e46..729f511a0a 100644 --- a/FAQ/preface.sgml +++ b/FAQ/preface.sgml @@ -1,617 +1,617 @@ - + Preface

Welcome to the FreeBSD 2.X FAQ! What is the purpose of this FAQ?

As is usual with Usenet FAQs, this document aims to cover the most frequently asked questions concerning the FreeBSD operating system (and of course answer them!). Although originally intended to reduce bandwidth and avoid the same old questions being asked over and over again, FAQs have become recognized as valuable information resources.

Every effort has been made to make this FAQ as informative as possible; if you have any suggestions as to how it may be improved, please feel free to mail them to the . What is FreeBSD?

Briefly, FreeBSD 2.X is a UN*X-like operating system based on U.C. Berkeley's 4.4BSD-lite release for the i386 platform. It is also based indirectly on William Jolitz's port of U.C. Berkeley's Net/2 to the i386, known as 386BSD, though very little of the 386BSD code remains. A fuller description of what FreeBSD is and how it can work for you may be found on the .

FreeBSD is used by companies, Internet Service Providers, researchers, computer professionals, students and home users all over the world in their work, education and recreation. See some of them in the

For more detailed information on FreeBSD, please see the What are the goals of FreeBSD?

The goals of the FreeBSD Project are to provide software that may be used for any purpose and without strings attached. Many of us have a significant investment in the code (and project) and would certainly not mind a little financial compensation now and then, but we're definitely not prepared to insist on it. We believe that our first and foremost "mission" is to provide code to any and all comers, and for whatever purpose, so that the code gets the widest possible use and provides the widest possible benefit. This is, we believe, one of the most fundamental goals of Free Software and one that we enthusiastically support.

That code in our source tree which falls under the GNU Public License (GPL) or GNU Library Public License (GLPL) comes with slightly more strings attached, though at least on the side of enforced access rather than the usual opposite. Due to the additional complexities that can evolve in the commercial use of GPL software, we do, however, endeavor to replace such software with submissions under the more relaxed BSD copyright whenever possible. Why is it called FreeBSD?

It may be used free of charge, even by commercial users. Full source for the operating system is freely available, and the minimum possible restrictions have been placed upon its use, distribution and incorporation into other work (commercial or non-commercial). Anyone who has an improvement and/or bug fix is free to submit their code and have it added to the source tree (subject to one or two obvious provisos).

For those of our readers whose first language is not English, it may be worth pointing out that the word ``free'' is being used in two ways here, one meaning ``at no cost'', the other meaning ``you can do whatever you like''. Apart from one or two things you What is the latest version of FreeBSD? -

Version Version is the latest stable version; it was released in December, 1998. This is also the latest release version.

Briefly explained, -stable is aimed at the ISP or other corporate user who wants stability and a low change count over the wizzy new features of the latest release. At the moment, these versions are one and the same, but it shouldn't be long before the -current branch is polished enough for general release.

This is not to say that a 3.0-STABLE release is unusable for business services, and many people who need some 3.0 specific feature (newer compiler technology, faster networking code, etc) have decided to take a chance with it with very good results. We simply do not wish to "certify" 3.0 as mission-worthy until it's been released as 3.1-RELEASE in February, 1999. What is FreeBSD-current?

is the development version of the operating system, which will in due course become 4.0-RELEASE. As such, it is really only of interest to developers working on the system and die-hard hobbyists. See the in the for details on running -current.

If you are not familiar with the operating system or are not capable of identifying the difference between a real problem and a temporary problem, you should not use FreeBSD-current. This branch sometimes evolves quite quickly and can be un-buildable for a number of days at a time. People that use FreeBSD-current are expected to be able to analyze any problems and only report them if they are deemed to be mistakes rather than ``glitches''. Questions such as ``make world produces some error about groups'' on the -current mailing list are sometimes treated with contempt.

Every now and again, a release is also made of this -current development code, CDROM distributions of the occasional snapshot even now being made available. The goals behind each snapshot release are: To test the latest version of the installation software. To give people who would like to run -current but who don't have the time and/or bandwidth to follow it on a day-to-day basis an easy way of bootstrapping it onto their systems. To preserve a fixed reference point for the code in question, just in case we break something really badly later. (Although CVS normally prevents anything horrible like this happening :) To ensure that any new features in need of testing have the greatest possible number of potential testers.

No claims are made that any snapshot can be considered ``production quality'' for any purpose. For stability and tested mettle, you will have to stick to full releases.

Snapshot releases are directly available from and are generated, on the average, once a day for both the 4.0-current and 3.0-stable branches. What is the FreeBSD-stable concept?

Back when FreeBSD 2.0.5 was released, we decided to branch FreeBSD development into two parts. One branch was named , with the intention that only well-tested bug fixes and small incremental enhancements would be made to it (for Internet Service Providers and other commercial enterprises for whom sudden shifts or experimental features are quite undesirable). The other branch was , which essentially has been one unbroken line leading towards 4.0-RELEASE (and beyond) since 2.0 was released. If a little ASCII art would help, this is how it looks: 2.0 | | | [2.1-stable] *BRANCH* 2.0.5 -> 2.1 -> 2.1.5 -> 2.1.6 -> 2.1.7.1 [2.1-stable ends] | (Mar 1997) | | | [2.2-stable] *BRANCH* 2.2.1 -> 2.2.2-RELEASE -> 2.2.5 -> 2.2.6 -> 2.2.7 -> 2.2.8 [end] | (Mar 1997) (Oct 97) (Apr 98) (Jul 98) (Dec 98) | | 3.0-SNAPs (started Q1 1997) | | 3.0.0-RELEASE (Oct 1998) | | [3.0-stable] *BRANCH* 3.1 (Feb 1999) -> ... future 3.x releases ... | | \|/ + [4.0-current continues]

The -current branch is slowly progressing towards 4.0 and beyond, the previous 2.2-stable branch having just retired with the release of 2.2.8. 3.0-stable has now replaced it, the next release coming up with 3.1 in early 1999. 4.0-current is now the "current branch", with the first 4.0 releases appearing in Q1 2000. When are FreeBSD releases made?

As a general principle, the FreeBSD core team only release a new version of FreeBSD when they believe that there are sufficient new features and/or bug fixes to justify one, and are satisfied that the changes made have settled down sufficiently to avoid compromising the stability of the release. Many users regard this caution as one of the best things about FreeBSD, although it can be a little frustrating when waiting for all the latest goodies to become available...

Releases are made about every 4 months on average.

For people needing (or wanting) a little more excitement, there are SNAPs released more frequently, particularly during the month or so leading up to a release. Is FreeBSD only available for PCs ?

FreeBSD 3.x currently runs on the as well as the x86 architecture. Some interest has also been expressed in a SPARC port, but details on this project are not yet clear. If your machine has a different architecture and you need something right now, we suggest you look at or . Who is responsible for FreeBSD?

The key decisions concerning the FreeBSD project, such as the overall direction of the project and who is allowed to add code to the source tree, are made by a of some 15 people. There is a much larger team of over 100 who are authorized to make changes directly to the FreeBSD source tree.

However, most non-trivial changes are discussed in advance in the , and there are no restrictions on who may take part in the discussion. Where can I get FreeBSD?

Every significant release of FreeBSD is available via anonymous ftp from the : For the current 2.2-stable release, 2.2.8R, see the directory. For the current 3.0-stable release, 3.0-RELEASE, see the directory. releases are made once a day along the RELENG_2_2 branch (post 2.2.8) as it slowly winds down in maintenance mode. The RELENG_2_2 branch is currently being carefully maintained by the legacy support folks and no changes other than those strictly necessary for security or reliability enhancements are now made. releases are also made once a day along the RELENG_3 branch (post 3.0-release) as it continues on its way towards 3.1-RELEASE. releases are made once a day for the branch, these being of service purely to bleeding-edge testers and developers.

FreeBSD is also available via CDROM, from the following place(s):

Walnut Creek CDROM 4041 Pike Lane, Suite F Concord, CA 94520 USA Orders: +1 800 786-9907 Questions: +1 925 674-0783 FAX: +1 925 674-0821 email: WWW:

In Australia, you may find it at:

Advanced Multimedia Distributors Factory 1/1 Ovata Drive Tullamarine, Melbourne Victoria Australia Voice: +61 3 9338 6777 CDROM Support BBS 17 Irvine St Peppermint Grove WA 6011 Voice: +61 9 385-3793 Fax: +61 9 385-2360 And in the UK: The Public Domain & Shareware Library Winscombe House, Beacon Rd Crowborough Sussex. TN6 1UL Voice: +44 1892 663-298 Fax: +44 1892 667-473 Where do I find info on the FreeBSD mailing lists?

You can find full information in the What FreeBSD news groups are available?

You can find full information in the Are there FreeBSD IRC (Internet Relay Chat) channels?

Yes, most major IRC networks host a FreeBSD chat channel: Channel #FreeBSD on EFNet is a FreeBSD forum, but don't go there for tech support or to try and get folks there to help you avoid the pain of reading man pages or doing your own research. It is a chat channel, first and foremost, and topics there are just as likely to involve sex, sports or nuclear weapons as they are FreeBSD. You Have Been Warned! Available at server irc.chat.org. Channel #FreeBSD on DALNET is available at irc.dal.net in the US and irc.eu.dal.net in Europe. Channel #FreeBSD on UNDERNET is available at us.undernet.org in the US and eu.undernet.org in Europe. Same provisions as for EFNET apply - either don't ask questions or learn to ask amazingly politely if you want help. It's a chat channel, not a help channel. Finally, you can also join #FreeBSD on BSDNET, a smaller BSD only chat network, at irc.FreeBSD.org. This network attempts to do more tech support and not be as anarchistic as EFNET, UNDERNET or DALNET, but it's also nowhere near as popular as a result. Why not volunteer to answer FreeBSD questions on BSDNET today?

Each of these channels are distinct and are not connected to each other. Their chat styles also differ, so you may need to try each to find one suited to your chat style. As with *all* types of IRC traffic, if you're easily offended or can't deal with lots of young people (and more than a few older ones) doing the verbal equivalent of jello wrestling, don't even bother with it. Books on FreeBSD

There is a FreeBSD Documentation Project which you may contact (or even better, join) on the doc mailing list: . This list is for discussion of the FreeBSD documentation. For actual questions about FreeBSD, there is the questions mailing list: .

A FreeBSD ``handbook'' is available, and can be found as: . Note that this is a work in progress, and so parts may be incomplete.

The definitive printed guide on FreeBSD is ``The Complete FreeBSD'', written by Greg Lehey and published by Walnut Creek CDROM Books. Now in its second edition, the book contains 1,750 pages of install & system administration guidance, program setup help, and manual pages. The book (and current FreeBSD release) can be ordered from , , or at your favorite bookstore. The ISBN is 1-57176-227-2.

However, as FreeBSD 2.2.X is based upon Berkeley 4.4BSD-Lite2, most of the 4.4BSD manuals are applicable to FreeBSD 2.2.X. O'Reilly and Associates publishes these manuals: 4.4BSD System Manager's Manual By Computer Systems Research Group, UC Berkeley 1st Edition June 1994, 804 pages : 1-56592-080-5 4.4BSD User's Reference Manual By Computer Systems Research Group, UC Berkeley 1st Edition June 1994, 905 pages : 1-56592-075-9 4.4BSD User's Supplementary Documents By Computer Systems Research Group, UC Berkeley 1st Edition July 1994, 712 pages : 1-56592-076-7 4.4BSD Programmer's Reference Manual By Computer Systems Research Group, UC Berkeley 1st Edition June 1994, 886 pages : 1-56592-078-3 4.4BSD Programmer's Supplementary Documents By Computer Systems Research Group, UC Berkeley 1st Edition July 1994, 596 pages : 1-56592-079-1

A description of these can be found via WWW as: . Due to poor sales, however, these manuals may be hard to get a hold of.

For a more in-depth look at the 4.4BSD kernel organization, you can't go wrong with:

McKusick, Marshall Kirk, Keith Bostic, Michael J Karels, and John Quarterman.

The Design and Implementation of the 4.4BSD Operating System. Reading, Mass. : Addison-Wesley, 1996. 0-201-54979-4

A good book on system administration is:

Evi Nemeth, Garth Snyder, Scott Seebass & Trent R. Hein, ``Unix System Administration Handbook'', Prentice-Hall, 1995 : 0-13-151051-7

This book covers the basics, as well as TCP/IP, DNS, NFS, SLIP/PPP, sendmail, INN/NNTP, printing, etc.. It's expensive (approx. US$45-$55), but worth it. It also includes a CDROM with the sources for various tools; most of these, however, are also on the FreeBSD 2.2.6R CDROM (and the FreeBSD CDROM often has newer versions). How do I access your Problem Report database?

The Problem Report database of all open user change requests may be queried (or submitted to) by using our web-based PR and interfaces. The send-pr(1) command can also be used to submit problem reports and change requests via electronic mail. Where can I get ASCII/PostScript versions of the FAQ?

The up-to-date FAQ is available from the FreeBSD Web Server or any mirror as PostScript and plain text (7 bit ASCII and 8-bit Latin1).

As PostScript (about 370KB):

As ASCII text (about 220KB):

As ISO 8859-1 text (about 220KB): Where can I get ASCII/PostScript versions of the Handbook?

The up-to-date Handbook is available from the FreeBSD Web Server or any mirror as PostScript and plain text (7 bit ASCII and 8-bit Latin1).

As PostScript (about 1.7MB):

As ASCII text (about 1080KB):

As ISO 8859-1 text (about 1080KB): The ASCII handbook isn't plain text!

True, the ASCII and Latin1 versions of the FAQ and Handbook aren't strictly plaintext; they contain underlines and overprints that assume the output is going directly to a dot matrix printer. If you need to reformat them to be human-readable, run the file through col: $ col -b < inputfile > outputfile I'd like to become a FreeBSD Web mirror!

Certainly! There are multiple ways to mirror the Web pages. Using CVSUP: You can retrieve the formatted files using CVSUP from cvsup.freebsd.org. Add this line to your cvsup file: www release=current hostname=/home base=/usr/local/etc/cvsup prefix=/usr/local/www/data/www.freebsd.org delete old use-rel-suffix Using rsync: See for information. Using ftp mirror: You can download the FTP server's copy of the web site using your favorite ftp mirror tool. Simply start at ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/www. I'd like to translate the documentation into Friesian.

Well, we can't pay, but we might arrange a free CD or T-shirt and a Contributor's Handbook entry if you submit a translation of the documentation. Other sources of information.

The following newsgroups contain pertinent discussion for FreeBSD users: (moderated)

Web resources: The .

The FreeBSD handbook also has a fairly complete section which is worth reading if you're looking for actual books to buy. diff --git a/handbook/current.sgml b/handbook/current.sgml index a00fb22776..60bb9f3931 100644 --- a/handbook/current.sgml +++ b/handbook/current.sgml @@ -1,163 +1,163 @@ - + Staying Current with FreeBSD

Contributed by &a.jkh;. What is FreeBSD-current?

FreeBSD-current is, quite literally, nothing more than a daily snapshot of the working sources for FreeBSD. These include work in progress, experimental changes and transitional mechanisms that may or may not be present in the next official release of the software. While many of us compile almost daily from FreeBSD-current sources, there are periods of time when the sources are literally un-compilable. These problems are generally resolved as expeditiously as possible, but whether or not FreeBSD-current sources bring disaster or greatly desired functionality can literally be a matter of which part of any given 24 hour period you grabbed them in! Who needs FreeBSD-current?

FreeBSD-current is aimed at 3 primary interest groups:

Members of the FreeBSD group who are actively working on some part of the source tree and for whom keeping `current' is an absolute requirement.

Members of the FreeBSD group who are active testers, willing to spend time working through problems in order to ensure that FreeBSD-current remains as sane as possible. These are also people who wish to make topical suggestions on changes and the general direction of FreeBSD.

Peripheral members of the FreeBSD (or some other) group who merely wish to keep an eye on things and use the current sources for reference purposes (e.g. for reading, not running). These people also make the occasional comment or contribute code. What is FreeBSD-current NOT?

A fast-track to getting pre-release bits because you heard there is some cool new feature in there and you want to be the first on your block to have it.

A quick way of getting bug fixes.

In any way ``officially supported'' by us. We do our best to help people genuinely in one of the 3 ``legitimate'' FreeBSD-current categories, but we simply do not have the time to provide tech support for it. This is not because we are mean and nasty people who do not like helping people out (we would not even be doing FreeBSD if we were), it is literally because we cannot answer 400 messages a day and actually work on FreeBSD! I am sure that, if given the choice between having us answer lots of questions or continuing to improve FreeBSD, most of you would vote for us improving it. Using FreeBSD-current

Join the &a.current and the &a.cvsall . This is not just a good idea, it is essential. If you are not on the FreeBSD-current mailing list, you will not see the comments that people are making about the current state of the system and thus will probably end up stumbling over a lot of problems that others have already found and solved. Even more importantly, you will miss out on important bulletins which may be critical to your system's continued health. The cvs-all mailing list also allows you to see the commit log entry for each change as it is made, along with any pertinent information on possible side-effects, and is another good mailing list to subscribe to. To join these lists, send mail to &a.majordomo and specify: subscribe freebsd-current subscribe cvs-all In the body of your message. Optionally, you can also say `help' and Majordomo will send you full help on how to subscribe and unsubscribe to the various other mailing lists we support.

Grab the sources from ftp.FreeBSD.ORG. You can do this in one of three ways:

Use the facility. Unless you have a good TCP/IP connection at a flat rate, this is the way to do it.

Use the program with . This is the second most recommended method, since it allows you to grab the entire collection once and then only what has changed from then on. Many people run cvsup from cron to keep their sources up-to-date automatically. For a fairly easy interface to this, simply type: - pkg_add -f ftp://ftp.freebsd.org/pub/FreeBSD/CVSup/cvsupit.tgz + pkg_add -f ftp://ftp.freebsd.org/pub/FreeBSD/development/CVSup/cvsupit.tgz

Use ftp. The source tree for FreeBSD-current is always "exported" on: We also use `wu-ftpd' which allows compressed/tar'd grabbing of whole trees. e.g. you see: usr.bin/lex You can do: ftp> cd usr.bin ftp> get lex.tar.Z and it will get the whole directory for you as a compressed tar file. Essentially, if you need rapid on-demand access to the source and communications bandwidth is not a consideration, use cvsup or ftp. Otherwise, use CTM. If you are grabbing the sources to run, and not just look at, then grab all of current, not just selected portions. The reason for this is that various parts of the source depend on updates elsewhere, and trying to compile just a subset is almost guaranteed to get you into trouble. Before compiling current, read the Makefile in /usr/src carefully. You should at least run a `' the first time through as part of the upgrading process. Reading the &a.current will keep you up-to-date on other bootstrapping procedures that sometimes become necessary as we move towards the next release.

Be active! If you are running FreeBSD-current, we want to know what you have to say about it, especially if you have suggestions for enhancements or bug fixes. Suggestions with accompanying code are received most enthusiastically! diff --git a/handbook/cvsup.sgml b/handbook/cvsup.sgml index d4b30406a4..03820d2298 100644 --- a/handbook/cvsup.sgml +++ b/handbook/cvsup.sgml @@ -1,622 +1,622 @@ - + CVSup

Contributed by &a.jdp;. Introduction

CVSup is a software package for distributing and updating source trees from a master CVS repository on a remote server host. The FreeBSD sources are maintained in a CVS repository on a central development machine in California. With CVSup, FreeBSD users can easily keep their own source trees up to date.

CVSup uses the so-called pull model of updating. Under the pull model, each client asks the server for updates, if and when they are wanted. The server waits passively for update requests from its clients. Thus all updates are instigated by the client. The server never sends unsolicited updates. Users must either run the CVSup client manually to get an update, or they must set up a cron job to run it automatically on a regular basis.

The term "CVSup", capitalized just so, refers to the entire software package. Its main components are the client "cvsup" which runs on each user's machine, and the server "cvsupd" which runs at each of the FreeBSD mirror sites.

As you read the FreeBSD documentation and mailing lists, you may see references to sup. Sup was the predecessor of CVSup, and it served a similar purpose. CVSup is in used in much the same way as sup and, in fact, uses configuration files which are backward-compatible with sup's. Sup is no longer used in the FreeBSD project, because CVSup is both faster and more flexible. Installation

The easiest way to install CVSup if you are running FreeBSD 2.2 or later is to use either from the FreeBSD or the corresponding , depending on whether you prefer to roll your own or not.

If you are running FreeBSD-2.1.6 or 2.1.7, you unfortunately cannot use the binary package versions due to the fact that it requires a version of the C library that does not yet exist in FreeBSD-2.1.{6,7}. You can easily -use , however, just as with FreeBSD 2.2. Simply unpack the tar file, cd to the cvsup subdirectory and type "make install".

Because CVSup is written in , both the package and the port require that the Modula-3 runtime libraries be installed. These are available as the port and the package. If you follow the same directions as for cvsup, these libraries will be compiled and/or installed automatically when you install the CVSup port or package.

The Modula-3 libraries are rather large, and fetching and compiling them is not an instantaneous process. For that reason, a third option is provided. You can get statically linked FreeBSD executables for CVSup from the USA distribution site: - + (client including GUI). - + (client without GUI). - + (server). as well as from the many FreeBSD around the world.

Most users will need only the client. These executables are entirely self-contained, and they will run on any version of FreeBSD from FreeBSD-2.1.0 to FreeBSD-current.

In summary, your options for installing CVSup are: FreeBSD-2.2 or later: static binary, port, or package FreeBSD-2.1.6, 2.1.7: static binary or port FreeBSD-2.1.5 or earlier: static binary Configuration

CVSup's operation is controlled by a configuration file called the "supfile". Beginning with FreeBSD-2.2, there are some sample supfiles in the directory . These examples are also available from if you are on a pre-2.2 system.

The information in a supfile answers the following questions for cvsup:

In the following sections, we will construct a typical supfile by answering each of these questions in turn. First, we describe the overall structure of a supfile.

A supfile is a text file. Comments begin with "#" and extend to the end of the line. Lines that are blank and lines that contain only comments are ignored.

Each remaining line describes a set of files that the user wishes to receive. The line begins with the name of a "collection", a logical grouping of files defined by the server. The name of the collection tells the server which files you want. After the collection name come zero or more fields, separated by white space. These fields answer the questions listed above. There are two types of fields: flag fields and value fields. A flag field consists of a keyword standing alone, e.g., "delete" or "compress". A value field also begins with a keyword, but the keyword is followed without intervening white space by "=" and a second word. For example, "release=cvs" is a value field.

A supfile typically specifies more than one collection to receive. One way to structure a supfile is to specify all of the relevant fields explicitly for each collection. However, that tends to make the supfile lines quite long, and it is inconvenient because most fields are the same for all of the collections in a supfile. CVSup provides a defaulting mechanism to avoid these problems. Lines beginning with the special pseudo-collection name "*default" can be used to set flags and values which will be used as defaults for the subsequent collections in the supfile. A default value can be overridden for an individual collection, by specifying a different value with the collection itself. Defaults can also be changed or augmented in mid-supfile by additional "*default" lines.

With this background, we will now proceed to construct a supfile for receiving and updating the main source tree of . Which files do you want to receive?

The files available via CVSup are organized into named groups called "collections". The collections that are available are described . In this example, we wish to receive the entire main source tree for the FreeBSD system. There is a single large collection "src-all" which will give us all of that, except the export-controlled cryptography support. Let us assume for this example that we are in the USA or Canada. Then we can get the cryptography code with one additional collection, "cvs-crypto". As a first step toward constructing our supfile, we simply list these collections, one per line: src-all cvs-crypto

Which version(s) of them do you want?

With CVSup, you can receive virtually any version of the sources that ever existed. That is possible because the cvsupd server works directly from the CVS repository, which contains all of the versions. You specify which one of them you want using the "tag=" and "date=" value fields.

WARNING: Be very careful to specify any "tag=" fields correctly. Some tags are valid only for certain collections of files. If you specify an incorrect or misspelled tag, CVSup will delete files which you probably do not want deleted. In particular, use only "tag=." for the "ports-*" collections.

The "tag=" field names a symbolic tag in the repository. There are two kinds of tags, revision tags and branch tags. A revision tag refers to a specific revision. Its meaning stays the same from day to day. A branch tag, on the other hand, refers to the latest revision on a given line of development, at any given time. Because a branch tag does not refer to a specific revision, it may mean something different tomorrow than it means today.

Here are the branch tags that users might be interested in:

Here are the revision tags that users might be interested in:

WARNING: Be very careful to type the tag name exactly as shown. CVSup cannot distinguish between valid and invalid tags. If you misspell the tag, CVSup will behave as though you had specified a valid tag which happens to refer to no files at all. It will delete your existing sources in that case.

When you specify a branch tag, you normally receive the latest versions of the files on that line of development. If you wish to receive some past version, you can do so by specifying a date with the "date=" value field. The cvsup(1) manual page explains how to do that.

For our example, we wish to receive FreeBSD-current. We add this line at the beginning of our supfile: *default tag=.

There is an important special case that comes into play if you specify neither a "tag=" field nor a "date=" field. In that case, you receive the actual RCS files directly from the server's CVS repository, rather than receiving a particular version. Developers generally prefer this mode of operation. By maintaining a copy of the repository itself on their systems, they gain the ability to browse the revision histories and examine past versions of files. This gain is achieved at a large cost in terms of disk space, however.

Where do you want to get them from?

We use the "host=" field to tell cvsup where to obtain its updates. Any of the will do, though you should try to select one that's near to you. In this example, we'll use the primary FreeBSD distribution site, "cvsup.FreeBSD.org": *default host=cvsup.FreeBSD.org

On any particular run of cvsup, you can override this setting on the command line, with "-h hostname".

Where do you want to put them on your own machine?

The "prefix=" field tells cvsup where to put the files it receives. In this example, we will put the source files directly into our main source tree, "/usr/src". The "src" directory is already implicit in the collections we have chosen to receive, so this is the correct specification: *default prefix=/usr

Where should cvsup maintain its status files?

The cvsup client maintains certain status files in what is called the "base" directory. These files help CVSup to work more efficiently, by keeping track of which updates you have already received. We will use the standard base directory, "/usr/local/etc/cvsup": *default base=/usr/local/etc/cvsup

This setting is used by default if it is not specified in the supfile, so we actually do not need the above line.

If your base directory does not already exist, now would be a good time to create it. The cvsup client will refuse to run if the base directory does not exist.

Miscellaneous supfile settings:

There is one more line of boiler plate that normally needs to be present in the supfile: *default release=cvs delete use-rel-suffix compress

"release=cvs" indicates that the server should get its information out of the main FreeBSD CVS repository. This is virtually always the case, but there are other possibilities which are beyond the scope of this discussion.

"delete" gives CVSup permission to delete files. You should always specify this, so that CVSup can keep your source tree fully up to date. CVSup is careful to delete only those files for which it is responsible. Any extra files you happen to have will be left strictly alone.

"use-rel-suffix" is ... arcane. If you really want to know about it, see the cvsup(1) manual page. Otherwise, just specify it and do not worry about it.

"compress" enables the use of gzip-style compression on the communication channel. If your network link is T1 speed or faster, you probably should not use compression. Otherwise, it helps substantially.

Putting it all together:

Here is the entire supfile for our example: *default tag=. *default host=cvsup.FreeBSD.org *default prefix=/usr *default base=/usr/local/etc/cvsup *default release=cvs delete use-rel-suffix compress src-all cvs-crypto Running CVSup

You are now ready to try an update. The command line for doing this is quite simple: cvsup supfile

where "supfile" is of course the name of the supfile you have just created. Assuming you are running under X11, cvsup will display a GUI window with some buttons to do the usual things. Press the "go" button, and watch it run.

Since you are updating your actual "/usr/src" tree in this example, you will need to run the program as root so that cvsup has the permissions it needs to update your files. Having just created your configuration file, and having never used this program before, that might understandably make you nervous. There is an easy way to do a trial run without touching your precious files. Just create an empty directory somewhere convenient, and name it as an extra argument on the command line: mkdir /var/tmp/dest cvsup supfile /var/tmp/dest

The directory you specify will be used as the destination directory for all file updates. CVSup will examine your usual files in "/usr/src", but it will not modify or delete any of them. Any file updates will instead land in "/var/tmp/dest/usr/src". CVSup will also leave its base directory status files untouched when run this way. The new versions of those files will be written into the specified directory. As long as you have read access to "/usr/src", you do not even need to be root to perform this kind of trial run.

If you are not running X11 or if you just do not like GUIs, you should add a couple of options to the command line when you run cvsup: cvsup -g -L 2 supfile

The "-g" tells cvsup not to use its GUI. This is automatic if you are not running X11, but otherwise you have to specify it.

The "-L 2" tells cvsup to print out the details of all the file updates it is doing. There are three levels of verbosity, from "-L 0" to "-L 2". The default is 0, which means total silence except for error messages.

There are plenty of other options available. For a brief list of them, type "cvsup -H". For more detailed descriptions, see the manual page.

Once you are satisfied with the way updates are working, you can arrange for regular runs of cvsup using cron(8). Obviously, you should not let cvsup use its GUI when running it from cron. CVSup File Collections

The file collections available via CVSup are organized hierarchically. There are a few large collections, and they are divided into smaller sub-collections. Receiving a large collection is equivalent to receiving each of its sub-collections. The hierarchical relationships among collections are reflected by the use of indentation in the list below.

The most commonly used collections are cvs-all release=cvs The main FreeBSD CVS repository, excluding the export-restricted cryptography code.

distrib release=cvs Files related to the distribution and mirroring of FreeBSD. doc-all release=cvs Sources for the FreeBSD handbook and other documentation. ports-all release=cvs The FreeBSD ports collection.

ports-archivers release=cvs Archiving tools. ports-astro release=cvs Astronomical ports. ports-audio release=cvs Sound support. ports-base release=cvs Miscellaneous files at the top of /usr/ports. ports-benchmarks release=cvs Benchmarks. ports-biology release=cvs Biology. ports-cad release=cvs Computer aided design tools. ports-chinese release=cvs Chinese language support. ports-comms release=cvs Communication software. ports-converters release=cvs character code converters. ports-databases release=cvs Databases. ports-deskutils release=cvs Things that used to be on the desktop before computers were invented. ports-devel release=cvs Development utilities. ports-editors release=cvs Editors. ports-emulators release=cvs Emulators for other operating systems. ports-games release=cvs Games. ports-german release=cvs German language support. ports-graphics release=cvs Graphics utilities. ports-japanese release=cvs Japanese language support. ports-korean release=cvs Korean language support. ports-lang release=cvs Programming languages. ports-mail release=cvs Mail software. ports-math release=cvs Numerical computation software. ports-mbone release=cvs MBone applications. ports-misc release=cvs Miscellaneous utilities. ports-net release=cvs Networking software. ports-news release=cvs USENET news software. ports-plan9 release=cvs Various programs from Plan9. ports-print release=cvs Printing software. ports-russian release=cvs Russian language support. ports-security release=cvs Security utilities. ports-shells release=cvs Command line shells. ports-sysutils release=cvs System utilities. ports-textproc release=cvs text processing utilities (does not include desktop publishing). ports-vietnamese release=cvs Vietnamese language support. ports-www release=cvs Software related to the World Wide Web. ports-x11 release=cvs Ports to support the X window system. ports-x11-clocks release=cvs X11 clocks. ports-x11-fm release=cvs X11 file managers. ports-x11-fonts release=cvs X11 fonts and font utilities. ports-x11-toolkits release=cvs X11 toolkits. ports-x11-wm release=cvs X11 window managers. src-all release=cvs The main FreeBSD sources, excluding the export-restricted cryptography code.

src-base release=cvs Miscellaneous files at the top of /usr/src. src-bin release=cvs User utilities that may be needed in single-user mode (/usr/src/bin). src-contrib release=cvs Utilities and libraries from outside the FreeBSD project, used relatively unmodified (/usr/src/contrib). src-etc release=cvs System configuration files (/usr/src/etc). src-games release=cvs Games (/usr/src/games). src-gnu release=cvs Utilities covered by the GNU Public License (/usr/src/gnu). src-include release=cvs Header files (/usr/src/include). src-kerberosIV release=cvs KerberosIV security package (/usr/src/kerberosIV). src-lib release=cvs Libraries (/usr/src/lib). src-libexec release=cvs System programs normally executed by other programs (/usr/src/libexec). src-release release=cvs Files required to produce a FreeBSD release (/usr/src/release). src-sbin release=cvs System utilities for single-user mode (/usr/src/sbin). src-share release=cvs Files that can be shared across multiple systems (/usr/src/share). src-sys release=cvs The kernel (/usr/src/sys). src-tools release=cvs Various tools for the maintenance of FreeBSD (/usr/src/tools). src-usrbin release=cvs User utilities (/usr/src/usr.bin). src-usrsbin release=cvs System utilities (/usr/src/usr.sbin). www release=cvs The sources for the World Wide Web data. cvs-crypto release=cvs The export-restricted cryptography code.

src-crypto release=cvs Export-restricted utilities and libraries from outside the FreeBSD project, used relatively unmodified (/usr/src/crypto). src-eBones release=cvs Kerberos and DES (/usr/src/eBones). src-secure release=cvs DES (/usr/src/secure). distrib release=self The CVSup server's own configuration files. Used by CVSup mirror sites. gnats release=current The GNATS bug-tracking database. mail-archive release=current FreeBSD mailing list archive. www release=current The installed World Wide Web data. Used by WWW mirror sites. Announcements, Questions, and Bug Reports

Most FreeBSD-related discussion of CVSup takes place on the &a.hackers;. New versions of the software are announced there, as well as on the &a.announce;.

Questions and bug reports should be addressed to the author of the program at . diff --git a/handbook/mirrors.sgml b/handbook/mirrors.sgml index 250ada0e0e..1c2e684485 100644 --- a/handbook/mirrors.sgml +++ b/handbook/mirrors.sgml @@ -1,931 +1,931 @@ - + Obtaining FreeBSD CD-ROM Publishers

FreeBSD is available on CD-ROM from Walnut Creek CDROM: Walnut Creek CDROM 4041 Pike Lane, Suite F Concord CA 94520 USA Phone: +1 925 674-0783 Fax: +1 925 674-0821 Email: WWW: FTP Sites

The official sources for FreeBSD are available via anonymous FTP from: .

The is more accurate than the 'mirror listing' in the handbook as it gets its information from the DNS rather than relying on static lists of hosts.

Additionally, FreeBSD is available via anonymous FTP from the following mirror sites. If you choose to obtain FreeBSD via anonymous FTP, please try to use a site near you. , , , , , , , , , , , , , , , , , , , , , , , , , , , , . In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. Contact: . In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. Contact: . In case of problems, please contact the for this domain. Contact: . In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. Contact: . Contact: . In case of problems, please contact the for this domain. In case of problems, please contact the for this domain. The latest versions of export-restricted code for FreeBSD (2.0C or later) (eBones and secure) are being made available at the following locations. If you are outside the U.S. or Canada, please get secure (DES) and eBones (Kerberos) from one of the following foreign distribution sites: South Africa for this domain. Brazil for this domain. Finland Contact: . CTM Sites

/FreeBSD is available via anonymous FTP from the following mirror sites. If you choose to obtain CTM via anonymous FTP, please try to use a site near you. In case of problems, please contact &a.phk;. California, Bay Area, official source - + Germany, Trier South Africa, backup server for old deltas Taiwan/R.O.C, Chiayi If you did not find a mirror near to you or the mirror is incomplete, try at . FTP search is a great free archie server in Trondheim, Norway. CVSup Sites

servers for FreeBSD are running at the following sites: Argentina cvsup.ar.FreeBSD.ORG () Australia cvsup.au.FreeBSD.ORG () Brazil cvsup.br.FreeBSD.ORG () Canada cvsup.ca.FreeBSD.ORG () Denmark cvsup.dk.FreeBSD.ORG () Estonia cvsup.ee.FreeBSD.ORG () Finland cvsup.fi.FreeBSD.ORG () Germany cvsup.de.FreeBSD.ORG () cvsup2.de.FreeBSD.ORG () cvsup3.de.FreeBSD.ORG () Iceland cvsup.is.FreeBSD.ORG () Japan cvsup.jp.FreeBSD.ORG () cvsup2.jp.FreeBSD.ORG () cvsup3.jp.FreeBSD.ORG () cvsup4.jp.FreeBSD.ORG () cvsup5.jp.FreeBSD.ORG () Netherlands cvsup.nl.FreeBSD.ORG () Norway cvsup.no.FreeBSD.ORG () Poland cvsup.pl.FreeBSD.ORG () Russia cvsup.ru.FreeBSD.ORG () Slovak Republic cvsup.sk.FreeBSD.ORG () cvsup2.sk.FreeBSD.ORG () South Africa cvsup.za.FreeBSD.ORG () cvsup2.za.FreeBSD.ORG () Sweden cvsup.se.FreeBSD.ORG () Taiwan cvsup.tw.FreeBSD.ORG () Ukraine cvsup2.ua.FreeBSD.ORG () United Kingdom cvsup.uk.FreeBSD.ORG () USA cvsup.FreeBSD.ORG () cvsup2.FreeBSD.ORG () cvsup3.FreeBSD.ORG () cvsup4.FreeBSD.ORG () The export-restricted code for FreeBSD (eBones and secure) is available via CVSup at the following international repository. Please use this site to get the export-restricted code, if you are outside the USA or Canada. South Africa cvsup.internat.FreeBSD.ORG ()

The following CVSup site is especially designed for users. Unlike the other CVSup mirrors, it is kept up-to-date by CTM. That means if you CVSup cvs-all with release=cvs from this site, you get a version of the repository (including the inevitable .ctm_status file) which is suitable for being updated using the CTM cvs-cur deltas. This allows users who track the entire cvs-all tree to go from CVSup to CTM without having to rebuild their repository from scratch using a fresh CTM base delta.

Please note that this special feature only works for the cvs-all distribution with cvs as the release tag. CVSupping any other distribution and/or release will get you the specified distribution, but it will not be suitable for CTM updating.

Also please note that, because the current version of CTM does not preserve the timestamps of files, the timestamps at this mirror site are not the same as those at other mirror sites. Switching between this site and other sites is not recommended. It will work correctly, but will be somewhat inefficient. Germany ctm.FreeBSD.ORG () AFS Sites

AFS servers for FreeBSD are running at the following sites: Sweden stacken.kth.se #Stacken Computer Club, KTH, Sweden 130.237.234.3 #milko.stacken.kth.se 130.237.234.43 #hot.stacken.kth.se 130.237.234.44 #dog.stacken.kth.se () diff --git a/handbook/porting.sgml b/handbook/porting.sgml index bcdc1d10a5..937c06a10a 100644 --- a/handbook/porting.sgml +++ b/handbook/porting.sgml @@ -1,2634 +1,2634 @@ - + Making a port yourself

Contributed by &a.jkh;, &a.gpalmer;, &a.asami;, &a.obrien; and &a.hoek;.28 August 1996.

So, now you are interested in making your own port? Great! What follows are some guidelines for creating a new port for FreeBSD. The bulk of the work is done by /usr/share/mk/bsd.port.mk, which all port Makefiles include. Please refer to that file for more details on the inner workings of the ports collection. Even if you don't hack Makefiles daily, it is well commented, and you will still gain much knowledge from it.

Note: Only a fraction of the overridable variables (${..}) are mentioned in this document. Most (if not all) are documented at the start of bsd.port.mk. This file uses a non-standard tab setting. Emacs and Vim should recognize the setting on loading the file. vi or ex can be set to using the correct value by typing `:set tabstop=4' once the file has been loaded. Quick Porting

This section tells you how to do a quick port. In many cases, it is not enough, but we will see.

First, get the original tarball and put it into ${DISTDIR}, which defaults to /usr/ports/distfiles.

Note: The following assumes that the software compiled out-of-the-box, i.e., there was absolutely no change required for the port to work on your FreeBSD box. If you needed to change something, you will have to refer to the next section too. Writing the Makefile

The minimal Makefile would look something like this: # New ports collection makefile for: oneko # Version required: 1.1b # Date created: 5 December 1994 # Whom: asami # # $Id$ # DISTNAME= oneko-1.1b CATEGORIES= games MASTER_SITES= ftp://ftp.cs.columbia.edu/archives/X11R5/contrib/ MAINTAINER= asami@FreeBSD.ORG MAN1= oneko.1 MANCOMPRESSED= yes USE_IMAKE= yes .include

See if you can figure it out. Do not worry about the contents of the $Id$ line, it will be filled in automatically by CVS when the port is imported to our main ports tree. You can find a more detailed example in the section. Writing the description files

There are three description files that are required for any port, whether they actually package or not. They are COMMENT, DESCR, and PLIST, and reside in the pkg subdirectory. COMMENT

This is the one-line description of the port. Please do not include the package name (or version number of the software) in the comment. Here is an example: A cat chasing a mouse all over the screen. DESCR

This is a longer description of the port. One to a few paragraphs concisely explaining what the port does is sufficient. This is not a manual or an in-depth description on how to use or compile the port! Please be careful if you are copying from the README or manpage; too often they are not a concise description of the port or are in an awkward format (e.g. manpages have justified spacing). If the ported software has an official WWW homepage, you should list it here.

It is recommended that you sign the name at the end of this file, as in: This is a port of oneko, in which a cat chases a poor mouse all over the screen. : (etc.) http://www.oneko.org/ - Satoshi asami@cs.berkeley.edu PLIST

This file lists all the files installed by the port. It is also called the `packing list' because the package is generated by packing the files listed here. The pathnames are relative to the installation prefix (usually /usr/local or /usr/X11R6). If you are using the Here is a small example: bin/oneko lib/X11/app-defaults/Oneko lib/X11/oneko/cat1.xpm lib/X11/oneko/cat2.xpm lib/X11/oneko/mouse.xpm @dirrm lib/X11/oneko

Refer to the pkg_create(1) man page for details on the packing list. Note that you should list all the files, but not the name directories, in the list. Also, if the port creates directories for itself during installation, make sure to add It is recommended you keep all the filenames in this file sorted alphabetically. It will make verifying the changes when you upgrade the port much easier. Creating the checksum file

Just type `make makesum'. The ports make rules will automatically generate the file files/md5. Testing the port

You should make sure that the port rules do exactly what you want it to do, including packaging up the port. These are the important points you need to verify: your port can be installed multiple times using the your port after itself upon deinstall

The recommended ordering of tests is: make install make package make deinstall pkg_add `make package-name` make deinstall make reinstall make package Make sure there aren't any warnings issued in any of the Checking your port with portlint

Please use portlint to see if your port conforms to our guidelines. The program is part of the ports collection. In particular, you may want to check if the is in the right shape and the is named appropriately. Submitting the port

First, make sure you have read the section.

Now that you are happy with your port, the only thing remaining is to put it in the main FreeBSD ports tree and make everybody else happy about it too. We do not need your work/ directory or the pkgname.tgz package, so delete them now. Next, simply include the output of `shar `find port_dir`' in a bug report and send it with the send-pr(1) program (see for more information about send-pr). If the uncompressed port is larger than 20KB, you should compress it into a tarfile and use uuencode(1) before including it in the bug report (uuencoded tarfiles are acceptable even if the report is smaller than 20KB but are not preferred). Be sure to classify the bug report as category `ports' and class `change-request'. (Do not mark the report `confidential'!)

One more time, do not include the original source distfile, the work/ directory, or the package you built with `make package'!

Note: in the past, we asked you to upload new port submissions in our ftp site (:<

We will look at your port, get back to you if necessary, and put it in the tree. Your name will also appear in the list of `Additional FreeBSD contributors' on the FreeBSD Handbook and other files. Isn't that great?!? :) Slow Porting

Ok, so it was not that simple, and the port required some modifications to get it to work. In this section, we will explain, step by step, how to modify it to get it to work with the ports paradigm. How things work

First, this is the sequence of events which occurs when the user first types `make' in your port's directory, and you may find that having bsd.port.mk in another window while you read this really helps to understand it.

But do not worry if you do not really understand what bsd.port.mk is doing, not many people do... :> The fetch target is run. The fetch target is responsible for making sure that the tarball exists locally in ${DISTDIR}. If fetch cannot find the required files in ${DISTDIR} it will look up the URL ${MASTER_SITES}, which is set in the Makefile, as well as our main ftp site at + name="ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/">, where we put sanctioned distfiles as backup. It will then attempt to fetch the named distribution file with ${FETCH}, assuming that the requesting site has direct access to the Internet. If that succeeds, it will save the file in ${DISTDIR} for future use and proceed. The extract target is run. It looks for your port's distribution file (typically a gzip'd tarball) in ${DISTDIR} and unpacks it into a temporary subdirectory specified by ${WRKDIR} (defaults to work). The patch target is run. First, any patches defined in ${PATCHFILES} are applied. Second, if any patches are found in ${PATCHDIR} (defaults to the patches subdirectory), they are applied at this time in alphabetical order. The configure target is run. This can do any one of many different things. If it exists, scripts/configure is run. If ${HAS_CONFIGURE} or ${GNU_CONFIGURE} is set, ${WRKSRC}/configure is run. If ${USE_IMAKE} is set, ${XMKMF} (default: `xmkmf -a') is run. The build target is run. This is responsible for descending into the port's private working directory (${WRKSRC}) and building it. If ${USE_GMAKE} is set, GNU make will be used, otherwise the system make will be used.

The above are the default actions. In addition, you can define targets `pre-<something>' or `post-<something>', or put scripts with those names, in the scripts subdirectory, and they will be run before or after the default actions are done.

For example, if you have a post-extract target defined in your Makefile, and a file pre-build in the scripts subdirectory, the post-extract target will be called after the regular extraction actions, and the pre-build script will be executed before the default build rules are done. It is recommended that you use Makefile targets if the actions are simple enough, because it will be easier for someone to figure out what kind of non-default action the port requires.

The default actions are done by the bsd.port.mk targets `do-<something>'. For example, the commands to extract a port are in the target `do-extract'. If you are not happy with the default target, you can fix it by redefining the `do-<something>' target in your Makefile.

Note that the `main' targets (e.g., extract, configure, etc.) do nothing more than make sure all the stages up to that one are completed and call the real targets or scripts, and they are not intended to be changed. If you want to fix the extraction, fix do-extract, but never ever touch extract!

Now that you understand what goes on when the user types `make', let us go through the recommended steps to create the perfect port. Getting the original sources

Get the original sources (normally) as a compressed tarball (<foo>.tar.gz or <foo>.tar.Z) and copy it into ${DISTDIR}. Always use mainstream sources when and where you can.

If you cannot find a ftp/http site that is well-connected to the net, or can only find sites that have irritatingly non-standard formats, you might want to put a copy on a reliable ftp or http server that you control (e.g., your home page). Make sure you set MASTER_SITES to reflect your choice.

If you cannot find somewhere convenient and reliable to put the distfile (note that if you are a FreeBSD committer, you can just put it in the public_html directory on freefall), we can `house' it ourselves by putting it on ftp://ftp.freebsd.org/pub/FreeBSD/ports/distfiles/LOCAL_PORTS/ as the last resort. Please refer to this location as ${MASTER_SITE_LOCAL}. Send mail to the &a.ports if you are not sure what to do.

If your port's distfile changes all the time for no good reason, consider putting the distfile in your home page and listing it as the first MASTER_SITES. This will prevent users from getting `checksum mismatch' errors, and also reduce the workload of maintainers of our ftp site. Also, if there is only one master site for the port, it is recommended that you house a backup at your site and list it as the second MASTER_SITES.

If your port requires some additional `patches' that are available on the Internet, fetch them too and put them in ${DISTDIR}. Do not worry if they come from a site other than where you got the main source tarball, we have a way to handle these situations (see the description of below). Modifying the port

Unpack a copy of the tarball in a private directory and make whatever changes are necessary to get the port to compile properly under the current version of FreeBSD. Keep careful track of everything you do, as you will be automating the process shortly. Everything, including the deletion, addition or modification of files should be doable using an automated script or patch file when your port is finished.

If your port requires significant user interaction/customization to compile or install, you should take a look at one of Larry Wall's classic Configure scripts and perhaps do something similar yourself. The goal of the new ports collection is to make each port as `plug-and-play' as possible for the end-user while using a minimum of disk space.

Note: Unless explicitly stated, patch files, scripts, and other files you have created and contributed to the FreeBSD ports collection are assumed to be covered by the standard BSD copyright conditions. Patching

In the preparation of the port, files that have been added or changed can be picked up with a recursive diff for later feeding to patch. Each set of patches you wish to apply should be collected into a file named `patch-<xx>' where <xx> denotes the sequence in which the patches will be applied -- these are done in alphabetical order, thus `aa' first, `ab' second and so on. These files should be stored in ${PATCHDIR}, from where they will be automatically applied. All patches should be relative to ${WRKSRC} (generally the directory your port's tarball unpacks itself into, that being where the build is done). To make fixes and upgrades easier, you should avoid having more than one patch fix the same file (e.g., patch-aa and patch-ab both changing ${WRKSRC}/foobar.c). Configuring

Include any additional customization commands to your configure script and save it in the `scripts' subdirectory. As mentioned above, you can also do this as Makefile targets and/or scripts with the name pre-configure or post-configure. Handling user input

If your port requires user input to build, configure or install, then set IS_INTERACTIVE in your Makefile. This will allow `overnight builds' to skip your port if the user sets the variable BATCH in his environment (and if the user sets the variable INTERACTIVE, then only those ports requiring interaction are built).

It is also recommended that if there are reasonable default answers to the questions, you check the Configuring the Makefile

Configuring the Makefile is pretty simple, and again we suggest that you look at existing examples before starting. Also, there is a in this handbook, so take a look and please follow the ordering of variables and sections in that template to make your port easier for others to read.

Now, consider the following problems in sequence as you design your new Makefile: The original source

Does it live in ${DISTDIR} as a standard gzip'd tarball? If so, you can go on to the next step. If not, you should look at overriding any of the ${EXTRACT_CMD}, ${EXTRACT_BEFORE_ARGS}, ${EXTRACT_AFTER_ARGS}, ${EXTRACT_SUFX}, or ${DISTFILES} variables, depending on how alien a format your port's distribution file is. (The most common case is `EXTRACT_SUFX=.tar.Z', when the tarball is condensed by regular compress, not gzip.)

In the worst case, you can simply create your own `do-extract' target to override the default, though this should be rarely, if ever, necessary. DISTNAME

You should set ${DISTNAME} to be the base name of your port. The default rules expect the distribution file list (${DISTFILES}) to be named ${DISTNAME}${EXTRACT_SUFX} which, if it is a normal tarball, is going to be something like: foozolix-1.0.tar.gz for a setting of `DISTNAME=foozolix-1.0'. The default rules also expect the tarball(s) to extract into a subdirectory called work/${DISTNAME}, e.g. work/foozolix-1.0/ All this behavior can be overridden, of course; it simply represents the most common time-saving defaults. For a port requiring multiple distribution files, simply set ${DISTFILES} explicitly. If only a subset of ${DISTFILES} are actual extractable archives, then set them up in ${EXTRACT_ONLY}, which will override the ${DISTFILES} list when it comes to extraction, and the rest will be just left in ${DISTDIR} for later use. PKGNAME

If ${DISTNAME} does not conform to our , you should set the ${PKGNAME} variable to something better. See the abovementioned guideline for more details. CATEGORIES

When a package is created, it is put under /usr/ports/packages/All and links are made from one or more subdirectories of /usr/ports/packages. The names of these subdirectories are specified by the variable ${CATEGORIES}. It is intended to make life easier for the user when he is wading through the pile of packages on the ftp site or the CD-ROM. Please take a look at the existing and pick the ones that are suitable for your port.

This list also determines where in the ports tree the port is imported. If you put more than one category here, it is assumed that the port files will be put in the subdirectory with the name in the first category. See the section for more discussion about how to pick the right categories.

If your port truly belongs to something that is different from all the existing ones, you can even create a new category name. In that case, please send mail to the &a.ports; to propose a new category.

Note that there is no error checking for category names; `make package' will happily create a new directory if you mistype the category name, so be careful! MASTER_SITES

Record the directory part of the ftp/http-URL pointing at the original tarball in ${MASTER_SITES}. Do not forget the trailing slash (/)! The make macros will try to use this specification for grabbing the distribution file with ${FETCH} if they cannot find it already on the system.

It is recommended that you put multiple sites on this list, preferably from different continents. This will safeguard against wide-area network problems, and we are even planning to add support for automatically determining the closest master site and fetching from there!

If the original tarball is part of one of the following popular archives: X-contrib, GNU, Perl CPAN, TeX CTAN, or Linux Sunsite, you refer to those sites in an easy compact form using MASTER_SITE_XCONTRIB, MASTER_SITE_GNU, MASTER_SITE_PERL_CPAN, MASTER_SITE_TEX_CTAN, and MASTER_SITE_SUNSITE. Simply set MASTER_SITE_SUBDIR to the path with in the archive. Here is an example: MASTER_SITES= ${MASTER_SITE_XCONTRIB} MASTER_SITE_SUBDIR= applications

The user can also set the MASTER_SITE_* variables in /etc/make.conf to override our choices, and use their favorite mirrors of these popular archives instead. PATCHFILES

If your port requires some additional patches that are available by ftp or http, set ${PATCHFILES} to the names of the files and ${PATCH_SITES} to the URL of the directory that contains them (the format is the same as ${MASTER_SITES}).

If the patch is not relative to the top of the source tree (i.e., ${WKRSRC}) because it contains some extra pathnames, set ${PATCH_DIST_STRIP} accordingly. For instance, if all the pathnames in the patch have an extra `foozolix-1.0/' in front of the filenames, then set `PATCH_DIST_STRIP=-p1'.

Do not worry if the patches are compressed, they will be decompressed automatically if the filenames end with `.gz' or `.Z'.

If the patch is distributed with some other files, such as documentation, in a gzip'd tarball, you can't just use ${PATCHFILES}. If that is the case, add the name and the location of the patch tarball to ${DISTFILES} and ${MASTER_SITES}. Then, from the pre-patch target, apply the patch either by running the patch command from there, or copying the patch file into the ${PATCHDIR} directory and calling it patch-<xx>. (Note the tarball will have been extracted alongside the regular source by then, so there is no need to explicitly extract it if it is a regular gzip'd or compress'd tarball.) If you do the latter, take extra care not to overwrite something that already exists in that directory. Also do not forget to add a command to remove the copied patch in the pre-clean target. MAINTAINER

Set your mail-address here. Please. :)

For detailed description of the responsibility of maintainers, refer to section. Dependencies

Many ports depend on other ports. There are five variables that you can use to ensure that all the required bits will be on the user's machine. There are also some pre-supported dependency variables for common cases, plus a few more to control the behavior of dependencies. LIB_DEPENDS

This variable specifies the shared libraries this port depends on. It is a list of `lib:dir[:target]' tuples where lib is the name of the shared library, and dir is the directory in which to find it in case it is not available, and LIB_DEPENDS= jpeg.9:${PORTSDIR}/graphics/jpeg:install will check for a shared jpeg library with major version 9, and descend into the graphics/jpeg subdirectory of your ports tree to build and install it if it is not found. The `${DEPENDS_TARGET} (which defaults to `lib part is an argument given to `ldconfig -r | grep -wF'. There shall be no regular expressions in this variable. The dependency is checked twice, once from within the pkg_add will automatically install it if it is not on the user's system. RUN_DEPENDS

This variable specifies executables or files this port depends on during run-time. It is a list of `path:dir[:target]' tuples where path is the name of the executable or file, and dir is the directory in which to find it in case it is not available, and `path starts with a slash (/), it is treated as a file or directory and its existence is tested with `test -e'; otherwise, it is assumed to be an executable, and `which -s' is used to determine if the program exists in the user's search path.

For example, RUN_DEPENDS= ${PREFIX}/etc/innd:${PORTSDIR}/news/inn \ wish8.0:${PORTSDIR}/x11-toolkits/tk80 will check if the file or directory `/usr/local/etc/innd' exists, and build and install it from the news/inn subdirectory of the ports tree if it is not found. It will also see if an executable called `wish8.0' is in your search path, and descend into the x11-toolkits/tk80 subdirectory of your ports tree to build and install it if it is not found. (Note that in this case, `innd' is actually an executable; if an executable is in a place that is not expected to be in a normal user's search path, you should use the full pathname.) The dependency is checked from within the install target. Also, the name of the dependency is put in to the package so that pkg_add will automatically install it if it is not on the user's system. The `${DEPENDS_TARGET}. BUILD_DEPENDS

This variable specifies executables or files this port requires to build. Like RUN_DEPENDS, it is a list of `path:dir[:target]' tuples. For example, BUILD_DEPENDS= unzip:${PORTSDIR}/archivers/unzip will check for an executable called `unzip', and descend into the archivers/unzip subdirectory of your ports tree to build and install it if it is not found. Note that `build' here means everything from extracting to compilation. The dependency is checked from within the extract target. The `${DEPENDS_TARGET}. FETCH_DEPENDS

This variable specifies executables or files this port requires to fetch. Like the previous two, it is a list of `path:dir[:target]' pairs. For example, FETCH_DEPENDS= ncftp2:${PORTSDIR}/net/ncftp2 will check for an executable called `ncftp2', and descend into the net/ncftp2 subdirectory of your ports tree to build and install it if it is not found. The dependency is checked from within the fetch target. The `${DEPENDS_TARGET}. DEPENDS

If there is a dependency that does not fall into either of the above four categories, or your port requires to have the source of the other port extracted in addition to having them installed, then use this variable. This is a list of `dir[:target]', as there is nothing to check, unlike the previous four. The `${DEPENDS_TARGET}. Common dependency variables

Define `USE_XLIB=yes' if your port requires the X Window System to be installed (it is implied by USE_IMAKE). Define `USE_GMAKE=yes' if your port requires GNU USE_AUTOCONF=yes' if your port requires GNU autoconf to be run. Define `USE_QT=yes' if your port uses the latest qt toolkit. Use `USE_PERL5=yes' if your port requires version 5 of the perl language. (The last is especially important since some versions of FreeBSD has perl5 as part of the base system while others don't.) Notes on dependencies

As mentioned above, the default target to call when a dependency is required is ${DEPENDS_TARGET}. It defaults to `*_DEPENDS variables instead of redefining ${DEPENDS_TARGET}.

When you type `make clean', its dependencies are automatically cleaned too. If you do not wish this to happen, define the variable To depend on another port unconditionally, it is customary to use the string ` BUILD_DEPENDS= /nonexistent:${PORTSDIR}/graphics/jpeg:extract will always descend to the JPEG port and extract it.

Do not use ` Building mechanisms

If your package uses GNU make, set `USE_GMAKE=yes'. If your package uses configure, set `HAS_CONFIGURE=yes'. If your package uses GNU GNU_CONFIGURE=yes' (this implies --prefix=${PREFIX}' for GNU ${CONFIGURE_ARGS}. If your package uses GNU USE_AUTOCONF=yes'. This implies If your package is an X application that creates Makefiles from Imakefiles using imake, then set `USE_IMAKE=yes'. This will cause the configure stage to automatically do an xmkmf -a. If the `-a' flag is a problem for your port, set `XMKMF=xmkmf'. If the port uses imake but does not understand the `install.man' target, `NO_INSTALL_MANPAGES=yes' should be set. In addition, the author of the original port should be shot. :>

If your port's source Makefile has something else than `all' as the main build target, set ${ALL_TARGET} accordingly. Same goes for `install' and ${INSTALL_TARGET}. Special Considerations

There are some more things you have to take into account when you create a port. This section explains the most common of those.

If your port installs a shared library, add a post-install target to your Makefile that runs `${LDCONFIG} -m' on the directory where the new library is installed (usually ${PREFIX}/lib) to register it into the shared library cache.

Also, add a matching `@exec /sbin/ldconfig -m'/`@unexec /sbin/ldconfig -R' pair to your pkg/PLIST file so that a user who installed the package can start using the shared library immediately and deinstallation will not cause the system to still believe the library is there. These lines should immediately follow the line for the shared library itself, as in: lib/libtcl80.so.1 @exec /sbin/ldconfig -m %D/lib @unexec /sbin/ldconfig -R

Never, ever, ever add a line that says `ldconfig' without any arguments to your Makefile or pkg/PLIST. This will reset the shared library cache to the contents of /usr/lib only, and will royally screw up the user's machine ("Help, xinit does not run anymore after I install this port!"). Anybody who does this will be shot and cut into 65,536 pieces by a rusty knife and have his liver chopped out by a bunch of crows and will eternally rot to death in the deepest bowels of hell (not necessarily in that order).... ELF support

Since FreeBSD moved to ELF shortly after 3.0-release, we need to convert many ports that build shared libraries to support ELF. Complicating this task is that a 3.0 system can run as both ELF and a.out, and that there will be one more release (2.2.8) from the 2.2 branch. Below are the guidelines on how to convert a.out only ports to support both a.out and ELF compilation.

Some part of this list is only applicable during the conversion, but will be left here for awhile for reference in case you have come across some old port you wish to upgrade. Moving a.out libraries out of the way

A.out libraries should be moved out of /usr/local/lib and similar to an `src/Makefile (called from ` Format

The ports tree will build packages in the format the machine is in. This means a.out for 2.2 and a.out or ELF for 3.0 depending on what `objformat` returns. Also, once users move a.out libraries to a subdirectory, building a.out libraries will be unsupported. (I.e., it may still work if you know what you are doing, but you are on your own.)

Note: if a port only works for a.out, set PORTOBJFORMAT

PORTOBJFORMAT=${PORTOBJFORMAT}'. (See comment on The variable is set using this line: PORTOBJFORMAT!= test -x /usr/bin/objformat && /usr/bin/objformat || echo aout in Ports' make processes should use this variable to decide what to do. However, if the port's Building shared libraries

The following are differences in handling shared libraries for a.out and ELF. Shared library versionsAn ELF shared library should be called "Linker command linesAssuming `cc -shared' is used rather than `-Wl,-soname,libfoo.so.M' on the command line for ELF.

You need to install a symlink libfoo.so -> libfoo.so.N to make ELF linkers happy. Since it should be listed in

All port Makefiles are edited to remove minor numbers from foo\\.1\\.\\(33|40\\)' -> `foo.2'.) They will be matched using `grep -wF'.

In cases where you really need to install shlibs with two versions on an ELF system or those with one version on an a.out system (for instance, ports that install compatibility libraries for other operating systems), define the variable

The ${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m .... and in @exec /usr/bin/env OBJFORMAT=%%PORTOBJFORMAT%% /sbin/ldconfig -m ... @unexec /usr/bin/env OBJFORMAT=%%PORTOBJFORMAT%% /sbin/ldconfig -R This is to ensure that the correct

If your port needs to build slightly different versions of packages by having a variable (for instance, resolution or paper size) take different values, create one subdirectory per package to make it easier for users to see what to do, but try to share as many files as possible between ports. Typically you only need a very short Makefile in all but one of the directories if you use variables cleverly. In the sole Makefiles, you can use ${MASTERDIR} to specify the directory where the rest of the files are. Also, use a variable as part of so the packages will have different names.

This will be best demonstrated by an example. This is part of japanese/xdvi300/Makefile: : PKGNAME= ja-xdvi${RESOLUTION}-17 : # default RESOLUTION?= 300 .if ${RESOLUTION} != 118 && ${RESOLUTION} != 240 && \ ${RESOLUTION} != 300 && ${RESOLUTION} != 400 @${ECHO} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\"" @${ECHO} "Possible values are: 118, 240, 300 (default) and 400." @${FALSE} .endif japanese/xdvi300 also has all the regular patches, package files, etc. If you type `As for other resolutions, this is the xdvi118/Makefile (minus the comments): RESOLUTION= 118 MASTERDIR= ${.CURDIR}/../xdvi300 .include "${MASTERDIR}/Makefile" (xdvi240/Makefile and xdvi400/Makefile are similar). The ${MASTERDIR} definition tells ${PATCHDIR} and ${PKGDIR} are to be found under xdvi300/Makefile and the port will be built with resolution set to 118. Shared library versions

First, please read our to understand what to do with shared library versions in general. Do not blindly assume software authors know what they are doing; many of them do not. It is very important that these details are carefully considered, as we have quite a unique situation where we are trying to have dozens of potentially incompatible software pairs co-exist. Careless port imports have caused great trouble regarding shared libraries in the past (ever wondered why the port However, if there is a port which is a different version of the same software already in the tree, the situation is much more complex. In short, the FreeBSD implementation does not allow the user to specify to the linker which version of shared library to link against (the linker will always pick the highest numbered version). This means, if there is a Manpages

The pkg/PLIST (this means you must for more). It also makes the install stage automatically compress or uncompress manpages depending on the setting of /etc/make.conf.

To specify whether the manpages are compressed upon installation, use the If your port anchors its man tree somewhere other than PREFIX, you can use the MANPREFIX to set it. Also, if only manpages in certain sections go in a non-standard place, such as some Perl modules ports, you can set individual man paths using MANsectPREFIX (where sect is one of 1-9, L or N).

If your manpages go to language-specific subdirectories, set the name of the languages to "" (i.e., English only).

Here is an example that puts it all together. MAN1= foo.1 MAN3= bar.3 MAN4= baz.4 MANLANG= "" ja MAN3PREFIX= ${PREFIX}/share/foobar MANCOMPRESSED= yes states that six files ${PREFIX}/man/man1/foo.1.gz ${PREFIX}/man/ja/man1/foo.1.gz ${PREFIX}/share/foobar/man/man3/bar.3.gz ${PREFIX}/share/foobar/man/ja/man3/bar.3.gz ${PREFIX}/man/man4/baz.4.gz ${PREFIX}/man/ja/man4/baz.4.gz are installed by this port. Ports that require Motif

There are many programs that require a Motif library (available from several commercial vendors, while there is a free clone reported to be able to run many applications in x11-toolkits/lesstif) to compile. Since it is a popular toolkit and their licenses usually permit redistribution of statically linked binaries, we have made special provisions for handling ports that require Motif in a way that we can easily compile binaries linked either dynamically (for people who are compiling from the port) or statically (for people who distribute packages). REQUIRES_MOTIF

If your port requires Motif, define this variable in the Makefile. This will prevent people who don't own a copy of Motif from even attempting to build it. ${MOTIFLIB}

This variable will be set by bsd.port.mk to be the appropriate reference to the Motif library. Please patch the source to use this wherever the Motif library is referenced in the Makefile or Imakefile.

There are two common cases: If the port refers to the Motif library as `-lXm' in its Makefile or Imakefile, simply substitute `${MOTIFLIB}' for it. If the port uses `XmClientLibs' in its Imakefile, change it to `${MOTIFLIB} ${XTOOLLIB} ${XLIB}'.

Note that ${MOTIFLIB} (usually) expands to `-L/usr/X11R6/lib -lXm' or `/usr/X11R6/lib/libXm.a', so there is no need to add `-L' or `-l' in front. X11 fonts

If your port installs fonts for the X window system, put them in ${X11BASE}/lib/X11/fonts/local. This directory is new to XFree86 release 3.3.3. If it does not exist, please create it, and print out a message urging the user to update their XFree86 to 3.3.3 or newer, or at least add this directory to the font path in /etc/XF86Config. Info files

The new version of texinfo (included in 2.2.2-RELEASE and onwards) contains a utility called `&dollar{PREFIX}/info/dir file. (Sorry for the length of this section, but it is imperative to weave all the info files together. If done correctly, it will produce a beautiful listing, so please bear with me! First, this is what you (as a porter) need to know: % install-info --help install-info [OPTION]... [INFO-FILE [DIR-FILE]] Install INFO-FILE in the Info directory file DIR-FILE. Options: --delete Delete existing entries in INFO-FILE; don't insert any new entries. : --entry=TEXT Insert TEXT as an Info directory entry. : --section=SEC Put this file's entries in section SEC of the directory. :

Note that this program will not actually Here's a seven-step procedure to convert ports to use editors/emacs as an example. Look at the texinfo sources and make a patch to insert --- ./man/vip.texi.org Fri Jun 16 15:31:11 1995 +++ ./man/vip.texi Tue May 20 01:28:33 1997 @@ -2,6 +2,10 @@ @setfilename ../info/vip @settitle VIP +@dircategory The Emacs editor and associated tools +@direntry +* VIP: (vip). A VI-emulation for Emacs. +@end direntry @iftex @finalout :

The format should be self-explanatory. Many authors leave a Note that you can put only one info entry per file because of a bug in `install-info --delete' that deletes only the first entry if you specify multiple entries in the You can give the three places (japanese/skk for examples on how to do this). Go back to the port directory and do a `make clean; make' and verify that the info files are regenerated from the texinfo sources. Since the texinfo sources are newer than the info files, they should be rebuilt when you type --- ./Makefile.in.org Mon Aug 19 21:12:19 1996 +++ ./Makefile.in Tue Apr 15 00:15:28 1997 @@ -184,7 +184,7 @@ # Subdirectories to make recursively. `lisp' is not included # because the compiled lisp files are part of the distribution # and you cannot remake them without installing Emacs first. -SUBDIR = lib-src src +SUBDIR = lib-src src man # The makefiles of the directories in $SUBDIR. SUBDIR_MAKEFILES = lib-src/Makefile man/Makefile src/Makefile oldXMenu/Makefile lwlib/Makefile --- ./man/Makefile.in.org Thu Jun 27 15:27:19 1996 +++ ./man/Makefile.in Tue Apr 15 00:29:52 1997 @@ -66,6 +66,7 @@ ${srcdir}/gnu1.texi \ ${srcdir}/glossary.texi +all: info info: $(INFO_TARGETS) dvi: $(DVI_TARGETS)

The second hunk was necessary because the default target in the /usr/share/info (that patch is not shown here). If there is a place in the --- ./Makefile.in.org Mon Aug 19 21:12:19 1996 +++ ./Makefile.in Mon Apr 14 23:38:07 1997 @@ -368,14 +368,8 @@ if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \ then \ (cd ${infodir}; \ - if [ -f dir ]; then \ - if [ ! -f dir.old ]; then mv -f dir dir.old; \ - else mv -f dir dir.bak; fi; \ - fi; \ cd ${srcdir}/info ; \ - (cd $${thisdir}; ${INSTALL_DATA} ${srcdir}/info/dir ${infodir}/dir); \ - (cd $${thisdir}; chmod a+r ${infodir}/dir); \ for f in ccmode* cl* dired-x* ediff* emacs* forms* gnus* info* message* mh-e* sc* vip*; do \ (cd $${thisdir}; \ ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \ chmod a+r ${infodir}/$$f); \ (This step is only necessary if you are modifying an existing port.) Take a look at pkg/PLIST and delete anything that is trying to patch up info/dir. They may be in pkg/INSTALL or some other file, so search extensively. Index: pkg/PLIST =================================================================== RCS file: /usr/cvs/ports/editors/emacs/pkg/PLIST,v retrieving revision 1.15 diff -u -r1.15 PLIST --- PLIST 1997/03/04 08:04:00 1.15 +++ PLIST 1997/04/15 06:32:12 @@ -15,9 +15,6 @@ man/man1/emacs.1.gz man/man1/etags.1.gz man/man1/ctags.1.gz -@unexec cp %D/info/dir %D/info/dir.bak -info/dir -@unexec cp %D/info/dir.bak %D/info/dir info/cl info/cl-1 info/cl-2 Add a Index: Makefile =================================================================== RCS file: /usr/cvs/ports/editors/emacs/Makefile,v retrieving revision 1.26 diff -u -r1.26 Makefile --- Makefile 1996/11/19 13:14:40 1.26 +++ Makefile 1997/05/20 10:25:09 1.28 @@ -20,5 +20,11 @@ post-install: .for file in emacs-19.34 emacsclient etags ctags b2m strip ${PREFIX}/bin/${file} .endfor + if [ ! -f ${PREFIX}/info/dir ]; then \ + ${SED} -ne '1,/Menu:/p' /usr/share/info/dir > ${PREFIX}/info/dir; \ + fi +.for info in emacs vip viper forms gnus mh-e cl sc dired-x ediff ccmode + install-info ${PREFIX}/info/${info} ${PREFIX}/info/dir +.endfor .include

Do not use anything other than /usr/share/info/dir and the above command to create a new info file. In fact, I'd add the first three lines of the above patch to Edit info/dir with Index: pkg/PLIST =================================================================== RCS file: /usr/cvs/ports/editors/emacs/pkg/PLIST,v retrieving revision 1.15 diff -u -r1.15 PLIST --- PLIST 1997/03/04 08:04:00 1.15 +++ PLIST 1997/05/20 10:25:12 1.17 @@ -16,7 +14,15 @@ man/man1/etags.1.gz man/man1/ctags.1.gz +@unexec install-info --delete %D/info/emacs %D/info/dir : +@unexec install-info --delete %D/info/ccmode %D/info/dir info/cl info/cl-1 @@ -87,6 +94,18 @@ info/viper-3 info/viper-4 +@exec [ -f %D/info/dir ] || sed -ne '1,/Menu:/p' /usr/share/info/dir > %D/info/dir +@exec install-info %D/info/emacs %D/info/dir : +@exec install-info %D/info/ccmode %D/info/dir libexec/emacs/19.34/i386--freebsd/cvtmail libexec/emacs/19.34/i386--freebsd/digest-doc

Note that the `@unexec install-info --delete' commands have to be listed before the info files themselves so they can read the files. Also, the `@exec install-info' commands have to be after the info files and the and admire your work. The

There are some tricks we haven't mentioned yet about the

If your port needs to execute commands when the binary package is installed with INSTALL ${PKGNAME} PRE-INSTALL' and the second time as `INSTALL ${PKGNAME} POST-INSTALL'. `$2' can be tested to determine which mode the script is being run in. The `PKG_PREFIX' environmental variable will be set to the package installation directory. See man pkg_add(1) for additional information. Note, that this script is not run automatically if you install the port with `make install'. If you are depending on it being run, you will have to explicitly call it from your port's Makefile.

If your port needs to determine if it should install or not, you can create a pkg/REQ ``requirements'' script. It will be invoked automatically at installation/deinstallation time to determine whether or not installation/deinstallation should proceed. Changing

Some ports, particularly the p5- ports, need to change their If you need to make other substitutions, you can set the PLIST_SUB variable with a list of VAR=VALUE pairs and instances of `%%VAR%%' will be substituted with ` OCTAVE_VERSION= 2.0.13 PLIST_SUB= OCTAVE_VERSION=${OCTAVE_VERSION} in the %%OCTAVE_VERSION%% wherever the version shows up in This substitution (as well as addition of any ) will be done between the ${PLIST} and writing to ${TMPPLIST} (default: ${WRKDIR}/.PLIST.mktmp). So if your port builds ${PLIST} on the fly, do so in or before Changing the names of files in the

All the filenames in the for why it is a bad idea to write directly into the Here is a list of variable names and their default values. COMMENT ${PKGDIR}/COMMENT DESCR ${PKGDIR}/DESCR PLIST ${PKGDIR}/PLIST PKGINSTALL ${PKGDIR}/INSTALL PKGDEINSTALL ${PKGDIR}/DEINSTALL PKGREQ ${PKGDIR}/REQ PKGMESSAGE ${PKGDIR}/MESSAGE

Please change these variables rather than overriding PKG_ARGS. If you change PKG_ARGS, those files will not correctly be installed in /var/db/pkg upon install from a port. Licensing Problems

Some software packages have restrictive licenses or can be in violation to the law (PKP's patent on public key crypto, ITAR (export of crypto software) to name just two of them). What we can do with them varies a lot, depending on the exact wordings of the respective licenses.

Note that it is your responsibility as a porter to read the licensing terms of the software and make sure that the FreeBSD project will not be held accountable of violating them by redistributing the source or compiled binaries either via ftp or CD-ROM. If in doubt, please contact the &a.ports;.

There are two variables you can set in the Makefile to handle the situations that arise frequently: If the port has a `do not sell for profit' type of license, set the variable NO_CDROM to the string describing the reason why. We will make sure such ports won't go into the CD-ROM come release time. The distfile and package will still be available via ftp. If the resulting package needs to be built uniquely for each site, or the resulting binary package can't be distributed due to licensing, set the variable NO_PACKAGE to the string describing the reason why. We will make sure such packages won't go on the ftp site, nor into the CD-ROM come release time. The distfile will still be included on both however. If the port has legal restrictions on who can use it (e.g., crypto stuff) or has a `no commercial use' license, set the variable RESTRICTED to be the string describing the reason why. For such ports, the distfiles/packages will not be available even from our ftp sites.

Note: The GNU General Public License (GPL), both version 1 and 2, should not be a problem for ports.

Note: If you are a committer, make sure you update the ports/LEGAL file too. Upgrading

When you notice that a port is out of date compared to the latest version from the original authors, first make sure you have the latest port. You can find them in the ports-current directory of the ftp mirror sites.

The next step is to send a mail to the maintainer, if one is listed in the port's Makefile. That person may already be working on an upgrade, or have a reason to not upgrade the port right now (because of, for example, stability problems of the new version).

If the maintainer asks you to do the upgrade or there isn't any such person to begin with, please make the upgrade and send the recursive diff (either unified or context diff is fine, but port committers appear to prefer unified diff more) of the new and old ports directories to us (e.g., if your modified port directory is called `superedit' and the original as in our tree is `superedit.bak', then send us the result of `diff -ruN superedit.bak superedit'). Please examine the output to make sure all the changes make sense. The best way to send us the diff is by including it to send-pr(1) (category `ports'). Please mention any added or deleted files in the message, as they have to be explicitly specified to CVS when doing a commit. If the diff is more than about 20KB, please compress and uuencode it; otherwise, just include it in as is in the PR. Do's and Dont's

Here is a list of common do's and dont's that you encounter during the porting process. You should check your own port against this list, but you can also check ports in the PR database that others have submitted. Submit any comments on ports you check as described in . Checking ports in the PR database will both make it faster for us to commit them, and prove that you know what you are doing. Strip Binaries

Do strip binaries. If the original source already strips the binaries, fine; otherwise you should add a post-install rule to do it yourself. Here is an example: post-install: strip ${PREFIX}/bin/xdl

Use the file command on the installed executable to check whether the binary is stripped or not. If it does not say `not stripped', it is stripped. INSTALL_* macros

Do use the macros provided in bsd.port.mk to ensure correct modes and ownership of files in your own *-install targets. They are: ${INSTALL_PROGRAM} is a command to install binary executables. ${INSTALL_SCRIPT} is a command to install executable scripts. ${INSTALL_DATA} is a command to install sharable data. ${INSTALL_MAN} is a command to install manpages and other documentation (it doesn't compress anything).

These are basically the install command with all the appropriate flags. See below for an example on how to use them.

Do not write anything to files outside for an example of building ports from a read-only tree). If you need to modify some file in ${PKGDIR}, do so by , not by writing over it.

Make sure your port honors ${WRKDIR} of another port, note that the correct location is ${WRKDIRPREFIX}${PORTSDIR}/subdir/name/work, not ${PORTSDIR}/subdir/name/work or ${.CURDIR}/../../subdir/name/work or some such.

Also, if you are defining ${WRKDIRPREFIX}${.CURDIR} in the front. Differentiating operating systems and OS versions

You may come across code that needs modifications or conditional compilation based upon what version of UNIX it is running under. If you need to make such changes to the code for conditional compilation, make sure you make the changes as general as possible so that we can back-port code to FreeBSD 1.x systems and cross-port to other BSD systems such as 4.4BSD from CSRG, BSD/386, 386BSD, NetBSD, and OpenBSD.

The preferred way to tell 4.3BSD/Reno (1990) and newer versions of the BSD code apart is by using the `BSD' macro defined in <sys/param.h>. Hopefully that file is already included; if not, add the code: #if (defined(__unix__) || defined(unix)) && !defined(USG) #include #endif

to the proper place in the .c file. We believe that every system that defines these two symbols has sys/param.h. If you find a system that doesn't, we would like to know. Please send mail to the &a.ports;.

Another way is to use the GNU Autoconf style of doing this: #ifdef HAVE_SYS_PARAM_H #include #endif Don't forget to add -DHAVE_SYS_PARAM_H to the CFLAGS in the Makefile for this method. Once you have <sys/param.h> included, you may use: #if (defined(BSD) && (BSD >= 199103)) to detect if the code is being compiled on a 4.3 Net2 code base or newer (e.g. FreeBSD 1.x, 4.3/Reno, NetBSD 0.9, 386BSD, BSD/386 1.1 and below). Use: #if (defined(BSD) && (BSD >= 199306)) to detect if the code is being compiled on a 4.4 code base or newer (e.g. FreeBSD 2.x, 4.4, NetBSD 1.0, BSD/386 2.0 or above). The value of the BSD macro is 199506 for the 4.4BSD-Lite2 code base. This is stated for informational purposes only. It should not be used to distinguish between versions of FreeBSD based only on 4.4-Lite vs. versions that have merged in changes from 4.4-Lite2. The __FreeBSD__ macro should be used instead.

Use sparingly: __FreeBSD__ is defined in all versions of FreeBSD. Use it if the change you are making ONLY affects FreeBSD. Porting gotchas like the use of sys_errlist[] vs strerror() are Berkeleyisms, not FreeBSD changes. In FreeBSD 2.x, __FreeBSD__ is defined to be 2. In earlier versions, it is 1. Later versions will bump it to match their major version number. If you need to tell the difference between a FreeBSD 1.x system and a FreeBSD 2.x or 3.x system, usually the right answer is to use the BSD macros described above. If there actually is a FreeBSD specific change (such as special shared library options when using `ld') then it is OK to use __FreeBSD__ and `#if __FreeBSD__ > 1' to detect a FreeBSD 2.x and later system. If you need more granularity in detecting FreeBSD systems since 2.0-RELEASE you can use the following: #if __FreeBSD__ >= 2 #include # if __FreeBSD_version >= 199504 /* 2.0.5+ release specific code here */ # endif #endif __FreeBSD_version values: 2.0-RELEASE: 199411 2.1-current's: 199501, 199503 2.0.5-RELEASE: 199504 2.2-current before 2.1: 199508 2.1.0-RELEASE: 199511 2.2-current before 2.1.5: 199512 2.1.5-RELEASE: 199607 2.2-current before 2.1.6: 199608 2.1.6-RELEASE: 199612 2.1.7-RELEASE: 199612 2.2-RELEASE: 220000 2.2.1-RELEASE: 220000 (yes, no change) 2.2-STABLE after 2.2.1-RELEASE: 220000 (yes, still no change) 2.2-STABLE after texinfo-3.9: 221001 2.2-STABLE after top: 221002 2.2.2-RELEASE: 222000 2.2-STABLE after 2.2.2-RELEASE: 222001 2.2.5-RELEASE: 225000 2.2-STABLE after 2.2.5-RELEASE: 225001 2.2-STABLE after ldconfig -R merge: 225002 2.2.6-RELEASE: 226000 2.2.7-RELEASE: 227000 2.2-STABLE after 2.2.7-RELEASE: 227001 2.2-STABLE after semctl(2) change: 227002 2.2.8-RELEASE: 228000 2.2-STABLE after 2.2.8-RELEASE: 228001 3.0-current before mount(2) change: 300000 3.0-current after mount(2) change: 300001 3.0-current after semctl(2) change: 300002 3.0-current after ioctl arg changes: 300003 3.0-current after ELF conversion: 300004 3.0-RELEASE: 300005 3.0-current after 3.0-RELEASE: 300006 3.0-stable after 3/4 branch: 300007 3.1-RELEASE: 310000 3.1-stable after 3.1-RELEASE: 310001 4.0-current after 3/4 branch: 400000 (Note that 2.2-STABLE sometimes identifies itself as "2.2.[5678]-STABLE" after the 2.2.5-RELEASE.) The pattern used to be year followed by the month, but we decided to change it to a more straightforward major/minor system starting from 2.2. This is because the parallel development on several branches made it infeasible to classify the releases simply by their real release dates. (Note that if you are making a port now, you don't have to worry about old -current's; they are listed here just for your reference.)

In the hundreds of ports that have been done, there have only been one or two cases where __FreeBSD__ should have been used. Just because an earlier port screwed up and used it in the wrong place does not mean you should do so too. Writing something after

Do not write anything after the `.include <bsd.port.mk>' line. It usually can be avoided by including &dollar{ARCH} The architecture, as returned by `uname -m' (e.g., `i386'). &dollar{OPSYS} The operating system type, as returned by `uname -s' (e.g., `FreeBSD'). &dollar{OSREL} The release version of the operating system (e.g., `2.1.5', `2.2.7'). &dollar{OSVERSION} The numeric version of the operating system, same as above. &dollar{PORTOBJFORMAT} The object format of the system (`aout' or `elf'). &dollar{LOCALBASE} The base of the `local' tree (e.g., `/usr/local/'). &dollar{X11BASE} The base of the `X11' tree (e.g., `/usr/X11R6/'). &dollar{PREFIX} Where the port installs itself (see ).

Note: if you have to define the variables # no need to compile lang/perl5 if perl5 is already in system .if ${OSVERSION} > 300003 BROKEN= perl is in system .endif # only one shlib version number for ELF .if ${PORTOBJFORMAT} == "elf" TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR} .else TCL_LIB_FILE= ${TCL_LIB}.${SHLIB_MAJOR}.${SHLIB_MINOR} .endif # software already makes link for ELF, but not for a.out post-install: .if ${PORTOBJFORMAT} == "aout" ${LN} -sf liblinpack.so.1.0 ${PREFIX}/lib/liblinpack.so .endif Install additional documentation

If your software has some documentation other than the standard man and info pages that you think is useful for the user, install it under ${PREFIX}/share/doc. This can be done, like the previous item, in the post-install target.

Create a new directory for your port. The directory name should reflect what the port is. This usually means ${PKGNAME} minus the version part. However, if you think the user might want different versions of the port to be installed at the same time, you can use the whole ${PKGNAME}.

Make the installation dependent on the variable NOPORTDOCS so that users can disable it in /etc/make.conf, like this: post-install: .if !defined(NOPORTDOCS) ${MKDIR} ${PREFIX}/share/doc/xv ${INSTALL_MAN} ${WRKSRC}/docs/xvdocs.ps ${PREFIX}/share/doc/xv .endif

Do not forget to add them to pkg/PLIST too! (Do not worry about NOPORTDOCS here; there is currently no way for the packages to read variables from /etc/make.conf.)

Also, you can use the pkg/MESSAGE file to display messages upon installation. See the section for details. DIST_SUBDIR

Do not let your port clutter /usr/ports/distfiles. If your port requires a lot of files to be fetched, or contains a file that has a name that might conflict with other ports (e.g., `Makefile'), set ${DIST_SUBDIR} to the name of the port (${PKGNAME} without the version part should work fine). This will change ${DISTDIR} from the default /usr/ports/distfiles to /usr/ports/distfiles/${DIST_SUBDIR}, and in effect puts everything that is required for your port into that subdirectory.

It will also look at the subdirectory with the same name on the backup master site at ftp.freebsd.org. (Setting ${DISTDIR} explicitly in your Makefile will not accomplish this, so please use ${DIST_SUBDIR}.)

Note this does not affect the ${MASTER_SITES} you define in your Makefile. RCS strings

Do not put RCS strings in patches. CVS will mangle them when we put the files into the ports tree, and when we check them out again, they will come out different and the patch will fail. RCS strings are surrounded by dollar (`$') signs, and typically start with `$Id' or `$RCS'. Recursive diff

Using the recurse (`-r') option to diff to generate patches is fine, but please take a look at the resulting patches to make sure you don't have any unnecessary junk in there. In particular, diffs between two backup files, Makefiles when the port uses Imake or GNU Also, if you had to delete a file, then you can do it in the post-extract target rather than as part of the patch. Once you are happy with the resulting diff, please split it up into one source file per patch file. PREFIX

Do try to make your port install relative to ${PREFIX}. (The value of this variable will be set to ${LOCALBASE} (default /usr/local), unless ${USE_X_PREFIX} or ${USE_IMAKE} is set, in which case it will be ${X11BASE} (default /usr/X11R6).)

Not hard-coding `/usr/local' or `/usr/X11R6' anywhere in the source will make the port much more flexible and able to cater to the needs of other sites. For X ports that use imake, this is automatic; otherwise, this can often be done by simply replacing the occurrences of `/usr/local' (or `/usr/X11R6' for X ports that do not use imake) in the various scripts/Makefiles in the port to read `${PREFIX}', as this variable is automatically passed down to every stage of the build and install processes.

Do not set USE_X_PREFIX unless your port truly requires it (i.e. it links against X libs or it needs to reference files in ${X11BASE}).

The variable ${PREFIX} can be reassigned in your Makefile or in the user's environment. However, it is strongly discouraged for individual ports to set this variable explicitly in the Makefiles.

Also, refer to programs/files from other ports with the variables mentioned above, not explicit pathnames. For instance, if your port requires a macro PAGER to be the full pathname of less, use the compiler flag: -DPAGER=\"${PREFIX}/bin/less\" or -DPAGER=\"${LOCALBASE}/bin/less\" if this is an X port, instead of -DPAGER=\"/usr/local/bin/less\". This way it will have a better chance of working if the system administrator has moved the whole `/usr/local' tree somewhere else. Subdirectories

Try to let the port put things in the right subdirectories of ${PREFIX}. Some ports lump everything and put it in the subdirectory with the port's name, which is incorrect. Also, many ports put everything except binaries, header files and manual pages in the a subdirectory of `lib', which does not bode well with the BSD paradigm. Many of the files should be moved to one of the following: `etc' (setup/configuration files), `libexec' (executables started internally), `sbin' (executables for superusers/managers), `info' (documentation for info browser) or `share' (architecture independent files). See man hier(7) for details; the rules governing /usr pretty much apply to /usr/local too. The exceptions are ports dealing with USENET `news'. They may use ${PREFIX}/news as a destination for their files. Cleaning up empty directories

Do make your ports clean up after themselves when they are deinstalled. This is usually accomplished by adding : lib/X11/oneko/pixmaps/cat.xpm lib/X11/oneko/sounds/cat.au : @dirrm lib/X11/oneko/pixmaps @dirrm lib/X11/oneko/sounds @dirrm lib/X11/oneko

However, sometimes : @unexec rmdir %D/share/doc/gimp 2>/dev/null || true This will neither print any error messages nor cause ${PREFIX}/share/doc/gimp is not empty due to other ports installing some files in there. UIDs

If your port requires a certain user to be on the installed system, let the pkg/INSTALL script call pw to create it automatically. Look at net/cvsup-mirror for an example.

If your port must use the same user/group ID number when it is installed as a binary package as when it was compiled, then you must choose a free UID from 50 to 99 and register it below. Look at japanese/Wnn for an example.

Make sure you don't use a UID already used by the system or other ports. This is the current list of UIDs between 50 and 99. majordom:*:54:54:Majordomo Pseudo User:/usr/local/majordomo:/nonexistent cyrus:*:60:60:the cyrus mail server:/nonexistent:/nonexistent gnats:*:61:1:GNATS database owner:/usr/local/share/gnats/gnats-db:/bin/sh uucp:*:66:66:UUCP pseudo-user:/var/spool/uucppublic:/usr/libexec/uucp/uucico xten:*:67:67:X-10 daemon:/usr/local/xten:/nonexistent pop:*:68:6:Post Office Owner (popper):/nonexistent:/nonexistent wnn:*:69:7:Wnn:/nonexistent:/nonexistent ifmail:*:70:66:Ifmail user:/nonexistent:/nonexistent pgsql:*:70:70:PostgreSQL pseudo-user:/usr/local/pgsql:/bin/sh ircd:*:72:72:IRCd hybrid:/nonexistent:/nonexistent alias:*:81:81:QMail user:/var/qmail/alias:/nonexistent qmaill:*:83:81:QMail user:/var/qmail:/nonexistent qmaild:*:82:81:QMail user:/var/qmail:/nonexistent qmailq:*:85:82:QMail user:/var/qmail:/nonexistent qmails:*:87:82:QMail user:/var/qmail:/nonexistent qmailp:*:84:81:QMail user:/var/qmail:/nonexistent qmailr:*:86:82:QMail user:/var/qmail:/nonexistent msql:*:87:87:mSQL-2 pseudo-user:/var/db/msqldb:/bin/sh

Please include a notice when you submit a port (or an upgrade) that reserves a new UID or GID in this range. This allows us to keep the list of reserved IDs up to date. Do things rationally

The Makefile should do things simply and reasonably. If you can make it a couple of lines shorter or more readable, then do so. Examples include using a make `.if' construct instead of a shell `if' construct, not redefining do-extract if you can redefine ${EXTRACT*} instead, and using $GNU_CONFIGURE instead of `CONFIGURE_ARGS += --prefix=${PREFIX}'. Respect CFLAGS

The port should respect the ${CFLAGS} variable. If it doesn't, please add `NO_PACKAGE=ignores cflags' to the Makefile. Configuration files

If your port requires some configuration files in ${PREFIX}/etc, do pkg/PLIST. That will cause Instead, install sample files with a suffix (`<filename>.sample' will work well) and print out a pointing out that the user has to copy and edit the file before the software can be made to work. Portlint

Do check your port with before you submit or commit it. Feedback

Do send applicable changes/patches to the original author/maintainer for inclusion in next release of the code. This will only make your job that much easier for the next release. Miscellanea

The files pkg/DESCR, pkg/COMMENT, and pkg/PLIST should each be double-checked. If you are reviewing a port and feel they can be worded better, do so.

Don't copy more copies of the GNU General Public License into our system, please.

Please be careful to note any legal issues! Don't let us illegally distribute software! If you are stuck....

Do look at existing examples and the bsd.port.mk file before asking us questions! ;)

Do ask us questions if you have any trouble! Do not just beat your head against a wall! :) A Sample Makefile

Here is a sample Makefile that you can use to create a new port. Make sure you remove all the extra comments (ones between brackets)!

It is recommended that you follow this format (ordering of variables, empty lines between sections, etc.). This format is designed so that the most important information is easy to locate. We recommend that you use to check the Makefile. [the header...just to make it easier for us to identify the ports.] # New ports collection makefile for: xdvi [the version required header should updated when upgrading a port.] # Version required: pl18 [things like "1.5alpha" are fine here too] [this is the date when the first version of this Makefile was created. Never change this when doing an update of the port.] # Date created: 26 May 1995 [this is the person who did the original port to FreeBSD, in particular, the person who wrote the first version of this Makefile. Remember, this should not be changed when upgrading the port later.] # Whom: Satoshi Asami # # $Id$ [ ^^^^ This will be automatically replaced with RCS ID string by CVS when it is committed to our repository.] # [section to describe the port itself and the master site - DISTNAME is always first, followed by PKGNAME (if necessary), CATEGORIES, and then MASTER_SITES, which can be followed by MASTER_SITE_SUBDIR. After those, one of EXTRACT_SUFX or DISTFILES can be specified too.] DISTNAME= xdvi PKGNAME= xdvi-pl18 CATEGORIES= print [do not forget the trailing slash ("/")! if you aren't using MASTER_SITE_* macros] MASTER_SITES= ${MASTER_SITE_XCONTRIB} MASTER_SITE_SUBDIR= applications [set this if the source is not in the standard ".tar.gz" form] EXTRACT_SUFX= .tar.Z [section for distributed patches -- can be empty] PATCH_SITES= ftp://ftp.sra.co.jp/pub/X11/japanese/ PATCHFILES= xdvi-18.patch1.gz xdvi-18.patch2.gz [maintainer; *mandatory*! This is the person (preferably with commit privileges) who a user can contact for questions and bug reports - this person should be the porter or someone who can forward questions to the original porter reasonably promptly. If you really do not want to have your address here, set it to "ports@FreeBSD.ORG".] MAINTAINER= asami@FreeBSD.ORG [dependencies -- can be empty] RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript LIB_DEPENDS= Xpm.5:${PORTSDIR}/graphics/xpm [this section is for other standard bsd.port.mk variables that do not belong to any of the above] [If it asks questions during configure, build, install...] IS_INTERACTIVE= yes [If it extracts to a directory other than ${DISTNAME}...] WRKSRC= ${WRKDIR}/xdvi-new [If the distributed patches were not made relative to ${WRKSRC}, you may need to tweak this] PATCH_DIST_STRIP= -p1 [If it requires a "configure" script generated by GNU autoconf to be run] GNU_CONFIGURE= yes [If it requires GNU make, not /usr/bin/make, to build...] USE_GMAKE= yes [If it is an X application and requires "xmkmf -a" to be run...] USE_IMAKE= yes [et cetera.] [non-standard variables to be used in the rules below] MY_FAVORITE_RESPONSE= "yeah, right" [then the special rules, in the order they are called] pre-fetch: i go fetch something, yeah post-patch: i need to do something after patch, great pre-install: and then some more stuff before installing, wow [and then the epilogue] .include Package Names

The following are the conventions you should follow in naming your packages. This is to have our package directory easy to scan, as there are already lots and lots of packages and users are going to turn away if they hurt their eyes!

The package name should look like [-][[-]]-; If your ${DISTNAME} doesn't look like that, set ${PKGNAME} to something in that format. FreeBSD strives to support the native language of its users. The `<language>' part should be a two letter abbreviation of the natural language defined by ISO-639 if the port is specific to a certain language. Examples are `ja' for Japanese, `ru' for Russian, `vi' for Vietnamese, `zh' for Chinese, `ko' for Korean and `de' for German. The `<name>' part should be all lowercases, except for a really large package (with lots of programs in it). Things like XFree86 (yes there really is a port of it, check it out) and ImageMagick fall into this category. Otherwise, convert the name (or at least the first letter) to lowercase. If the capital letters are important to the name (for example, with one-letter names like R or V) you may use capital letters at your discretion. There is a tradition of naming Perl 5 modules by prepending `p5-' and converting the double-colon separator to a hyphen; for example, the `Data::Dumper' module becomes `p5-Data-Dumper'. If the software in question has numbers, hyphens, or underscores in its name, you may include them as well (like `kinput2'). If the port can be built with different (usually part of the directory name in a family of ports), the `<compiled.specifics>' part should state the compiled-in defaults (the hyphen is optional). Examples are papersize and font units. The version string should be a period-separated list of integers and single lowercase alphabetics. The only exception is the string `pl' (meaning `patchlevel'), which can be used only when there are no major and minor version numbers in the software.

Here are some (real) examples on how to convert a ${DISTNAME} into a suitable ${PKGNAME}: DISTNAME PKGNAME Reason mule-2.2.2 mule-2.2.2 no prob at all XFree86-3.1.2 XFree86-3.1.2 ditto EmiClock-1.0.2 emiclock-1.0.2 no uppercase names for single programs gmod1.4 gmod-1.4 need hyphen after `' xmris.4.02 xmris-4.02 ditto rdist-1.3alpha rdist-1.3a no strings like `alpha' allowed es-0.9-beta1 es-0.9b1 ditto v3.3beta021.src tiff-3.3 what the heck was that anyway? ;) tvtwm tvtwm-pl11 version string always required piewm piewm-1.0 ditto xvgr-2.10pl1 xvgr-2.10.1 `pl' allowed only when no maj/minor numbers gawk-2.15.6 ja-gawk-2.15.6 Japanese language version psutils-1.13 psutils-letter-1.13 papersize hardcoded at package build time pkfonts pkfonts300-1.0 package for 300dpi fonts

If there is absolutely no trace of version information in the original source and it is unlikely that the original author will ever release another version, just set the version string to `1.0' (like the piewm example above). Otherwise, ask the original author or use the date string (`yy.mm.dd') as the version. Categories

As you already know, ports are classified in several categories. But for this to work, it is important that porters and users understand what each category is and how we decide what to put in each category. Current list of categories

First, this is the current list of port categories. Those marked with an asterisk (pkg/COMMENT file in that subdirectory (e.g., archivers/pkg/COMMENT). Ports to support the AfterStep window manager. Archiving tools. Astronomical ports. Sound support. Benchmarking utilities. Biology-related software. Computer aided design tools. Chinese language support. Communication software. Mostly software to talk to your serial port. Character code converters. Databases. Things that used to be on the desktop before computers were invented. Development utilities. Do not put libraries here just because they are libraries -- unless they truly don't belong to anywhere else, they shouldn't be in this category. General editors. Specialized editors go in the section for those tools (e.g., a mathematical-formula editor will go in Emacs-lisp ports. Emulators for other operating systems. Terminal emulators do Games. German language support. Graphics utilities. Japanese language support. Ports that form the K Desktop Environment (kde). Korean language support. Programming languages. Mail software. Numerical computation software and other utilities for mathematics. MBone applications. Miscellaneous utilities -- basically things that doesn't belong to anywhere else. This is the only category that should not appear with any other non-virtual category. If you have Miscellaneous networking software. USENET news software. Ports from the OffiX suite. Software support for the 3Com Palm(tm) series. Ports that require perl version 5 to run. Various programs from Plan9. Printing software. Desktop publishing tools (previewers, etc.) belong here too. Software written in python. Russian language support. Security utilities. Command line shells. System utilities. Ports that use tcl version 7.5 to run. Ports that use tcl version 7.6 to run. Ports that use tcl version 8.0 to run. Ports that use tcl version 8.1 to run. Text processing utilities. It does not include desktop publishing tools, which go to Ports that use tk version 4.1 to run. Ports that use tk version 4.2 to run. Ports that use tk version 8.0 to run. Ports that use tk version 8.1 to run. Vietnamese language support. Ports to support the WindowMaker window manager. Software related to the World Wide Web. HTML language support belong here too. The X window system and friends. This category is only for software that directly support the window system. Do not put regular X applications here. If your port is an X application, define X11 clocks. X11 file managers. X11 fonts and font utilities. X11 toolkits. X11 window managers. Choosing the right category

As many of the categories overlap, you often have to choose which of the categories should be the `primary' category of your port. There are several rules that govern this issue. Here is the list of priorities, in decreasing order of precedence. Language specific categories always come first. For example, if your port installs Japanese X11 fonts, then your japanese x11-fonts'. Specific categories win over less-specific ones. For instance, an HTML editor should be listed as `www editors', not the other way around. Also, you don't need to list If your port truly doesn't belong to anywhere else, put it in

If you are not sure about the category, please put a comment to that effect in your Changes to this document and the ports system

If you maintain a lot of ports, you should consider following the &a.ports;. Important changes to the way ports work will be announced there. You can always find more detailed information on the latest changes by looking at . That is It, Folks!

Boy, this sure was a long tutorial, wasn't it? Thanks for following us to here, really.

Well, now that you know how to do a port, let us go at it and convert everything in the world into ports! That is the easiest way to start contributing to the FreeBSD Project! :) diff --git a/handbook/stable.sgml b/handbook/stable.sgml index af4670215c..6fdac7e4f6 100644 --- a/handbook/stable.sgml +++ b/handbook/stable.sgml @@ -1,128 +1,128 @@ - + Staying Stable with FreeBSD

Contributed by &a.jkh;. What is FreeBSD-stable?

FreeBSD-stable is our development branch for a more low-key and conservative set of changes intended for our next mainstream release. Changes of an experimental or untested nature do not go into this branch (see ). Who needs FreeBSD-stable?

If you are a commercial user or someone who puts maximum stability of their FreeBSD system before all other concerns, you should consider tracking stable. This is especially true if you have installed the most recent release ( at the time of this writing) since the stable branch is effectively a bug-fix stream relative to the previous release.

Please note that the stable tree endeavors, above all, to be fully compilable and stable at all times, but we do occasionally make mistakes (these are still active sources with quickly-transmitted updates, after all). We also do our best to thoroughly test fixes in current before bringing them into stable, but sometimes our tests fail to catch every case. If something breaks for you in stable, please let us know immediately! (see next section). Getting FreeBSD-stable

Join the &a.stable . This will keep you informed of build-dependencies that may appear in stable or any other issues requiring special attention. Developers will also make announcements in this mailing list when they are contemplating some controversial fix or update, giving the users a chance to respond if they have any issues to raise concerning the proposed change. The cvs-all mailing list also allows you to see the commit log entry for each change as it is made, along with any pertinent information on possible side-effects, and is another good mailing list to subscribe to. To join these lists, send mail to &a.majordomo and specify: subscribe freebsd-stable subscribe cvs-all In the body of your message. Optionally, you can also say `help' and Majordomo will send you full help on how to subscribe and unsubscribe to the various other mailing lists we support.

If you're installing a new system and want it to be as -stable as possible, you can simply grab the latest dated branch snapshot from and install it like any other release.

If you're already running a previous release of 2.2 and wish to upgrade via sources then you can easily do so from ftp.FreeBSD.ORG. This can be done in one of three ways:

Use the facility. Unless you have a good TCP/IP connection at a flat rate, this is the way to do it.

Use the program with . This is the second most recommended method, since it allows you to grab the entire collection once and then only what has changed from then on. Many people run cvsup from cron to keep their sources up-to-date automatically. For a fairly easy interface to this, simply type: - pkg_add -f ftp://ftp.freebsd.org/pub/FreeBSD/CVSup/cvsupit.tgz + pkg_add -f ftp://ftp.freebsd.org/pub/FreeBSD/development/CVSup/cvsupit.tgz

Use ftp. The source tree for FreeBSD-stable is always "exported" on:

We also use `wu-ftpd' which allows compressed/tar'd grabbing of whole trees. e.g. you see: usr.bin/lex You can do: ftp> cd usr.bin ftp> get lex.tar.Z and it will get the whole directory for you as a compressed tar file.

Essentially, if you need rapid on-demand access to the source and communications bandwidth is not a consideration, use cvsup or ftp. Otherwise, use CTM.

Before compiling stable, read the Makefile in /usr/src carefully. You should at least run a `' the first time through as part of the upgrading process. Reading the &a.stable will keep you up-to-date on other bootstrapping procedures that sometimes become necessary as we move towards the next release.