source: branches/gsoc13-tests/doc/INTERNALS @ 139170

Last change on this file since 139170 was 26391, checked in by jmpp@…, 13 years ago

There's no mportget, so provide a different example.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.7 KB
1MacPorts Internals:
3The MacPorts system is composed of three TCL libraries:
4        macports - public API
5        port - portfile parsing and execution
6        pextlib - necessary C extensions to TCL
8    These three TCL libraries are grouped as TCL "packages". They allow
9for complex versioning and have a provide/require model of use, making
10them well suited for maintaining a backwards compatable ports system.
12    The "macports" TCL Library provides a public API into the MacPorts
13system. Any external application wishing to manipulate a port can
14load the "macports" TCL library. 'port', the included command line port
15utility, uses only the exported "macports" API.
17    The "macports" API provides very simple primitives for dealing with
18ports (ie, mportexec/mportopen/mportinit). Also, the API has very little
19knowledge of the contents of a portfile; instead, it relies entirely upon
20the "port" TCL library. By keeping the high level API simple and generic,
21a revision of the underlying ports system will not necessarily require
22a revision of the high level "macports" API.
24    TCL packages allow for complex versioning with a strong requires/provides
25model; this means that a revision of the API at any level will not break
26backwards compatibility.
28    When parsing a port, the "macports" library loads the Portfile into a
29sub-interpreter. The "port" library and all port-specific code is run
30entirely within this sub-interpreter, and thus can never pollute the TCL
31space of other ports, the "macports" library, or the calling application.
33    The "macports" library is also responsible for loading user specified
34options into the sub-interpreter to be evaluated by the "ports" library. In
35that case it sets the variable name in the sub-interpreter and adds the
36option to the sub-interpreter's global array user_options(). User options
37are passed as part of the call to mportopen.
39    The "port" TCL package provides all the primitives required for a mac
40portfile to be parsed, queried, and its actions executed. It also provides
41a single procedure call that the "macports" TCL package uses to kick off
42execution: "eval_targets".
44    The port TCL package is loaded by every Portfile with the following line
45at the start of the Portfile:
46        PortSystem <version required>
47    The version should be set to the version of the port API required to build
48your port. Currently the only version supplied is 1.0.
50    Because a port is not actually parsed, but in fact executed in the TCL
51interpreter, every port option must be a TCL procedure. The ports library
52supplies all these procedures, all of which are generated at run-time using
53the "options" procedure in portutil.tcl.
55    The "pextlib" TCL library provides a variety of otherwise unavailable TCL
56procedures, such as an interface to flock(2) and mkstemp(3).
Note: See TracBrowser for help on using the repository browser.