Packages

CM Modula-3 is distributed as a set of packages. Each package is contained in a single directory which conforms to a standard structure. The top level directory should contain a README file (or index.html), and a src subdirectory containing Modula-3 source files, and a derived directory for each platform on which the package has been built.

The location of public packages, as well as any other variable is specified in the cm3.cfg configuration file which is located in the same directory as cm3 executable program. You can move the compiler or the public packages around, as long as the configuration file stays at the same directory as the compiler.

There are three primary types of packages: source, program, and library. A source package contains a collection of sources, like html files; it builds nothing. A program package constructs a single executable program by compiling and linking the contents of a set of source packages. Similarly, a library package constructs a single library from a set of source packages.

The m3makefile, that describes the package, resides in the src subdirectory of the package. Although it is common for all the Modula-3 sources to also reside in the src directory, they may be distributed in a more complex directory structure rooted at src.

The m3makefile for a source package simply lists the pieces of source that are to be included in programs or libraries that include the source package.

The m3makefile for a program package names the sources needed to build the program, and the packages that it uses to satisfy its imports. It ends with a single program() or Program() invocation. See the example.

The m3makefile for a library package names the sources to be included in the library, and the packages that it uses to satisfy its imports. It ends with a single library() or Library() invocation.

Note that as in a program, all the imports of a package must be satisfied. If a package A builds a library and any of the objects in that library import interfaces from another library package B, then import(B) must be specified in A's m3makefile.

Use cm3 -ship command to install a private package in the public repository. Note that on some systems, you must have special privileges to install public packages.