No subject


Fri Mar 7 15:32:22 PST 2014


---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----
Just as a very simple primer:
 - port/ contains the tools you run from the command line
   Those should take care of argument parsing and output presentation
 - macports1.0/ is the core of MacPorts
   It knows where all the Portfiles are, manages settings, opens and runs
   Portfiles, etc.
 - port1.0/ is the API available to Portfiles and some helper functions
   All commands available in Portfiles are defined there, along with some
   helpers we use to simplify running Portfiles. Most of this code is usually
   run in a sub-interpreter created in macports1.0.
 - package1.0/ manages all the binary archive downloading and packaging
   If something extracts, packages or downloads a binary archive, it's
   probably using this code.
 - pextlib1.0/ is a collection of helper functions exported to Tcl
   Most of these would otherwise not be available in Tcl and export a Tcl
   command that's used elsewhere.
 - registry2.0/ and cregistry/ are helpers related to the registry
   They provide a Tcl abstraction of the C routines used to talk to the
   SQLite database of installed ports and files.

The rest are rather minor packages:
 - machista1.0/ is a helper library to parse Mach-O binaries
   It is used in rev-upgrade to check for linking errors
 - darwintracelib1.0/ contains a library needed for trace mode
   These are the source files that will be injected into each process using
   DYLD_INSERT_LIBRARIES when using trace mode.
 - programs/ contains helpers, e.g. for launchd plists
 - tcjobjc1.0/ and cflib1.0/ are currently unused
   Those were supposed to be bridges between Tcl and Objective-C or
   CoreFoundation for other (mostly GUI) software to use.

So, e.g. the progress information for downloads is generated in
pextlib1.0/curl.c where the cURL API is used to download files.
pextlib1.0/curl.c exports a Tcl command called "curl", which is used in
port1.0 and package1.0 for downloads. To implement the progress bar, this
command got a new parameter to define a Tcl callback proc to be called with
the updated information. However, since port/port.tcl should take care of how
the progress bar should be displayed, the callback needs to be provided by
this file. To get the correct callback from port/port.tcl to port1.0 and
package1.0 where it is passed to pextlib1.0, it needs to go through
macports1.0 (as you have seen). Always imagine that it should be possible
to replace port/port.tcl with a GUI client (rendering a GUI progress bar).

---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ---- >8 ----

HTH,

-- 
Clemens Lang


More information about the macports-dev mailing list