PORTFILE-GLOBAL7portfile-globalMacPorts Portfile referenceDescriptionA reference of all available Portfile global variables and keywords.
Portfiles consist of valid TCL and are encoded in UTF-8. They usually
contain only simple keyword/value combinations and Tcl extensions as
described below, though they may also contain arbitrary TCL code. Every
port has a corresponding Portfile, but Portfiles do not completely define
a port's installation behavior since the MacPorts base has default port
installation characteristics coded within it. Therefore Portfiles need
only specify required options and, if necessary, non-default
characteristics for a port.Global VariablesGlobal variables are variables available to any Portfile. For a list
of additional variables available to ports that are assigned to a MacPorts
Portgroup, see portgroup(7).prefixInstallation prefix, set in
${prefix}/etc/macports/macports.conf —may be
overridden on a per port basis. For example, aqua applications are
installed in /Applications/MacPorts.Default: /opt/localbinpathDefault PATH to use in finding executables.libpathPath to the MacPorts TCL libraries.portpathFull path to the Portfile location.filesdirPath to port files relative to
${portpath}.workpathFull path to work directory.worksrcpathFull path to extracted source code. Equivalent to
${workpath}/${worksrcdir}.destrootFull path into which software will be destrooted. Equivalent
to ${workpath}/destroot.distpathLocation to store downloaded distfiles.install.userThe Unix user at the time of port installation.install.groupThe Unix group at the time of port installation.os.platformIdentifies platform type (ie, "darwin", "freebsd",
etc).os.archIdentifies hardware type (ie, "powerpc", "intel").os.versionThe version number of the host operating system (ie "8.0" for
Darwin 8.0).os.majorThe major version number of the host operating system (ie "8"
for Darwin 8.0).Global KeywordsMacPorts 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.GeneralThe list of global keywords.PortSystemThe top line of every Portfile; it must be followed by a
blank line. It defines which version of the Portfile interpreter
will be used.PortSystem 1.0
nameThe name of the Port; it should be lowercase.name fooversionThe version of the ported software.version 1.23.45revisionOptional 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.revision 1epochOptional keyword (default is 0) that is used if the new port
version looks older than the previous version (for example 1.10
-> 1.2). Often the epoch is formatted like a date, but it can
simple a number like 1.epoch 20070924epoch 1categoriesThe 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 securitymaintainersA port's maintainer is a person or persons who take
responsibility for keeping the port up-to-date, and the maintainer
keyword lists maintainer email addresses(s). However, many
maintainers wish to hide these addresses from spambots; to do so
follow these conventions:For addresses in domain @macports.org, simply omit the
domain name.For addresses in other domains, say
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:julesvernedescriptionA one-sentence description of the ported software.description A classic shooter arcade game.long_descriptionA long description of the ported software. Break long lines
with escaped newlines.description A classic shooter arcade game derived from \
the game alien-munchers. Not suitable for \
children under two years old. homepagePort application's homepage.homepage http://www.somesite.org/appsplatformsThe platforms on which the port has been tested.platforms darwin freebsdDependenciesFree and open source software is highly modular, and MacPorts
ports often require that other ports be installed beforehand; these
prerequisites for a given port are called a port's
dependencies.There are three types of MacPorts dependencies: library, build,
and run dependencies. Dependency types are important for proper port
upgrade and uninstall behavior. For example, you may not uninstall a
port that is a library dependency for another port, though you may
remove one with a build dependency; likewise, upgrading a port will
upgrade its library and build dependencies also, but not its run
dependencies.depends_libdepends_lib-appenddepends_lib-deleteThe list of dependencies to check before phases
, ,
, , and
. Library dependencies are needed both at
build time (for headers and libraries to link against) and at run
time.depends_builddepends_build-appenddepends_build-deleteThe list of dependencies to check before phases
, ,
, and . Build
dependencies are needed when software is compiled, but not needed
at all once the software is compiled and installed.depends_rundepends_run-appenddepends_run-deleteThe list of dependencies to check before phases
, , and
. Run dependencies are needed when the
software is run, but not to compile it.Port and Non-Port DependenciesPort dependencies should be provided by MacPorts ports whenever
possible, however dependencies may be provided by vendor-supplied
software when satisfying a dependency by a port is not practical or
desirable for a special reason. Dependencies of this type are called
non-port dependencies.Port dependencies, the preferred type, are specified as shown in
these examples:depends_lib port:rrdtool port:apache2
depends_build port:apache2 port:php5Non-port dependencies are specified as shown in these
examples:depends_lib lib:libX11.6:xorg
depends_build bin:rrdtoolVariantsMacPorts variants are conditional modifications of port
installation behavior that may be invoked by a user at the time of port
install.variant [requires variant] [conflicts variant] [description
description]The variant declaration may contain any keywords that can be
placed in a Portfile's global section. If you wish to execute
system (shell) calls or Tcl extensions during the execution of a
port phase, you should place those statements within a
variant_isset conditional within a phase
declaration and not within the variant declaration itself.
Dependencies and conflicts with other variants in the same port
can be expressed with requires and conflicts. See the isset Tcl
extension.Default: noExample:variant gnome requires glib {
configure.args-append --with-gnome
depends_lib-append port:gnome-session
}default_variantsIf variants are defined, then the default_variants value
lists which variants are enabled by default. This allows for
Portfile modularity and also allows users to suppress default
variants if they wish.Default: noneExample:default_variants +ssl +tcpd
Default variants may be suppressed by preceding a variant
name with a "-" as shown in this example.%%port install foo -ssluniversal_variantWhen using MacPorts on Mac OS X, a universal variant is
defined by default to configure ports with universal flags. The
variant can be overridden if the default code does not work (see
the Configure Universal section below), or suppressed if a
universal variant is not possible for the port with this
keyword.Default: yesExample:universal_variant noLivecheck / DistcheckOptions livecheck and distcheck are especially useful for port
maintainers, but others may also find this information valuable.Livecheck checks to see if MacPorts can query the developer's
download site to determine if a newer version of the software has become
available since the port was installed.livecheck.checkSpecify what kind of update check to perform.Open source mirror site options are to use the project's
latest file release from or
, or the project's
date_updated XML tag for
.Generic download site options are to specify a
(modification date) of a URL resource), a
(retrieve the version by applying a regex
to a URL resource), (retrieve the version
by applying a multi-line regex to a URL resource),
(compares the md5 sum of a URL resource) or
(no check).Default: sourceforge or googlecode if the master_sites
is one of these, else freshmeat.Values: freshmeat sourceforge googlecode moddate regex
regexm md5 noneExamples:livecheck.check regex
livecheck.url http://dev.mysql.com/
livecheck.regex "Generally Available (${major_version}\\.\[0-9.\]+)"
livecheck.nameName of the project for live checks; only used with
freshmeat, sourceforge, and googlecode livechecks.Default: ${name} or the
sourceforge/freshmeat/googlecode project name if it can be
guessed from master_sites.Values:
any_project_nameExample:livecheck.name hibernatelivecheck.distnameName of the file release for sourceforge and googlecode
checks. You may use this keyword without livecheck.version if you
replace the version part of the name with "(.*)".Default: SourceForge:
${livecheck.name} ; GoogleCode: first
${distfiles} itemValues: filenameExample:livecheck.distname faad2.srclivecheck.versionVersion of the project for a check; used for regex-based
checks.Default: ${version}Values: any_versionExample:livecheck.version ${name}-${version}livecheck.urlURL to query for a check.Default:homepage or the first hit among the following
siteshttp://freshmeat.net/projects-xml/${livecheck.name}/${livecheck.name}.xmlhttp://sourceforge.net/export/rss2_projfiles.php?project=${livecheck.name}http://code.google.com/p/${livecheck.name}/downloads/listValues: any_urlExample:livecheck.url http://ftp.gnu.org/gnu/bison/livecheck.regexRegular expression to parse the resource for regex checks.
Be sure to use a regular expression grouping around the version
component.Default: noneValues: any_regexExample:livecheck.regex 4th-([a-z0-9.]+)-unix.tar.gzlivecheck.md5md5 checksum to use for an md5 comparison.Default: noneValues:
any_md5_checksumExample:livecheck md5 37e6a5b6516a680c7178b72021d3b706Distcheck reports whether or not the distfile(s) specified in a
Portfile are still available on the developer's download site. Examples
are given below.distcheck.checkThis option can be used to disable distcheck. It specifies
what kind of check should be performed on distfiles: moddate
(check if the Portfile is older than the distfile) or none (no
check).Default: moddateValues: moddate noneExample:distcheck.check noneSEE ALSOportfile-phase7, portfile-startupitem7, portfile-tcl7AUTHORSLandon Fuller landonf@macports.orgJuan Manuel Palacios jmpp@macports.orgMark Duling markd@macports.orgKevin Van Vechten kevin@opendarwin.orgJordan K. Hubbard jkh@macports.orgChris Ridd cjr@opendarwin.orgKevin Ballard eridius@macports.orgMarkus W. Weissmann mww@macports.org