Index: head/en_US.ISO8859-1/articles/committers-guide/article.xml
===================================================================
--- head/en_US.ISO8859-1/articles/committers-guide/article.xml (revision 53416)
+++ head/en_US.ISO8859-1/articles/committers-guide/article.xml (revision 53417)
@@ -1,5500 +1,5489 @@
]>
Committer's GuideThe &os; Documentation Project199920002001200220032004200520062007200820092010201120122013201420152016201720182019The &os; Documentation Project
&tm-attrib.freebsd;
&tm-attrib.coverity;
&tm-attrib.ibm;
&tm-attrib.intel;
&tm-attrib.sparc;
&tm-attrib.general;
$FreeBSD$$FreeBSD$This document provides information for the &os;
committer community. All new committers should read this
document before they start, and existing committers are
strongly encouraged to review it from time to time.Almost all &os; developers have commit rights to one or
more repositories. However, a few developers do not, and some
of the information here applies to them as well. (For
instance, some people only have rights to work with the
Problem Report database). Please see
for more information.This document may also be of interest to members of the
&os; community who want to learn more about how the project
works.Administrative DetailsLogin Methods&man.ssh.1;, protocol 2 onlyMain Shell Hostfreefall.FreeBSD.orgSMTP Hostsmtp.FreeBSD.org:587
(see also ).src/ Subversion
Rootsvn+ssh://repo.FreeBSD.org/base
(see also ).doc/ Subversion
Rootsvn+ssh://repo.FreeBSD.org/doc
(see also ).ports/ Subversion
Rootsvn+ssh://repo.FreeBSD.org/ports
(see also ).Internal Mailing Listsdevelopers (technically called all-developers),
doc-developers, doc-committers, ports-developers,
ports-committers, src-developers, src-committers. (Each
project repository has its own -developers and
-committers mailing lists. Archives for these lists can
be found in the files
/local/mail/repository-name-developers-archive
and
/local/mail/repository-name-committers-archive
on the FreeBSD.org
cluster.)Core Team monthly
reports/home/core/public/monthly-reports
on the FreeBSD.org
cluster.Ports Management Team monthly
reports/home/portmgr/public/monthly-reports
on the FreeBSD.org
cluster.Noteworthy src/ SVN
Branchesstable/n
(n-STABLE),
head (-CURRENT)&man.ssh.1; is required to connect to the project hosts.
For more information, see .Useful links:&os;
Project Internal Pages&os;
Project Hosts&os;
Project Administrative GroupsOpenPGP Keys for &os;Cryptographic keys conforming to the
OpenPGP (Pretty Good
Privacy) standard are used by the &os; project to
authenticate committers. Messages carrying important
information like public SSH keys can be
signed with the OpenPGP key to prove that
they are really from the committer. See
PGP &
GPG: Email for the Practical Paranoid by Michael Lucas
and
for more information.Creating a KeyExisting keys can be used, but should be checked with
doc/head/share/pgpkeys/checkkey.sh
first. In this case, make sure the key has a &os; user
ID.For those who do not yet have an
OpenPGP key, or need a new key to meet &os;
security requirements, here we show how to generate
one.Install
security/gnupg. Enter
these lines in ~/.gnupg/gpg.conf to
set minimum acceptable defaults:fixed-list-mode
keyid-format 0xlong
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
use-agent
verify-options show-uid-validity
list-options show-uid-validity
sig-notation issuer-fpr@notations.openpgp.fifthhorseman.net=%g
cert-digest-algo SHA512Generate a key:&prompt.user; gpg --full-gen-key
gpg (GnuPG) 2.1.8; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Warning: using insecure memory!
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 2048
Requested keysize is 2048 bits
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 3y
Key expires at Wed Nov 4 17:20:20 2015 MST
Is this correct? (y/N) y
GnuPG needs to construct a user ID to identify your key.
Real name: Chucky Daemon
Email address: notreal@example.com
Comment:
You selected this USER-ID:
"Chucky Daemon <notreal@example.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o
You need a Passphrase to protect your secret key.2048-bit keys with a three-year expiration provide
adequate protection at present (2013-12).
describes the situation in more detail.A three year key lifespan is short enough to
obsolete keys weakened by advancing computer power,
but long enough to reduce key management
problems.Use your real name here, preferably matching that
shown on government-issued ID to
make it easier for others to verify your identity.
Text that may help others identify you can be entered
in the Comment section.After the email address is entered, a passphrase is
requested. Methods of creating a secure passphrase are
contentious. Rather than suggest a single way, here are
some links to sites that describe various methods: ,
,
,
.Protect the private key and passphrase. If either the
private key or passphrase may have been compromised or
disclosed, immediately notify
accounts@FreeBSD.org and revoke the key.Committing the new key is shown in
.Kerberos and LDAP web Password for &os; ClusterThe &os; cluster requires a Kerberos password to access
certain services. The Kerberos password also serves as the
LDAP web password, since LDAP is proxying to Kerberos in the
cluster. Some of the services
which require this include:BugzillaJenkinsTo create a new Kerberos account in the &os; cluster, or to
reset a Kerberos password for an existing account using a random
password generator:&prompt.user; ssh kpasswd.freebsd.orgThis must be done from a machine outside of the &os;.org
cluster.A Kerberos password can also be set manually
by logging into freefall.FreeBSD.org and
running:&prompt.user; kpasswdUnless the Kerberos-authenticated services
of the &os;.org cluster have been used previously,
Client unknown will be shown. This
error means that the
ssh kpasswd.freebsd.org method shown above
must be used first to initialize the Kerberos account.Commit Bit TypesThe &os; repository has a number of components which, when
combined, support the basic operating system source,
documentation, third party application ports infrastructure, and
various maintained utilities. When &os; commit bits are
allocated, the areas of the tree where the bit may be used are
specified. Generally, the areas associated with a bit reflect
who authorized the allocation of the commit bit. Additional
areas of authority may be added at a later date: when this
occurs, the committer should follow normal commit bit allocation
procedures for that area of the tree, seeking approval from the
appropriate entity and possibly getting a mentor for that area
for some period of time.Committer TypeResponsibleTree Componentssrccore@src/, doc/ subject to appropriate reviewdocdoceng@doc/, ports/, src/ documentationportsportmgr@ports/Commit bits allocated prior to the development of the notion
of areas of authority may be appropriate for use in many parts
of the tree. However, common sense dictates that a committer
who has not previously worked in an area of the tree seek review
prior to committing, seek approval from the appropriate
responsible party, and/or work with a mentor. Since the rules
regarding code maintenance differ by area of the tree, this is
as much for the benefit of the committer working in an area of
less familiarity as it is for others working on the tree.Committers are encouraged to seek review for their work as
part of the normal development process, regardless of the area
of the tree where the work is occurring.Policy for Committer Activity in Other TreesAll committers may modify
base/head/share/misc/committers-*.dot,
base/head/usr.bin/calendar/calendars/calendar.freebsd,
and
ports/head/astro/xearth/files.doc committers may commit
documentation changes to src
files, such as man pages, READMEs, fortune databases,
calendar files, and comment fixes without approval from a
src committer, subject to the normal care and tending of
commits.Any committer may make changes to any other tree
with an "Approved by" from a non-mentored committer with
the appropriate bit.Committers can acquire an additional bit by the usual
process of finding a mentor who will propose them to core,
doceng, or portmgr, as appropriate. When approved, they
will be added to 'access' and the normal mentoring period
will ensue, which will involve a continuing of
Approved by for some period."Approved by" is only acceptable from non-mentored src
committers -- mentored committers can provide a "Reviewed
by" but not an "Approved by".Subversion PrimerNew committers are assumed to already be familiar with the
basic operation of Subversion. If not, start by reading the
Subversion
Book.IntroductionThe &os; source repository switched from
CVS to Subversion on May 31st, 2008. The
first real SVN commit is
r179447.The &os; doc/www repository switched
from CVS to Subversion on May 19th, 2012.
The first real SVN commit is
r38821.The &os; ports repository switched
from CVS to Subversion on July 14th, 2012.
The first real SVN commit is
r300894.Subversion can be installed from the &os; Ports
Collection by issuing these commands:&prompt.root; pkg install subversionGetting StartedThere are a few ways to obtain a working copy of the tree
from Subversion. This section will explain them.Direct CheckoutThe first is to check out directly from the main
repository. For the src tree,
use:&prompt.user; svn checkout svn+ssh://repo.freebsd.org/base/head /usr/srcFor the doc tree, use:&prompt.user; svn checkout svn+ssh://repo.freebsd.org/doc/head /usr/docFor the ports tree, use:&prompt.user; svn checkout svn+ssh://repo.freebsd.org/ports/head /usr/portsThough the remaining examples in this document are
written with the workflow of working with the
src tree in mind, the underlying
concepts are the same for working with the
doc and the ports
tree.
Ports related Subversion operations are listed in
.The above command will check out a
CURRENT source tree as
/usr/src/,
which can be any target directory on the local filesystem.
Omitting the final argument of that command causes the
working copy, in this case, to be named head,
but that can be renamed safely.svn+ssh means the
SVN protocol tunnelled over
SSH. The name of the server is
repo.freebsd.org, base
is the path to the repository, and head
is the subdirectory within the repository.If your &os; login name is different from the login
name used on the local machine, either include it in
the URL (for example
svn+ssh://jarjar@repo.freebsd.org/base/head),
or add an entry to ~/.ssh/config
in the form:Host repo.freebsd.org
User jarjarThis is the simplest method, but it is hard to tell just
yet how much load it will place on the repository.The svn diff does not require
access to the server as SVN stores a
reference copy of every file in the working copy. This,
however, means that Subversion working copies are very
large in size.RELENG_* Branches and General
LayoutIn svn+ssh://repo.freebsd.org/base,
base refers to the source tree.
Similarly, ports refers to the ports
tree, and so on. These are separate repositories with their
own change number sequences, access controls and commit
mail.For the base repository, HEAD refers to the -CURRENT
tree. For example, head/bin/ls is what
would go into /usr/src/bin/ls in a
release. Some key locations are:/head/ which corresponds to
HEAD, also known as
-CURRENT./stable/n
which corresponds to
RELENG_n./releng/n.n
which corresponds to
RELENG_n_n./release/n.n.n
which corresponds to
RELENG_n_n_n_RELEASE./vendor* is the vendor branch
import work area. This directory itself does not
contain branches, however its subdirectories do. This
contrasts with the stable,
releng and
release directories./projects and
/user feature a branch work area.
As above, the
/user directory does not contain
branches itself.&os; Documentation Project Branches and
LayoutIn svn+ssh://repo.freebsd.org/doc,
doc refers to the repository root of
the source tree.In general, most &os; Documentation Project work will be
done within the head/ branch of the
documentation source tree.&os; documentation is written and/or translated to
various languages, each in a separate
directory in the head/
branch.Each translation set contains several subdirectories for
the various parts of the &os; Documentation Project. A few
noteworthy directories are:/articles/ contains the source
code for articles written by various &os;
contributors./books/ contains the source
code for the different books, such as the
&os; Handbook./htdocs/ contains the source
code for the &os; website.&os; Ports Tree Branches and LayoutIn svn+ssh://repo.freebsd.org/ports,
ports refers to the repository root of
the ports tree.In general, most &os; port work will be done within the
head/ branch of the ports tree which is
the actual ports tree used to install software. Some other
key locations are:/branches/RELENG_n_n_n
which corresponds to
RELENG_n_n_n
is used to merge back security updates in preparation
for a release./tags/RELEASE_n_n_n
which corresponds to
RELEASE_n_n_n
represents a release tag of the ports tree./tags/RELEASE_n_EOL
represents the end of life tag of a specific &os;
branch.Daily UseThis section will explain how to perform common day-to-day
operations with Subversion.HelpSVN has built in help documentation.
It can be accessed by typing:&prompt.user; svn helpAdditional information can be found in the
Subversion
Book.CheckoutAs seen earlier, to check out the &os; head
branch:&prompt.user; svn checkout svn+ssh://repo.freebsd.org/base/head /usr/srcAt some point, more than just HEAD
will probably be useful, for instance when merging changes
to stable/7. Therefore, it may be useful to have a partial
checkout of the complete tree (a full checkout would be very
painful).To do this, first check out the root of the
repository:&prompt.user; svn checkout --depth=immediates svn+ssh://repo.freebsd.org/baseThis will give base with all the
files it contains (at the time of writing, just
ROADMAP.txt) and empty subdirectories
for head, stable,
vendor and so on.Expanding the working copy is possible. Just change the
depth of the various subdirectories:&prompt.user; svn up --set-depth=infinity base/head
&prompt.user; svn up --set-depth=immediates base/release base/releng base/stableThe above command will pull down a full copy of
head, plus empty copies of every
release tag, every
releng branch, and every
stable branch.If at a later date merging to
7-STABLE is required, expand the working
copy:&prompt.user; svn up --set-depth=infinity base/stable/7Subtrees do not have to be expanded completely. For
instance, expanding only stable/7/sys and
then later expand the rest of
stable/7:&prompt.user; svn up --set-depth=infinity base/stable/7/sys
&prompt.user; svn up --set-depth=infinity base/stable/7Updating the tree with svn update
will only update what was previously asked for (in this
case, head and
stable/7; it will not pull down the whole
tree.Anonymous CheckoutIt is possible to anonymously check out the &os;
repository with Subversion. This will give access to a
read-only tree that can be updated, but not committed back
to the main repository. To do this, use:&prompt.user; svn co https://svn.FreeBSD.org/base/head /usr/srcMore details on using Subversion this way can be found
in Using
Subversion.Updating the TreeTo update a working copy to either the latest revision,
or a specific revision:&prompt.user; svn update
&prompt.user; svn update -r12345StatusTo view the local changes that have been made to the
working copy:&prompt.user; svn statusTo show local changes and files that are out-of-date
do:&prompt.user; svn status --show-updatesEditing and CommittingSVN does not need to
be told in advance about file editing.To commit all changes in
the current directory and all subdirectories:&prompt.user; svn commitTo commit all changes in, for example,
lib/libfetch/
and
usr/bin/fetch/
in a single operation:&prompt.user; svn commit lib/libfetchusr/bin/fetchThere is also a commit wrapper for the ports tree to
handle the properties and sanity checking the
changes:&prompt.user; /usr/ports/Tools/scripts/psvn commitAdding and Removing FilesBefore adding files, get a copy of auto-props.txt
(there is also a
ports tree specific version) and add it to
~/.subversion/config according to the
instructions in the file. If you added something before
reading this, use svn rm --keep-local
for just added files, fix your config file and re-add them
again. The initial config file is created when you first
run a svn command, even something as simple as
svn help.Files are added to a
SVN repository with svn
add. To add a file named
foo, edit it, then:&prompt.user; svn add fooMost new source files should include a
$&os;$ string near the
start of the file. On commit, svn will
expand the $&os;$ string,
adding the file path, revision number, date and time of
commit, and the username of the committer. Files which
cannot be modified may be committed without the
$&os;$ string.Files can be removed with svn
remove:&prompt.user; svn remove fooSubversion does not require deleting the file before
using svn rm, and indeed complains if
that happens.It is possible to add directories with
svn add:&prompt.user; mkdir bar
&prompt.user; svn add barAlthough svn mkdir makes this easier
by combining the creation of the directory and the adding of
it:&prompt.user; svn mkdir barLike files, directories are removed with
svn rm. There is no separate command
specifically for removing directories.&prompt.user; svn rm barCopying and Moving FilesThis command creates a copy of
foo.c named bar.c,
with the new file also under version control and with the
full history of foo.c:&prompt.user; svn copy foo.cbar.cThis is usually preferred to copying the file with
cp and adding it to the repository with
svn add because this way the new file
does not inherit the original one's history.To move and rename a file:&prompt.user; svn move foo.cbar.cLog and Annotatesvn log shows revisions and commit
messages, most recent first, for files or directories. When
used on a directory, all revisions that affected the
directory and files within that directory are shown.svn annotate, or equally svn
praise or svn blame, shows
the most recent revision number and who committed that
revision for each line of a file.Diffssvn diff displays changes to the
working copy. Diffs generated by SVN are
unified and include new files by default in the diff
output.svn diff can show the changes between
two revisions of the same file:&prompt.user; svn diff -r179453:179454 ROADMAP.txtIt can also show all changes for a specific changeset.
This command shows what changes were made to the
current directory and all subdirectories in changeset
179454:&prompt.user; svn diff -c179454 .RevertingLocal changes (including additions and deletions) can be
reverted using svn revert. It does not
update out-of-date files, but just replaces them with
pristine copies of the original version.ConflictsIf an svn update resulted in a merge
conflict, Subversion will remember which files have
conflicts and refuse to commit any changes to those files
until explicitly told that the conflicts have been resolved.
The simple, not yet deprecated procedure is:&prompt.user; svn resolved fooHowever, the preferred procedure is:&prompt.user; svn resolve --accept=working fooThe two examples are equivalent. Possible values for
--accept are:working: use the version in your
working directory (which one presumes has been edited to
resolve the conflicts).base: use a pristine copy of the
version you had before svn update,
discarding your own changes, the conflicting changes,
and possibly other intervening changes as well.mine-full: use what you had
before svn update, including your own
changes, but discarding the conflicting changes, and
possibly other intervening changes as well.theirs-full: use the version that
was retrieved when you did
svn update, discarding your own
changes.Advanced UseSparse CheckoutsSVN allows
sparse, or partial checkouts of a
directory by adding to a
svn checkout.Valid arguments to
are:empty: the directory itself
without any of its contents.files: the directory and any
files it contains.immediates: the directory and any
files and directories it contains, but none of the
subdirectories' contents.infinity: anything.The --depth option applies to many
other commands, including svn commit,
svn revert, and svn
diff.Since --depth is sticky, there is a
--set-depth option for svn
update that will change the selected depth.
Thus, given the working copy produced by the previous
example:&prompt.user; cd ~/freebsd
&prompt.user; svn update --set-depth=immediates .The above command will populate the working copy in
~/freebsd with
ROADMAP.txt and empty subdirectories,
and nothing will happen when svn update
is executed on the subdirectories. However, this
command will set the depth for
head (in this case) to infinity,
and fully populate it:&prompt.user; svn update --set-depth=infinity headDirect OperationCertain operations can be performed directly on the
repository without touching the working copy. Specifically,
this applies to any operation that does not require editing
a file, including:log,
diffmkdirremove, copy,
renamepropset,
propedit,
propdelmergeBranching is very fast. This command would be
used to branch RELENG_8:&prompt.user; svn copy svn+ssh://repo.freebsd.org/base/head svn+ssh://repo.freebsd.org/base/stable/8This is equivalent to these commands
which take minutes and hours as opposed to seconds,
depending on your network connection:&prompt.user; svn checkout --depth=immediates svn+ssh://repo.freebsd.org/base
&prompt.user; cd base
&prompt.user; svn update --set-depth=infinity head
&prompt.user; svn copy head stable/8
&prompt.user; svn commit stable/8Merging with SVNThis section deals with merging code from one branch to
another (typically, from head to a stable branch).In all examples below, $FSVN
refers to the location of the &os; Subversion repository,
svn+ssh://repo.freebsd.org/base/.About Merge TrackingFrom the user's perspective, merge tracking
information (or mergeinfo) is stored in a property called
svn:mergeinfo, which is a
comma-separated list of revisions and ranges of revisions
that have been merged. When set on a file, it applies
only to that file. When set on a directory, it applies to
that directory and its descendants (files and directories)
except for those that have their own
svn:mergeinfo.It is not inherited. For
instance, stable/6/contrib/openpam/
does not implicitly inherit mergeinfo from
stable/6/, or
stable/6/contrib/.
Doing so would make partial checkouts very hard to manage.
Instead, mergeinfo is explicitly propagated down the tree.
For merging something into
branch/foo/bar/,
these rules apply:If
branch/foo/bar/
does not already have a mergeinfo record, but a direct
ancestor (for instance,
branch/foo/)
does, then that record will be propagated down to
branch/foo/bar/
before information about the current merge is
recorded.Information about the current merge will
not be propagated back up that
ancestor.If a direct descendant of
branch/foo/bar/ (for instance,
branch/foo/bar/baz/) already has
a mergeinfo record, information about the current
merge will be propagated down to it.If you consider the case where a revision changes
several separate parts of the tree (for example,
branch/foo/bar/ and
branch/foo/quux/), but you only want
to merge some of it (for example,
branch/foo/bar/), you will see that
these rules make sense. If mergeinfo was propagated up,
it would seem like that revision had also been merged to
branch/foo/quux/, when in fact it had
not been.Selecting the Source and Target Branch
When MergingMerging to stable/ branches should
originate from head/. For
example:&prompt.user; svn merge -c r123456 ^/head/ stable/11
&prompt.user; svn commit stable/11Merges to releng/ branches should
always originate from the corresponding
stable/ branch. For example:&prompt.user; svn merge -c r123456 ^/stable/11 releng/11.0
&prompt.user; svn commit releng/11.0Committers are only permitted to commit to the
releng/ branches during a release
cycle after receiving approval from the Release
Engineering Team, after which only the Security Officer
may commit to a releng/ branch for
a Security Advisory or Errata Notice.All merges are
merged to and committed from the root of the
branch. All merges look like:&prompt.user; svn merge -c r123456 ^/head/ checkout
&prompt.user; svn commit checkoutNote that checkout must be
a complete checkout of the branch to which the merge
occurs.&prompt.user; svn merge -c r123456 ^/stable/10 releng/10.0Preparing the Merge TargetBecause of the mergeinfo propagation issues described
earlier, it is very important to never merge changes
into a sparse working copy. Always use a full
checkout of the branch being merged into. For instance,
when merging from HEAD to 7, use a full checkout
of stable/7:&prompt.user; cd stable/7
&prompt.user; svn up --set-depth=infinityThe target directory must also be up-to-date and must
not contain any uncommitted changes or stray files.Identifying RevisionsIdentifying revisions to be merged is a must. If the
target already has complete mergeinfo, ask
SVN for a list:&prompt.user; cd stable/6/contrib/openpam
&prompt.user; svn mergeinfo --show-revs=eligible $FSVN/head/contrib/openpamIf the target does not have complete mergeinfo, check
the log for the merge source.MergingNow, let us start merging!The PrinciplesFor example, To merge:revision $Rin directory $target in stable branch
$Bfrom directory $source in head$FSVN is
svn+ssh://repo.freebsd.org/baseAssuming that revisions $P and $Q have
already been merged, and that the current directory is
an up-to-date working copy of stable/$B, the
existing mergeinfo looks like this:&prompt.user; svn propget svn:mergeinfo -R $target
$target - /head/$source:$P,$QMerging is done like so:&prompt.user; svn merge -c$R $FSVN/head/$source $targetChecking the results of this is possible with
svn diff.The svn:mergeinfo now looks like:&prompt.user; svn propget svn:mergeinfo -R $target
$target - head/$source:$P,$Q,$RIf the results are not exactly as shown, assistance
may be required before committing as mistakes may have
been made, or there may be something wrong with the
existing mergeinfo, or there may be a bug in
Subversion.Practical ExampleAs a practical example, consider this
scenario. The changes to netmap.4
in r238987 are to be merged from CURRENT to 9-STABLE.
The file resides in
head/share/man/man4. According
to , this is
also where to do the merge. Note that in this example
all paths are relative to the top of the svn repository.
For more information on the directory layout, see .The first step is to inspect the existing
mergeinfo.&prompt.user; svn propget svn:mergeinfo -R stable/9/share/man/man4Take a quick note of how it looks before moving on
to the next step; doing the actual merge:&prompt.user; svn merge -c r238987 svn+ssh://repo.freebsd.org/base/head/share/man/man4 stable/9/share/man/man4
--- Merging r238987 into 'stable/9/share/man/man4':
U stable/9/share/man/man4/netmap.4
--- Recording mergeinfo for merge of r238987 into
'stable/9/share/man/man4':
U stable/9/share/man/man4Check that the revision number of the merged
revision has been added. Once this is verified, the
only thing left is the actual commit.&prompt.user; svn commit stable/9/share/man/man4Precautions Before CommittingAs always, build world (or appropriate parts of
it).Check the changes with svn diff and
svn stat. Make sure all the files that
should have been added or deleted were in fact added or
deleted.Take a closer look at any property change (marked by a
M in the second column of svn
stat). Normally, no svn:mergeinfo properties
should be anywhere except the target directory (or
directories).If something looks fishy, ask for help.CommittingMake sure to commit a top level directory to have the
mergeinfo included as well. Do not specify individual
files on the command line. For more information about
committing files in general, see the relevant section of
this primer.Vendor Imports with SVNPlease read this entire section before starting a
vendor import.Patches to vendor code fall into two
categories:Vendor patches: these are patches that have been
issued by the vendor, or that have been extracted from
the vendor's version control system, which address
issues which cannot wait until the
next vendor release.&os; patches: these are patches that modify the
vendor code to address &os;-specific issues.The nature of a patch dictates where it should be
committed:Vendor patches must be committed to the vendor
branch, and merged from there to head. If the patch
addresses an issue in a new release that is currently
being imported, it must not be
committed along with the new release: the release must
be imported and tagged first, then the patch can be
applied and committed. There is no need to re-tag the
vendor sources after committing the patch.&os; patches are committed directly to
head.Preparing the TreeIf importing for the first time after the switch to
Subversion, flattening and cleaning up the vendor tree is
necessary, as well as bootstrapping the merge history in
the main tree.FlatteningDuring the conversion from CVS to
Subversion, vendor branches were imported with the same
layout as the main tree. This means that the
pf vendor sources ended up in
vendor/pf/dist/contrib/pf. The
vendor source is best directly in
vendor/pf/dist.To flatten the pf tree:&prompt.user; cd vendor/pf/dist/contrib/pf
&prompt.user; svn mv $(svn list) ../..
&prompt.user; cd ../..
&prompt.user; svn rm contrib
&prompt.user; svn propdel -R svn:mergeinfo .
&prompt.user; svn commitThe propdel bit is necessary
because starting with 1.5, Subversion will automatically
add svn:mergeinfo to any directory
that is copied or moved. In this case, as nothing is
being merged from the deleted tree, they just get in the
way.Tags may be flattened as well (3, 4, 3.5 etc.); the
procedure is exactly the same, only changing
dist to 3.5 or
similar, and putting the svn commit
off until the end of the process.Cleaning UpThe dist tree can be cleaned up
as necessary. Disabling keyword expansion is
recommended, as it makes no sense on unmodified vendor
code and in some cases it can even be harmful.
OpenSSH, for example,
includes two files that originated with &os; and still
contain the original version tags. To do this:&prompt.user; svn propdel svn:keywords -R .
&prompt.user; svn commitBootstrapping Merge HistoryIf importing for the first time after the switch to
Subversion, bootstrap svn:mergeinfo
on the target directory in the main tree to the revision
that corresponds to the last related change to the
vendor tree, prior to importing new sources:&prompt.user; cd head/contrib/pf
&prompt.user; svn merge --record-only svn+ssh://repo.freebsd.org/base/vendor/pf/dist@180876 .
&prompt.user; svn commitImporting New SourcesWith two commits—one for the import itself and
one for the tag—this step can optionally be repeated
for every upstream release between the last import and the
current import.Preparing the Vendor SourcesSubversion is able to store a
full distribution in the vendor tree. So, import
everything, but merge only what is required.A svn add is required to add any
files that were added since the last vendor import, and
svn rm is required to remove any that
were removed since. Preparing sorted lists of the
contents of the vendor tree and of the sources that are
about to be imported is recommended, to facilitate the
process.&prompt.user; cd vendor/pf/dist
&prompt.user; svn list -R | grep -v '/$' | sort >../old
&prompt.user; cd ../pf-4.3
&prompt.user; find . -type f | cut -c 3- | sort >../newWith these two files,
comm -23 ../old ../new will list
removed files (files only in old),
while comm -13 ../old ../new will
list added files only in
new.Importing into the Vendor TreeNow, the sources must be copied into
dist and
the svn add and
svn rm commands are used as
needed:&prompt.user; cd vendor/pf/pf-4.3
&prompt.user; tar cf - . | tar xf - -C ../dist
&prompt.user; cd ../dist
&prompt.user; comm -23 ../old ../new | xargs svn rm
&prompt.user; comm -13 ../old ../new | xargs svn add --parentsIf any directories were removed, they will have to
be svn rmed manually. Nothing will
break if they are not, but they will remain in the
tree.Check properties on any new files. All text files
should have svn:eol-style set to
native. All binary files should have
svn:mime-type set to
application/octet-stream unless there
is a more appropriate media type. Executable files
should have svn:executable set to
*. No other properties should exist
on any file in the tree.Committing is now possible. However, it is good
practice to make sure that everything is okay by using
the svn stat and
svn diff commands.TaggingOnce committed, vendor releases are tagged for
future reference. The best and quickest way to do this
is directly in the repository:&prompt.user; svn cp svn+ssh://repo.freebsd.org/base/vendor/pf/dist svn+ssh://repo.freebsd.org/base/vendor/pf/4.3Once that is complete, svn up the
working copy of
vendor/pf
to get the new tag, although this is rarely
needed.If creating the tag in the working copy of the tree,
svn:mergeinfo results must be
removed:&prompt.user; cd vendor/pf
&prompt.user; svn cp dist 4.3
&prompt.user; svn propdel svn:mergeinfo -R 4.3Merging to Head&prompt.user; cd head/contrib/pf
&prompt.user; svn up
&prompt.user; svn merge --accept=postpone svn+ssh://repo.freebsd.org/base/vendor/pf/dist .The --accept=postpone tells
Subversion not to complain about merge
conflicts as they will be handled manually.The cvs2svn changeover occurred
on June 3, 2008. When performing vendor merges for
packages which were already present and converted by the
cvs2svn process, the command used to
merge
/vendor/package_name/dist
to
/head/package_location
(for example,
head/contrib/sendmail) must use
to
indicate the revision to merge from the
/vendor tree. For example:&prompt.user; svn checkout svn+ssh://repo.freebsd.org/base/head/contrib/sendmail
&prompt.user; cd sendmail
&prompt.user; svn merge -c r261190 '^/vendor/sendmail/dist' .^ is an alias for the
repository path.If using the Zsh shell,
the ^ must be escaped with
\ or quoted.It is necessary to resolve any merge conflicts.Make sure that any files that were added or removed in
the vendor tree have been properly added or removed in the
main tree. To check diffs against the vendor
branch:&prompt.user; svn diff --no-diff-deleted --old=svn+ssh://repo.freebsd.org/base/vendor/pf/dist --new=.The --no-diff-deleted tells
Subversion not to complain about files that are in the
vendor tree but not in the main tree. Things that
would have previously been removed before the vendor
import, like the vendor's makefiles
and configure scripts.Using CVS, once a file was off the
vendor branch, it was not able to be put back. With
Subversion, there is no concept of on or off the vendor
branch. If a file that previously had local
modifications, to make it not show up in diffs in the
vendor tree, all that has to be done is remove any
left-over cruft like &os; version tags, which is much
easier.If any changes are required for the world to build
with the new sources, make them now, and keep testing
until everything builds and runs perfectly.Committing the Vendor ImportCommitting is now possible! Everything must be
committed in one go. If done properly, the tree will move
from a consistent state with old code, to a consistent
state with new code.From ScratchImporting into the Vendor TreeThis section is an example of importing and tagging
byacc into
head.First, prepare the directory in
vendor:&prompt.user; svn co --depth immediates $FSVN/vendor
&prompt.user; cd vendor
&prompt.user; svn mkdir byacc
&prompt.user; svn mkdir byacc/distNow, import the sources into the
dist directory.
Once the files are in place, svn add
the new ones, then svn commit and tag
the imported version. To save time and bandwidth,
direct remote committing and tagging is possible:&prompt.user; svn cp -m "Tag byacc 20120115"$FSVN/vendor/byacc/dist$FSVN/vendor/byacc/20120115Merging to headDue to this being a new file, copy it for the
merge:&prompt.user; svn cp -m "Import byacc to contrib"$FSVN/vendor/byacc/dist$FSVN/head/contrib/byaccWorking normally on newly imported sources is still
possible.Reverting a CommitReverting a commit to a previous version is fairly
easy:&prompt.user; svn merge -r179454:179453 ROADMAP.txt
&prompt.user; svn commitChange number syntax, with negative meaning a reverse
change, can also be used:&prompt.user; svn merge -c -179454 ROADMAP.txt
&prompt.user; svn commitThis can also be done directly in the repository:&prompt.user; svn merge -r179454:179453 svn+ssh://repo.freebsd.org/base/ROADMAP.txtIt is important to ensure that the mergeinfo
is correct when reverting a file to permit
svn mergeinfo --eligible to work as
expected.Reverting the deletion of a file is slightly different.
Copying the version of the file that predates the deletion
is required. For example, to restore a file that was
deleted in revision N, restore version N-1:&prompt.user; svn copy svn+ssh://repo.freebsd.org/base/ROADMAP.txt@179454
&prompt.user; svn commitor, equally:&prompt.user; svn copy svn+ssh://repo.freebsd.org/base/ROADMAP.txt@179454 svn+ssh://repo.freebsd.org/baseDo not simply recreate the file
manually and svn add it—this will
cause history to be lost.Fixing MistakesWhile we can do surgery in an emergency, do not plan on
having mistakes fixed behind the scenes. Plan on mistakes
remaining in the logs forever. Be sure to check the output
of svn status and svn
diff before committing.Mistakes will happen but,
they can generally be fixed without
disruption.Take a case of adding a file in the wrong location. The
right thing to do is to svn move the file
to the correct location and commit. This causes just a
couple of lines of metadata in the repository journal, and
the logs are all linked up correctly.The wrong thing to do is to delete the file and then
svn add an independent copy in the
correct location. Instead of a couple of lines of text, the
repository journal grows an entire new copy of the file.
This is a waste.Using a Subversion MirrorThere is a serious disadvantage to this method: every
time something is to be committed, a
svn relocate to the master repository has
to be done, remembering to svn relocate
back to the mirror after the commit. Also, since
svn relocate only works between
repositories that have the same UUID, some hacking of the
local repository's UUID has to occur before it is possible
to start using it.Checkout from a MirrorCheck out a working copy from a mirror by
substituting the mirror's URL for
svn+ssh://repo.freebsd.org/base. This
can be an official mirror or a mirror maintained by using
svnsync.Setting up a svnsync
MirrorAvoid setting up a svnsync
mirror unless there is a very good reason for it. Most
of the time a git mirror is a better
alternative. Starting a fresh mirror from scratch takes
a long time.
Expect a minimum of 10 hours for high speed connectivity.
If international links are involved, expect this to take
four to ten times longer.One way to limit the time required is to grab a seed
file. It is large (~1GB) but will consume less
network traffic and take less time to fetch than svnsync
will.Extract the file and update it:&prompt.user; tar xf svnmirror-base-r261170.tar.xz
&prompt.user; svnsync sync file:///home/svnmirror/baseNow, set that up to run from &man.cron.8;, do
checkouts locally, set up a svnserve server for local
machines to talk to, etc.The seed mirror is set to fetch from
svn://svn.freebsd.org/base. The
configuration for the mirror is stored in
revprop 0 on the local mirror. To see
the configuration, try:&prompt.user; svn proplist -v --revprop -r 0 file:///home/svnmirror/baseUse svn propset to change
things.Committing High-ASCII DataFiles that have high-ASCII bits are
considered binary files in SVN, so the
pre-commit checks fail and indicate that the
mime-type property should be set to
application/octet-stream. However, the
use of this is discouraged, so please do not set it. The
best way is always avoiding high-ASCII
data, so that it can be read everywhere with any text editor
but if it is not avoidable, instead of changing the
mime-type, set the fbsd:notbinary
property with propset:&prompt.user; svn propset fbsd:notbinary yes foo.dataMaintaining a Project BranchA project branch is one that is synced to head (or
another branch) is used to develop a project then commit it
back to head. In SVN,
dolphin branching is used for this. A
dolphin branch is one that diverges for a
while and is finally committed back to the original branch.
During development code migration in one direction (from
head to the branch only). No code is committed back to head
until the end. After the branch is committed back at the
end, it is dead (although a new branch with the same name
can be created after the dead one is deleted).As per https://people.FreeBSD.org/~peter/svn_notes.txt,
work that is intended to be merged back into HEAD should be
in base/projects/. If the
work is beneficial to the &os; community in some way
but not intended to be merged directly back into HEAD then
the proper location is
base/user/username/.
This
page contains further details.To create a project branch:&prompt.user; svn copy svn+ssh://repo.freebsd.org/base/head svn+ssh://repo.freebsd.org/base/projects/spifTo merge changes from HEAD back into the project
branch:&prompt.user; cd copy_of_spif
&prompt.user; svn merge svn+ssh://repo.freebsd.org/base/head
&prompt.user; svn commitIt is important to resolve any merge conflicts before
committing.Some TipsIn commit logs etc., rev 179872 is
spelled r179872 as per convention.Speeding up svn is possible by adding these entries to
~/.ssh/config:Host *
ControlPath ~/.ssh/sockets/master-%l-%r@%h:%p
ControlMaster auto
ControlPersist yesand then typingmkdir ~/.ssh/socketsChecking out a working copy with a stock Subversion client
without &os;-specific patches
(OPTIONS_SET=FREEBSD_TEMPLATE) will mean
that $FreeBSD$ tags will not
be expanded. Once the correct version has been installed,
trick Subversion into expanding them like so:&prompt.user; svn propdel -R svn:keywords .
&prompt.user; svn revert -R .This will wipe out uncommitted patches.It is possible to automatically fill the "Sponsored by"
and "MFC after" commit log fields by setting
"freebsd-sponsored-by" and "freebsd-mfc-after" fields in the
"[miscellany]" section of the
~/.subversion/config configuration file.
For example:freebsd-sponsored-by = The FreeBSD Foundation
freebsd-mfc-after = 2 weeksSetup, Conventions, and TraditionsThere are a number of things to do as a new developer.
The first set of steps is specific to committers only. These
steps must be done by a mentor for those who are not
committers.For New CommittersThose who have been given commit rights to the &os;
repositories must follow these steps.Get mentor approval before committing each of these
changes!The .ent and
.xml files mentioned below exist in
the &os; Documentation Project SVN repository at
svn+ssh://repo.FreeBSD.org/doc/.New files that do not have the
FreeBSD=%Hsvn:keywords property will be rejected
when attempting to commit them to the repository. Be sure
to read
regarding adding and removing files. Verify that
~/.subversion/config contains the
necessary auto-props entries from
auto-props.txt mentioned
there.All src commits go to
&os.current; first before being merged to &os.stable;.
The &os.stable; branch must maintain
ABI and API
compatibility with earlier versions of that branch. Do
not merge changes that break this compatibility.Steps for New CommittersAdd an Author Entitydoc/head/share/xml/authors.ent
— Add an author entity. Later steps depend on this
entity, and missing this step will cause the
doc/ build to fail. This is a
relatively easy task, but remains a good first test of
version control skills.Update the List of Developers and
Contributorsdoc/head/en_US.ISO8859-1/articles/contributors/contrib.committers.xml
—
Add an entry to the Developers section
of the Contributors
List. Entries are sorted by last name.doc/head/en_US.ISO8859-1/articles/contributors/contrib.additional.xml
— Remove the entry from the
Additional Contributors section. Entries
are sorted by first name.Add a News Itemdoc/head/share/xml/news.xml
— Add an entry. Look for the other entries that
announce new committers and follow the format. Use the
date from the commit bit approval email from
core@FreeBSD.org.Add a PGP Keydoc/head/share/pgpkeys/pgpkeys.ent
and
doc/head/share/pgpkeys/pgpkeys-developers.xml
- Add your PGP or
GnuPG key. Those who do not yet have a
key should see .&a.des.email; has written a shell script
(doc/head/share/pgpkeys/addkey.sh) to
make this easier. See the README
file for more information.Use
doc/head/share/pgpkeys/checkkey.sh to
verify that keys meet minimal best-practices
standards.After adding and checking a key, add both updated
files to source control and then commit them. Entries in
this file are sorted by last name.It is very important to have a current
PGP/GnuPG key in
the repository. The key may be required for positive
identification of a committer. For example, the
&a.admins; might need it for account recovery. A
complete keyring of FreeBSD.org users is
available for download from https://www.FreeBSD.org/doc/pgpkeyring.txt.Update Mentor and Mentee Informationbase/head/share/misc/committers-repository.dot
— Add an entry to the current committers section,
where repository is
doc, ports, or
src, depending on the commit privileges
granted.Add an entry for each additional mentor/mentee
relationship in the bottom section.Generate a Kerberos
PasswordSee to generate or
set a Kerberos for use with
other &os; services like the bug tracking database.Optional: Enable Wiki Account&os;
Wiki Account — A wiki account allows
sharing projects and ideas. Those who do not yet have an
account can follow instructions on the AboutWiki
Page to obtain one. Contact
wiki-admin@FreeBSD.org if you need help
with your Wiki account.Optional: Update Wiki InformationWiki Information - After gaining access to the wiki,
some people add entries to the How
We Got Here, IRC
Nicks, and
Dogs of FreeBSD pages.Optional: Update Ports with Personal
Informationports/astro/xearth/files/freebsd.committers.markers
and
src/usr.bin/calendar/calendars/calendar.freebsd
- Some people add entries for themselves to these files to
show where they are located or the date of their
birthday.Optional: Prevent Duplicate MailingsSubscribers to &a.svn-src-all.name;,
&a.svn-ports-all.name; or &a.svn-doc-all.name; might wish
to unsubscribe to avoid receiving duplicate copies of
commit messages and followups.For EveryoneIntroduce yourself to the other developers, otherwise
no one will have any idea who you are or what you are
working on. The introduction need not be a comprehensive
biography, just write a paragraph or two about who you
are, what you plan to be working on as a developer in
&os;, and who will be your mentor. Email this to the
&a.developers; and you will be on your way!Log into freefall.FreeBSD.org
and create a
/var/forward/user
(where user is your username)
file containing the e-mail address where you want mail
addressed to
yourusername@FreeBSD.org to be
forwarded. This includes all of the commit messages as
well as any other mail addressed to the &a.committers; and
the &a.developers;. Really large mailboxes which have
taken up permanent residence on
freefall may get truncated
without warning if space needs to be freed, so forward it
or save it elsewhere.If your e-mail system uses SPF with strict rules,
you should whitelist mx2.FreeBSD.org from
SPF checks.Due to the severe load dealing with SPAM places on the
central mail servers that do the mailing list processing,
the front-end server does do some basic checks and will
drop some messages based on these checks. At the moment
proper DNS information for the connecting host is the only
check in place but that may change. Some people blame
these checks for bouncing valid email. To have these
checks turned off for your email, create a file
named ~/.spam_lover
on freefall.FreeBSD.org.Those who are developers but not committers will
not be subscribed to the committers or developers mailing
lists. The subscriptions are derived from the access
rights.SMTP Access SetupFor those willing to send e-mail messages through the
FreeBSD.org infrastructure, follow the instructions
below:Point your mail client at
smtp.FreeBSD.org:587.Enable STARTTLS.Ensure your From: address is set
to
yourusername@FreeBSD.org.For authentication, you can use your &os; Kerberos
username and password (see ). The
yourusername/mail
principal is preferred, as it is only valid for
authenticating to mail resources.Do not include @FreeBSD.org
when entering in your username.Additional NotesWill only accept mail from
yourusername@FreeBSD.org.
If you are authenticated as one user, you are not
permitted to send mail from another.A header will be appended with the SASL username:
(Authenticated sender:
username).Host has various rate limits in place to cut down
on brute force attempts.Using a Local MTA to Forward Emails to the
&os;.org SMTP ServiceIt is also possible to use a local
MTA to forward locally sent emails to
the &os;.org SMTP servers.Using PostfixTo tell a local Postfix instance that anything from
yourusername@FreeBSD.org
should be forwarded to the &os;.org servers, add this to
your main.cf:sender_dependent_relayhost_maps = hash:/usr/local/etc/postfix/relayhost_maps
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/usr/local/etc/postfix/sasl_passwd
smtp_use_tls = yesCreate
/usr/local/etc/postfix/relayhost_maps
with the following content:yourusername@FreeBSD.org [smtp.freebsd.org]:587Create
/usr/local/etc/postfix/sasl_passwd
with the following content:[smtp.freebsd.org]:587 yourusername:yourpasswordIf the email server is used by other people, you
may want to prevent them from sending e-mails from your
address. To achieve this, add this to your
main.cf:smtpd_sender_login_maps = hash:/usr/local/etc/postfix/sender_login_maps
smtpd_sender_restrictions = reject_known_sender_login_mismatchCreate
/usr/local/etc/postfix/sender_login_maps
with the following content:yourusername@FreeBSD.org yourlocalusernameWhere yourlocalusername
is the SASL username used to connect
to the local instance of
Postfix.MentorsAll new developers have a mentor assigned to them for
the first few months. A mentor is responsible for teaching
the mentee the rules and conventions of the project and
guiding their first steps in the developer community. The
mentor is also personally responsible for the mentee's actions
during this initial period.For committers: do not commit anything without first
getting mentor approval. Document that approval with an
Approved by: line in the commit
message.When the mentor decides that a mentee has learned the
ropes and is ready to commit on their own, the mentor
announces it with a commit to
conf/mentors. This file is in the
svnadmin branch of each
repository:srcbase/svnadmin/conf/mentorsdocdoc/svnadmin/conf/mentorsportsports/svnadmin/conf/mentorsPre-Commit ReviewCode review is one way to increase the quality of software.
The following guidelines apply to commits to the
head (-CURRENT) branch of the
src repository. Other branches and the
ports and docs trees have
their own review policies, but these guidelines generally apply
to commits requiring review:All non-trivial changes should be reviewed before they
are committed to the repository.Reviews may be conducted by email, in
Bugzilla, in
Phabricator, or by another
mechanism. Where possible, reviews should be public.The developer responsible for a code change is also
responsible for making all necessary review-related
changes.Code review can be an iterative process, which continues
until the patch is ready to be committed. Specifically,
once a patch is sent out for review, it should receive an
explicit looks good before it is committed.
So long as it is explicit, this can take whatever form makes
sense for the review method.Timeouts are not a substitute for review.Sometimes code reviews will take longer than you would hope
for, especially for larger features. Accepted ways to speed up
review times for your patches are:Review other people's patches. If you help out,
everybody will be more willing to do the same for you;
goodwill is our currency.Ping the patch. If it is urgent, provide reasons why
it is important to you to get this patch landed and ping
it every couple of days. If it is not urgent, the common
courtesy ping rate is one week. Remember that you are
asking for valuable time from other professional
developers.Ask for help on mailing lists, IRC, etc. Others
may be able to either help you directly, or suggest a
reviewer.Split your patch into multiple smaller patches that
build on each other. The smaller your patch, the higher
the probability that somebody will take a quick look at
it.When making large changes, it is helpful to keep this
in mind from the beginning of the effort as breaking large
changes into smaller ones is often difficult after the
fact.Developers should participate in code reviews as both
reviewers and reviewees. If someone is kind enough to review
your code, you should return the favor for someone else.
Note that while anyone is welcome to review and give feedback
on a patch, only an appropriate subject-matter expert can
approve a change. This will usually be a committer who works
with the code in question on a regular basis.In some cases, no subject-matter expert may be available.
In those cases, a review by an experienced developer is
sufficient when coupled with appropriate testing.Commit Log MessagesThis section contains some suggestions and traditions for
how commit logs are formatted.As well as including an informative message with each
commit, some additional information may be needed.This information consists of one or more lines
containing the key word or phrase, a colon, tabs for formatting,
and then the additional information.The key words or phrases are:PR:The problem report (if any) which is affected
(typically, by being closed) by this commit.
Multiple PRs may be specified on one line, separated by
commas or spaces.Submitted by:The name and e-mail address of the person
that submitted the fix; for developers, just the
username on the &os; cluster.If the submitter is the maintainer of the port
being committed, include "(maintainer)"
after the email address.Avoid obfuscating the email address of the
submitter as this adds additional work when searching
logs.Reviewed by:The name and e-mail address of the person or
people that reviewed the change; for developers,
just the username on the &os; cluster. If a
patch was submitted to a mailing list for review,
and the review was favorable, then just include
the list name.Approved by:The name and e-mail address of the person or
people that approved the change; for developers, just
the username on the &os; cluster. It is customary to
get prior approval for a commit if it is to an area of
the tree to which you do not usually commit. In
addition, during the run up to a new release all commits
must be approved by the release
engineering team.While under mentorship, get mentor approval before
the commit. Enter the mentor's username in this field,
and note that they are a mentor:Approved by: username-of-mentor(mentor)If a team approved these commits then include the
team name followed by the username of the approver in
parentheses. For example:Approved by: re (username)Obtained from:The name of the project (if any) from which
the code was obtained. Do not use this line for the
name of an individual person.Sponsored by:Sponsoring organizations for this change, if any.
Separate multiple organizations with commas. If only a
portion of the work was sponsored, or different amounts
of sponsorship were provided to different authors,
please give appropriate credit in parentheses after each
sponsor name. For example, Example.com (alice,
code refactoring), Wormulon (bob), Momcorp
(cindy) shows that Alice was sponsored by
Example.com to do code refactoring, while Wormulon
sponsored Bob's work and Momcorp sponsored Cindy's work.
Other authors were either not sponsored or chose not to
list sponsorship.MFC after:To receive an e-mail reminder to
MFC at a later date, specify the
number of days, weeks, or months after which an
MFC is planned.MFC to:If the commit should be merged to a subset of
stable branches, specify the branch names.MFC with:If the commit should be merged together with
a previous one in a single
MFC commit (for example, where
this commit corrects a bug in the previous change),
specify the corresponding revision number.Relnotes:If the change is a candidate for inclusion in
the release notes for the next release from the branch,
set to yes.Security:If the change is related to a security
vulnerability or security exposure, include one or more
references or a description of the issue. If possible,
include a VuXML URL or a CVE ID.Event:The description for the event where this commit was
made. If this is a recurring event, add the year or
even the month to it. For example, this could be
FooBSDcon 2019. The idea behind this
line is to put recognition to conferences, gatherings,
and other types of meetups and to show that these are
useful to have. Please do not use the
Sponsored by: line for this as that
is meant for organizations sponsoring certain features
or developers working on them.Differential Revision:The full URL of the Phabricator review. This line
must be the last line. For
example:
https://reviews.freebsd.org/D1708.Commit Log for a Commit Based on a PRThe commit is based on a patch from a PR submitted by John
Smith. The commit message PR and
Submitted by fields are filled.....
PR: 12345
Submitted by: John Smith <John.Smith@example.com>Commit Log for a Commit Needing ReviewThe virtual memory system is being changed. After
posting patches to the appropriate mailing list (in this
case, freebsd-arch) and the changes have
been approved....
Reviewed by: -archCommit Log for a Commit Needing ApprovalCommit a port, after working with
the listed MAINTAINER, who said to go ahead and
commit....
Approved by: abc (maintainer)Where abc is the account name
of the person who approved.Commit Log for a Commit Bringing in Code from
OpenBSDCommitting some code based on work done in the
OpenBSD project....
Obtained from: OpenBSDCommit Log for a Change to &os.current; with a Planned
Commit to &os.stable; to Follow at a Later Date.Committing some code which will be merged from
&os.current; into the &os.stable; branch after two
weeks....
MFC after: 2 weeksWhere 2 is the number of days,
weeks, or months after which an MFC is
planned. The weeks option may be
day, days,
week, weeks,
month, months.It is often necessary to combine these.Consider the situation where a user has submitted a PR
containing code from the NetBSD project. Looking at the PR, the
developer sees it is not an area of the tree they normally work
in, so they have the change reviewed by the
arch mailing list. Since the change is
complex, the developer opts to MFC after one
month to allow adequate testing.The extra information to include in the commit would look
something likeExample Combined Commit LogPR: 54321
Submitted by: John Smith <John.Smith@example.com>
Reviewed by: -arch
Obtained from: NetBSD
MFC after: 1 month
Relnotes: yesPreferred License for New FilesThe &os; Project's full license policy can be found at https://www.FreeBSD.org/internal/software-license.html.
The rest of this section is intended to help you get started.
As a rule, when in doubt, ask. It is much easier to give advice
than to fix the source tree.The &os; Project suggests and uses this
text as the preferred license scheme:/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) [year] [your name]
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* [id for your version control system, if any]
*/The &os; project strongly discourages the so-called
"advertising clause" in new code. Due to the large number of
contributors to the &os; project, complying with this clause for
many commercial vendors has become difficult. If you have code
in the tree with the advertising clause, please consider
removing it. In fact, please consider using the above license
for your code.The &os; project discourages completely new licenses and
variations on the standard licenses. New licenses require the
approval of the &a.core; to reside in the
main repository. The more different licenses that are used in
the tree, the more problems that this causes to those wishing to
utilize this code, typically from unintended consequences from a
poorly worded license.Project policy dictates that code under some non-BSD
licenses must be placed only in specific sections of the
repository, and in some cases, compilation must be conditional
or even disabled by default. For example, the GENERIC kernel
must be compiled under only licenses identical to or
substantially similar to the BSD license. GPL, APSL, CDDL, etc,
licensed software must not be compiled into GENERIC.Developers are reminded that in open source, getting "open"
right is just as important as getting "source" right, as
improper handling of intellectual property has serious
consequences. Any questions or concerns should immediately be
brought to the attention of the core team.Keeping Track of Licenses Granted to the &os;
ProjectVarious software or data exist in the repositories where
the &os; project has been granted a special licence to be able
to use them. A case in point are the Terminus fonts for use
with &man.vt.4;. Here the author Dimitar Zhekov has allowed us
to use the "Terminus BSD Console" font under a 2-clause BSD
license rather than the regular Open Font License he normally
uses.It is clearly sensible to keep a record of any such
license grants. To that end, the &a.core; has decided to keep
an archive of them. Whenever the &os; project is granted a
special license we require the &a.core; to be notified. Any
developers involved in arranging such a license grant, please
send details to the &a.core; including:Contact details for people or organizations granting the
special license.What files, directories etc. in the repositories are
covered by the license grant including the revision numbers
where any specially licensed material was committed.The date the license comes into effect from. Unless
otherwise agreed, this will be the date the license was
issued by the authors of the software in question.The license text.A note of any restrictions, limitations or exceptions
that apply specifically to &os;'s usage of the licensed
material.Any other relevant information.Once the &a.core; is satisfied that all the necessary
details have been gathered and are correct, the secretary will
send a PGP-signed acknowledgement of receipt including the
license details. This receipt will be persistently archived and
serve as our permanent record of the license grant.The license archive should contain only details of license
grants; this is not the place for any discussions around
licensing or other subjects. Access to data within the license
archive will be available on request to the &a.core;.Developer RelationsWhen working directly on your own code or on code which is
already well established as your responsibility, then there is
probably little need to check with other committers before
jumping in with a commit. Working on a bug in an area of the
system which is clearly orphaned (and there are a few such
areas, to our shame), the same applies. When modifying
parts of the system which are maintained, formally, or
informally, consider asking for review just as a developer
would have before becoming a
committer. For ports, contact the listed
MAINTAINER in the
Makefile.To determine if an area of the tree is maintained, check the
MAINTAINERS file at the root of the tree. If nobody is listed,
scan the revision history to see who has committed
changes in the past. An example script that lists each person
who has committed to a given file along with the number of
commits each person has made can be found at on
freefall at
~eadler/bin/whodid. If queries go
unanswered or the committer otherwise indicates a lack of
interest in the area affected, go ahead and commit it.Avoid sending private emails to maintainers. Other people
might be interested in the conversation, not just the final
output.If there is any doubt about a commit for any reason at all,
have it reviewed before
committing. Better to have it flamed then and there rather than
when it is part of the repository. If a commit does results in
controversy erupting, it may be advisable to consider backing
the change out again until the matter is settled. Remember,
with a version control system we can always change it
back.Do not impugn the intentions of others. If they see a
different solution to a problem, or even a different problem, it
is probably not because they are stupid, because they have
questionable parentage, or because they are trying to destroy
hard work, personal image, or &os;, but basically because they
have a different outlook on the world. Different is
good.Disagree honestly. Argue your position from its merits,
be honest about any shortcomings it may have, and be open to
seeing their solution, or even their vision of the problem,
with an open mind.Accept correction. We are all fallible. When you have made
a mistake, apologize and get on with life. Do not beat up
yourself, and certainly do not beat up others for your mistake.
Do not waste time on embarrassment or recrimination, just fix
the problem and move on.Ask for help. Seek out (and give) peer reviews. One of
the ways open source software is supposed to excel is in the
number of eyeballs applied to it; this does not apply if nobody
will review code.If in Doubt...When unsure about something, whether it be a
technical issue or a project convention be sure to ask. If you
stay silent you will never make progress.If it relates to a technical issue ask on the public
mailing lists. Avoid the temptation to email the individual
person that knows the answer. This way everyone will be able to
learn from the question and the answer.For project specific or administrative questions
ask, in order:Your mentor or former mentor.An experienced committer on IRC, email, etc.Any team with a "hat", as they can give you a
definitive answer.If still not sure, ask on &a.developers;.Once your question is answered, if no one pointed you to
documentation that spelled out the answer to your question,
document it, as others will have the same question.BugzillaThe &os; Project utilizes
Bugzilla for tracking bugs and change
requests. Be sure that if you commit a fix or suggestion found
in the PR database to close it. It is also considered nice if
you take time to close any PRs associated with your commits, if
appropriate.Committers with
non-&os;.org
Bugzilla accounts can have the old account merged with the
&os;.org account by
following these steps:Log in using your old account.Open new bug. Choose Services as the
Product, and Bug Tracker as the
Component. In bug description list acounts you wish to be
merged.Log in using &os;.org account and post
comment to newly opened bug to confirm ownership. See for more details on how to
generate or set a password for your &os;.org account.If there are more than two accounts to merge, post
comments from each of them.You can find out more about
Bugzilla at:&os;
Problem Report Handling Guidelineshttps://www.FreeBSD.org/support.htmlPhabricatorThe &os; Project utilizes Phabricator
for code review requests. See the CodeReview
wiki page for details.Committers with
non-&os;.org
Phabricator accounts can have the old account renamed to the
&os;.org account by
following these steps:Change your Phabricator
account email to your &os;.org email.Open new bug on our bug tracker using your &os;.org account, see
for more information. Choose
Services as the Product, and
Code Review as the Component. In bug
description request that your
Phabricator account be renamed,
and provide a link to your
Phabricator user. For example,
https://reviews.freebsd.org/p/bob_example.com/Phabricator accounts cannot be
merged, please do not open a new account.Who's WhoBesides the repository meisters, there are other &os;
project members and teams whom you will probably get to know in
your role as a committer. Briefly, and by no means
all-inclusively, these are:&a.doceng;doceng is the group responsible for the documentation
build infrastructure, approving new documentation
committers, and ensuring that the &os; website and
documentation on the FTP site is up to date with respect
to the subversion tree. It is
not a conflict resolution body.
The vast majority of documentation related discussion
takes place on the &a.doc;. More details regarding the
doceng team can be found in its charter.
Committers interested in contributing to the documentation
should familiarize themselves with the Documentation
Project Primer.&a.bde.email;Bruce is the Style Police-Meister. When you do a
commit that could have been done better, Bruce will be
there to tell you. Be thankful that someone is. Bruce is
also very knowledgeable on the various standards
applicable to &os;.&a.re.members.email;These are the members of the &a.re;. This team is
responsible for setting release deadlines and controlling
the release process. During code freezes, the release
engineers have final authority on all changes to the
system for whichever branch is pending release status. If
there is something you want merged from &os.current; to
&os.stable; (whatever values those may have at any given
time), these are the people to talk to about it.&a.so.email;&a.so; is the
&os; Security
Officer and oversees the
&a.security-officer;.&a.wollman.email;If you need advice on obscure network internals or
are not sure of some potential change to the networking
subsystem you have in mind, Garrett is someone to talk
to. Garrett is also very knowledgeable on the various
standards applicable to &os;.&a.committers;&a.svn-src-all.name;, &a.svn-ports-all.name; and
&a.svn-doc-all.name; are the mailing lists that the
version control system uses to send commit messages to.
Never send email directly
to these lists. Only send replies to this list
when they are short and are directly related to a
commit.&a.developers;All committers are subscribed to -developers. This
list was created to be a forum for the committers
community issues. Examples are Core
voting, announcements, etc.The &a.developers; is for the exclusive use of &os;
committers. To develop &os;, committers must
have the ability to openly discuss matters that will be
resolved before they are publicly announced. Frank
discussions of work in progress are not suitable for open
publication and may harm &os;.All &os; committers are expected not to
not publish or forward messages from the
&a.developers; outside the list membership without
permission of all of the authors. Violators will be
removed from the
&a.developers;, resulting in a suspension of commit
privileges. Repeated or flagrant violations may result in
permanent revocation of commit privileges.This list is not intended as a
place for code reviews or for any technical discussion.
In fact using it as such hurts the &os; Project as it
gives a sense of a closed list where general decisions
affecting all of the &os; using community are made without
being open. Last, but not least
never, never ever, email the &a.developers; and
CC:/BCC: another &os; list. Never, ever email
another &os; email list and CC:/BCC: the &a.developers;.
Doing so can greatly diminish the benefits of this
list.SSH Quick-Start GuideIf you do not wish to type your password in every time
you use &man.ssh.1;, and you use keys to
authenticate, &man.ssh-agent.1; is there for your
convenience. If you want to use &man.ssh-agent.1;, make
sure that you run it before running other applications. X
users, for example, usually do this from their
.xsession or
.xinitrc. See &man.ssh-agent.1; for
details.Generate a key pair using &man.ssh-keygen.1;. The key
pair will wind up in your
$HOME/.ssh/
directory.Only ECDSA,
Ed25519 or RSA keys
are supported.Send your public key
($HOME/.ssh/id_ecdsa.pub,
$HOME/.ssh/id_ed25519.pub, or
$HOME/.ssh/id_rsa.pub)
to the person setting you up as a committer so it can be put
into
yourlogin
in
/etc/ssh-keys/ on
freefall.Now &man.ssh-add.1; can be used for
authentication once per session. It prompts for
the private key's pass phrase, and then stores it in the
authentication agent (&man.ssh-agent.1;). Use ssh-add
-d to remove keys stored in the agent.Test with a simple remote command: ssh
freefall.FreeBSD.org ls /usr.For more information, see
security/openssh,
&man.ssh.1;, &man.ssh-add.1;, &man.ssh-agent.1;,
&man.ssh-keygen.1;, and &man.scp.1;.For information on adding, changing, or removing &man.ssh.1;
keys, see this
article.&coverity; Availability for &os; CommittersAll &os; developers can obtain access to
Coverity analysis results of all &os;
Project software. All who are interested in obtaining access to
the analysis results of the automated
Coverity runs, can sign up at Coverity
Scan.The &os; wiki includes a mini-guide for developers who are
interested in working with the &coverity; analysis reports: https://wiki.freebsd.org/CoverityPrevent.
Please note that this mini-guide is only readable by &os;
developers, so if you cannot access this page, you will have to
ask someone to add you to the appropriate Wiki access
list.Finally, all &os; developers who are going to use
&coverity; are always encouraged to ask for more details and
usage information, by posting any questions to the mailing list
of the &os; developers.The &os; Committers' Big List of RulesEveryone involved with the &os; project is expected to
abide by the Code of Conduct available from
https://www.FreeBSD.org/internal/code-of-conduct.html.
As committers, you form the public face of the project, and how
you behave has a vital impact on the public perception of it.
This guide expands on the parts of the
Code of Conduct specific to
committers.Respect other committers.Respect other contributors.Discuss any significant change
before committing.Respect existing maintainers (if listed in the
MAINTAINER field in
Makefile or in
MAINTAINER in the top-level
directory).Any disputed change must be backed out pending
resolution of the dispute if requested by a maintainer.
Security related changes may override a maintainer's wishes
at the Security Officer's discretion.Changes go to &os.current; before &os.stable; unless
specifically permitted by the release engineer or unless
they are not applicable to &os.current;. Any non-trivial or
non-urgent change which is applicable should also be allowed
to sit in &os.current; for at least 3 days before merging so
that it can be given sufficient testing. The release
engineer has the same authority over the &os.stable; branch
as outlined for the maintainer in rule #5.Do not fight in public with other committers; it looks
bad.Respect all code freezes and read the
committers and
developers mailing lists in a timely
manner so you know when a code freeze is in effect.When in doubt on any procedure, ask first!Test your changes before committing them.Do not commit to contributed software without
explicit approval from the respective
maintainers.As noted, breaking some of these rules can be grounds for
suspension or, upon repeated offense, permanent removal of
commit privileges. Individual members of core have the power to
temporarily suspend commit privileges until core as a whole has
the chance to review the issue. In case of an
emergency (a committer doing damage to the
repository), a temporary suspension may also be done by the
repository meisters. Only a 2/3 majority of core has the
authority to suspend commit privileges for longer than a week or
to remove them permanently. This rule does not exist to set
core up as a bunch of cruel dictators who can dispose of
committers as casually as empty soda cans, but to give the
project a kind of safety fuse. If someone is out of control, it
is important to be able to deal with this immediately rather
than be paralyzed by debate. In all cases, a committer whose
privileges are suspended or revoked is entitled to a
hearing by core, the total duration of the
suspension being determined at that time. A committer whose
privileges are suspended may also request a review of the
decision after 30 days and every 30 days thereafter (unless the
total suspension period is less than 30 days). A committer
whose privileges have been revoked entirely may request a review
after a period of 6 months has elapsed. This review policy is
strictly informal and, in all cases, core
reserves the right to either act on or disregard requests for
review if they feel their original decision to be the right
one.In all other aspects of project operation, core is a subset
of committers and is bound by the
same rules. Just because someone is in
core this does not mean that they have special dispensation to
step outside any of the lines painted here; core's
special powers only kick in when it acts as a
group, not on an individual basis. As individuals, the core
team members are all committers first and core second.DetailsRespect other committers.This means that you need to treat other committers as
the peer-group developers that they are. Despite our
occasional attempts to prove the contrary, one does not
get to be a committer by being stupid and nothing rankles
more than being treated that way by one of your peers.
Whether we always feel respect for one another or not (and
everyone has off days), we still have to
treat other committers with respect
at all times, on public forums and in private
email.Being able to work together long term is this
project's greatest asset, one far more important than any
set of changes to the code, and turning arguments about
code into issues that affect our long-term ability to work
harmoniously together is just not worth the trade-off by
any conceivable stretch of the imagination.To comply with this rule, do not send email when you
are angry or otherwise behave in a manner which is likely
to strike others as needlessly confrontational. First
calm down, then think about how to communicate in the most
effective fashion for convincing the other persons that
your side of the argument is correct, do not just blow off
some steam so you can feel better in the short term at the
cost of a long-term flame war. Not only is this very bad
energy economics, but repeated displays of
public aggression which impair our ability to work well
together will be dealt with severely by the project
leadership and may result in suspension or termination of
your commit privileges. The project leadership will take
into account both public and private communications
brought before it. It will not seek the disclosure of
private communications, but it will take it into account
if it is volunteered by the committers involved in the
complaint.All of this is never an option which the project's
leadership enjoys in the slightest, but unity comes first.
No amount of code or good advice is worth trading that
away.Respect other contributors.You were not always a committer. At one time you were
a contributor. Remember that at all times. Remember what
it was like trying to get help and attention. Do not
forget that your work as a contributor was very important
to you. Remember what it was like. Do not discourage,
belittle, or demean contributors. Treat them with
respect. They are our committers in waiting. They are
every bit as important to the project as committers.
Their contributions are as valid and as important as your
own. After all, you made many contributions before you
became a committer. Always remember that.Consider the points raised under
and apply them also to
contributors.Discuss any significant change
before committing.The repository is not where changes are initially
submitted for correctness or argued over, that happens
first in the mailing lists or by use of the Phabricator
service. The commit will only happen once something
resembling consensus has been reached. This does not mean
that permission is required before correcting every
obvious syntax error or manual page misspelling, just that
it is good to develop a feel for when a proposed change is
not quite such a no-brainer and requires some feedback
first. People really do not mind sweeping changes if the
result is something clearly better than what they had
before, they just do not like being
surprised by those changes. The very
best way of making sure that things are on the right track
is to have code reviewed by one or more other
committers.When in doubt, ask for review!Respect existing maintainers if listed.Many parts of &os; are not owned in
the sense that any specific individual will jump up and
yell if you commit a change to their area,
but it still pays to check first. One convention we use
is to put a maintainer line in the
Makefile for any package or subtree
which is being actively maintained by one or more people;
see https://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/policies.html
for documentation on this. Where sections of code have
several maintainers, commits to affected areas by one
maintainer need to be reviewed by at least one other
maintainer. In cases where the
maintainer-ship of something is not clear,
look at the repository logs for the files
in question and see if someone has been working recently
or predominantly in that area.Any disputed change must be backed out pending
resolution of the dispute if requested by a maintainer.
Security related changes may override a maintainer's
wishes at the Security Officer's discretion.This may be hard to swallow in times of conflict (when
each side is convinced that they are in the right, of
course) but a version control system makes it unnecessary
to have an ongoing dispute raging when it is far easier to
simply reverse the disputed change, get everyone calmed
down again and then try to figure out what is the best way
to proceed. If the change turns out to be the best thing
after all, it can be easily brought back. If it turns out
not to be, then the users did not have to live with the
bogus change in the tree while everyone was busily
debating its merits. People very
rarely call for back-outs in the repository since
discussion generally exposes bad or controversial changes
before the commit even happens, but on such rare occasions
the back-out should be done without argument so that we
can get immediately on to the topic of figuring out
whether it was bogus or not.Changes go to &os.current; before &os.stable; unless
specifically permitted by the release engineer or unless
they are not applicable to &os.current;. Any non-trivial
or non-urgent change which is applicable should also be
allowed to sit in &os.current; for at least 3 days before
merging so that it can be given sufficient testing. The
release engineer has the same authority over the
&os.stable; branch as outlined in rule #5.This is another do not argue about it
issue since it is the release engineer who is ultimately
responsible (and gets beaten up) if a change turns out to
be bad. Please respect this and give the release engineer
your full cooperation when it comes to the &os.stable;
branch. The management of &os.stable; may frequently seem
to be overly conservative to the casual observer, but also
bear in mind the fact that conservatism is supposed to be
the hallmark of &os.stable; and different rules apply
there than in &os.current;. There is also really no point
in having &os.current; be a testing ground if changes are
merged over to &os.stable; immediately. Changes need a
chance to be tested by the &os.current; developers, so
allow some time to elapse before merging unless the
&os.stable; fix is critical, time sensitive or so obvious
as to make further testing unnecessary (spelling fixes to
manual pages, obvious bug/typo fixes, etc.) In other
words, apply common sense.Changes to the security branches (for example,
releng/9.3) must be approved by a
member of the &a.security-officer;, or in some cases, by a
member of the &a.re;.Do not fight in public with other committers; it looks
bad.This project has a public image to uphold and that
image is very important to all of us, especially if we are
to continue to attract new members. There will be
occasions when, despite everyone's very best attempts at
self-control, tempers are lost and angry words are
exchanged. The best thing that can be done in such cases
is to minimize the effects of this until everyone has
cooled back down. Do not air
angry words in public and do not forward private
correspondence or other private communications to public
mailing lists, mail aliases, instant messaging channels or
social media sites. What people say one-to-one is often
much less sugar-coated than what they would say in public,
and such communications therefore have no place there -
they only serve to inflame an already bad situation. If
the person sending a flame-o-gram at least had the
grace to send it privately, then have the grace to keep it
private yourself. If you feel you are being unfairly
treated by another developer, and it is causing you
anguish, bring the matter up with core rather than taking
it public. Core will do its best to play peace makers and
get things back to sanity. In cases where the dispute
involves a change to the codebase and the participants do
not appear to be reaching an amicable agreement, core may
appoint a mutually-agreeable third party to resolve the
dispute. All parties involved must then agree to be bound
by the decision reached by this third party.Respect all code freezes and read the
committers and
developers mailing list on a timely
basis so you know when a code freeze is in effect.Committing unapproved changes during a code freeze is
a really big mistake and committers are expected to keep
up-to-date on what is going on before jumping in after a
long absence and committing 10 megabytes worth of
accumulated stuff. People who abuse this on a regular
basis will have their commit privileges suspended until
they get back from the &os; Happy Reeducation Camp we
run in Greenland.When in doubt on any procedure, ask first!Many mistakes are made because someone is in a hurry
and just assumes they know the right way of doing
something. If you have not done it before, chances are
good that you do not actually know the way we do things
and really need to ask first or you are going to
completely embarrass yourself in public. There is no
shame in asking
how in the heck do I do this? We already
know you are an intelligent person; otherwise, you would
not be a committer.Test your changes before committing them.This may sound obvious, but if it really were so
obvious then we probably would not see so many cases of
people clearly not doing this. If your changes are to the
kernel, make sure you can still compile both GENERIC and
LINT. If your changes are anywhere else, make sure you
can still make world. If your changes are to a branch,
make sure your testing occurs with a machine which is
running that code. If you have a change which also may
break another architecture, be sure and test on all
supported architectures. Please refer to the
&os;
Internal Page for a list of available resources.
As other architectures are added to the &os; supported
platforms list, the appropriate shared testing resources
will be made available.Do not commit to contributed software without
explicit approval from the respective
maintainers.Contributed software is anything under the
src/contrib,
src/crypto, or
src/sys/contrib trees.The trees mentioned above are for contributed software
usually imported onto a vendor branch. Committing
something there may cause unnecessary headaches
when importing newer versions of the software. As a
general consider sending patches upstream to the vendor.
Patches may be committed to FreeBSD first with permission
of the maintainer.Reasons for modifying upstream software range from
wanting strict control over a tightly coupled dependency
to lack of portability in the canonical repository's
distribution of their code. Regardless of the reason,
effort to minimize the maintenance burden of fork is
helpful to fellow maintainers. Avoid committing trivial
or cosmetic changes to files since it makes every merge
thereafter more difficult: such patches need to be
manually re-verified every import.If a particular piece of software lacks a maintainer,
you are encouraged to take up owership. If you are unsure
of the current maintainership email &a.arch; and
ask.Policy on Multiple Architectures&os; has added several new architecture ports during
recent release cycles and is truly no longer an &i386; centric
operating system. In an effort to make it easier to keep
&os; portable across the platforms we support, core has
developed this mandate:
Our 32-bit reference platform is &arch.i386;, and our
64-bit reference platform is &arch.amd64;. Major design
work (including major API and ABI changes) must prove
itself on at least one 32-bit and at least one 64-bit
platform, preferably the primary reference platforms,
before it may be committed to the source tree.
The &arch.i386; and &arch.amd64; platforms were chosen
due to being more readily available to developers and as
representatives of more diverse processor and system designs -
big versus little endian, register file versus register stack,
different DMA and cache implementations, hardware page tables
versus software TLB management etc.We will continue to re-evaluate this policy as cost and
availability of the 64-bit platforms change.Developers should also be aware of our Tier Policy for
the long term support of hardware architectures. The rules
here are intended to provide guidance during the development
process, and are distinct from the requirements for features
and architectures listed in that section. The Tier rules for
feature support on architectures at release-time are more
strict than the rules for changes during the development
process.Other SuggestionsWhen committing documentation changes, use a spell checker
before committing. For all XML docs, verify that the
formatting directives are correct by running
make lint and
textproc/igor.For manual pages, run sysutils/manck
and textproc/igor
over the manual page to verify all of the cross
references and file references are correct and that the man
page has all of the appropriate MLINKs
installed.Do not mix style fixes with new functionality. A style
fix is any change which does not modify the functionality of
the code. Mixing the changes obfuscates the functionality
change when asking for differences between revisions, which
can hide any new bugs. Do not include whitespace changes with
content changes in commits to doc/ .
The extra clutter in the diffs
makes the translators' job much more difficult. Instead, make
any style or whitespace changes in separate commits that are
clearly labeled as such in the commit message.Deprecating FeaturesWhen it is necessary to remove functionality from software
in the base system, follow these guidelines
whenever possible:Mention is made in the manual page and possibly the
release notes that the option, utility, or interface is
deprecated. Use of the deprecated feature generates a
warning.The option, utility, or interface is preserved until
the next major (point zero) release.The option, utility, or interface is removed and no
longer documented. It is now obsolete. It is also
generally a good idea to note its removal in the release
notes.Privacy and ConfidentialityMost &os; business is done in public.&os; is an open project. Which
means that not only can anyone use the source code, but
that most of the development process is open to public
scrutiny.Certain sensitive matters must remain private or
held under embargo.There unfortunately cannot be complete transparency.
As a &os; developer you will have a certain degree of
privileged access to information. Consequently you are
expected to respect certain requirements for
confidentiality. Sometimes the need for confidentiality
comes from external collaborators or has a specific time
limit. Mostly though, it is a matter of not releasing
private communications.The Security Officer has sole control over the
release of security advisories.Where there are security problems that affect many
different operating systems, &os; frequently depends on
early access to be able to prepare advisories for
coordinated release. Unless &os; developers can be
trusted to maintain security, such early access will not
be made available. The Security Officer is responsible
for controlling pre-release access to information about
vulnerabilities, and for timing the release of all
advisories. He may request help under condition of
confidentiality from any developer with relevant knowledge
to prepare security fixes.Communications with Core are kept confidential for as
long as necessary.Communications to core will initially be treated as
confidential. Eventually however, most of Core's business
will be summarized into the monthly or quarterly core
reports. Care will be taken to avoid publicising any
sensitive details. Records of some particularly sensitive
subjects may not be reported on at all and will be
retained only in Core's private archives.Non-disclosure Agreements may be required for access
to certain commercially sensitive data.Access to certain commercially sensitive data may
only be available under a Non-Disclosure Agreement. The
FreeBSD Foundation legal staff must be consulted before
any binding agreements are entered into.Private communications must not be made
public without permission.Beyond the specific requirements above there is a
general expectation not to publish private communications
between developers without the consent of all parties
involved. Ask permission before forwarding a message onto
a public mailing list, or posting it to a forum or website
that can be accessed by other than the original
correspondents.Communications on project-only or restricted access
channels must be kept private.Similarly to personal communications, certain
internal communications channels, including &os; Committer
only mailing lists and restricted access IRC channels
are considered private communications. Permission is
required to publish material from these
sources.Core may approve publication.Where it is impractical to obtain permission due to
the number of correspondents or where permission to
publish is unreasonably withheld, Core may approve release
of such private matters that merit more general
publication.Support for Multiple Architectures&os; is a highly portable operating system intended to
function on many different types of hardware architectures.
Maintaining clean separation of Machine Dependent (MD) and
Machine Independent (MI) code, as well as minimizing MD code, is
an important part of our strategy to remain agile with regards
to current hardware trends. Each new hardware architecture
supported by &os; adds substantially to the cost of code
maintenance, toolchain support, and release engineering. It
also dramatically increases the cost of effective testing of
kernel changes. As such, there is strong motivation to
differentiate between classes of support for various
architectures while remaining strong in a few key architectures
that are seen as the &os; target audience.Statement of General IntentThe &os; Project targets "production quality commercial
off-the-shelf (COTS) workstation, server, and high-end
embedded systems". By retaining a focus on a narrow set of
architectures of interest in these environments, the &os;
Project is able to maintain high levels of quality, stability,
and performance, as well as minimize the load on various
support teams on the project, such as the ports team,
documentation team, security officer, and release engineering
teams. Diversity in hardware support broadens the options for
&os; consumers by offering new features and usage
opportunities (such as support for 64-bit CPUs, use in
embedded environments, etc.), but these benefits must always
be carefully considered in terms of the real-world maintenance
cost associated with additional platform support.The &os; Project differentiates platform targets into
four tiers. Each tier includes a specification of the
requirements for an architecture to be in that tier,
as well as specifying the obligations of developers with
regards to the platform. In addition, a policy is defined
regarding the circumstances required to change the tier
of an architecture.Tier 1: Fully Supported ArchitecturesTier 1 platforms are fully supported by the security
officer, release engineering, and toolchain maintenance staff.
New features added to the operating system must be fully
functional across all Tier 1 architectures for every release
(features which are inherently architecture-specific, such as
support for hardware device drivers, may be exempt from this
requirement). In general, all Tier 1 platforms must have
build and test automation support either in the FreeBSD.org
cluster, or easily available for all developers. Embedded
platforms may substitute an emulator available in the
FreeBSD.org cluster for actual hardware.Tier 1 architectures are expected to be Production Quality
with respects to all aspects of the &os; operating system,
including installation and development environments.Tier 1 architectures are expected to be completely
integrated into the source tree and have all features
necessary to produce an entire system relevant for that target
architecture. Tier 1 architectures generally have at least 6
active developers.Tier 1 architectures are expected to be fully supported by
the ports system. All the ports should build on a Tier 1
platform, or have the appropriate filters to prevent the
inappropriate ones from building there. The packaging system
must support all Tier 1 architectures. To ensure an
architecture's Tier 1 status, proponents of that architecture
must show that all relevant packages can be built on that
platform.Tier 1 embedded architectures must be able to cross-build
packages on at least one other Tier 1 architecture. The
packages must be the most relevant for the platform, but may
be a non-empty subset of those that build natively.Tier 1 architectures must be fully documented. All basic
operations need to be covered by the handbook or other
documents. All relevant integration documentation must also
be integrated into the tree, or readily available.Current Tier 1 platforms are &arch.i386; and
&arch.amd64;.Tier 2: Developmental ArchitecturesTier 2 platforms are not supported by the security officer
and release engineering teams. Platform maintainers are
responsible for toolchain support in the tree. The toolchain
maintainers are expected to work with the platform maintainers
to refine these changes. Major new toolchain components are
allowed to break support for Tier 2 architectures if the
&os;-local changes have not been incorporated upstream.
The toolchain maintainers are expected to provide prompt
review of any proposed changes and cannot block, through their
inaction, changes going into the tree. New features added to
&os; should be feasible to implement on these platforms,
but an implementation is not required before the feature may
be added to the &os; source tree. New features that may be
difficult to implement on Tier 2 architectures should provide
a means of disabling them on those architectures. The
implementation of a Tier 2 architecture may be committed to
the main &os; tree as long as it does not interfere with
production work on Tier 1 platforms, or substantially with
other Tier 2 platforms. Before a Tier 2 platform can be added
to the &os; base source tree, the platform must be able to
boot multi-user on actual hardware. Generally, there must be
at least three active developers working on the
platform.Tier 2 architectures are usually systems targeted at Tier
1 support, but that are still under development.
Architectures reaching end of life may also be moved from Tier
1 status to Tier 2 status as the availability of resources to
continue to maintain the system in a Production Quality state
diminishes. Well supported niche architectures may also be
Tier 2.Tier 2 architectures have basic support for them
integrated into the ports infrastructure. They may have cross
compilation support added, at the discretion of portmgr. Some
ports must built natively into packages if the package system
supports that architecture. If not integrated into the base
system, some external patches for the architecture for ports
must be available.Tier 2 architectures can be integrated into the &os;
handbook. The basics for how to get a system running must be
documented, although not necessarily for every single board or
system a Tier 2 architecture supports. The supported hardware
list must exist and be relatively recent. It should be
integrated into the &os; documentation.Current Tier 2 platforms are &arch.arm;, &arch.arm64;,
&arch.mips;, &arch.powerpc;, and &arch.sparc64;.Tier 3: Experimental ArchitecturesTier 3 platforms are not supported by the security officer
and release engineering teams. At the discretion of the
toolchain maintainers, they may be supported in the toolchain.
Tier 3 platforms are architectures in the early stages of
development, for non-mainstream hardware platforms, or which
are considered legacy systems unlikely to see broad future
use. Initial support for Tier 3 platforms is worked on
in external SCM repositories.
The transition to &os;'s subversion takes place after
the platform boots multi-user on hardware; sharing via
subversion is needed for wider exposure; and multiple
developers are actively working on the platform.
Platforms that transition to Tier 3 status may be
removed from the tree if they are no longer actively supported
by the &os; developer community at the discretion of the
release engineer.Tier 3 platforms may have ports support, either integrated
or external, but do not require it.Tier 3 platforms must have the basics documented for how
to build a kernel and how to boot it on at least one target
hardware or emulation environment. This documentation need
not be integrated into the &os; tree.Current Tier 3 platforms are &arch.riscv;.Tier 4: Unsupported ArchitecturesTier 4 systems are not supported in any form by the
project.All systems not otherwise classified into a support tier
are Tier 4 systems.Policy on Changing the Tier of an ArchitectureSystems may only be moved from one tier to another by
approval of the &os; Core Team, which shall make that
decision in collaboration with the Security Officer, Release
Engineering, and toolchain maintenance teams.Ports Specific FAQAdding a New PortHow do I add a new port?First, please read the section about repository
copies.The easiest way to add a new port is the
addport script located in the
ports/Tools/scripts directory. It
adds a port from the directory specified, determining
the category automatically from the port
Makefile. It also adds an entry to
the port's category Makefile. It
was written by &a.mharo.email;, &a.will.email;, and
&a.garga.email;. When sending questions about this
script to the &a.ports;, please also CC &a.crees.email;,
the current maintainer.Any other things I need to know when I add a new
port?Check the port, preferably to make sure it compiles
and packages correctly. This is the recommended
sequence:&prompt.root; make install
&prompt.root; make package
&prompt.root; make deinstall
&prompt.root; pkg add package you built above
&prompt.root; make deinstall
&prompt.root; make reinstall
&prompt.root; make packageThe Porters
Handbook contains more detailed
instructions.Use &man.portlint.1; to check the syntax of the
port. You do not necessarily have to eliminate all
warnings but make sure you have fixed the simple
ones.If the port came from a submitter who has not
contributed to the Project before, add that person's
name to the Additional
Contributors section of the &os;
Contributors List.Close the PR if the port came in as a PR. To close
a PR, change the state to Issue
Resolved and the resolution as
Fixed.Removing an Existing PortHow do I remove an existing port?First, please read the section about repository
copies. Before you remove the port, you have to verify
there are no other ports depending on it.Make sure there is no dependency on the port
in the ports collection:The port's PKGNAME appears in exactly
one line in a recent INDEX file.No other ports contains any reference
to the port's directory or PKGNAME in their
MakefilesWhen using Git,
consider using git grep, it
is much faster than grep
-r.Then, remove the port:Remove the port's files and directory with
svn remove.Remove the SUBDIR listing
of the port in the parent directory
Makefile.Add an entry to
ports/MOVED.Search for entries in
ports/security/vuxml/vuln.xml
and adjust them accordingly. In particular,
check for previous packages with the new name
which version could include the new port.Remove the port from
ports/LEGAL if it is
there.Alternatively, you can use the
rmport script, from
ports/Tools/scripts. This script
was written by &a.vd.email;. When sending questions
about this script to the &a.ports;, please also CC
&a.crees.email;, the current maintainer.Re-adding a Deleted PortHow do I re-add a deleted port?This is essentially the reverse of deleting a
port.Do not use svn add to add the
port. Follow these steps. If they are unclear, or
are not working, ask for help, do not just
svn add the port.Figure out when the port was removed. Use this
list,
or look for the port on freshports,
and then copy the last living revision of the
port:&prompt.user; cd /usr/ports/category
&prompt.user; svn cp 'svn+ssh://repo.freebsd.org/ports/head/category/portname/@XXXXXX' portnamePick the revision that is just before the
removal. For example, if the revision where it was
removed is 269874, use
269873.It is also possible to specify a date. In that
case, pick a date that is before the removal but
after the last commit to the port.&prompt.user; cd /usr/ports/category
&prompt.user; svn cp 'svn+ssh://repo.freebsd.org/ports/head/category/portname/@{YYYY-MM-DD}' portnameMake the changes necessary to get the port
working again. If it was deleted because the
distfiles are no longer available, either
volunteer to host the distfiles, or find someone
else to do so.If some files have been added, or were removed
during the resurrection process, use svn
add or svn remove to
make sure all the files in the port will be
committed.Restore the SUBDIR listing of
the port in the parent directory
Makefile, keeping the entries
sorted.Delete the port entry from
ports/MOVED.If the port had an entry in
ports/LEGAL, restore it.svn commit these changes,
preferably in one step.The addport script mentioned in
now detects when the
port to add has previously existed, and attempts to
handle all except the ports/LEGAL
step automatically.Repository CopiesWhen do we need a repository copy?When you want to add a port that is related to any
port that is already in the tree in a separate
directory, you have to do a repository copy. Here
related means it is a different
version or a slightly modified version. Examples are
print/ghostscript* (different
versions) and x11-wm/windowmaker*
(English-only and internationalized version).Another example is when a port is moved from one
subdirectory to another, or when the name of a directory
must be changed because the authors renamed their
software even though it is a descendant of a port
already in a tree.What do I need to do?With Subversion, a repo copy can be done by any
committer:Doing a repo copy:Verify that the target directory does
not exist.Use svn up to make
certain the original files, directories, and
checkout information is current.Use svn move or
svn copy to do the repo
copy.Upgrade the copied port to the new version.
Remember to add or change the
PKGNAMEPREFIX or
PKGNAMESUFFIX so there are no
duplicate ports with the same name. In some
rare cases it may be necessary to change the
PORTNAME instead of adding
PKGNAMEPREFIX or
PKGNAMESUFFIX, but this is
only done when it is really needed — for
example, using an existing port as the base for
a very similar program with a different name, or
upgrading a port to a new upstream version which
actually changes the distribution name, like the
transition from
textproc/libxml to
textproc/libxml2. In most
cases, adding or changing
PKGNAMEPREFIX or
PKGNAMESUFFIX
suffices.Add the new subdirectory to the
SUBDIR listing in the parent
directory Makefile. You
can run make checksubdirs in
the parent directory to check this.If the port changed categories, modify the
CATEGORIES line of the port's
Makefile accordinglyAdd an entry to
ports/MOVED, if you remove
the original port.Commit all changes on one commit.When removing a port:Perform a thorough check of the ports
collection for any dependencies on the old port
location/name, and update them. Running
grep on
INDEX is not enough because
some ports have dependencies enabled by
compile-time options. A full
grep -r of the ports
collection is recommended.Remove the old port and the
old SUBDIR entry.Add an entry to
ports/MOVED.After repo moves (rename
operations where a port is copied and the old
location is removed):Follow the same steps that are outlined in
the previous two entries, to activate the new
location of the port and remove the old
one.Ports FreezeWhat is a ports freeze?A ports freeze was a restricted state
the ports tree was put in before a release. It was used
to ensure a higher quality for the packages shipped with
a release. It usually lasted a couple of weeks. During
that time, build problems were fixed, and the release
packages were built. This practice is no longer used,
as the packages for the releases are built from the
current stable, quarterly branch.For more information on how to merge commits to the
quarterly branch, see .Quarterly BranchesWhat is the procedure to request authorization for
merging a commit to the quarterly branch?When doing the commit, add the branch name to the
MFH: line, for example:MFH: 2014Q1It will automatically notify the &a.ports-secteam;
and the &a.portmgr;. They will then decide if the
commit can be merged and answer with the
procedure.If the commit has already been made, send an email
to the &a.ports-secteam; and the &a.portmgr; with the
revision number and a small description of why the
commit needs to be merged.If the MFH is covered by a blanket approval,
please explain why with a couple of words on the
MFH line, so that the reviewing
team can skip this commit and save time. For
example:MFH: 2014Q1 (runtime fix)
MFH: 2014Q1 (browser blanket)The list of blanket approvals is available in
.Are there any changes that can be merged without
asking for approval?The following blanket approvals for merging to the
quarterly branches are in effect:This blanket approval also applies to direct
commits for ports that have been removed from
head.These fixes must be
tested on the quarterly branch.Fixes that do not result in a change in contents
of the resulting package. For example:pkg-descr:
WWW: URL updates (existing
404, moved or incorrect)Build, runtime or packaging fixes, if the
quarterly branch version is currently broken.Missing dependencies (detected, linked against
but not registered via
*_DEPENDS).Fixing shebangs,
stripping installed libraries and binaries, and
plist fixes.Backport of security and reliability fixes which
only result in PORTREVISION bumps
and no changes to enabled features. for example,
adding a patch fixing a buffer overflow.Minor version changes that do nothing but fix
security or crash-related issues.Adding/fixing
CONFLICTS.Web Browsers, browser plugins, and their
required dependencies.Commits that are not covered by these blanket
approvals always require explicit approval of either
&a.ports-secteam; or &a.portmgr;.What is the procedure for merging commits to the
quarterly branch?A script is provided to automate merging a specific
commit: ports/Tools/scripts/mfh.
It is used as follows:&prompt.user; /usr/ports/Tools/scripts/mfh 380362
U 2015Q1
Checked out revision 380443.
A 2015Q1/security
Updating '2015Q1/security/rubygem-sshkit':
A 2015Q1/security/rubygem-sshkit
A 2015Q1/security/rubygem-sshkit/Makefile
A 2015Q1/security/rubygem-sshkit/distinfo
A 2015Q1/security/rubygem-sshkit/pkg-descr
Updated to revision 380443.
--- Merging r380362 into '2015Q1':
U 2015Q1/security/rubygem-sshkit/Makefile
U 2015Q1/security/rubygem-sshkit/distinfo
--- Recording mergeinfo for merge of r380362 into '2015Q1':
U 2015Q1
--- Recording mergeinfo for merge of r380362 into '2015Q1/security':
G 2015Q1/security
--- Eliding mergeinfo from '2015Q1/security':
U 2015Q1/security
--- Recording mergeinfo for merge of r380362 into '2015Q1/security/rubygem-sshkit':
G 2015Q1/security/rubygem-sshkit
--- Eliding mergeinfo from '2015Q1/security/rubygem-sshkit':
U 2015Q1/security/rubygem-sshkit
M 2015Q1
M 2015Q1/security/rubygem-sshkit/Makefile
M 2015Q1/security/rubygem-sshkit/distinfo
Index: 2015Q1/security/rubygem-sshkit/Makefile
===================================================================
--- 2015Q1/security/rubygem-sshkit/Makefile (revision 380443)
+++ 2015Q1/security/rubygem-sshkit/Makefile (working copy)
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= sshkit
-PORTVERSION= 1.6.1
+PORTVERSION= 1.7.0
CATEGORIES= security rubygems
MASTER_SITES= RG
Index: 2015Q1/security/rubygem-sshkit/distinfo
===================================================================
--- 2015Q1/security/rubygem-sshkit/distinfo (revision 380443)
+++ 2015Q1/security/rubygem-sshkit/distinfo (working copy)
@@ -1,2 +1,2 @@
-SHA256 (rubygem/sshkit-1.6.1.gem) = 8ca67e46bb4ea50fdb0553cda77552f3e41b17a5aa919877d93875dfa22c03a7
-SIZE (rubygem/sshkit-1.6.1.gem) = 135680
+SHA256 (rubygem/sshkit-1.7.0.gem) = 90effd1813363bae7355f4a45ebc8335a8ca74acc8d0933ba6ee6d40f281a2cf
+SIZE (rubygem/sshkit-1.7.0.gem) = 136192
Index: 2015Q1
===================================================================
--- 2015Q1 (revision 380443)
+++ 2015Q1 (working copy)
Property changes on: 2015Q1
___________________________________________________________________
Modified: svn:mergeinfo
Merged /head:r380362
Do you want to commit? (no = start a shell) [y/n]At that point, the script will either open a shell
for you to fix things, or open your text editor with the
commit message all prepared and then commit the
merge.The script assumes that you can connect to
repo.FreeBSD.org with
SSH directly, so if your
local login name is different than your &os; cluster
account, you need a few lines in your
~/.ssh/config:Host *.freebsd.org
User freebsd-loginThe script is also able to merge more than one
revision at a time. If there have been other updates
to the port since the branch was created that have not
been merged because they were not security related.
Add the different revisions in the order
they were committed on the
mfh line. The new commit log
message will contain the combined log messages from
all the original commits. These messages
must be edited to show what is
actually being done with the new commit.&prompt.user; /usr/ports/Tools/scripts/mfh r407208 r407713 r407722 r408567 r408943 r410728The mfh script can also take an optional first
argument, the branch where the merge is being done.
Only the latest quarterly branch is supported, so
specifying the branch is discouraged. To be safe, the
script will give a warning if the quarterly branch is
not the latest:&prompt.user; /usr/ports/Tools/scripts/mfh 2016Q1 r407208 r407713
/!\ The latest branch is 2016Q2, do you really want to commit to 2016Q1? [y/n]Creating a New CategoryWhat is the procedure for creating a new
category?Please see
Proposing a New Category in the Porter's
Handbook. Once that procedure has been followed and the
PR has been assigned to the &a.portmgr;, it is their
decision whether or not to approve it. If they do, it
is their responsibility to:Perform any needed moves. (This only applies
to physical categories.)Update the VALID_CATEGORIES
definition in
ports/Mk/bsd.port.mk.Assign the PR back to you.What do I need to do to implement a new physical
category?Upgrade each moved port's
Makefile. Do not connect the
new category to the build yet.To do this, you will need to:Change the port's
CATEGORIES (this was the
point of the exercise, remember?) The new
category is listed
first. This will help to
ensure that the PKGORIGIN is
correct.Run a make describe.
Since the top-level
make index that you will be
running in a few steps is an iteration of
make describe over the entire
ports hierarchy, catching any errors here will
save you having to re-run that step later
on.If you want to be really thorough, now
might be a good time to run
&man.portlint.1;.Check that the PKGORIGINs are
correct. The ports system uses each port's
CATEGORIES entry to create its
PKGORIGIN, which is used to
connect installed packages to the port directory
they were built from. If this entry is wrong,
common port tools like &man.pkg.version.1; and
&man.portupgrade.1; fail.To do this, use the
chkorigin.sh tool:
env
PORTSDIR=/path/to/ports
sh -e
/path/to/ports/Tools/scripts/chkorigin.sh.
This will check every port in
the ports tree, even those not connected to the
build, so you can run it directly after the move
operation. Hint: do not forget to look at the
PKGORIGINs of any slave ports of
the ports you just moved!On your own local system, test the proposed
changes: first, comment out the
SUBDIR entries in the old ports'
categories' Makefiles; then
enable building the new category in
ports/Makefile. Run
make checksubdirs in the affected
category directories to check the
SUBDIR entries. Next, in the
ports/
directory, run make index. This
can take over 40 minutes on even modern systems;
however, it is a necessary step to prevent problems
for other people.Once this is done, you can commit the updated
ports/Makefile to connect the
new category to the build and also commit the
Makefile changes for the old
category or categories.Add appropriate entries to
ports/MOVED.Update the documentation by modifying:the list
of categories in the Porter's
Handbookdoc/en_US.ISO8859-1/htdocs/ports.
Note that these are now displayed by sub-groups,
as specified in
doc/en_US.ISO8859-1/htdocs/ports/categories.descriptions.(Note: these are in the docs, not the ports,
repository). If you are not a docs committer, you
will need to submit a PR for this.Only once all the above have been done, and no
one is any longer reporting problems with the new
ports, should the old ports be deleted from their
previous locations in the repository.It is not necessary to manually update the
ports web
pages to reflect the new category. This is
done automatically via the change to
en_US.ISO8859-1/htdocs/ports/categories
and the automated rebuild of
INDEX.What do I need to do to implement a new virtual
category?This is much simpler than a physical category. Only
a few modifications are needed:the list
of categories in the Porter's
Handbooken_US.ISO8859-1/htdocs/ports/categoriesMiscellaneous QuestionsAre there changes that can be committed without
asking the maintainer for approval?Blanket approval for most ports applies to these
types of fixes:Most infrastructure changes to a port (that is,
modernizing, but not changing the functionality).
For example, the blanket covers converting to new
USES macros, enabling verbose
builds, and switching to new ports system
syntaxes.Trivial and tested build
and runtime fixes.Exceptions to this are anything maintained by the
&a.portmgr;, or the &a.security-officer;. No
unauthorized commits may ever be made to ports
maintained by those groups.
-
- Blanket approval does not apply to ports that are
- maintained by teams like autotools@FreeBSD.org, x11@FreeBSD.org, gnome@FreeBSD.org, or kde@FreeBSD.org. These teams
- use external repositories and can have work that would
- conflict with changes that would normally fall under
- blanket approval.
- How do I know if my port is building correctly or
not?The packages are built multiple times each week. If
a port fails, the maintainer will receive an email from
pkg-fallout@FreeBSD.org.Reports for all the package builds (official,
experimental, and non-regression) are aggregated at
pkg-status.FreeBSD.org.I added a new port. Do I need to add it to the
INDEX?No. The file can either be generated by running
make index, or a pre-generated
version can be downloaded with
make fetchindex.Are there any other files I am not allowed to
touch?Any file directly under ports/,
or any file under a subdirectory that starts with an
uppercase letter (Mk/,
Tools/, etc.). In particular, the
&a.portmgr; is very protective of
ports/Mk/bsd.port*.mk so do not
commit changes to those files unless you want to face
their wrath.What is the proper procedure for updating the
checksum for a port distfile when the file changes
without a version change?When the checksum for a distribution file is updated
due to the author updating the file without changing the
port revision, the commit message includes a
summary of the relevant diffs between the original and
new distfile to ensure that the distfile has not been
corrupted or maliciously altered. If the current
version of the port has been in the ports tree for a
while, a copy of the old distfile will usually be
available on the ftp servers; otherwise the author or
maintainer should be contacted to find out why the
distfile has changed.How can an experimental test build of the ports tree
(exp-run) be requested?An exp-run must be completed before patches with a
significant ports impact are committed. The patch can
be against the ports tree or the base system.Full package builds will be done with the patches
provided by the submitter, and the submitter is required
to fix detected problems (fallout)
before commit.Go to the Bugzilla
new PR page.Select the product your patch is about.Fill in the bug report as normal. Remember to
attach the patch.If at the top it says Show Advanced
Fields click on it. It will now say
Hide Advanced Fields. Many new
fields will be available. If it already says
Hide Advanced Fields, no need to do
anything.In the Flags section, set the
exp-run one to ?.
As for all other fields, hovering the mouse over any
field shows more details.Submit. Wait for the build to run.&a.portmgr; will replies with a possible
fallout.Depending on the fallout:If there is no fallout, the procedure stops
here, and the change can be committed, pending
any other approval required.If there is fallout, it
must be fixed, either
by fixing the ports directly in the ports
tree, or adding to the submitted
patch.When this is done, go back to step 6
saying the fallout was fixed and wait for
the exp-run to be run again. Repeat as long
as there are broken ports.Issues Specific to Developers Who Are Not
CommittersA few people who have access to the &os; machines do not
have commit bits. Almost all of this document will apply to
these developers as well (except things specific to commits and
the mailing list memberships that go with them). In particular,
we recommend that you read:Administrative
DetailsConventionsGet your mentor to add you to the
Additional Contributors
(doc/en_US.ISO8859-1/articles/contributors/contrib.additional.xml),
if you are not already listed there.Developer
RelationsSSH Quick-Start
GuideThe &os; Committers' Big List
of RulesInformation About &ga;As of December 12, 2012, &ga; was enabled on the
&os; Project website to collect anonymized usage statistics
regarding usage of the site. The information collected is
valuable to the &os; Documentation Project, to
identify various problems on the &os; website.&ga; General PolicyThe &os; Project takes visitor privacy very
seriously. As such, the &os; Project website honors the
Do Not Track header before
fetching the tracking code from Google. For more information,
please see the
&os;
Privacy Policy.&ga; access is not arbitrarily
allowed — access must be requested, voted on by the
&a.doceng;, and explicitly granted.Requests for &ga; data must include a specific purpose.
For example, a valid reason for requesting access would be
to see the most frequently used web browsers when
viewing &os; web pages to ensure page rendering speeds are
acceptable.Conversely, to see what web browsers are most
frequently used (without stating
why) would be rejected.All requests must include the timeframe for which the data
would be required. For example, it must be explicitly stated
if the requested data would be needed for a timeframe covering
a span of 3 weeks, or if the request would be one-time
only.Any request for &ga; data without a clear, reasonable
reason beneficial to the &os; Project will be
rejected.Data Available Through &ga;A few examples of the types of &ga; data available
include:Commonly used web browsersPage load timesSite access by languageMiscellaneous QuestionsHow do I add a new file to a branch?To add a file onto a branch, simply checkout or update
to the branch you want to add to and then add the file
using the add operation as you normally would. This works
fine for the doc and
ports trees. The
src tree uses SVN and requires more
care because of the mergeinfo
properties. See the
Subversion Primer
for details on how to perform an MFC.How do I access people.FreeBSD.org to
put up personal or project information?people.FreeBSD.org is
the same as freefall.FreeBSD.org.
Just create a public_html directory.
Anything you place in that directory will automatically be
visible under https://people.FreeBSD.org/.Where are the mailing list archives stored?The mailing lists are archived under
/local/mail on freefall.FreeBSD.org.I would like to mentor a new committer. What process
do I need to follow?See the New
Account Creation Procedure document on the
internal pages.Benefits and Perks for &os; CommittersRecognitionRecognition as a competent software engineer is the
longest lasting value. In addition, getting a chance to work
with some of the best people that every engineer would dream
of meeting is a great perk!FreeBSD Mall&os; committers can get a free 4-CD or DVD set at
conferences from
&os; Mall,
Inc..IRCIn addition, developers may request a cloaked hostmask
for their account on the Freenode IRC network in the form
of
freebsd/developer/freefall
name or
freebsd/developer/NickServ
name. To request a cloak, send an email to
&a.irc.email; with your requested hostmask and NickServ
account name.Gandi.netGandi provides website hosting, cloud computing, domain
registration, and X.509 certificate services.Gandi offers an E-rate discount to all &os; developers.
Send mail to non-profit@gandi.net using your
@freebsd.org mail address, and indicate
your Gandi handle.
Index: head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
===================================================================
--- head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml (revision 53416)
+++ head/en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml (revision 53417)
@@ -1,8192 +1,8184 @@
Configuring the MakefileConfiguring the Makefile is pretty
simple, and again we suggest looking at existing examples
before starting. Also, there is a
sample Makefile in this
handbook, so take a look and please follow the ordering of
variables and sections in that template to make the port easier
for others to read.Consider these problems in sequence during the
design of the new Makefile:The Original SourceDoes it live in DISTDIR as a standard
gzipped tarball named something like
foozolix-1.2.tar.gz? If so, go on
to the next step. If not, the distribution file format might
require overriding one or more of
DISTVERSION, DISTNAME,
EXTRACT_CMD,
EXTRACT_BEFORE_ARGS,
EXTRACT_AFTER_ARGS,
EXTRACT_SUFX, or
DISTFILES.In the worst case, create a custom
do-extract target to override the
default. This is rarely, if ever, necessary.NamingThe first part of the port's Makefile
names the port, describes its version number, and lists it in
the correct category.PORTNAMESet PORTNAME to the base name of the
software. It is used as the base for the &os; package, and
for DISTNAME.The package name must be unique across the entire ports
tree. Make sure that the PORTNAME is not
already in use by an existing port, and that no other port
already has the same PKGBASE. If the
name has already been used, add either PKGNAMEPREFIX
or PKGNAMESUFFIX.Versions, DISTVERSIONorPORTVERSIONSet DISTVERSION to the version number
of the software.PORTVERSION is the version used for the
&os; package. It will be automatically derived from
DISTVERSION to be compatible with &os;'s
package versioning scheme. If the version contains
letters, it might be needed to set
PORTVERSION and not
DISTVERSION.Only one of PORTVERSION and
DISTVERSION can be set at a time.From time to time, some software will use a version
scheme that is not compatible with how
DISTVERSION translates in
PORTVERSION.When updating a port, it is possible to use
&man.pkg-version.8;'s argument to
check if the new version is greater or lesser than before.
See .Using &man.pkg-version.8; to Compare Versions.pkg version -t takes two versions as
arguments, it will respond with <,
= or > if the first
version is less, equal, or more than the second
version, respectively.&prompt.user; pkg version -t 1.2 1.3
<
&prompt.user; pkg version -t 1.2 1.2
=
&prompt.user; pkg version -t 1.2 1.2.0
=
&prompt.user; pkg version -t 1.2 1.2.p1
>
&prompt.user; pkg version -t 1.2.a1 1.2.b1
<
&prompt.user; pkg version -t 1.2 1.2p1
< 1.2 is before
1.3.1.2 and 1.2
are equal as they have the same version.1.2 and 1.2.0
are equal as nothing equals zero.1.2 is after
1.2.p1 as .p1,
think pre-release 1.1.2.a1 is before
1.2.b1, think alpha
and beta, and a is
before b.1.2 is before
1.2p1 as 2p1,
think 2, patch level 1 which is a version
after any 2.X but before
3.In here, the a,
b, and p are used as
if meaning alpha, beta or
pre-release and patch level,
but they are only letters and are sorted alphabetically,
so any letter can be used, and they will be sorted
appropriately.
Examples of DISTVERSION and the
Derived PORTVERSIONDISTVERSIONPORTVERSION0.7.1d0.7.1.d10Alpha310.a33Beta7-pre23.b7.p28:f_178f.17
Using DISTVERSIONWhen the version only contains numbers separated by
dots, dashes or underscores, use
DISTVERSION.PORTNAME= nekoto
DISTVERSION= 1.2-4It will generate a PORTVERSION of
1.2.4.Using DISTVERSION When the Version
Starts with a Letter or a PrefixWhen the version starts or ends with a letter, or a
prefix or a suffix that is not part of the version, use
DISTVERSIONPREFIX,
DISTVERSION, and
DISTVERSIONSUFFIX.If the version is v1.2-4:PORTNAME= nekoto
DISTVERSIONPREFIX= v
DISTVERSION= 1_2_4Some of the time, projects using
GitHub will use their name in
their versions. For example, the version could be
nekoto-1.2-4:PORTNAME= nekoto
DISTVERSIONPREFIX= nekoto-
DISTVERSION= 1.2_4Those projects also sometimes use some string at the end
of the version, for example,
1.2-4_RELEASE:PORTNAME= nekoto
DISTVERSION= 1.2-4
DISTVERSIONSUFFIX= _RELEASEOr they do both, for example,
nekoto-1.2-4_RELEASE:PORTNAME= nekoto
DISTVERSIONPREFIX= nekoto-
DISTVERSION= 1.2-4
DISTVERSIONSUFFIX= _RELEASEDISTVERSIONPREFIX and
DISTVERSIONSUFFIX will not be used while
constructing PORTVERSION, but only used
in DISTNAME.All will generate a PORTVERSION of
1.2.4.Using DISTVERSION When the Version
Contains Letters Meaning alpha,
beta, or pre-releaseWhen the version contains numbers separated by dots,
dashes or underscores, and letters are used to mean
alpha, beta or
pre-release, which is, before the version
without the letters, use
DISTVERSION.PORTNAME= nekoto
DISTVERSION= 1.2-pre4PORTNAME= nekoto
DISTVERSION= 1.2p4Both will generate a PORTVERSION of
1.2.p4 which is before than 1.2.
&man.pkg-version.8; can be used to check that fact:&prompt.user; pkg version -t 1.2.p4 1.2
<Not Using DISTVERSION When the
Version Contains Letters Meaning "Patch Level"When the version contains letters that are not meant as
alpha, beta, or
pre, but more in a patch
level, and meaning after the version without the
letters, use PORTVERSION.PORTNAME= nekoto
PORTVERSION= 1.2p4In this case, using DISTVERSION is
not possible because it would generate a version of
1.2.p4 which would be before
1.2 and not after. &man.pkg-version.8;
will verify this:&prompt.user; pkg version -t 1.2 1.2.p4
>
&prompt.user; pkg version -t 1.2 1.2p4
< 1.2 is after
1.2.p4, which is
wrong in this case.1.2 is before
1.2p4, which is what was
needed.For some more advanced examples of setting
PORTVERSION, when the software's versioning
is really not compatible with &os;'s, or
DISTNAME when the distribution file does
not contain the version itself, see .PORTREVISION and
PORTEPOCHPORTREVISIONPORTREVISION is a
monotonically increasing value which is reset to 0 with
every increase of DISTVERSION, typically
every time there is a new official vendor release. If
PORTREVISION is non-zero, the value is
appended to the package name. Changes to
PORTREVISION are used by automated tools
like &man.pkg-version.8; to determine that a new package is
available.PORTREVISION must be increased each
time a change is made to the port that changes the generated
package in any way. That includes changes that only affect
a package built with non-default
options.Examples of when PORTREVISION
must be bumped:Addition of patches to correct security
vulnerabilities, bugs, or to add new functionality to
the port.Changes to the port Makefile to
enable or disable compile-time options in the
package.Changes in the packing list or the install-time
behavior of the package. For example, a change to a
script which generates initial data for the package,
like &man.ssh.1; host keys.Version bump of a port's shared library dependency
(in this case, someone trying to install the old package
after installing a newer version of the dependency will
fail since it will look for the old libfoo.x instead of
libfoo.(x+1)).Silent changes to the port distfile which have
significant functional differences. For example,
changes to the distfile requiring a correction to
distinfo with no corresponding
change to DISTVERSION, where a
diff -ru of the old and new versions
shows non-trivial changes to the code.Examples of changes which do not require a
PORTREVISION bump:Style changes to the port skeleton with no
functional change to what appears in the resulting
package.Changes to MASTER_SITES or other
functional changes to the port which do not affect the
resulting package.Trivial patches to the distfile such as correction
of typos, which are not important enough that users of
the package have to go to the trouble of
upgrading.Build fixes which cause a package to become
compilable where it was previously failing. As long as
the changes do not introduce any functional change on
any other platforms on which the port did previously
build. Since PORTREVISION reflects
the content of the package, if the package was not
previously buildable then there is no need to increase
PORTREVISION to mark a change.A rule of thumb is to decide whether a change
committed to a port is something which
some people would benefit from having.
Either because of an enhancement, fix,
or by virtue that the new package will actually work at
all. Then weigh that against that fact that it will cause
everyone who regularly updates their ports tree to be
compelled to update. If yes,
PORTREVISION must be bumped.People using binary packages will
never see the update if
PORTREVISION is not bumped. Without
increasing PORTREVISION, the
package builders have no way to detect the change and
thus, will not rebuild the package.PORTEPOCHFrom time to time a software vendor or &os; porter will
do something silly and release a version of their software
which is actually numerically less than the previous
version. An example of this is a port which goes from
foo-20000801 to foo-1.0 (the former will be incorrectly
treated as a newer version since 20000801 is a numerically
greater value than 1).The results of version number comparisons are not
always obvious. pkg version (see
&man.pkg-version.8;) can be used to test the comparison of
two version number strings. For example:&prompt.user; pkg version -t 0.031 0.29
>The > output indicates that
version 0.031 is considered greater than version 0.29,
which may not have been obvious to the porter.In situations such as this,
PORTEPOCH must be increased.
If PORTEPOCH is nonzero it is appended to
the package name as described in section 0 above.
PORTEPOCH must never be decreased or
reset to zero, because that would cause comparison to a
package from an earlier epoch to fail. For example, the
package would not be detected as out of date. The new
version number, 1.0,1 in the above
example, is still numerically less than the previous
version, 20000801, but the ,1 suffix is
treated specially by automated tools and found to be greater
than the implied suffix ,0 on the earlier
package.Dropping or resetting PORTEPOCH
incorrectly leads to no end of grief. If the discussion
above was not clear enough, please consult the
&a.ports;.It is expected that PORTEPOCH will
not be used for the majority of ports, and that sensible use
of DISTVERSION, or that use
PORTVERSION carefully, can often preempt
it
becoming necessary if a future release of the software
changes the version structure. However, care is
needed by &os; porters when a vendor release is made without
an official version number — such as a code
snapshot release. The temptation is to label
the release with the release date, which will cause problems
as in the example above when a new official
release is made.For example, if a snapshot release is made on the date
20000917, and the previous version of the
software was version 1.2, do not use
20000917 for
DISTVERSION. The correct way is a
DISTVERSION of
1.2.20000917, or similar, so that the
succeeding release, say 1.3, is still a
numerically greater value.Example of PORTREVISION and
PORTEPOCH UsageThe gtkmumble port, version
0.10, is committed to the ports
collection:PORTNAME= gtkmumble
DISTVERSION= 0.10PKGNAME becomes
gtkmumble-0.10.A security hole is discovered which requires a local
&os; patch. PORTREVISION is bumped
accordingly.PORTNAME= gtkmumble
DISTVERSION= 0.10
PORTREVISION= 1PKGNAME becomes
gtkmumble-0.10_1A new version is released by the vendor, numbered
0.2 (it turns out the author actually
intended 0.10 to actually mean
0.1.0, not what comes after
0.9 - oops, too late now). Since the new minor
version 2 is numerically less than the
previous version 10,
PORTEPOCH must be bumped to manually
force the new package to be detected as
newer. Since it is a new vendor release of
the code, PORTREVISION is reset to 0 (or
removed from the Makefile).PORTNAME= gtkmumble
DISTVERSION= 0.2
PORTEPOCH= 1PKGNAME becomes
gtkmumble-0.2,1The next release is 0.3. Since
PORTEPOCH never decreases, the version
variables are now:PORTNAME= gtkmumble
DISTVERSION= 0.3
PORTEPOCH= 1PKGNAME becomes
gtkmumble-0.3,1If PORTEPOCH were reset to
0 with this upgrade, someone who had
installed the gtkmumble-0.10_1 package
would not detect the gtkmumble-0.3
package as newer, since 3 is still
numerically less than 10. Remember,
this is the whole point of PORTEPOCH in
the first place.PKGNAMEPREFIX and
PKGNAMESUFFIXTwo optional variables, PKGNAMEPREFIX
and PKGNAMESUFFIX, are combined with
PORTNAME and PORTVERSION
to form PKGNAME as
${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}.
Make sure this conforms to our
guidelines for a good
package name. In particular, the use of a
hyphen (-) in
PORTVERSION is not
allowed.
Also, if the package name has the
language- or the
-compiled.specifics part (see
below), use PKGNAMEPREFIX and
PKGNAMESUFFIX, respectively. Do not make
them part of PORTNAME.Package Naming ConventionsThese are the conventions to follow when
naming packages. This is to make the package directory
easy to scan, as there are already thousands of packages and
users are going to turn away if they hurt their eyes!Package names take the form of
language_region-name-compiled.specifics-version.numbers.The package name is defined as
${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}.
Make sure to set the variables to conform to that
format.language_region-&os; strives to support the native language of its
users. The language- part is
a two letter abbreviation of the natural language
defined by ISO-639 when 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.If the port is specific to a certain region within
the language area, add the two letter country code as
well. Examples are en_US for US
English and fr_CH for Swiss
French.The language- part is
set in PKGNAMEPREFIX.nameMake sure that the port's name and version are
clearly separated and placed into
PORTNAME and
DISTVERSION. The only
reason for PORTNAME to contain a
version part is if the upstream distribution is really
named that way, as in the
textproc/libxml2 or
japanese/kinput2-freewnn
ports. Otherwise, PORTNAME cannot
contain any version-specific information. It is quite
normal for several ports to have the same
PORTNAME, as the
www/apache* ports do; in
that case, different versions (and different index
entries) are distinguished by
PKGNAMEPREFIX
and PKGNAMESUFFIX values.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.-compiled.specificsIf the port can be built with different hardcoded defaults
(usually part of the directory name in a family of
ports), the
-compiled.specifics part
states the compiled-in defaults. The hyphen is
optional. Examples are paper size and font
units.The -compiled.specifics
part is set in PKGNAMESUFFIX.-version.numbersThe version string follows a dash
(-) and is a period-separated list of
integers and single lowercase alphabetics. In
particular, it is not permissible to have another dash
inside the version string. 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. If the software
version has strings like alpha,
beta, rc, or
pre, take the first letter and put it
immediately after a period. If the version string
continues after those names, the numbers follow
the single alphabet without an extra period between
them (for example, 1.0b2).The idea is to make it easier to sort ports by
looking at the version string. In particular, make sure
version number components are always delimited by a
period, and if the date is part of the string, use the
dyyyy.mm.dd
format, not
dd.mm.yyyy
or the non-Y2K compliant
yy.mm.dd
format. It is important to prefix the version with a
letter, here d (for date), in case a
release with an actual
version number is made, which would be
numerically less than
yyyy.Package name must be unique among all of the ports
tree, check that there is not already a port with the same
PORTNAME and if there is add one of PKGNAMEPREFIX
or PKGNAMESUFFIX.Here are some (real) examples on how to convert the name
as called by the software authors to a suitable package name,
for each line, only one of DISTVERSION or
PORTVERSION is set in, depending on which
would be used in the port's
Makefile:
Package Naming ExamplesDistribution NamePKGNAMEPREFIXPORTNAMEPKGNAMESUFFIXDISTVERSIONPORTVERSIONReason or commentmule-2.2.2(empty)mule(empty)2.2.2No changes requiredmule-1.0.1(empty)mule11.0.1This is version 1 of
mule, and version 2 already
existsEmiClock-1.0.2(empty)emiclock(empty)1.0.2No uppercase names for single programsrdist-1.3alpha(empty)rdist(empty)1.3alphaVersion will be 1.3.aes-0.9-beta1(empty)es(empty)0.9-beta1Version will be 0.9.b1mailman-2.0rc3(empty)mailman(empty)2.0rc3Version will be 2.0.r3v3.3beta021.src(empty)tiff(empty)3.3What the heck was that anyway?tvtwm(empty)tvtwm(empty)p11No version in the filename, use what upstream
says it ispiewm(empty)piewm(empty)1.0No version in the filename, use what upstream
says it isxvgr-2.10pl1(empty)xvgr(empty)2.10.pl1In that case, pl1 means patch
level, so using DISTVERSION is not possible.gawk-2.15.6ja-gawk(empty)2.15.6Japanese language versionpsutils-1.13(empty)psutils-letter1.13Paper size hardcoded at package build
timepkfonts(empty)pkfonts3001.0Package 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 the source file was
released on
(dyyyy.mm.dd,
or
dyyyymmdd)
as the version.Use any letter. Here, d here stands
for date, if the source is a Git
repository, g followed by the commit date
is commonly used, using s for snapshot is
also common.CategorizationCATEGORIESWhen 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 CDROM. Please take a look at
the current list of
categories and pick the ones that are suitable for
the port.This list also determines where in the ports tree the port
is imported. If there is more than one category here,
the port files must be put in the subdirectory
with the name of the first category. See
below for more
discussion about how to pick the right categories.Current List of CategoriesHere is the current list of port categories. Those marked
with an asterisk (*) are
virtual categories—those that do
not have a corresponding subdirectory in the ports tree. They
are only used as secondary categories, and only for search
purposes.For non-virtual categories, there is a one-line
description in COMMENT in that
subdirectory's Makefile.CategoryDescriptionNotesaccessibilityPorts to help disabled users.afterstep*Ports to support the AfterStep
window manager.arabicArabic language support.archiversArchiving tools.astroAstronomical ports.audioSound support.benchmarksBenchmarking utilities.biologyBiology-related software.cadComputer aided design tools.chineseChinese language support.commsCommunication software.Mostly software to talk to the serial
port.convertersCharacter code converters.databasesDatabases.deskutilsThings that used to be on the desktop before
computers were invented.develDevelopment utilities.Do not put libraries here just because they are
libraries. They should not be
in this category unless they truly do not belong
anywhere else.dnsDNS-related software.docs*Meta-ports for &os; documentation.editorsGeneral editors.Specialized editors go in the section for those
tools. For example, a mathematical-formula editor
will go in math, and have
editors as a second
category.elisp*Emacs-lisp ports.emulatorsEmulators for other operating systems.Terminal emulators do not
belong here. X-based ones go to
x11 and text-based ones to
either comms or
misc, depending on the exact
functionality.financeMonetary, financial and related
applications.frenchFrench language support.ftpFTP client and server
utilities.If the port speaks both FTP
and HTTP, put it
in ftp with a secondary
category of www.gamesGames.geography*Geography-related software.germanGerman language support.gnome*Ports from the
GNOME
Project.gnustep*Software related to the GNUstep desktop
environment.graphicsGraphics utilities.hamradio*Software for amateur radio.haskell*Software related to the Haskell
language.hebrewHebrew language support.hungarianHungarian language support.ipv6*IPv6 related software.ircInternet Relay Chat utilities.japaneseJapanese language support.javaSoftware related to the Java™
language.The java category must not
be the only one for a port. Save for ports directly
related to the Java language, porters are also
encouraged not to use java as the
main category of a port.kde*Ports from the
KDE
Project.kld*Kernel loadable modules.koreanKorean language support.langProgramming languages.linux*Linux applications and support
utilities.lisp*Software related to the Lisp language.mailMail software.mathNumerical computation software and other
utilities for mathematics.mbone*MBone applications.miscMiscellaneous utilitiesThings that do not belong anywhere
else. If at all possible, try to find a better
category for the port than misc,
as ports tend to be overlooked in here.multimediaMultimedia software.netMiscellaneous networking software.net-imInstant messaging software.net-mgmtNetworking management software.net-p2pPeer to peer network applications.newsUSENET news software.palmSoftware support for the Palm™
series.parallel*Applications dealing with parallelism in
computing.pear*Ports related to the Pear PHP
framework.perl5*Ports that require
Perl version 5 to
run.plan9*Various programs from Plan9.polishPolish language support.ports-mgmtPorts for managing, installing and developing
&os; ports and packages.portuguesePortuguese language support.printPrinting software.Desktop publishing tools
(previewers, etc.) belong here too.python*Software related to the Python
language.ruby*Software related to the Ruby
language.rubygems*Ports of RubyGems
packages.russianRussian language support.scheme*Software related to the Scheme
language.scienceScientific ports that do not fit into other
categories such as astro,
biology and
math.securitySecurity utilities.shellsCommand line shells.spanish*Spanish language support.sysutilsSystem utilities.tcl*Ports that use Tcl to run.textprocText processing utilities.It does not include desktop publishing tools,
which go to print.tk*Ports that use Tk to run.ukrainianUkrainian language support.vietnameseVietnamese language support.windowmaker*Ports to support the WindowMaker window
manager.wwwSoftware related to the World Wide Web.HTML language
support belongs here too.x11The X Window System and friends.This category is only for software that directly
supports the window system. Do not put regular X
applications here. Most of them go into other
x11-* categories (see
below).x11-clocksX11 clocks.x11-driversX11 drivers.x11-fmX11 file managers.x11-fontsX11 fonts and font utilities.x11-serversX11 servers.x11-themesX11 themes.x11-toolkitsX11 toolkits.x11-wmX11 window managers.xfce*Ports related to the
Xfce
desktop environment.zope*Zope
support.Choosing the Right CategoryAs many of the categories overlap, choosing which of the
categories will be the primary category of the port can be
tedious. There are several rules that govern this issue.
Here is the list of priorities, in decreasing order of
precedence:The first category must be a physical category (see
above). This is
necessary to make the packaging work. Virtual categories
and physical categories may be intermixed after
that.Language specific categories always come first. For
example, if the port installs Japanese X11 fonts, then
the CATEGORIES line would read
japanese x11-fonts.Specific categories are listed before less-specific
ones. For instance, an HTML editor is listed as
www editors, not the other way
around. Also, do not list
net when the port belongs to any of
irc, mail,
news, security,
or www, as net
is included implicitly.x11 is used as a secondary
category only when the primary category is a natural
language. In particular, do not put
x11 in the category line for X
applications.Emacs modes are
placed in the same ports category as the application
supported by the mode, not in
editors. For example, an
Emacs mode to edit source files
of some programming language goes into
lang.Ports installing loadable kernel modules also
have the virtual category kld in
their CATEGORIES line. This is one of
the things handled automatically by adding
USES=kmod.misc does not appear with any
other non-virtual category. If there is
misc with something else in
CATEGORIES, that means
misc can safely be deleted and the port
placed only in the other subdirectory.If the port truly does not belong anywhere else,
put it in misc.If the category is not clearly defined, please put a
comment to that effect in the port
submission in the bug database so
we can discuss it before we import it. As a committer,
send a note to the &a.ports; so we can discuss it
first. Too often, new ports are imported to the wrong
category only to be moved right away.Proposing a New CategoryAs the Ports Collection has grown over time, various new
categories have been introduced. New categories can either be
virtual categories—those that do
not have a corresponding subdirectory in the ports tree—
or physical categories—those that
do. This section discusses the issues involved in creating a
new physical category. Read it thouroughly before proposing a
new one.Our existing practice has been to avoid creating a new
physical category unless either a large number of ports would
logically belong to it, or the ports that would belong to it
are a logically distinct group that is of limited general
interest (for instance, categories related to spoken human
languages), or preferably both.The rationale for this is that such a change creates a
fair
amount of work for both the committers and also for
all users who track changes to the Ports Collection. In
addition, proposed category changes just naturally seem to
attract controversy. (Perhaps this is because there is no
clear consensus on when a category is too big,
nor whether categories should lend themselves to browsing (and
thus what number of categories would be an ideal number), and
so forth.)Here is the procedure:Propose the new category on &a.ports;. Include
a detailed rationale for the new category,
including why the existing categories are not
sufficient, and the list of existing ports proposed to
move. (If there are new ports pending in
Bugzilla that would fit this
category, list them too.) If you are the maintainer
and/or submitter, respectively, mention that as it may
help the case.Participate in the discussion.If it seems that there is support for the idea, file
a PR which includes both the rationale and the list of
existing ports that need to be moved. Ideally, this PR
would also include these patches:Makefiles for the new ports
once they are repocopiedMakefile for the new
categoryMakefile for the old ports'
categoriesMakefiles for ports that
depend on the old ports(for extra credit, include the other files
that have to change, as per the procedure in the
Committer's Guide.)Since it affects the ports infrastructure and involves
moving and patching many ports but also possibly running
regression tests on the build cluster, assign the PR to
the &a.portmgr;.If that PR is approved, a committer will need to
follow the rest of the procedure that is outlined
in the Committer's Guide.Proposing a new virtual category is similar to the
above but much less involved, since no ports will actually
have to move. In this case, the only patches to include in
the PR would be those to add the new category to
CATEGORIES of the affected ports.Proposing Reorganizing All the CategoriesOccasionally someone proposes reorganizing the
categories with either a 2-level structure, or some other kind
of keyword structure. To date, nothing has come of any of
these proposals because, while they are very easy to make, the
effort involved to retrofit the entire existing ports
collection with any kind of reorganization is daunting to say
the very least. Please read the history of these proposals in
the mailing list archives before posting this idea.
Furthermore, be prepared to be challenged to offer
a working prototype.The Distribution FilesThe second part of the Makefile
describes the files that must be downloaded to build
the port, and where they can be downloaded.DISTNAMEDISTNAME is the name of the port as
called by the authors of the software.
DISTNAME defaults to
${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX},
and if not set, DISTVERSION defaults to
${PORTVERSION} so override
DISTNAME
only if necessary. DISTNAME is only used
in two places. First, the distribution file list
(DISTFILES) defaults to
${DISTNAME}${EXTRACT_SUFX}.
Second, the distribution file is expected to extract into a
subdirectory named WRKSRC, which defaults
to work/${DISTNAME}.Some vendor's distribution names which do not fit into the
${PORTNAME}-${PORTVERSION}-scheme can be
handled automatically by setting
DISTVERSIONPREFIX,
DISTVERSION, and
DISTVERSIONSUFFIX.
PORTVERSION will be derived from
DISTVERSION automatically.Only one of PORTVERSION and
DISTVERSION can be set at a time. If
DISTVERSION does not derive a correct
PORTVERSION, do not use
DISTVERSION.If the upstream version scheme can be derived into a
ports-compatible version scheme, set some variable to the
upstream version, do not use
DISTVERSION as the variable name. Set
PORTVERSION to the computed version based
on the variable you
created, and set DISTNAME
accordingly.If the upstream version scheme cannot easily be coerced
into a ports-compatible value, set
PORTVERSION to a sensible value, and set
DISTNAME with PORTNAME
with the verbatim upstream version.Deriving PORTVERSION
ManuallyBIND9 uses a version scheme
that is not compatible with the ports versions (it has
- in its versions) and cannot be derived
using DISTVERSION because after the 9.9.9
release, it will release a patchlevels in the
form of 9.9.9-P1. DISTVERSION would
translate that into 9.9.9.p1, which, in
the ports versioning scheme means 9.9.9 pre-release 1, which
is before 9.9.9 and not after. So
PORTVERSION is manually derived from an
ISCVERSION variable to output
9.9.9p1.The order into which the ports framework, and pkg, will
sort versions is checked using the -t
argument of &man.pkg-version.8;:&prompt.user; pkg version -t 9.9.9 9.9.9.p1
>
&prompt.user; pkg version -t 9.9.9 9.9.9p1
< The > sign means that the
first argument passed to -t is
greater than the second argument.
9.9.9 is after
9.9.9.p1.The < sign means that the
first argument passed to -t is less
than the second argument. 9.9.9 is
before 9.9.9p1.In the port Makefile, for example
dns/bind99, it is achieved
by:PORTNAME= bind
PORTVERSION= ${ISCVERSION:S/-P/P/:S/b/.b/:S/a/.a/:S/rc/.rc/}
CATEGORIES= dns net ipv6
MASTER_SITES= ISC/bind9/${ISCVERSION}
PKGNAMESUFFIX= 99
DISTNAME= ${PORTNAME}-${ISCVERSION}
MAINTAINER= mat@FreeBSD.org
COMMENT= BIND DNS suite with updated DNSSEC and DNS64
LICENSE= ISCL
# ISC releases things like 9.8.0-P1 or 9.8.1rc1, which our versioning does not like
ISCVERSION= 9.9.9-P6 Define upstream version in
ISCVERSION, with a comment saying
why it is needed.Use ISCVERSION to get a
ports-compatible PORTVERSION.Use ISCVERSION directly to get
the correct URL for fetching the
distribution file.Use ISCVERSION directly to name
the distribution file.Derive DISTNAME from
PORTVERSIONFrom time to time, the distribution file name has little
or no relation to the version of the software.In comms/kermit, only the
last element of the version is present in the distribution
file:PORTNAME= kermit
PORTVERSION= 9.0.304
CATEGORIES= comms ftp net
MASTER_SITES= ftp://ftp.kermitproject.org/kermit/test/tar/
DISTNAME= cku${PORTVERSION:E}-dev20 The :E &man.make.1; modifier
returns the suffix of the variable, in this case,
304. The distribution file is
correctly generated as
cku304-dev20.tar.gz.Exotic Case 1Sometimes, there is no relation between the software
name, its version, and the distribution file it is
distributed in.From audio/libworkman:PORTNAME= libworkman
PORTVERSION= 1.4
CATEGORIES= audio
MASTER_SITES= LOCAL/jim
DISTNAME= ${PORTNAME}-1999-06-20Exotic Case 2In comms/librs232, the
distribution file is not versioned, so using DIST_SUBDIR
is needed:PORTNAME= librs232
PORTVERSION= 20160710
CATEGORIES= comms
MASTER_SITES= http://www.teuniz.net/RS-232/
DISTNAME= RS-232
DIST_SUBDIR= ${PORTNAME}-${PORTVERSION}PKGNAMEPREFIX and
PKGNAMESUFFIX do not affect
DISTNAME. Also note that if
WRKSRC is equal to
${WRKDIR}/${DISTNAME} while
the original source archive is named something other than
${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX},
leave DISTNAME
alone— defining only
DISTFILES is easier than both
DISTNAME and WRKSRC
(and possibly EXTRACT_SUFX).MASTER_SITESRecord 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 multiple sites are included on this
list, preferably from different continents. This will
safeguard against wide-area network problems.MASTER_SITES must not be blank. It
must point to the actual site hosting the distribution
files. It cannot point to web archives, or the &os;
distribution files cache sites. The only exception to this
rule is ports that do not have any distribution files. For
example, meta-ports do not have any distribution files, so
MASTER_SITES does not need to be
set.Using
MASTER_SITE_*
VariablesShortcut abbreviations are available for popular
archives like SourceForge (SOURCEFORGE),
GNU (GNU), or Perl CPAN
(PERL_CPAN).
MASTER_SITES can use them
directly:MASTER_SITES= GNU/makeThe older expanded format still works, but all ports
have been converted to the compact format. The expanded
format looks like this:MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= makeThese values and variables are defined in Mk/bsd.sites.mk.
New entries are added often, so make sure to check the
latest version of this file before submitting a port.For any
MASTER_SITE_FOO
variable, the shorthand
FOO can be
used. For example, use:MASTER_SITES= FOOIf MASTER_SITE_SUBDIR is needed,
use this:MASTER_SITES= FOO/barSome
MASTER_SITE_*
names are quite long, and for ease of use, shortcuts have
been defined:
Shortcuts for
MASTER_SITE_*
MacrosMacroShortcutPERL_CPANCPANGITHUBGHGITHUB_CLOUDGHCLIBREOFFICE_DEVLODEVNETLIBNLRUBYGEMSRGSOURCEFORGESF
Magic MASTER_SITES MacrosSeveral magic macros exist for
popular sites with a predictable directory structure. For
these, just use the abbreviation and the system will choose
a subdirectory automatically. For a port
named Stardict, of version
1.2.3, and hosted on SourceForge, adding
this line:MASTER_SITES= SFinfers a subdirectory named
/project/stardict/stardict/1.2.3. If the
inferred directory is incorrect, it can be
overridden:MASTER_SITES= SF/stardict/WyabdcRealPeopleTTS/${PORTVERSION}This can also be written asMASTER_SITES= SF
MASTER_SITE_SUBDIR= stardict/WyabdcRealPeopleTTS/${PORTVERSION}
USE_GITHUBIf the distribution file comes from a specific commit or
tag on GitHub
for which there is no officially released file, there is an
easy way to set the right DISTNAME and
MASTER_SITES automatically. These
variables are available:
USE_GITHUB DescriptionVariableDescriptionDefaultGH_ACCOUNTAccount name of the GitHub user hosting the
project${PORTNAME}GH_PROJECTName of the project on GitHub${PORTNAME}GH_TAGNAMEName of the tag to download (2.0.1, hash, ...)
Using the name of a branch here is incorrect. It is
also possible to use the hash of a commit id to do a
snapshot.${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}GH_SUBDIRWhen the software needs an additional
distribution file to be extracted within
${WRKSRC}, this variable can be
used. See the examples in
for more information.(none)GH_TUPLEGH_TUPLE allows putting
GH_ACCOUNT,
GH_PROJECT,
GH_TAGNAME, and
GH_SUBDIR into a single variable.
The format is
account:project:tagname:group/subdir.
The
/subdir
part is optional. It is helpful when there is more
than one GitHub project from which to fetch.
Do not use GH_TUPLE for the default
distribution file, as it has no default.Simple Use of USE_GITHUBWhile trying to make a port for version
1.2.7 of pkg
from the &os; user on github, at , The
Makefile would end up looking like
this (slightly stripped for the example):PORTNAME= pkg
DISTVERSION= 1.2.7
USE_GITHUB= yes
GH_ACCOUNT= freebsdIt will automatically have
MASTER_SITES set to GH
GHC and WRKSRC to
${WRKDIR}/pkg-1.2.7.More Complete Use of
USE_GITHUBWhile trying to make a port for the bleeding edge
version of pkg from the &os;
user on github, at , the
Makefile ends up looking like
this (slightly stripped for the example):PORTNAME= pkg-devel
DISTVERSION= 1.3.0.a.20140411
USE_GITHUB= yes
GH_ACCOUNT= freebsd
GH_PROJECT= pkg
GH_TAGNAME= 6dbb17bIt will automatically have
MASTER_SITES set to GH
GHC and WRKSRC to
${WRKDIR}/pkg-6dbb17b.20140411 is the date of the
commit referenced in GH_TAGNAME, not
the date the Makefile is edited, or
the date the commit is made.Use of USE_GITHUB with
DISTVERSIONPREFIXFrom time to time, GH_TAGNAME is a
slight variation from DISTVERSION.
For example, if the version is 1.0.2,
the tag is v1.0.2. In those cases, it
is possible to use DISTVERSIONPREFIX or
DISTVERSIONSUFFIX:PORTNAME= foo
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.2
USE_GITHUB= yesIt will automatically set
GH_TAGNAME to
v1.0.2, while WRKSRC
will be kept to
${WRKDIR}/foo-1.0.2.Using USE_GITHUB When Upstream Does
Not Use VersionsIf there never was a version upstream, do not invent one
like 0.1 or 1.0.
Create the port with a DISTVERSION of
gYYYYMMDD,
where g is for
Git, and
YYYYMMDD
represents the date the commit referenced in
GH_TAGNAME.PORTNAME= bar
DISTVERSION= g20140411
USE_GITHUB= yes
GH_TAGNAME= c472d66bThis creates a versioning scheme that increases over
time, and that is still before version 0
(see for
details on &man.pkg-version.8;):&prompt.user; pkg version -t g20140411 0
<Which means using PORTEPOCH will not
be needed in case upstream decides to cut versions in the
future.Using USE_GITHUB to Access
a Commit Between Two VersionsIf the current version of the software uses a
Git tag, and the port needs to be
updated to a newer, intermediate version, without a tag, use
&man.git-describe.1; to find out the version to use:&prompt.user; git describe --tags f0038b1
v0.7.3-14-gf0038b1v0.7.3-14-gf0038b1 can be split into
three parts:v0.7.3This is the last Git
tag that appears in the commit history before the
requested commit.-14This means that the requested commit,
f0038b1, is the 14th commit after
the v0.7.3 tag.-gf0038b1The -g means
Git, and
the f0038b1 is the commit hash
that this reference points to.PORTNAME= bar
DISTVERSIONPREFIX= v
DISTVERSION= 0.7.3-14
DISTVERSIONSUFFIX= -gf0038b1
USE_GITHUB= yesThis creates a versioning scheme that increases over
time (well, over commits), and does not conflict with the
creation of a 0.7.4 version.
(See for
details on &man.pkg-version.8;):&prompt.user; pkg version -t 0.7.3 0.7.3.14
<
&prompt.user; pkg version -t 0.7.3.14 0.7.4
<If the requested commit is the same as a tag, a
shorter description is shown by default. The longer
version is equivalent:&prompt.user; git describe --tags c66c71d
v0.7.3
&prompt.user; git describe --tags --long c66c71d
v0.7.3-0-gc66c71dFetching Multiple Files from GitHubThe USE_GITHUB framework also
supports fetching multiple distribution files from
different places in GitHub. It works in a way very
similar to .Multiple values are added to
GH_ACCOUNT,
GH_PROJECT, and
GH_TAGNAME. Each different value is
assigned a group. The main value can either have no group,
or the :DEFAULT group. A value can be
omitted if it is the same as the default as listed in
.GH_TUPLE can also be used when there
are a lot of distribution files. It helps keep the account,
project, tagname, and group information at the same
place.For each group, a
${WRKSRC_group}
helper variable is created, containing the directory into
which the file has been extracted. The
${WRKSRC_group}
variables can be used to move directories around during
post-extract, or add to
CONFIGURE_ARGS, or whatever is needed
so that the software builds correctly.The
:group part
must be used for only
one distribution file. It is used as a
unique key and using it more than once will overwrite the
previous values.As this is only syntactic sugar above
DISTFILES and
MASTER_SITES, the group names must
adhere to the restrictions on group names outlined in
When fetching multiple files from GitHub, sometimes the
default distribution file is not fetched from GitHub. To disable
fetching the default distribution, set:USE_GITHUB= nodefaultWhen using USE_GITHUB=nodefault,
the Makefile must set
DISTFILES in its
top block.
The definition should be:DISTFILES= ${DISTNAME}${EXTRACT_SUFX}Use of USE_GITHUB with Multiple
Distribution FilesFrom time to time, there is a need to fetch more
than one distribution file. For example, when the
upstream git repository uses submodules. This can be
done easily using groups in the
GH_*
variables:PORTNAME= foo
DISTVERSION= 1.0.2
USE_GITHUB= yes
GH_ACCOUNT= bar:icons,contrib
GH_PROJECT= foo-icons:icons foo-contrib:contrib
GH_TAGNAME= 1.0:icons fa579bc:contrib
GH_SUBDIR= ext/icons:icons
CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}This will fetch three distribution files from
github. The default one comes from
foo/foo and is version
1.0.2. The second one, with the
icons group, comes from
bar/foo-icons and is in version
1.0. The third one comes from
bar/foo-contrib and uses the
Git commit
fa579bc. The distribution files are
named foo-foo-1.0.2_GH0.tar.gz,
bar-foo-icons-1.0_GH0.tar.gz, and
bar-foo-contrib-fa579bc_GH0.tar.gz.All the distribution files are extracted in
${WRKDIR} in their respective
subdirectories. The default file is still extracted in
${WRKSRC}, in this case,
${WRKDIR}/foo-1.0.2. Each
additional distribution file is extracted in
${WRKSRC_group}.
Here, for the icons group, it is called
${WRKSRC_icons} and it contains
${WRKDIR}/foo-icons-1.0. The file
with the contrib group is called
${WRKSRC_contrib} and contains
${WRKDIR}/foo-contrib-fa579bc.The software's build system expects to find the icons
in a ext/icons subdirectory in its
sources, so GH_SUBDIR is used.
GH_SUBDIR makes sure that
ext exists, but that
ext/icons does not already exist.
Then it does this:post-extract:
@${MV} ${WRKSRC_icons} ${WRKSRC}/ext/iconsUse of USE_GITHUB with Multiple
Distribution Files Using
GH_TUPLEThis is functionally equivalent to , but
using GH_TUPLE:PORTNAME= foo
DISTVERSION= 1.0.2
USE_GITHUB= yes
GH_TUPLE= bar:foo-icons:1.0:icons/ext/icons \
bar:foo-contrib:fa579bc:contrib
CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}Grouping was used in the previous example with
bar:icons,contrib. Some redundant
information is present with GH_TUPLE
because grouping is not possible.How to Use USE_GITHUB with
Git Submodules?Ports with GitHub as an upstream repository sometimes
use submodules. See &man.git-submodule.1; for more
information.The problem with submodules is that each is a separate
repository. As such, they each must be fetched
separately.Using finance/moneymanagerex as an
example, its GitHub repository is .
It has a .gitmodules
file at the root. This file describes all the submodules
used in this repository, and lists additional repositories
needed. This file will tell what additional repositories
are needed:[submodule "lib/wxsqlite3"]
path = lib/wxsqlite3
url = https://github.com/utelle/wxsqlite3.git
[submodule "3rd/mongoose"]
path = 3rd/mongoose
url = https://github.com/cesanta/mongoose.git
[submodule "3rd/LuaGlue"]
path = 3rd/LuaGlue
url = https://github.com/moneymanagerex/LuaGlue.git
[submodule "3rd/cgitemplate"]
path = 3rd/cgitemplate
url = https://github.com/moneymanagerex/html-template.git
[...]The only information missing from that file is the
commit hash or tag to use as a version. This information
is found after cloning the repository:&prompt.user; git clone --recurse-submodules https://github.com/moneymanagerex/moneymanagerex.git
Cloning into 'moneymanagerex'...
remote: Counting objects: 32387, done.
[...]
Submodule '3rd/LuaGlue' (https://github.com/moneymanagerex/LuaGlue.git) registered for path '3rd/LuaGlue'
Submodule '3rd/cgitemplate' (https://github.com/moneymanagerex/html-template.git) registered for path '3rd/cgitemplate'
Submodule '3rd/mongoose' (https://github.com/cesanta/mongoose.git) registered for path '3rd/mongoose'
Submodule 'lib/wxsqlite3' (https://github.com/utelle/wxsqlite3.git) registered for path 'lib/wxsqlite3'
[...]
Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/LuaGlue'...
Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/cgitemplate'...
Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/3rd/mongoose'...
Cloning into '/home/mat/work/freebsd/ports/finance/moneymanagerex/moneymanagerex/lib/wxsqlite3'...
[...]
Submodule path '3rd/LuaGlue': checked out 'c51d11a247ee4d1e9817dfa2a8da8d9e2f97ae3b'
Submodule path '3rd/cgitemplate': checked out 'cd434eeeb35904ebcd3d718ba29c281a649b192c'
Submodule path '3rd/mongoose': checked out '2140e5992ab9a3a9a34ce9a281abf57f00f95cda'
Submodule path 'lib/wxsqlite3': checked out 'fb66eb230d8aed21dec273b38c7c054dcb7d6b51'
[...]
&prompt.user; cd moneymanagerex
&prompt.user; git submodule status
c51d11a247ee4d1e9817dfa2a8da8d9e2f97ae3b 3rd/LuaGlue (heads/master)
cd434eeeb35904ebcd3d718ba29c281a649b192c 3rd/cgitemplate (cd434ee)
2140e5992ab9a3a9a34ce9a281abf57f00f95cda 3rd/mongoose (6.2-138-g2140e59)
fb66eb230d8aed21dec273b38c7c054dcb7d6b51 lib/wxsqlite3 (v3.4.0)
[...]It can also be found on GitHub. Each subdirectory
that is a submodule is shown as
directory @ hash,
for example,
mongoose @ 2140e59.While getting the information from GitHub seems more
straightforward, the information found using
git submodule status will provide
more meaningful information. For example, here,
lib/wxsqlite3's commit hash
fb66eb2 correspond to
v3.4.0. Both can be used
interchangeably, but when a tag is available, use
it.Now that all the required information has been
gathered, the Makefile can be written
(only GitHub-related lines are shown):PORTNAME= moneymanagerex
DISTVERSIONPREFIX= v
DISTVERSION= 1.3.0
USE_GITHUB= yes
GH_TUPLE= utelle:wxsqlite3:v3.4.0:wxsqlite3/lib/wxsqlite3 \
moneymanagerex:LuaGlue:c51d11a:lua_glue/3rd/LuaGlue \
moneymanagerex:html-template:cd434ee:html_template/3rd/cgitemplate \
cesanta:mongoose:2140e59:mongoose/3rd/mongoose \
[...]USE_GITLABSimilar to GitHub, if the distribution file comes from
gitlab.com
or is hosting the GitLab
software, these variables are available for use and might
need to be set.
USE_GITLAB DescriptionVariableDescriptionDefaultGL_SITESite name hosting the GitLab
projecthttps://gitlab.comGL_ACCOUNTAccount name of the GitLab
user hosting the project${PORTNAME}GL_PROJECTName of the project on GitLab${PORTNAME}GL_COMMITThe commit hash to download. Must be the full
160 bit, 40 character hex sha1 hash. This is a required
variable for GitLab.(none)GL_SUBDIRWhen the software needs an additional
distribution file to be extracted within
${WRKSRC}, this variable can be
used. See the examples in
for more information.(none)GL_TUPLEGL_TUPLE allows putting
GL_SITE,
GL_ACCOUNT,
GL_PROJECT,
GL_COMMIT, and
GL_SUBDIR into a single variable.
The format is
site:account:project:commit:group/subdir.
The site: and
/subdir
part is optional. It is helpful when there are more
than one GitLab project from
which to fetch.
Simple Use of USE_GITLABWhile trying to make a port for version
1.14 of libsignon-glib
from the accounts-sso user on gitlab.com, at , The
Makefile would end up looking like
this for fetching the distribution files:PORTNAME= libsignon-glib
DISTVERSION= 1.14
USE_GITLAB= yes
GL_ACCOUNT= accounts-sso
GL_COMMIT= e90302e342bfd27bc8c9132ab9d0ea3d8723fd03It will automatically have
MASTER_SITES set to gitlab.com
and WRKSRC to
${WRKDIR}/libsignon-glib-e90302e342bfd27bc8c9132ab9d0ea3d8723fd03-e90302e342bfd27bc8c9132ab9d0ea3d8723fd03.More Complete Use of
USE_GITLABA more complete use of the above if
port had no versioning and foobar
from the foo user on project bar on a self hosted GitLab
site https://gitlab.example.com, the Makefile
ends up looking like this for fetching distribution files:PORTNAME= foobar
DISTVERSION= g20170906
USE_GITLAB= yes
GL_SITE= https://gitlab.example.com
GL_ACCOUNT= foo
GL_PROJECT= bar
GL_COMMIT= 9c1669ce60c3f4f5eb43df874d7314483fb3f8a6It will have MASTER_SITES set to
"https://gitlab.example.com" and WRKSRC to
${WRKDIR}/bar-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6-9c1669ce60c3f4f5eb43df874d7314483fb3f8a6.20170906 is the date of the
commit referenced in GL_COMMIT, not
the date the Makefile is edited, or
the date the commit to the &os; ports tree is made.GL_SITE's protocol, port and
webroot can all be modified in the same variable.Fetching Multiple Files from GitLabThe USE_GITLAB framework also
supports fetching multiple distribution files from
different places from GitLab
and GitLab hosted sites. It
works in a way very similar to and .Multiple values are added to
GL_SITE,
GL_ACCOUNT,
GL_PROJECT and
GL_COMMIT. Each different value is
assigned a group.
.GL_TUPLE can also be used when there
are a lot of distribution files. It helps keep the site,
account, project, commit, and group information at the same
place.For each group, a
${WRKSRC_group}
helper variable is created, containing the directory into
which the file has been extracted. The
${WRKSRC_group}
variables can be used to move directories around during
post-extract, or add to
CONFIGURE_ARGS, or whatever is needed
so that the software builds correctly.The
:group part
must be used for only
one distribution file. It is used as a
unique key and using it more than once will overwrite the
previous values.As this is only syntactic sugar above
DISTFILES and
MASTER_SITES, the group names must
adhere to the restrictions on group names outlined in
When fetching multiple files using GitLab,
sometimes the default distribution file is not fetched from a GitLab
site. To disable fetching the default distribution, set:USE_GITLAB= nodefaultWhen using USE_GITLAB=nodefault,
the Makefile must set
DISTFILES in its
top block.
The definition should be:DISTFILES= ${DISTNAME}${EXTRACT_SUFX}Use of USE_GITLAB with Multiple
Distribution FilesFrom time to time, there is a need to fetch more
than one distribution file. For example, when the
upstream git repository uses submodules. This can be
done easily using groups in the
GL_*
variables:PORTNAME= foo
DISTVERSION= 1.0.2
USE_GITLAB= yes
GL_SITE= https://gitlab.example.com:9434/gitlab:icons
GL_ACCOUNT= bar:icons,contrib
GL_PROJECT= foo-icons:icons foo-contrib:contrib
GL_COMMIT= c189207a55da45305c884fe2b50e086fcad4724b ae7368cab1ca7ca754b38d49da064df87968ffe4:icons 9e4dd76ad9b38f33fdb417a4c01935958d5acd2a:contrib
GL_SUBDIR= ext/icons:icons
CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}This will fetch two distribution files from
gitlab.com and one from gitlab.example.com
hosting GitLab. The default one comes
from https://gitlab.com/foo/foo and commit is
c189207a55da45305c884fe2b50e086fcad4724b. The
second one, with the icons group, comes from
https://gitlab.example.com:9434/gitlab/bar/foo-icons
and commit is ae7368cab1ca7ca754b38d49da064df87968ffe4.
The third one comes from https://gitlab.com/bar/foo-contrib
and is commit 9e4dd76ad9b38f33fdb417a4c01935958d5acd2a.
The distribution files are named foo-foo-c189207a55da45305c884fe2b50e086fcad4724b_GL0.tar.gz,
bar-foo-icons-ae7368cab1ca7ca754b38d49da064df87968ffe4_GL0.tar.gz, and
bar-foo-contrib-9e4dd76ad9b38f33fdb417a4c01935958d5acd2a_GL0.tar.gz.All the distribution files are extracted in
${WRKDIR} in their respective
subdirectories. The default file is still extracted in
${WRKSRC}, in this case,
${WRKDIR}/foo-c189207a55da45305c884fe2b50e086fcad4724b-c189207a55da45305c884fe2b50e086fcad4724b.
Each additional distribution file is extracted in
${WRKSRC_group}.
Here, for the icons group, it is called
${WRKSRC_icons} and it contains
${WRKDIR}/foo-icons-ae7368cab1ca7ca754b38d49da064df87968ffe4-ae7368cab1ca7ca754b38d49da064df87968ffe4.
The file with the contrib group is
called ${WRKSRC_contrib} and contains
${WRKDIR}/foo-contrib-9e4dd76ad9b38f33fdb417a4c01935958d5acd2a-9e4dd76ad9b38f33fdb417a4c01935958d5acd2a.The software's build system expects to find the icons
in a ext/icons subdirectory in its
sources, so GL_SUBDIR is used.
GL_SUBDIR makes sure that
ext exists, but that
ext/icons does not already exist.
Then it does this:post-extract:
@${MV} ${WRKSRC_icons} ${WRKSRC}/ext/iconsUse of USE_GITLAB with Multiple
Distribution Files Using
GL_TUPLEThis is functionally equivalent to , but
using GL_TUPLE:PORTNAME= foo
DISTVERSION= 1.0.2
USE_GITLAB= yes
GL_COMMIT= c189207a55da45305c884fe2b50e086fcad4724b
GL_TUPLE= https://gitlab.example.com:9434/gitlab:bar:foo-icons:ae7368cab1ca7ca754b38d49da064df87968ffe4:icons/ext/icons \
bar:foo-contrib:9e4dd76ad9b38f33fdb417a4c01935958d5acd2a:contrib
CONFIGURE_ARGS= --with-contrib=${WRKSRC_contrib}Grouping was used in the previous example with
bar:icons,contrib. Some redundant
information is present with GL_TUPLE
because grouping is not possible.EXTRACT_SUFXIf there is one distribution file, and it uses an odd
suffix to indicate the compression mechanism, set
EXTRACT_SUFX.For example, if the distribution file was named
foo.tar.gzip instead of the more normal
foo.tar.gz, write:DISTNAME= foo
EXTRACT_SUFX= .tar.gzipThe
USES=tar[:xxx],
USES=lha or USES=zip
automatically set EXTRACT_SUFX to the most
common archives extensions as necessary, see for more details. If neither of
these are set then EXTRACT_SUFX defaults to
.tar.gz.As EXTRACT_SUFX is only used in
DISTFILES, only set one of them..DISTFILESSometimes the names of the files to be downloaded have no
resemblance to the name of the port. For example, it might be
called source.tar.gz or similar. In
other cases the application's source code might be in several
different archives, all of which must be downloaded.If this is the case, set DISTFILES to
be a space separated list of all the files that must be
downloaded.DISTFILES= source1.tar.gz source2.tar.gzIf not explicitly set, DISTFILES
defaults to
${DISTNAME}${EXTRACT_SUFX}.EXTRACT_ONLYIf only some of the DISTFILES must be
extracted—for example, one of them is the source code,
while another is an uncompressed document—list the
filenames that must be extracted in
EXTRACT_ONLY.DISTFILES= source.tar.gz manual.html
EXTRACT_ONLY= source.tar.gzWhen none of the DISTFILES need to be
uncompressed, set EXTRACT_ONLY to the empty
string.EXTRACT_ONLY=PATCHFILESIf the 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
(that is, WRKSRC) 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
.Z, .gz,
.bz2 or .xz.If the patch is distributed with some other files, such as
documentation, in a compressed tarball, using
PATCHFILES is not possible. If that is the
case, add the name and the location of the patch tarball to
DISTFILES and
MASTER_SITES. Then, use
EXTRA_PATCHES to point to those
files and bsd.port.mk will automatically
apply them. In particular, do
not copy patch files into
${PATCHDIR}. That directory may
not be writable.If there are multiple patches and they need mixed values
for the strip parameter, it can be added alongside the patch
name in PATCHFILES, e.g:PATCHFILES= patch1 patch2:-p1This does not conflict with the master site grouping
feature, adding a group also works:PATCHFILES= patch2:-p1:source2The 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 compressed tarball. Take extra
care not to overwrite something that already exists in that
directory if extracting it manually. Also, do not forget to
add a command to remove the copied patch in the
pre-clean target.Multiple Distribution or Patches Files from Multiple
Locations(Consider this to be a somewhat
advanced topic; those new to this document
may wish to skip this section at first).This section has information on the fetching mechanism
known as both MASTER_SITES:n and
MASTER_SITES_NN. We will refer to this
mechanism as MASTER_SITES:n.A little background first. OpenBSD has a neat feature
inside DISTFILES and
PATCHFILES which allows files and
patches to be postfixed with :n
identifiers. Here, n can be any word
containing [0-9a-zA-Z_] and denote a group
designation. For example:DISTFILES= alpha:0 beta:1In OpenBSD, distribution file alpha
will be associated with variable
MASTER_SITES0 instead of our common
MASTER_SITES and
beta with
MASTER_SITES1.This is a very interesting feature which can decrease
that endless search for the correct download site.Just picture 2 files in DISTFILES and
20 sites in MASTER_SITES, the sites slow as
hell where beta is carried by all sites
in MASTER_SITES, and
alpha can only be found in the 20th site.
It would be such a waste to check all of them if the
maintainer knew this beforehand, would it not? Not a good
start for that lovely weekend!Now that you have the idea, just imagine more
DISTFILES and more
MASTER_SITES. Surely our
distfiles survey meister would appreciate the
relief to network strain that this would bring.In the next sections, information will follow on the
&os; implementation of this idea. We improved a bit on
OpenBSD's concept.The group names cannot have dashes in them
(-), in fact, they cannot have any
characters out of the [a-zA-Z0-9_] range.
This is because, while &man.make.1; is ok with variable
names containing dashes, &man.sh.1; is not.Simplified InformationThis section explains how to quickly prepare fine
grained fetching of multiple distribution files and patches
from different sites and subdirectories. We describe here a
case of simplified MASTER_SITES:n usage.
This will be sufficient for most scenarios. More detailed
information are available in .Some applications consist of multiple distribution files
that must be downloaded from a number of different sites.
For example, Ghostscript consists
of the core of the program, and then a large number of
driver files that are used depending on the user's printer.
Some of these driver files are supplied with the core, but
many others must be downloaded from a variety of different
sites.To support this, each entry in
DISTFILES may be followed by a colon and
a group name. Each site listed in
MASTER_SITES is then followed by a colon,
and the group that indicates which distribution files are
downloaded from this site.For example, consider an application with the source
split in two parts, source1.tar.gz and
source2.tar.gz, which must be
downloaded from two different sites. The port's
Makefile would include lines like .Simplified Use of MASTER_SITES:n
with One File Per SiteMASTER_SITES= ftp://ftp1.example.com/:source1 \
http://www.example.com/:source2
DISTFILES= source1.tar.gz:source1 \
source2.tar.gz:source2Multiple distribution files can have the same group.
Continuing the previous example, suppose that there was a
third distfile, source3.tar.gz, that
is downloaded from
ftp.example2.com. The
Makefile would then be written like
.Simplified Use of MASTER_SITES:n
with More Than One File Per SiteMASTER_SITES= ftp://ftp.example.com/:source1 \
http://www.example.com/:source2
DISTFILES= source1.tar.gz:source1 \
source2.tar.gz:source2 \
source3.tar.gz:source2Detailed InformationOkay, so the previous example did not reflect the new
port's needs? In this section we will explain in detail how
the fine grained fetching mechanism
MASTER_SITES:n works and how it can
be used.Elements can be postfixed with
:n where
n is
[^:,]+, that is,
n could conceptually be any
alphanumeric string but we will limit it to
[a-zA-Z_][0-9a-zA-Z_]+ for
now.Moreover, string matching is case sensitive; that
is, n is different from
N.However, these words cannot be used for
postfixing purposes since they yield special meaning:
default, all and
ALL (they are used internally in
item ).
Furthermore, DEFAULT is a special
purpose word (check item ).Elements postfixed with :n
belong to the group n,
:m belong to group
m and so forth.Elements without a postfix are groupless, they
all belong to the special group
DEFAULT. Any elements postfixed
with DEFAULT, is just being
redundant unless an element belongs
to both DEFAULT and other groups at
the same time (check item ).These examples are equivalent but the first
one is preferred:MASTER_SITES= alphaMASTER_SITES= alpha:DEFAULTGroups are not exclusive, an element may belong to
several different groups at the same time and a group
can either have either several different elements or
none at all.When an element belongs to several groups
at the same time, use the comma operator
(,).Instead of repeating it several times, each time
with a different postfix, we can list several groups at
once in a single postfix. For instance,
:m,n,o marks an element that belongs
to group m, n and
o.All these examples are equivalent but the
last one is preferred:MASTER_SITES= alpha alpha:SOME_SITEMASTER_SITES= alpha:DEFAULT alpha:SOME_SITEMASTER_SITES= alpha:SOME_SITE,DEFAULTMASTER_SITES= alpha:DEFAULT,SOME_SITEAll sites within a given group are sorted according
to MASTER_SORT_AWK. All groups
within MASTER_SITES and
PATCH_SITES are sorted as
well.Group semantics can be used in any of the
variables MASTER_SITES,
PATCH_SITES,
MASTER_SITE_SUBDIR,
PATCH_SITE_SUBDIR,
DISTFILES, and
PATCHFILES according to this
syntax:All MASTER_SITES,
PATCH_SITES,
MASTER_SITE_SUBDIR and
PATCH_SITE_SUBDIR elements must
be terminated with the forward slash
/ character. If any elements
belong to any groups, the group postfix
:n
must come right after the terminator
/. The
MASTER_SITES:n mechanism relies
on the existence of the terminator
/ to avoid confusing elements
where a :n is a valid part of the
element with occurrences where :n
denotes group n. For
compatibility purposes, since the
/ terminator was not required
before in both MASTER_SITE_SUBDIR
and PATCH_SITE_SUBDIR elements,
if the postfix immediate preceding character is not
a / then :n
will be considered a valid part of the element
instead of a group postfix even if an element is
postfixed with :n. See both
and .Detailed Use of
MASTER_SITES:n in
MASTER_SITE_SUBDIRMASTER_SITE_SUBDIR= old:n new/:NEWDirectories within group
DEFAULT ->
old:nDirectories within group
NEW -> newDetailed Use of
MASTER_SITES:n with Comma
Operator, Multiple Files, Multiple Sites and
Multiple SubdirectoriesMASTER_SITES= http://site1/%SUBDIR%/ http://site2/:DEFAULT \
http://site3/:group3 http://site4/:group4 \
http://site5/:group5 http://site6/:group6 \
http://site7/:DEFAULT,group6 \
http://site8/%SUBDIR%/:group6,group7 \
http://site9/:group8
DISTFILES= file1 file2:DEFAULT file3:group3 \
file4:group4,group5,group6 file5:grouping \
file6:group7
MASTER_SITE_SUBDIR= directory-trial:1 directory-n/:groupn \
directory-one/:group6,DEFAULT \
directoryThe previous example results in this
fine grained fetching. Sites are listed in the
exact order they will be used.file1 will be
fetched fromMASTER_SITE_OVERRIDEhttp://site1/directory-trial:1/http://site1/directory-one/http://site1/directory/http://site2/http://site7/MASTER_SITE_BACKUPfile2 will be fetched
exactly as file1 since
they both belong to the same groupMASTER_SITE_OVERRIDEhttp://site1/directory-trial:1/http://site1/directory-one/http://site1/directory/http://site2/http://site7/MASTER_SITE_BACKUPfile3 will be fetched
fromMASTER_SITE_OVERRIDEhttp://site3/MASTER_SITE_BACKUPfile4 will be
fetched fromMASTER_SITE_OVERRIDEhttp://site4/http://site5/http://site6/http://site7/http://site8/directory-one/MASTER_SITE_BACKUPfile5 will be fetched
fromMASTER_SITE_OVERRIDEMASTER_SITE_BACKUPfile6 will be fetched
fromMASTER_SITE_OVERRIDEhttp://site8/MASTER_SITE_BACKUPHow do I group one of the special macros from
bsd.sites.mk, for example,
SourceForge (SF)?This has been simplified as much as possible. See
.Detailed Use of MASTER_SITES:n
with SourceForge (SF)MASTER_SITES= http://site1/ SF/something/1.0:sourceforge,TEST
DISTFILES= something.tar.gz:sourceforgesomething.tar.gz will be
fetched from all sites within SourceForge.How do I use this with
PATCH*?All examples were done with
MASTER*
but they work exactly the same for
PATCH*
ones as can be seen in .Simplified Use of
MASTER_SITES:n with
PATCH_SITESPATCH_SITES= http://site1/ http://site2/:test
PATCHFILES= patch1:testWhat Does Change for Ports? What Does Not?All current ports remain the same. The
MASTER_SITES:n feature code is only
activated if there are elements postfixed with
:n like
elements according to the aforementioned syntax rules,
especially as shown in item .The port targets remain the same:
checksum,
makesum,
patch,
configure,
build, etc. With the obvious
exceptions of do-fetch,
fetch-list,
master-sites and
patch-sites.do-fetch: deploys
the new grouping postfixed
DISTFILES and
PATCHFILES with their matching
group elements within both
MASTER_SITES and
PATCH_SITES which use matching
group elements within both
MASTER_SITE_SUBDIR and
PATCH_SITE_SUBDIR. Check .fetch-list: works
like old fetch-list with
the exception that it groups just like
do-fetch.master-sites and
patch-sites:
(incompatible with older versions) only return the
elements of group DEFAULT; in
fact, they execute targets
master-sites-default and
patch-sites-default
respectively.Furthermore, using target either
master-sites-all or
patch-sites-all is
preferred to directly checking either
MASTER_SITES or
PATCH_SITES. Also,
directly checking is not guaranteed to work in any
future versions. Check item
for more information on these new port
targets.New port targetsThere are
master-sites-n
and
patch-sites-n
targets which will list the elements of the
respective group n
within MASTER_SITES and
PATCH_SITES respectively. For
instance, both
master-sites-DEFAULT
and patch-sites-DEFAULT
will return the elements of group
DEFAULT,
master-sites-test and
patch-sites-test of
group test, and thereon.There are new targets
master-sites-all and
patch-sites-all which do
the work of the old
master-sites and
patch-sites ones. They
return the elements of all groups as if they all
belonged to the same group with the caveat that it
lists as many MASTER_SITE_BACKUP
and MASTER_SITE_OVERRIDE as there
are groups defined within either
DISTFILES or
PATCHFILES; respectively for
master-sites-all and
patch-sites-all.DIST_SUBDIRDo not let the port clutter
/usr/ports/distfiles. If the port
requires a lot of files to be fetched, or contains a file that
has a name that might conflict with other ports (for example,
Makefile), set
DIST_SUBDIR to the name of the port
(${PORTNAME} or
${PKGNAMEPREFIX}${PORTNAME} are
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 the port into
that subdirectory.It will also look at the subdirectory with the same name
on the backup master site at http://distcache.FreeBSD.org
(Setting
DISTDIR explicitly in
Makefile will not accomplish this, so
please use DIST_SUBDIR.)This does not affect
MASTER_SITES defined in the
Makefile.MAINTAINERSet your mail-address here. Please.
:-)Only a single address without the comment part is
allowed as a MAINTAINER value. The format
used is user@hostname.domain. Please
do not include any descriptive text such as a real name in
this entry. That merely confuses the Ports infrastructure
and most tools using it.The maintainer is responsible for keeping the port up to
date and making sure that it works correctly. For a detailed
description of the responsibilities of a port maintainer, refer
to The
challenge for port maintainers.A maintainer volunteers to keep a port in good working
order. Maintainers have the primary responsibility for their
ports, but not exclusive ownership. Ports exist for the
benefit of the community and, in reality, belong to the
community. What this means is that people other than the
maintainer can make changes to a port. Large changes to the
Ports Collection might require changes to many ports. The
&os; Ports Management Team or members of other teams might
modify ports to fix dependency issues or other problems, like
a version bump for a shared library update.Some types of fixes have blanket approval
from the &a.portmgr;, allowing any committer to fix those
categories of problems on any port. These fixes do not need
- approval from the maintainer. Blanket approval does not apply
- to ports that are maintained by teams like autotools@FreeBSD.org, x11@FreeBSD.org, gnome@FreeBSD.org, or kde@FreeBSD.org. These teams use
- external repositories and can have work that would conflict
- with changes that would normally fall under blanket
- approval.
+ approval from the maintainer.
Blanket approval for most ports applies to fixes like
infrastructure changes, or trivial and
tested build and runtime fixes. The
current list is available in Ports
section of the Committer's Guide.Other changes to the port will be sent to the maintainer
for review and approval before being committed. If the
maintainer does not respond to an update request after two weeks
(excluding major public holidays), then that is considered a
maintainer timeout, and the update can be made without explicit
maintainer approval. If the maintainer does not respond within
three months, or if there have been three consecutive timeouts,
then that maintainer is considered absent without
leave, and all of their ports can be assigned back to the pool.
Exceptions to this are anything maintained by
the &a.portmgr;, or the &a.security-officer;. No unauthorized
commits may ever be made to ports maintained by those
groups.We reserve the right to modify the maintainer's submission
to better match existing policies and style of the Ports
Collection without explicit blessing from the submitter or the
maintainer. Also,
large infrastructural changes can result in a port being
modified without the maintainer's consent. These kinds of
changes will never affect the port's functionality.The &a.portmgr; reserves the right to revoke or override
anyone's maintainership for any reason, and the
&a.security-officer; reserves the right to revoke or override
maintainership for security reasons.COMMENTThe comment is a one-line description of a port shown by
pkg info. Please follow these rules when
composing it:The COMMENT string should be 70 characters or
less.Do not include the package name or
version number of software.The comment must begin with a capital and end without
a period.Do not start with an indefinite article (that is, A or
An).Capitalize names such as Apache, JavaScript, or
Perl.Use a serial comma for lists of words: "green,
red, and blue."Check for spelling errors.Here is an example:COMMENT= Cat chasing a mouse all over the screenThe COMMENT variable immediately follows the
MAINTAINER variable in the Makefile.LicensesEach port must document the license under which it is
available. If it is not an OSI approved license it must also
document any restrictions on redistribution.LICENSEA short name for the license or licenses if more than one
license apply.If it is one of the licenses listed in , only
LICENSE_FILE and
LICENSE_DISTFILES variables can be
set.If this is a license that has not been defined in the
ports framework (see ),
the LICENSE_PERMS and
LICENSE_NAME must be set, along with either
LICENSE_FILE or
LICENSE_TEXT.
LICENSE_DISTFILES and
LICENSE_GROUPS can also be set, but are not
required.The predefined licenses are shown in
. The current list is
always available in
Mk/bsd.licenses.db.mk.Simplest Usage, Predefined LicensesWhen the README of some software
says This software is under the terms of the GNU
Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or
(at your option) any later version. but does not
provide the license file, use this:LICENSE= LGPL21+When the software provides the license file, use
this:LICENSE= LGPL21+
LICENSE_FILE= ${WRKSRC}/COPYINGFor the predefined licenses, the default permissions are
dist-mirror dist-sell pkg-mirror pkg-sell
auto-accept.
Predefined License ListShort NameNameGroupPermissionsAGPLv3GNU Affero General Public License version
3FSFGPLOSI(default)AGPLv3+GNU Affero General Public License version 3 (or
later)FSFGPLOSI(default)APACHE10Apache License 1.0FSF(default)APACHE11Apache License 1.1FSFOSI(default)APACHE20Apache License 2.0FSFOSI(default)ART10Artistic License version 1.0OSI(default)ART20Artistic License version 2.0FSFGPLOSI(default)ARTPERL10Artistic License (perl) version 1.0OSI(default)BSDBSD license Generic Version (deprecated)FSFOSICOPYFREE(default)BSD2CLAUSEBSD 2-clause "Simplified" LicenseFSFOSICOPYFREE(default)BSD3CLAUSEBSD 3-clause "New" or "Revised" LicenseFSFOSICOPYFREE(default)BSD4CLAUSEBSD 4-clause "Original" or "Old" LicenseFSF(default)BSLBoost Software LicenseFSFOSICOPYFREE(default)CC-BY-1.0Creative Commons Attribution 1.0(default)CC-BY-2.0Creative Commons Attribution 2.0(default)CC-BY-2.5Creative Commons Attribution 2.5(default)CC-BY-3.0Creative Commons Attribution 3.0(default)CC-BY-4.0Creative Commons Attribution 4.0(default)CC-BY-NC-1.0Creative Commons Attribution Non Commercial
1.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-2.0Creative Commons Attribution Non Commercial
2.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-2.5Creative Commons Attribution Non Commercial
2.5dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-3.0Creative Commons Attribution Non Commercial
3.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-4.0Creative Commons Attribution Non Commercial
4.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-ND-1.0Creative Commons Attribution Non Commercial No
Derivatives 1.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-ND-2.0Creative Commons Attribution Non Commercial No
Derivatives 2.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-ND-2.5Creative Commons Attribution Non Commercial No
Derivatives 2.5dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-ND-3.0Creative Commons Attribution Non Commercial No
Derivatives 3.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-ND-4.0Creative Commons Attribution Non Commercial No
Derivatives 4.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-SA-1.0Creative Commons Attribution Non Commercial Share
Alike 1.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-SA-2.0Creative Commons Attribution Non Commercial Share
Alike 2.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-SA-2.5Creative Commons Attribution Non Commercial Share
Alike 2.5dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-SA-3.0Creative Commons Attribution Non Commercial Share
Alike 3.0dist-mirrorpkg-mirrorauto-acceptCC-BY-NC-SA-4.0Creative Commons Attribution Non Commercial Share
Alike 4.0dist-mirrorpkg-mirrorauto-acceptCC-BY-ND-1.0Creative Commons Attribution No Derivatives
1.0(default)CC-BY-ND-2.0Creative Commons Attribution No Derivatives
2.0(default)CC-BY-ND-2.5Creative Commons Attribution No Derivatives
2.5(default)CC-BY-ND-3.0Creative Commons Attribution No Derivatives
3.0(default)CC-BY-ND-4.0Creative Commons Attribution No Derivatives
4.0(default)CC-BY-SA-1.0Creative Commons Attribution Share Alike
1.0(default)CC-BY-SA-2.0Creative Commons Attribution Share Alike
2.0(default)CC-BY-SA-2.5Creative Commons Attribution Share Alike
2.5(default)CC-BY-SA-3.0Creative Commons Attribution Share Alike
3.0(default)CC-BY-SA-4.0Creative Commons Attribution Share Alike
4.0(default)CC0-1.0Creative Commons Zero v1.0 UniversalFSFGPLCOPYFREE(default)CDDLCommon Development and Distribution
LicenseFSFOSI(default)CPAL-1.0Common Public Attribution LicenseFSFOSI(default)ClArtisticClarified Artistic LicenseFSFGPLOSI(default)EPLEclipse Public LicenseFSFOSI(default)GFDLGNU Free Documentation LicenseFSF(default)GMGPLGNAT Modified General Public LicenseFSFGPLOSI(default)GPLv1GNU General Public License version 1FSFGPLOSI(default)GPLv1+GNU General Public License version 1 (or
later)FSFGPLOSI(default)GPLv2GNU General Public License version 2FSFGPLOSI(default)GPLv2+GNU General Public License version 2 (or
later)FSFGPLOSI(default)GPLv3GNU General Public License version 3FSFGPLOSI(default)GPLv3+GNU General Public License version 3 (or
later)FSFGPLOSI(default)GPLv3RLEGNU GPL version 3 Runtime Library
ExceptionFSFGPLOSI(default)GPLv3RLE+GNU GPL version 3 Runtime Library Exception (or
later)FSFGPLOSI(default)ISCLInternet Systems Consortium LicenseFSFGPLOSICOPYFREE(default)LGPL20GNU Library General Public License version
2.0FSFGPLOSI(default)LGPL20+GNU Library General Public License version 2.0
(or later)FSFGPLOSI(default)LGPL21GNU Lesser General Public License version
2.1FSFGPLOSI(default)LGPL21+GNU Lesser General Public License version 2.1 (or
later)FSFGPLOSI(default)LGPL3GNU Lesser General Public License version
3FSFGPLOSI(default)LGPL3+GNU Lesser General Public License version 3 (or
later)FSFGPLOSI(default)LPPL10LaTeX Project Public License version 1.0FSFOSIdist-mirrordist-sellLPPL11LaTeX Project Public License version 1.1FSFOSIdist-mirrordist-sellLPPL12LaTeX Project Public License version 1.2FSFOSIdist-mirrordist-sellLPPL13LaTeX Project Public License version 1.3FSFOSIdist-mirrordist-sellLPPL13aLaTeX Project Public License version 1.3aFSFOSIdist-mirrordist-sellLPPL13bLaTeX Project Public License version 1.3bFSFOSIdist-mirrordist-sellLPPL13cLaTeX Project Public License version 1.3cFSFOSIdist-mirrordist-sellMITMIT license / X11 licenseCOPYFREEFSFGPLOSI(default)MPL10Mozilla Public License version 1.0FSFOSI(default)MPL11Mozilla Public License version 1.1FSFOSI(default)MPL20Mozilla Public License version 2.0FSFOSI(default)NCSAUniversity of Illinois/NCSA Open Source
LicenseCOPYFREEFSFGPLOSI(default)NONENo license specifiednoneOFL10SIL Open Font License version 1.0
(http://scripts.sil.org/OFL)FONTS(default)OFL11SIL Open Font License version 1.1
(http://scripts.sil.org/OFL)FONTS(default)OWLOpen Works License (owl.apotheon.org)COPYFREE(default)OpenSSLOpenSSL LicenseFSF(default)PDPublic DomainGPLCOPYFREE(default)PHP202PHP License version 2.02FSFOSI(default)PHP30PHP License version 3.0FSFOSI(default)PHP301PHP License version 3.01FSFOSI(default)PSFLPython Software Foundation LicenseFSFGPLOSI(default)PostgreSQLPostgreSQL LicenceFSFGPLOSICOPYFREE(default)RUBYRuby LicenseFSF(default)UNLICENSEThe UnlicenseCOPYFREEFSFGPL(default)WTFPLDo What the Fuck You Want To Public License
version 2GPLFSFCOPYFREE(default)WTFPL1Do What the Fuck You Want To Public License
version 1GPLFSFCOPYFREE(default)ZLIBzlib LicenseGPLFSFOSI(default)ZPL21Zope Public License version 2.1GPLOSI(default)
LICENSE_PERMS and
LICENSE_PERMS_NAMEPermissions. use none if empty.License Permissions Listdist-mirrorRedistribution of the distribution files is
permitted. The distribution files will be added to the
&os; MASTER_SITE_BACKUP
CDN.no-dist-mirrorRedistribution of the distribution files is
prohibited. This is equivalent to setting RESTRICTED.
The distribution files will not be
added to the &os; MASTER_SITE_BACKUP
CDN.dist-sellSelling of distribution files is permitted. The
distribution files will be present on the installer
images.no-dist-sellSelling of distribution files is prohibited. This
is equivalent to setting NO_CDROM.pkg-mirrorFree redistribution of package is permitted. The
package will be distributed on the &os; package
CDN https://pkg.freebsd.org/.no-pkg-mirrorFree redistribution of package is prohibited.
Equivalent to setting NO_PACKAGE.
The package will not be distributed
from the &os; package
CDN https://pkg.freebsd.org/.pkg-sellSelling of package is permitted. The package will
be present on the installer images.no-pkg-sellSelling of package is prohibited. This is
equivalent to setting NO_CDROM.
The package will not be present on
the installer images.auto-acceptLicense is accepted by default. Prompts to accept a
license are not displayed unless the user has defined
LICENSES_ASK. Use this unless the
license states the user must accept the terms of the
license.no-auto-acceptLicense is not accepted by default. The user will
always be asked to confirm the acceptance of this
license. This must be used if the license states that
the user must accept its terms.When both
permission and
no-permission is
present the
no-permission
will cancel
permission.When
permission is
not present, it is considered to be a
no-permission.Some missing permissions will prevent a port (and all
ports depending on it) from being usable by package
users:A port without the auto-accept
permission will never be be built and all the ports
depending on it will be ignored.A port without the pkg-mirror
permission will be removed, as well as all the ports
depending on it, after the build and they will ever end up
being distributed.Nonstandard LicenseRead the terms of the license and translate those using
the available permissions.LICENSE= UNKNOWN
LICENSE_NAME= unknown
LICENSE_TEXT= This program is NOT in public domain.\
It can be freely distributed for non-commercial purposes only.
LICENSE_PERMS= dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-acceptStandard and Nonstandard LicensesRead the terms of the license and express those using
the available permissions. In case of doubt, please ask for
guidance on the &a.ports;.LICENSE= WARSOW GPLv2
LICENSE_COMB= multi
LICENSE_NAME_WARSOW= Warsow Content License
LICENSE_FILE_WARSOW= ${WRKSRC}/docs/license.txt
LICENSE_PERMS_WARSOW= dist-mirror pkg-mirror auto-acceptWhen the permissions of the GPLv2 and the UNKNOWN
licenses are mixed, the port ends up with
dist-mirror dist-sell pkg-mirror pkg-sell
auto-accept dist-mirror no-dist-sell pkg-mirror
no-pkg-sell auto-accept. The
no-permissions
cancel the permissions. The
resulting list of permissions are dist-mirror
pkg-mirror auto-accept. The distribution
files and the packages will not be available on the
installer images.LICENSE_GROUPS and
LICENSE_GROUPS_NAMEGroups the license belongs.Predefined License Groups ListFSFFree Software Foundation Approved, see the FSF
Licensing & Compliance Team.GPLGPL CompatibleOSIOSI Approved, see the Open Source Initiative Open
Source Licenses page.COPYFREEComply with Copyfree Standard Definition, see the
Copyfree
Licenses page.FONTSFont licensesLICENSE_NAME and
LICENSE_NAME_NAMEFull name of the license.LICENSE_NAMELICENSE= UNRAR
LICENSE_NAME= UnRAR License
LICENSE_FILE= ${WRKSRC}/license.txt
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-acceptLICENSE_FILE and
LICENSE_FILE_NAMEFull path to the file containing the license text, usually
${WRKSRC}/some/file. If the file is not
in the distfile, and its content is too long to be put in
LICENSE_TEXT,
put it in a new file in
${FILESDIR}.LICENSE_FILELICENSE= GPLv3+
LICENSE_FILE= ${WRKSRC}/COPYINGLICENSE_TEXT and
LICENSE_TEXT_NAMEText to use as a license. Useful when the license is not
in the distribution files and its text is short.LICENSE_TEXTLICENSE= UNKNOWN
LICENSE_NAME= unknown
LICENSE_TEXT= This program is NOT in public domain.\
It can be freely distributed for non-commercial purposes only,\
and THERE IS NO WARRANTY FOR THIS PROGRAM.
LICENSE_PERMS= dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-acceptLICENSE_DISTFILES and
LICENSE_DISTFILES_NAMEThe distribution files to which the licenses apply.
Defaults to all the distribution files.LICENSE_DISTFILESUsed when the distribution files do not all have the
same license. For example, one has a code license, and
another has some artwork that cannot be
redistributed:MASTER_SITES= SF/some-game
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} artwork.zip
LICENSE= BSD3CLAUSE ARTWORK
LICENSE_COMB= dual
LICENSE_NAME_ARTWORK= The game artwork license
LICENSE_TEXT_ARTWORK= The README says that the files cannot be redistributed
LICENSE_PERMS_ARTWORK= pkg-mirror pkg-sell auto-accept
LICENSE_DISTFILES_BSD3CLAUSE= ${DISTNAME}${EXTRACT_SUFX}
LICENSE_DISTFILES_ARTWORK= artwork.zipLICENSE_COMBSet to multi if all licenses apply.
Set to dual if any license applies.
Defaults to single.Dual LicensesWhen a port says This software may be distributed
under the GNU General Public License or the Artistic
License, it means that either license can be used.
Use this:LICENSE= ART10 GPLv1
LICENSE_COMB= dualIf license files are provided, use this:LICENSE= ART10 GPLv1
LICENSE_COMB= dual
LICENSE_FILE_ART10= ${WRKSRC}/Artistic
LICENSE_FILE_GPLv1= ${WRKSRC}/CopyingMultiple LicensesWhen part of a port has one license, and another part
has a different license, use
multi:LICENSE= GPLv2 LGPL21+
LICENSE_COMB= multiPORTSCOUTPortscout is an automated
distfile check utility for the &os; Ports Collection,
described in detail in .PORTSCOUT defines special
conditions within which the Portscout
distfile scanner is restricted.Situations where PORTSCOUT
is set include:When distfiles have to be ignored, whether for specific
versions, or specific minor revisions. For example, to
exclude version 8.2 from distfile
version checks because it is known to be broken, add:PORTSCOUT= ignore:8.2When specific versions or specific major and minor
revisions of a distfile must be checked. For example, if
only version 0.6.4 must be
monitored because newer versions have compatibility issues
with &os;, add:PORTSCOUT= limit:^0\.6\.4When URLs listing the available versions differ from the
download URLs. For example, to limit distfile version
checks to the download page for the
databases/pgtune port,
add:PORTSCOUT= site:http://pgfoundry.org/frs/?group_id=1000416DependenciesMany ports depend on other ports. This is a very convenient
feature of most Unix-like operating systems, including &os;.
Multiple ports can share a common dependency, rather than
bundling that dependency with every port or package that needs
it. There are seven variables that can be used 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_DEPENDSThis variable specifies the shared libraries this port
depends on. It is a list of
lib:dir
tuples where lib is the name of
the shared library, dir is the
directory in which to find it in case it is not available.
For example,LIB_DEPENDS= libjpeg.so:graphics/jpegwill check for a shared jpeg library with any version, and
descend into the graphics/jpeg
subdirectory of the ports tree to build and install it if it
is not found.The dependency is checked twice, once from within the
build target and then from within
the install target. Also, the name
of the dependency is put into the package so that
pkg install (see &man.pkg-install.8;) will
automatically install it if it is not on the user's
system.RUN_DEPENDSThis 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, dir is the
directory in which to find it in case it is not available, and
target is the target to call in
that directory. If path starts
with a slash (/), it is treated as a file
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 search path.For example,RUN_DEPENDS= ${LOCALBASE}/news/bin/innd:news/inn \
xmlcatmgr:textproc/xmlcatmgrwill check if the file or directory
/usr/local/news/bin/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 xmlcatmgr
is in the search path, and descend into
textproc/xmlcatmgr
to build and install it if it is not found.In this case, innd is actually an
executable; if an executable is in a place that is not
expected to be in the search path, use the full
pathname.The official search PATH used on the
ports build cluster is/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/binThe dependency is checked from within the
install target. Also, the name of
the dependency is put into the package so that
pkg install (see &man.pkg-install.8;) will
automatically install it if it is not on the user's system.
The target part can be omitted if
it is the same as DEPENDS_TARGET.A quite common situation is when
RUN_DEPENDS is literally the same as
BUILD_DEPENDS, especially if ported
software is written in a scripted language or if it requires
the same build and run-time environment. In this case, it is
both tempting and intuitive to directly assign one to the
other:RUN_DEPENDS= ${BUILD_DEPENDS}However, such assignment can pollute run-time
dependencies with entries not defined in the port's original
BUILD_DEPENDS. This happens because of
&man.make.1;'s lazy evaluation of variable assignment.
Consider a Makefile with
USE_*,
which are processed by ports/Mk/bsd.*.mk
to augment initial build dependencies. For example,
USES= gmake adds
devel/gmake to
BUILD_DEPENDS. To prevent such additional
dependencies from polluting RUN_DEPENDS,
create another variable with the current content of
BUILD_DEPENDS and assign it to both
BUILD_DEPENDS and
RUN_DEPENDS:MY_DEPENDS= some:devel/some \
other:lang/other
BUILD_DEPENDS= ${MY_DEPENDS}
RUN_DEPENDS= ${MY_DEPENDS}Do not use :=
to assign BUILD_DEPENDS to
RUN_DEPENDS or vice-versa. All
variables are expanded immediately, which is exactly the
wrong thing to do and almost always a failure.BUILD_DEPENDSThis 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:archivers/unzipwill check for an executable called
unzip, and descend into the
archivers/unzip subdirectory of the
ports tree to build and install it if it is not found.build here means everything from
extraction to compilation. The dependency is checked from
within the extract target. The
target part can be omitted if it
is the same as DEPENDS_TARGETFETCH_DEPENDSThis variable specifies executables or files this port
requires to fetch. Like the previous two, it is a list of
path:dir:target
tuples. For example,FETCH_DEPENDS= ncftp2:net/ncftp2will check for an executable called
ncftp2, and descend into the
net/ncftp2 subdirectory of the ports
tree to build and install it if it is not found.The dependency is checked from within the
fetch target. The
target part can be omitted if it is
the same as DEPENDS_TARGET.EXTRACT_DEPENDSThis variable specifies executables or files this port
requires for extraction. Like the previous, it is a list of
path:dir:target
tuples. For example,EXTRACT_DEPENDS= unzip:archivers/unzipwill check for an executable called
unzip, and descend into the
archivers/unzip subdirectory of the
ports tree to build and install it if it is not found.The dependency is checked from within the
extract target. The
target part can be omitted if it
is the same as DEPENDS_TARGET.Use this variable only if the extraction does not
already work (the default assumes tar)
and cannot be made to work using
USES=tar, USES=lha or
USES=zip described in .PATCH_DEPENDSThis variable specifies executables or files this port
requires to patch. Like the previous, it is a list of
path:dir:target
tuples. For example,PATCH_DEPENDS= ${NONEXISTENT}:java/jfc:extractwill descend into the java/jfc
subdirectory of the ports tree to extract it.The dependency is checked from within the
patch target. The
target part can be omitted if it
is the same as DEPENDS_TARGET.USESParameters can be added to define different features and
dependencies used by the port. They are specified by adding
this line to the Makefile:USES= feature[:arguments]For the complete list of values, please see
.USES cannot be assigned after
inclusion of bsd.port.pre.mk.USE_*Several variables exist to define common dependencies
shared by many ports. Their use is optional, but helps to
reduce the verbosity of the port
Makefiles. Each of them is styled as
USE_*. These
variables may be used only in the port
Makefiles and
ports/Mk/bsd.*.mk. They are not meant
for user-settable options — use
PORT_OPTIONS for that purpose.It is always incorrect to set any
USE_* in
/etc/make.conf. For instance,
settingUSE_GCC=X.Y(where X.Y is version number) would add a dependency
on gccXY for every port, including
lang/gccXY itself!
USE_*VariableMeansUSE_GCCThe port requires GCC (gcc or
g++) to build. Some ports need any
GCC version, some require modern, recent versions. It
is typically set to any (in this
case, GCC from base would be used on versions of &os;
that still have it, or lang/gcc
port would be installed when default C/C++ compiler is
Clang); or yes (means always use
stable, modern GCC from lang/gcc
port). The exact version can also be specified, with
a value such as 4.7. The minimal
required version can be specified as
4.6+. The GCC from the base system
is used when it satisfies the requested version,
otherwise an appropriate compiler is built from the
port, and CC and
CXX are adjusted
accordingly.USE_GCC will register a
build-time and a run-time dependency.
Variables related to gmake and
configure are described in
, while
autoconf,
automake and
libtool are described in
.
Perl related variables are
described in . X11 variables are
listed in .
deals with GNOME and
with KDE related variables.
documents Java variables, while
contains information on
Apache,
PHP and PEAR modules.
Python is discussed in
, while
Ruby in
.
provides variables used for SDL
applications and finally,
contains information on
Xfce.Minimal Version of a DependencyA minimal version of a dependency can be specified in any
*_DEPENDS
except LIB_DEPENDS using this
syntax:p5-Spiffy>=0.26:devel/p5-SpiffyThe first field contains a dependent package name, which
must match the entry in the package database, a comparison
sign, and a package version. The dependency is satisfied if
p5-Spiffy-0.26 or newer is installed on the machine.Notes on DependenciesAs mentioned above, the default target to call when a
dependency is required is
DEPENDS_TARGET. It defaults to
install. This is a user variable; it is
never defined in a port's Makefile. If
the port needs a special way to handle a dependency, use the
:target part of
*_DEPENDS
instead of redefining
DEPENDS_TARGET.When running make clean, the port
dependencies are automatically cleaned too. If this is not
desirable, define
NOCLEANDEPENDS in the environment. This
may be particularly desirable if the port has something that
takes a long time to rebuild in its dependency list, such as
KDE, GNOME or Mozilla.To depend on another port unconditionally, use the
variable ${NONEXISTENT} as the first field
of BUILD_DEPENDS or
RUN_DEPENDS. Use this only when
the source of the other port is needed. Compilation time can
be saved by specifying the target too. For
instanceBUILD_DEPENDS= ${NONEXISTENT}:graphics/jpeg:extractwill always descend to the jpeg port
and extract it.Circular Dependencies Are FatalDo not introduce any circular dependencies into the
ports tree!The ports building technology does not tolerate circular
dependencies. If one is introduced, someone, somewhere in the
world, will have their &os; installation broken
almost immediately, with many others quickly to follow. These
can really be hard to detect. If in doubt, before making
that change, make sure to run:
cd /usr/ports; make index. That process
can be quite slow on older machines, but it may be able to
save a large number of people, including yourself,
a lot of grief in the process.Problems Caused by Automatic DependenciesDependencies must be declared either explicitly or by
using the
OPTIONS framework.
Using other methods like automatic detection complicates
indexing, which causes problems for port and package
management.Wrong Declaration of an Optional Dependency.include <bsd.port.pre.mk>
.if exists(${LOCALBASE}/bin/foo)
LIB_DEPENDS= libbar.so:foo/bar
.endifThe problem with trying to automatically add dependencies
is that files and settings outside an individual port can
change at any time. For example: an index is built, then a
batch of ports are installed. But one of the ports installs
the tested file. The index is now incorrect, because an
installed port unexpectedly has a new dependency. The index
may still be wrong even after rebuilding if other ports also
determine their need for dependencies based on the existence
of other files.Correct Declaration of an Optional DependencyOPTIONS_DEFINE= BAR
BAR_DESC= Calling cellphones via bar
BAR_LIB_DEPENDS= libbar.so:foo/barTesting option variables is the correct method. It will
not cause inconsistencies in the index of a batch of ports,
provided the options were defined prior to the index build.
Simple scripts can then be used to automate the building,
installation, and updating of these ports and their
packages.Slave Ports and MASTERDIRIf the 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, by
using variables cleverly, only a very short
Makefile is needed in all but one of the
directories. In the sole Makefile, use
MASTERDIR to specify the directory where the
rest of the files are. Also, use a variable as part of PKGNAMESUFFIX
so the packages will have different names.This will be best demonstrated by an example. This is part
of print/pkfonts300/Makefile;PORTNAME= pkfonts${RESOLUTION}
PORTVERSION= 1.0
DISTFILES= pk${RESOLUTION}.tar.gz
PLIST= ${PKGDIR}/pkg-plist.${RESOLUTION}
.if !defined(RESOLUTION)
RESOLUTION= 300
.else
.if ${RESOLUTION} != 118 && ${RESOLUTION} != 240 && \
${RESOLUTION} != 300 && ${RESOLUTION} != 360 && \
${RESOLUTION} != 400 && ${RESOLUTION} != 600
.BEGIN:
@${ECHO_MSG} "Error: invalid value for RESOLUTION: \"${RESOLUTION}\""
@${ECHO_MSG} "Possible values are: 118, 240, 300, 360, 400 and 600."
@${FALSE}
.endif
.endifprint/pkfonts300 also has all
the regular patches, package files, etc. Running
make there, it will take the default value
for the resolution (300) and build the port normally.As for other resolutions, this is the
entireprint/pkfonts360/Makefile:RESOLUTION= 360
MASTERDIR= ${.CURDIR}/../pkfonts300
.include "${MASTERDIR}/Makefile"(print/pkfonts118/Makefile,
print/pkfonts600/Makefile, and all the
other are similar).
MASTERDIR definition tells
bsd.port.mk that the regular set of
subdirectories like FILESDIR and
SCRIPTDIR are to be found under
pkfonts300. The
RESOLUTION=360 line will override the
RESOLUTION=300 line in
pkfonts300/Makefile and the port will be
built with resolution set to 360.Man PagesIf the port anchors its man tree somewhere other than
PREFIX, use
MANDIRS to specify those directories. Note
that the files corresponding to manual pages must be placed in
pkg-plist along with the rest of the files.
The purpose of MANDIRS is to enable automatic
compression of manual pages, therefore the file names are
suffixed with .gz.Info FilesIf the package needs to install GNU info
files, list them in INFO (without the
trailing .info), one entry per document.
These files are assumed to be installed to
PREFIX/INFO_PATH. Change
INFO_PATH if the package uses a different
location. However, this is not recommended. These entries
contain just the path relative to
PREFIX/INFO_PATH. For example,
lang/gcc34 installs info files to
PREFIX/INFO_PATH/gcc34, and
INFO will be something like this:INFO= gcc34/cpp gcc34/cppinternals gcc34/g77 ...Appropriate installation/de-installation code will be
automatically added to the temporary
pkg-plist before package
registration.Makefile OptionsMany applications can be built with optional or differing
configurations. Examples include choice of natural (human)
language, GUI versus command-line, or type of database to
support. Users may need a different configuration than the
default, so the ports system provides hooks the port author can
use to control which variant will be built. Supporting these
options properly will make users happy, and effectively provide
two or more ports for the price of one.OPTIONSBackgroundOPTIONS_*
give the user installing the port a dialog showing the
available options, and then saves those options to
${PORT_DBDIR}/${OPTIONS_NAME}/options.
The next time the port is built, the options are
reused. PORT_DBDIR defaults to
/var/db/ports.
OPTIONS_NAME is to the port origin with
an underscore as the space separator, for example, for
dns/bind99 it will be
dns_bind99.When the user runs make config (or
runs make build for the first time), the
framework checks for
${PORT_DBDIR}/${OPTIONS_NAME}/options.
If that file does not exist, the values of
OPTIONS_*
are used, and a dialog box is
displayed where the options can be enabled or disabled.
Then options is saved and the
configured variables are used when building the port.If a new version of the port adds new
OPTIONS, the dialog will be presented to
the user with the saved values of old
OPTIONS prefilled.make showconfig shows the saved
configuration. Use make rmconfig
to remove the saved configuration.SyntaxOPTIONS_DEFINE contains a list of
OPTIONS to be used. These are
independent of each other and are not grouped:OPTIONS_DEFINE= OPT1 OPT2Once defined, OPTIONS are
described (optional, but strongly recommended):OPT1_DESC= Describe OPT1
OPT2_DESC= Describe OPT2
OPT3_DESC= Describe OPT3
OPT4_DESC= Describe OPT4
OPT5_DESC= Describe OPT5
OPT6_DESC= Describe OPT6ports/Mk/bsd.options.desc.mk
has descriptions for many common OPTIONS.
While often useful, override them if the
description is insufficient for the port.When describing options, view it from the
perspective of the user: What functionality does it
change?
and Why would I want to enable this?
Do not just repeat the name. For example, describing the
NLS option as
include NLS support does not help the user,
who can already see the option name but may not know what
it means. Describing it as Native Language Support
via gettext utilities is much more
helpful.Option names are always in all uppercase. They
cannot use mixed case or lowercase.OPTIONS can be grouped as radio
choices, where only one choice from each group is
allowed:OPTIONS_SINGLE= SG1
OPTIONS_SINGLE_SG1= OPT3 OPT4There must be one of each
OPTIONS_SINGLE group selected at all
times for the options to be valid. One option of each
group must be added to
OPTIONS_DEFAULT.OPTIONS can be grouped as radio
choices, where none or only one choice from each group
is allowed:OPTIONS_RADIO= RG1
OPTIONS_RADIO_RG1= OPT7 OPT8OPTIONS can also be grouped as
multiple-choice lists, where
at least one option must be
enabled:OPTIONS_MULTI= MG1
OPTIONS_MULTI_MG1= OPT5 OPT6OPTIONS can also be grouped as
multiple-choice lists, where none or any
option can be enabled:OPTIONS_GROUP= GG1
OPTIONS_GROUP_GG1= OPT9 OPT10OPTIONS are unset by default,
unless they are listed in
OPTIONS_DEFAULT:OPTIONS_DEFAULT= OPT1 OPT3 OPT6OPTIONS definitions must appear
before the inclusion of
bsd.port.options.mk.
PORT_OPTIONS values can only be tested
after the inclusion of
bsd.port.options.mk. Inclusion of
bsd.port.pre.mk can be used instead,
too, and is still widely used in ports written before the
introduction of bsd.port.options.mk.
But be aware that some variables will not work as expected
after the inclusion of bsd.port.pre.mk,
typically some
USE_*
flags.Simple Use of OPTIONSOPTIONS_DEFINE= FOO BAR
OPTIONS_DEFAULT=FOO
FOO_DESC= Option foo support
BAR_DESC= Feature bar support
# Will add --with-foo / --without-foo
FOO_CONFIGURE_WITH= foo
BAR_RUN_DEPENDS= bar:bar/bar
.include <bsd.port.mk>Check for Unset Port
OPTIONS.if ! ${PORT_OPTIONS:MEXAMPLES}
CONFIGURE_ARGS+=--without-examples
.endifThe form shown above is discouraged. The preferred
method is using a configure knob to really enable and
disable the feature to match the option:# Will add --with-examples / --without-examples
EXAMPLES_CONFIGURE_WITH= examplesPractical Use of OPTIONSOPTIONS_DEFINE= EXAMPLES
OPTIONS_DEFAULT= PGSQL LDAP SSL
OPTIONS_SINGLE= BACKEND
OPTIONS_SINGLE_BACKEND= MYSQL PGSQL BDB
OPTIONS_MULTI= AUTH
OPTIONS_MULTI_AUTH= LDAP PAM SSL
EXAMPLES_DESC= Install extra examples
MYSQL_DESC= Use MySQL as backend
PGSQL_DESC= Use PostgreSQL as backend
BDB_DESC= Use Berkeley DB as backend
LDAP_DESC= Build with LDAP authentication support
PAM_DESC= Build with PAM support
SSL_DESC= Build with OpenSSL support
# Will add USE_PGSQL=yes
PGSQL_USE= pgsql=yes
# Will add --enable-postgres / --disable-postgres
PGSQL_CONFIGURE_ENABLE= postgres
ICU_LIB_DEPENDS= libicuuc.so:devel/icu
# Will add --with-examples / --without-examples
EXAMPLES_CONFIGURE_WITH= examples
# Check other OPTIONS
.include <bsd.port.mk>Default OptionsThese options are always on by default.DOCS — build and install
documentation.NLS — Native Language
Support.EXAMPLES — build and
install examples.IPV6 — IPv6 protocol
support.There is no need to add these to
OPTIONS_DEFAULT. To have them active,
and show up in the options selection dialog, however, they
must be added to OPTIONS_DEFINE.Feature Auto-ActivationWhen using a GNU configure script, keep an eye on which
optional features are activated by auto-detection. Explicitly
disable optional features that are not needed by
adding --without-xxx or
--disable-xxx in
CONFIGURE_ARGS.Wrong Handling of an Option.if ${PORT_OPTIONS:MFOO}
LIB_DEPENDS+= libfoo.so:devel/foo
CONFIGURE_ARGS+= --enable-foo
.endifIn the example above, imagine a library libfoo is
installed on the system. The user does not want this
application to use libfoo, so he toggled the option off in the
make config dialog. But the application's
configure script detects the library present in the system and
includes its support in the resulting executable. Now when
the user decides to remove libfoo from the system, the ports
system does not protest (no dependency on libfoo was recorded)
but the application breaks.Correct Handling of an OptionFOO_LIB_DEPENDS= libfoo.so:devel/foo
# Will add --enable-foo / --disable-foo
FOO_CONFIGURE_ENABLE= fooUnder some circumstances, the shorthand conditional
syntax can cause problems with complex constructs. The
errors are usually
Malformed conditional, an alternative
syntax can be used..if !empty(VARIABLE:MVALUE)as an alternative to.if ${VARIABLE:MVALUE}Options HelpersThere are some macros to help simplify conditional values
which differ based on the options set. For easier access, a
comprehensive list is provided:PLIST_SUB,
SUB_LISTFor automatic
%%OPT%%
and
%%NO_OPT%%
generation, see .For more complex usage, see .CONFIGURE_ARGSFor
--enable-x
and
--disable-x,
see .For
--with-x
and
--without-x,
see .For all other cases, see .CMAKE_ARGSFor arguments that are booleans
(on, off,
true, false,
0, 1) see .For all other cases, see .MESON_ARGSFor arguments that take true or
false, see .For arguments that take yes or
no, use .For arguments that take enabled
or disabled, see .For all other cases, use .QMAKE_ARGSSee .USE_*See .*_DEPENDSSee .* (Any variable)The most used variables have direct helpers, see
.For any variable without a specific helper, see
.Options dependenciesWhen an option need another option to work, see
.Options conflictsWhen an option cannot work if another is also
enabled, see .Build targetsWhen an option need some extra processing, see .OPTIONS_SUBIf OPTIONS_SUB is set to
yes then each of the options added to
OPTIONS_DEFINE will be added to
PLIST_SUB and
SUB_LIST, for example:OPTIONS_DEFINE= OPT1
OPTIONS_SUB= yesis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
PLIST_SUB+= OPT1="" NO_OPT1="@comment "
SUB_LIST+= OPT1="" NO_OPT1="@comment "
.else
PLIST_SUB+= OPT1="@comment " NO_OPT1=""
SUB_LIST+= OPT1="@comment " NO_OPT1=""
.endifThe value of OPTIONS_SUB is
ignored. Setting it to any value will add
PLIST_SUB and
SUB_LIST entries for
all options.OPT_USE
and
OPT_USE_OFFWhen option OPT is selected,
for each
key=value
pair in
OPT_USE,
value is appended to the
corresponding
USE_KEY. If
value has spaces in it, replace
them with commas and they will be changed back to spaces
during processing.
OPT_USE_OFF
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
OPT1_USES= xorg
OPT1_USE= mysql=yes xorg=x11,xextproto,xext,xrandr
OPT1_USE_OFF= openssl=yesis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
USE_MYSQL= yes
USES+= xorg
USE_XORG= x11 xextproto xext xrandr
.else
USE_OPENSSL= yes
.endifCONFIGURE_ARGS HelpersOPT_CONFIGURE_ENABLEWhen option OPT is
selected, for each entry in
OPT_CONFIGURE_ENABLE
then
--enable-entry
is appended to CONFIGURE_ARGS. When
option OPT is
not selected,
--disable-entry
is appended to CONFIGURE_ARGS. An
optional argument can be specified with an
= symbol. This argument is only
appended to the
--enable-entry
configure option. For example:OPTIONS_DEFINE= OPT1 OPT2
OPT1_CONFIGURE_ENABLE= test1 test2
OPT2_CONFIGURE_ENABLE= test2=exhaustiveis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CONFIGURE_ARGS+= --enable-test1 --enable-test2
.else
CONFIGURE_ARGS+= --disable-test1 --disable-test2
.endif
.if ${PORT_OPTIONS:MOPT2}
CONFIGURE_ARGS+= --enable-test2=exhaustive
.else
CONFIGURE_ARGS+= --disable-test2
.endifOPT_CONFIGURE_WITHWhen option OPT is
selected, for each entry in
OPT_CONFIGURE_WITH
then
--with-entry
is appended to CONFIGURE_ARGS. When
option OPT is
not selected,
--without-entry
is appended to CONFIGURE_ARGS. An
optional argument can be specified with an
= symbol. This argument is only
appended to the
--with-entry
configure option. For example:OPTIONS_DEFINE= OPT1 OPT2
OPT1_CONFIGURE_WITH= test1
OPT2_CONFIGURE_WITH= test2=exhaustiveis equivalent to:OPTIONS_DEFINE= OPT1 OPT2
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CONFIGURE_ARGS+= --with-test1
.else
CONFIGURE_ARGS+= --without-test1
.endif
.if ${PORT_OPTIONS:MOPT2}
CONFIGURE_ARGS+= --with-test2=exhaustive
.else
CONFIGURE_ARGS+= --without-test2
.endifOPT_CONFIGURE_ON
and
OPT_CONFIGURE_OFFWhen option OPT is
selected, the value of
OPT_CONFIGURE_ON,
if defined, is appended to
CONFIGURE_ARGS.
OPT_CONFIGURE_OFF
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
OPT1_CONFIGURE_ON= --add-test
OPT1_CONFIGURE_OFF= --no-testis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CONFIGURE_ARGS+= --add-test
.else
CONFIGURE_ARGS+= --no-test
.endifMost of the time, the helpers in and provide a shorter
and more comprehensive functionality.CMAKE_ARGS HelpersOPT_CMAKE_ON
and
OPT_CMAKE_OFFWhen option OPT is
selected, the value of
OPT_CMAKE_ON,
if defined, is appended to CMAKE_ARGS.
OPT_CMAKE_OFF
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
OPT1_CMAKE_ON= -DTEST:BOOL=true -DDEBUG:BOOL=true
OPT1_CMAKE_OFF= -DOPTIMIZE:BOOL=trueis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CMAKE_ARGS+= -DTEST:BOOL=true -DDEBUG:BOOL=true
.else
CMAKE_ARGS+= -DOPTIMIZE:BOOL=true
.endifSee for a
shorter helper when the value is boolean.OPT_CMAKE_BOOL
and
OPT_CMAKE_BOOL_OFFWhen option OPT is
selected, for each entry in
OPT_CMAKE_BOOL
then
-Dentry:BOOL=true
is appended to CMAKE_ARGS. When option
OPT is not
selected,
-Dentry:BOOL=false
is appended to CONFIGURE_ARGS.
OPT_CMAKE_BOOL_OFF
is the opposite,
-Dentry:BOOL=false
is appended to CMAKE_ARGS when the
option is selected, and
-Dentry:BOOL=true
when the option is not selected. For
example:OPTIONS_DEFINE= OPT1
OPT1_CMAKE_BOOL= TEST DEBUG
OPT1_CMAKE_BOOL_OFF= OPTIMIZEis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CMAKE_ARGS+= -DTEST:BOOL=true -DDEBUG:BOOL=true \
-DOPTIMIZE:BOOL=false
.else
CMAKE_ARGS+= -DTEST:BOOL=false -DDEBUG:BOOL=false \
-DOPTIMIZE:BOOL=true
.endifMESON_ARGS HelpersOPT_MESON_ON
and
OPT_MESON_OFFWhen option OPT is
selected, the value of
OPT_MESON_ON,
if defined, is appended to MESON_ARGS.
OPT_MESON_OFF
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
OPT1_MESON_ON= -Dopt=1
OPT1_MESON_OFF= -Dopt=2is equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
MESON_ARGS+= -Dopt=1
.else
MESON_ARGS+= -Dopt=2
.endifOPT_MESON_TRUE
and
OPT_MESON_FALSEWhen option OPT is
selected, for each entry in
OPT_MESON_TRUE
then
-Dentry=true
is appended to MESON_ARGS. When option
OPT is not
selected,
-Dentry=false
is appended to MESON_ARGS.
OPT_MESON_FALSE
is the opposite,
-Dentry=false
is appended to MESON_ARGS when the
option is selected, and
-Dentry=true
when the option is not selected. For
example:OPTIONS_DEFINE= OPT1
OPT1_MESON_TRUE= test debug
OPT1_MESON_FALSE= optimizeis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
MESON_ARGS+= -Dtest=true -Ddebug=true \
-Doptimize=false
.else
MESON_ARGS+= -Dtest=false -Ddebug=false \
-Doptimize=true
.endifOPT_MESON_YES
and
OPT_MESON_NOWhen option OPT is
selected, for each entry in
OPT_MESON_YES
then
-Dentry=yes
is appended to MESON_ARGS. When option
OPT is not
selected,
-Dentry=no
is appended to MESON_ARGS.
OPT_MESON_NO
is the opposite,
-Dentry=no
is appended to MESON_ARGS when the
option is selected, and
-Dentry=yes
when the option is not selected. For
example:OPTIONS_DEFINE= OPT1
OPT1_MESON_YES= test debug
OPT1_MESON_NO= optimizeis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
MESON_ARGS+= -Dtest=yes -Ddebug=yes \
-Doptimize=no
.else
MESON_ARGS+= -Dtest=no -Ddebug=no \
-Doptimize=yes
.endifOPT_MESON_ENABLED
and
OPT_MESON_DISABLEDWhen option OPT is
selected, for each entry in
OPT_MESON_ENABLED
then
-Dentry=enabled
is appended to MESON_ARGS. When option
OPT is not
selected,
-Dentry=disabled
is appended to MESON_ARGS.
OPT_MESON_DISABLED
is the opposite,
-Dentry=disabled
is appended to MESON_ARGS when the
option is selected, and
-Dentry=enabled
when the option is not selected. For
example:OPTIONS_DEFINE= OPT1
OPT1_MESON_ENABLED= test
OPT1_MESON_DISABLED= debugis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
MESON_ARGS+= -Dtest=enabled -Ddebug=disabled
.else
MESON_ARGS+= -Dtest=disabled -Ddebug=enabled
.endifOPT_QMAKE_ON
and
OPT_QMAKE_OFFWhen option OPT is selected,
the value of
OPT_QMAKE_ON,
if defined, is appended to QMAKE_ARGS.
OPT_QMAKE_OFF
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
OPT1_QMAKE_ON= -DTEST:BOOL=true
OPT1_QMAKE_OFF= -DPRODUCTION:BOOL=trueis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
QMAKE_ARGS+= -DTEST:BOOL=true
.else
QMAKE_ARGS+= -DPRODUCTION:BOOL=true
.endifOPT_IMPLIESProvides a way to add dependencies between
options.When OPT is selected, all the
options listed in this variable will be selected too. Using
the OPT_CONFIGURE_ENABLE
described earlier to illustrate:OPTIONS_DEFINE= OPT1 OPT2
OPT1_IMPLIES= OPT2
OPT1_CONFIGURE_ENABLE= opt1
OPT2_CONFIGURE_ENABLE= opt2Is equivalent to:OPTIONS_DEFINE= OPT1 OPT2
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
CONFIGURE_ARGS+= --enable-opt1
.else
CONFIGURE_ARGS+= --disable-opt1
.endif
.if ${PORT_OPTIONS:MOPT2} || ${PORT_OPTIONS:MOPT1}
CONFIGURE_ARGS+= --enable-opt2
.else
CONFIGURE_ARGS+= --disable-opt2
.endifSimple Use of
OPT_IMPLIESThis port has a X11 option, and a
GNOME option that needs the
X11 option to be selected to
build.OPTIONS_DEFINE= X11 GNOME
OPTIONS_DEFAULT= X11
X11_USES= xorg
X11_USE= xorg=xi,xextproto
GNOME_USE= gnome=gtk30
GNOME_IMPLIES= X11OPT_PREVENTS
and
OPT_PREVENTS_MSGProvides a way to add conflicts between options.When OPT is selected, all the
options listed in OPT_PREVENTS
must be un-selected. If OPT_PREVENTS_MSG
is set and a conflict is triggered, its content will be shown explaining
why they conflict. For example:OPTIONS_DEFINE= OPT1 OPT2
OPT1_PREVENTS= OPT2
OPT1_PREVENTS_MSG= OPT1 and OPT2 enable conflicting optionsIs roughly equivalent to:OPTIONS_DEFINE= OPT1 OPT2
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT2} && ${PORT_OPTIONS:MOPT1}
BROKEN= Option OPT1 conflicts with OPT2 (select only one)
.endifThe only difference is that the first one will write an
error after running make config,
suggesting changing the selected options.Simple Use of
OPT_PREVENTSThis port has X509 and
SCTP options. Both options add
patches, but the patches conflict with each other, so they
cannot be selected at the same time.OPTIONS_DEFINE= X509 SCTP
SCTP_PATCHFILES= ${PORTNAME}-6.8p1-sctp-2573.patch.gz:-p1
SCTP_CONFIGURE_WITH= sctp
X509_PATCH_SITES= http://www.roumenpetrov.info/openssh/x509/:x509
X509_PATCHFILES= ${PORTNAME}-7.0p1+x509-8.5.diff.gz:-p1:x509
X509_PREVENTS= SCTP
X509_PREVENTS_MSG= X509 and SCTP patches conflictOPT_VARS
and
OPT_VARS_OFFProvides a generic way to set and append to
variables.Before using
OPT_VARS and
OPT_VARS_OFF,
see if there is already a more specific helper available in
.When option OPT is selected,
and OPT_VARS
defined,
key=value
and
key+=value
pairs are evaluated from
OPT_VARS. An
= cause the existing value of
KEY to be overwritten, an
+= appends to the value.
OPT_VARS_OFF
works the same way, but when OPT is
not selected.OPTIONS_DEFINE= OPT1 OPT2 OPT3
OPT1_VARS= also_build+=bin1
OPT2_VARS= also_build+=bin2
OPT3_VARS= bin3_build=yes
OPT3_VARS_OFF= bin3_build=no
MAKE_ARGS= ALSO_BUILD="${ALSO_BUILD}" BIN3_BUILD="${BIN3_BUILD}"is equivalent to:OPTIONS_DEFINE= OPT1 OPT2
MAKE_ARGS= ALSO_BUILD="${ALSO_BUILD}" BIN3_BUILD="${BIN3_BUILD}"
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
ALSO_BUILD+= bin1
.endif
.if ${PORT_OPTIONS:MOPT2}
ALSO_BUILD+= bin2
.endif
.if ${PORT_OPTIONS:MOPT2}
BIN3_BUILD= yes
.else
BIN3_BUILD= no
.endifValues containing whitespace must be enclosed in
quotes:OPT_VARS= foo="bar baz"This is due to the way &man.make.1; variable expansion
deals with whitespace. When OPT_VARS= foo=bar
baz is expanded, the variable ends up
containing two strings, foo=bar and
baz. But the submitter probably
intended there to be only one string, foo=bar
baz. Quoting the value prevents whitespace
from being used as a delimiter.Also, do not add extra spaces
after the
var= sign
and before the value, it would also be split into two
strings. This will not work:OPT_VARS= foo= barDependencies,
OPT_DEPTYPE
and
OPT_DEPTYPE_OFFFor any of these dependency types:PKG_DEPENDSEXTRACT_DEPENDSPATCH_DEPENDSFETCH_DEPENDSBUILD_DEPENDSLIB_DEPENDSRUN_DEPENDSWhen option OPT is
selected, the value of
OPT_DEPTYPE,
if defined, is appended to
DEPTYPE.
OPT_DEPTYPE_OFF
works the same, but when OPT is
not
selected. For example:OPTIONS_DEFINE= OPT1
OPT1_LIB_DEPENDS= liba.so:devel/a
OPT1_LIB_DEPENDS_OFF= libb.so:devel/bis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
LIB_DEPENDS+= liba.so:devel/a
.else
LIB_DEPENDS+= libb.so:devel/b
.endifGeneric Variables Replacement,
OPT_VARIABLE
and
OPT_VARIABLE_OFFFor any of these variables:ALL_TARGETBINARY_ALIASBROKENCATEGORIESCFLAGSCONFIGURE_ENVCONFLICTSCONFLICTS_BUILDCONFLICTS_INSTALLCPPFLAGSCXXFLAGSDESKTOP_ENTRIESDISTFILESEXTRACT_ONLYEXTRA_PATCHESGH_ACCOUNTGH_PROJECTGH_SUBDIRGH_TAGNAMEGH_TUPLEGL_ACCOUNTGL_COMMITGL_PROJECTGL_SITEGL_SUBDIRGL_TUPLEIGNOREINFOINSTALL_TARGETLDFLAGSLIBSMAKE_ARGSMAKE_ENVMASTER_SITESPATCHFILESPATCH_SITESPLIST_DIRSPLIST_FILESPLIST_SUBPORTDOCSPORTEXAMPLESSUB_FILESSUB_LISTTEST_TARGETUSESWhen option OPT is
selected, the value of
OPT_ABOVEVARIABLE,
if defined, is appended to
ABOVEVARIABLE.
OPT_ABOVEVARIABLE_OFF
works the same way, but when OPT is
not
selected. For example:OPTIONS_DEFINE= OPT1
OPT1_USES= gmake
OPT1_CFLAGS_OFF= -DTESTis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPT1}
USES+= gmake
.else
CFLAGS+= -DTEST
.endifSome variables are not in this list, in particular
PKGNAMEPREFIX and
PKGNAMESUFFIX. This is intentional. A
port must not change its name when
its option set changes.Some of these variables, at least
ALL_TARGET,
DISTFILES and
INSTALL_TARGET, have their default
values set after the options are
processed.With these lines in the
Makefile:ALL_TARGET= all
DOCS_ALL_TARGET= docIf the DOCS option is enabled,
ALL_TARGET will have a final value of
all doc; if the option is disabled, it
would have a value of all.With only the options helper line in the
Makefile:DOCS_ALL_TARGET= docIf the DOCS option is enabled,
ALL_TARGET will have a final value of
doc; if the option is disabled, it
would have a value of all.Additional Build Targets,
target-OPT-on
and
target-OPT-offThese Makefile targets can accept
optional extra build targets:pre-fetchdo-fetchpost-fetchpre-extractdo-extractpost-extractpre-patchdo-patchpost-patchpre-configuredo-configurepost-configurepre-builddo-buildpost-buildpre-installdo-installpost-installpost-stagepre-packagedo-packagepost-packageWhen option OPT is
selected, the target
TARGET-OPT-on,
if defined, is executed after
TARGET.
TARGET-OPT-off
works the same way, but when OPT is
not selected. For example:OPTIONS_DEFINE= OPT1
post-patch-OPT1-on:
@${REINPLACE_CMD} -e '/opt1/s|/usr/bin/|${EXAMPLESDIR}/|' ${WRKSRC}/Makefile
post-patch-OPT1-off:
@${REINPLACE_CMD} -e '/opt1/s|/usr/bin/|${PREFIX}/bin/|' ${WRKSRC}/Makefileis equivalent to:OPTIONS_DEFINE= OPT1
.include <bsd.port.options.mk>
post-patch:
.if ${PORT_OPTIONS:MOPT1}
@${REINPLACE_CMD} -e '/opt1/s|/usr/bin/|${EXAMPLESDIR}/|' ${WRKSRC}/Makefile
.else
@${REINPLACE_CMD} -e '/opt1/s|/usr/bin/|${PREFIX}/bin/|' ${WRKSRC}/Makefile
.endifSpecifying the Working DirectoryEach port is extracted into a working directory, which must
be writable. The ports system defaults to having
DISTFILES unpack in to a directory called
${DISTNAME}. In other words, if the
Makefile has:PORTNAME= foo
DISTVERSION= 1.0then the port's distribution files contain a top-level
directory, foo-1.0, and the rest of the
files are located under that directory.A number of variables can be overridden if that is
not the case.WRKSRCThe variable lists the name of the directory that is
created when the application's distfiles are extracted. If
our previous example extracted into a directory called
foo (and not
foo-1.0) write:WRKSRC= ${WRKDIR}/fooor possiblyWRKSRC= ${WRKDIR}/${PORTNAME}WRKSRC_SUBDIRIf the source files needed for the port are in a
subdirectory of the extracted distribution file, set
WRKSRC_SUBDIR to that directory.WRKSRC_SUBDIR= srcNO_WRKSUBDIRIf the port does not extract in to a subdirectory at all,
then set NO_WRKSUBDIR to
indicate that.NO_WRKSUBDIR= yesBecause WRKDIR is the only directory
that is supposed to be writable during the build, and is
used to store many files recording the status of the build,
the port's extraction will be forced into a
subdirectory.Conflict HandlingThere are three different variables to register a conflict
between packages and ports: CONFLICTS,
CONFLICTS_INSTALL and
CONFLICTS_BUILD.The conflict variables automatically set the variable
IGNORE, which is more fully documented in
.When removing one of several conflicting ports, it is
advisable to retain CONFLICTS in
those other ports for a few months to cater for users who only
update once in a while.CONFLICTS_INSTALLIf the package cannot coexist with other
packages (because of file conflicts, runtime
incompatibilities, etc.).
CONFLICTS_INSTALL check is done after the
build stage and prior to the install stage.CONFLICTS_BUILDIf the port cannot be built when other specific ports
are already installed. Build conflicts are not recorded
in the resulting package.CONFLICTSIf the port cannot be built if a certain port is
already installed and the resulting package cannot coexist
with the other package. CONFLICTS
check is done prior to the build stage and prior to the
install stage.The most common content of one of these variable is the
package base of another port. The package base is the package
name without the appended version, it can be obtained by running
make -V PKGBASE.Basic usage of
CONFLICTS*dns/bind99 cannot be
installed if dns/bind910 is
present because they install same files. First gather the
package base to use:&prompt.user; make -C dns/bind99 -V PKGBASE
bind99
&prompt.user; make -C dns/bind910 -V PKGBASE
bind910Then add to the Makefile of dns/bind99:CONFLICTS_INSTALL= bind910And add to the Makefile of dns/bind910:CONFLICTS_INSTALL= bind99Sometime, only some version of another port is incompatible,
in this case, use the full package name, with the version, and
use shell globs, like * and
? to make sure all possible versions are
matched.Using CONFLICTS* With Globs.From versions from 2.0 and up-to 2.4.1_2, deskutils/gnotime used to install a
bundled version of databases/qof.To reflect this past, the Makefile of
databases/qof contains:CONFLICTS_INSTALL= gnotime-2.[0-3]* \
gnotime-2.4.0* gnotime-2.4.1 \
gnotime-2.4.1_[12]The first entry match versions 2.0
through 2.3, the second all the revisions
of 2.4.0, the third the exact
2.4.1 version, and the last the first and
second revisions of the 2.4.1
version.deskutils/gnotime does not
have any conflicts line because its current version does not
conflict with anything else.Installing FilesThe install phase is very
important to the end user because it
adds files to their system. All the additional commands run
in the port Makefile's
*-install targets should be
echoed to the screen. Do not silence
these commands with
@ or .SILENT.INSTALL_*
MacrosUse the macros provided in
bsd.port.mk to ensure correct modes of
files in the port's *-install
targets. Set ownership directly in
pkg-plist with the corresponding entries,
such as
@(owner,group,),
@owner owner,
and @group
group.
These operators work until overridden, or until the end
of pkg-plist, so remember to reset
them after they are no longer needed. The default ownership
is root:wheel. See for more information.INSTALL_PROGRAM is a command to
install binary executables.INSTALL_SCRIPT is a command to
install executable scripts.INSTALL_LIB is a command to install
shared libraries (but not static libraries).INSTALL_KLD is a command to
install kernel loadable modules. Some architectures
do not like having the modules stripped, so
use this command instead of
INSTALL_PROGRAM.INSTALL_DATA is a command to
install sharable data, including static libraries.INSTALL_MAN is a command to
install manpages and other documentation (it does not
compress anything).These variables are set to the &man.install.1; command
with the appropriate flags for each situation.Do not use INSTALL_LIB to install
static libraries, because stripping them renders them
useless. Use INSTALL_DATA
instead.Stripping Binaries and Shared LibrariesInstalled binaries should be stripped. Do not strip
binaries manually unless absolutely required. The
INSTALL_PROGRAM macro installs and
strips a binary at the same time. The
INSTALL_LIB macro does the same thing to
shared libraries.When a file must be stripped, but neither
INSTALL_PROGRAM nor
INSTALL_LIB macros are desirable,
${STRIP_CMD} strips the program or
shared library. This is typically done within the
post-install target. For
example:post-install:
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/xdlWhen multiple files need to be stripped:post-install:
.for l in geometry media body track world
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib${PORTNAME}-${l}.so.0
.endforUse &man.file.1; on a file to determine if it has been
stripped. Binaries are reported by &man.file.1; as
stripped, or
not stripped. Additionally, &man.strip.1;
will detect programs that have already been stripped and exit
cleanly.When WITH_DEBUG is defined, elf files
must not be stripped.The variables (STRIP_CMD,
INSTALL_PROGRAM,
INSTALL_LIB, ...) and USES provided by the framework
handle this automatically.Some software, add -s to their
LDFLAGS, in this case, either remove
-s if WITH_DEBUG is
set, or remove it unconditionally and use
STRIP_CMD in
post-install.Installing a Whole Tree of FilesSometimes, a large number of files must be installed while
preserving their hierarchical organization. For example,
copying over a whole directory tree from
WRKSRC to a target directory under
PREFIX. Note that
PREFIX, EXAMPLESDIR,
DATADIR, and other path variables must
always be prepended with STAGEDIR to
respect staging (see ).Two macros exist for this situation. The advantage of
using these macros instead of cp is that
they guarantee proper file ownership and permissions on target
files. The first macro, COPYTREE_BIN, will
set all the installed files to be executable, thus being
suitable for installing into PREFIX/bin.
The second macro, COPYTREE_SHARE, does not
set executable permissions on files, and is therefore suitable
for installing files under PREFIX/share
target.post-install:
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
(cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})This example will install the contents of the
examples directory in the vendor distfile
to the proper examples location of the port.post-install:
${MKDIR} ${STAGEDIR}${DATADIR}/summer
(cd ${WRKSRC}/temperatures && ${COPYTREE_SHARE} "June July August" ${STAGEDIR}${DATADIR}/summer)And this example will install the data of summer months to
the summer subdirectory of a
DATADIR.Additional find arguments can be
passed via the third argument to
COPYTREE_*
macros. For example, to install
all files from the first example except Makefiles, one can use
these commands.post-install:
${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
(cd ${WRKSRC}/examples && \
${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR} "! -name Makefile")These macros do not add the installed files to
pkg-plist. They must be added manually.
For optional documentation (PORTDOCS, see
) and examples
(PORTEXAMPLES), the
%%PORTDOCS%% or
%%PORTEXAMPLES%% prefixes must be prepended
in pkg-plist.Install Additional DocumentationIf the software has some documentation other than the
standard man and info pages that is useful for the
user, install it under DOCSDIR
This can be done, like the previous item, in the
post-install target.Create a new directory for the port. The directory name
is DOCSDIR. This usually equals
PORTNAME. However, if the user
might want different versions of the port to be installed at
the same time, the whole
PKGNAME can be used.Since only the files listed in
pkg-plist are installed, it is safe to
always install documentation to STAGEDIR
(see ). Hence .if
blocks are only needed when the installed files are large
enough to cause significant I/O overhead.post-install:
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_MAN} ${WRKSRC}/docs/xvdocs.ps ${STAGEDIR}${DOCSDIR}On the other hand, if there is a DOCS option in the port,
install the documentation in a
post-install-DOCS-on target. These
targets are described in .Here are some handy variables and how they are expanded by
default when used in the Makefile:DATADIR gets expanded to
PREFIX/share/PORTNAME.DATADIR_REL gets expanded to
share/PORTNAME.DOCSDIR gets expanded to
PREFIX/share/doc/PORTNAME.DOCSDIR_REL gets expanded to
share/doc/PORTNAME.EXAMPLESDIR gets expanded to
PREFIX/share/examples/PORTNAME.EXAMPLESDIR_REL gets expanded to
share/examples/PORTNAME.The DOCS option only controls
additional documentation installed in
DOCSDIR. It does not apply to standard
man pages and info pages. Things installed in
EXAMPLESDIR are controlled by
the EXAMPLES option.These variables are exported to
PLIST_SUB. Their values will appear there
as pathnames relative to PREFIX if
possible. That is, share/doc/PORTNAME
will be substituted for %%DOCSDIR%% in the
packing list by default, and so on. (See more on
pkg-plist substitution
here.)All conditionally installed documentation files and
directories are included in
pkg-plist with the
%%PORTDOCS%% prefix, for example:%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
%%PORTDOCS%%%%DOCSDIR%%/CONTACTAs an alternative to enumerating the documentation files
in pkg-plist, a port can set the variable
PORTDOCS to a list of file names and shell
glob patterns to add to the final packing list. The names
will be relative to DOCSDIR. Therefore, a
port that utilizes PORTDOCS, and uses a
non-default location for its documentation, must set
DOCSDIR accordingly. If a directory is
listed in PORTDOCS or matched by a glob
pattern from this variable, the entire subtree of contained
files and directories will be registered in the final packing
list. If the DOCS option has been unset
then files and directories listed in
PORTDOCS would not be installed or added to
port packing list. Installing the documentation at
PORTDOCS as shown above remains up to the
port itself. A typical example of utilizing
PORTDOCS:PORTDOCS= README.* ChangeLog docs/*The equivalents of PORTDOCS for files
installed under DATADIR and
EXAMPLESDIR are
PORTDATA and
PORTEXAMPLES, respectively.The contents of pkg-message are
displayed upon installation. See
the section on using
pkg-message for details.
pkg-message does not need to be added
to pkg-plist.Subdirectories Under PREFIXTry 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 a subdirectory of
lib, which does not work well with the
BSD paradigm. Many of the files must be moved to one of these
directories: 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 exception are ports
dealing with USENET news. They may use
PREFIX/news as a destination for their
files.Use BINARY_ALIAS to Rename Commands
Instead of Patching the BuildWhen BINARY_ALIAS is defined it will
create symlinks of the given commands in a directory which
will be prepended to PATH.Use it to substitute hardcoded commands the build phase
relies on without having to patch any build files.Using BINARY_ALIAS to Make
gsed Available as
sedSome ports expect sed to behave like
GNU sed and use features that
&man.sed.1; does not provide.
GNU sed is available from
textproc/gsed on &os;.Use BINARY_ALIAS to substitute
sed with gsed
for the duration of the build:BUILD_DEPENDS= gsed:textproc/gsed
...
BINARY_ALIAS= sed=gsedUsing BINARY_ALIAS to Provide Aliases
for Hardcoded python3 CommandsA port that has a hardcoded reference to
python3 in its build scripts will need
to have it available in PATH at build
time. Use BINARY_ALIAS to create an alias
that points to the right Python 3 binary:USES= python:3.4+,build
...
BINARY_ALIAS= python3=${PYTHON_CMD}See for more information
about USES=python.