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.
PortSystem 1.0
name foo
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
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.
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 co-maintainers.
The maintainers
keyword lists the maintainers' GitHub usernames or email addresses.
GitHub usernames start with an @
symbol.
Email addresses are preferably listed in the obfuscated form below to hide them from spambots:
example.org:account
to specify the address.In the example below, the port is maintained by a GitHub user named neverpanic, and the owners of the two email addresses jdoe@macports.org and julesverne@example.org
maintainers @neverpanic \ jdoe \ example.org:julesverne
+ Braces can be used to express that these refer to the same person, for example the GitHub username and an email. In the following example, the port is maintained by a GitHub user named jverne, that can also be contacted directly at julesverne@example.org.
+
maintainers {@jverne example.org:julesverne}
+
The 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.
description A classic shooter arcade game.
long_description A classic shooter arcade game derived from \ the game alien-munchers. Not suitable for \ children under two years old.
homepage https://www.example.org/apps
darwin
(= macosx
or +puredarwin+
), +macosx+
, +puredarwin+
, +freebsd+
, +linux+
, +sunos+
, +netbsd+
.
In general, it can just be set to +darwin+
.
(+puredarwin+
is an OS based on Apple’s open-source Darwin releases without any of Apple’s proprietary bits.) See also +os.platform+
.platforms darwin
The CPU architectures for which this port can be built.
Archs currently supported by macOS 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}
license_noconflict openssl
+
license_noconflict readline gdbm
build.type xcode
or includes the xcode
PortGroup.
If a port needs to use Xcode (i.e., xcodebuild) in any way, use_xcode yes
should be set or the port should include the xcode PortGroup.
The environment variable DEVELOPER_DIR is now exported during all build phases, set to the value of ${configure.developer_dir}
which may be the directory of Xcode or CLT depending on use_xcode.
This means that libxcselect shims (i.e., /usr/bin/clang) will resolve to Xcode/CLT.
Build systems that ignore the environment may accidentally use Xcode which will cause a failure in trace mode.use_xcode no
+
use_xcode yes