This chapter serves as a reference for the major elements of a Portfile: port phases, dependencies, StartupItems, variables, keywords, and Tcl extensions.
MacPorts keywords are used to specify required or optional items within a Portfile, or to override default options used by MacPorts base for individual ports. Keywords are to be used within the “global” and “variant” sections of Portfiles, and not within optional port phase declarations.
The global keywords listed below specify information for ports as a whole, whereas the keywords listed under a port phase specify information to be used during a particular installation phase.
The first non-comment line of every Portfile; it should be followed by PortGroup inclusions (if any) and then a blank line. It defines which version of the Portfile interpreter will be used. (There is currently only one version.)
PortSystem 1.0
The name of the port. To avoid special interpretation by shells and the like, names should contain only alphanumeric characters, underscores, dashes or dots. For projects whose proper names contain “+” characters, change these to “x” (i.e. “libstdc++” becomes “libstdcxx”).
name foo
The version of the ported software.
version 1.23.45
Optional keyword (default is 0) that is used to track port revisions. It should not be incremented for port revisions unless it would benefit users to upgrade an installed port, and cleared when the port is updated to a newer version.
It should be used if a bug in the Portfile was found and all installations of this port have to be updated. If the change only affects new installations, there is no need to increase it.
revision 1
An optional keyword (default value is 0) that must be used when a port is updated to a version that is numerically less than the previous version, for example 1.10 -> 1.2 or 20070928 -> 1.0. Some Portfile authors have used large epoch values that look like a date, but there is no reason to do so. The epoch is simply an unsigned integer, and the only requirement is that it never be decreased.
epoch 1
An epoch is not needed for most ports. If a port's version numbers advance in normal dotted-decimal sequence, there is no reason to add an epoch.
The category under which the ported software falls. The first category should be the same as the directory within which the Portfile is stored; secondary and tertiary categories may be selected.
categories net security
A port's maintainers are the people who have agreed to take
responsibility for keeping the port up-to-date. Most ports have only a
single maintainer, but some ports have two or more comaintainers. The
maintainers keyword lists the maintainers' email
addresses, preferrably in the obfuscated form which hides them
from spambots:
For addresses in domain @macports.org, simply omit the domain name.
For addresses in other domains, e.g.
<account@example.org>, use the convention
example.org:account to specify the address.
In the example below, the maintainer email addresses
<jdoe@macports.org> and
<julesverne@example.org> are hidden using these
conventions.
maintainers jdoe \
example.org:julesverneThe address <nomaintainer> designates a port that
is not maintained by anybody and may be modified by any committer.
Feel free to claim maintainership of a nomaintainer port if desired.
The address <openmaintainer> designates a port that has
a maintainer who allows minor changes to be committed without his or
her prior approval. Port maintainers who are not committers are
encouraged to add <openmaintainer> to their ports.
A one-sentence description of the ported software.
description A classic shooter arcade game.
A long description of the ported software. Break long lines with escaped newlines.
long_description A classic shooter arcade game derived from \
the game alien-munchers. Not suitable for \
children under two years old.Port application's homepage.
homepage http://www.example.org/apps
The platforms on which the port has been tested.
platforms darwin freebsd
The CPU architectures for which this port can be built. Archs currently
supported by Mac OS X are: i386, ppc, ppc64, x86_64. If this option is not
set, it is assumed that the port can build for all archs. If a port does not
install any architecture-specific files, use the special value
noarch.
If the building architecture isn't among supported_archs, port fails with an error message, except when building on x86_64 and supported_archs contains i386 or when building on ppc64 and supported_archs contains ppc, in which case the port will be built in 32-bit mode.
supported_archs i386 ppc
supported_archs noarch
The proper format for license consists of the license name, followed by a hyphen and number if indicating a specific version. A space should be placed between licenses if there is more than one that applies. If an element in the license list is itself a list, it is interpreted as offering a choice of any one of the licenses in the sub-list.
If the version number is a “.0” version, the “.0” should be omitted to make the version an integer. If the author gives the choice of using a given license or “any later version” of it, append a plus sign (+) to the version number. If the version specified in this case is also the earliest version, just leave out the version number entirely since it implies all versions.
license GPL-3
license {freetype GPL}