1 Running mzc
2 Compiling Modified Modules to Bytecode
3 Creating and Distributing Stand-Alone Executables
4 Packaging Library Collections
5 Compiling and Linking C Extensions
6 Embedding Scheme Modules via C
7 Compiling to Raw Bytecode
8 Compiling to Native Code via C
9 Scheme API for Compilation
Index
On this page:
4.1 Scheme API for Packaging
Version: 4.0.2

 

4 Packaging Library Collections

Before creating a ".plt" archive to distribute, consider instead posting your package on PLaneT.

The command-line flags --plt and --collection-plt direct mzc to create an archive for distributing library files to PLT Scheme users. A distribution archive usually has the suffix ".plt", which DrScheme recognizes as an archive to provide automatic unpacking facilities. The setup-plt program also supports ".plt" unpacking.

An archive contains the following elements:

Use the --plt flag to specify individual directories and files for the archive. Each file and directory must be specified with a relative path. By default, if the archive is unpacked with DrScheme, the user will be prompted for a target directory, and if setup-plt is used to unpack the archive, the files and directories will be unpacked relative to the current directory. If the --at-plt flag is provided to mzc, the files and directories will be unpacked relative to the user’s PLT Scheme add-ons directory, instead. Finally, if the --all-users flag is provided to mzc, the files and directories will be unpacked relative to the PLT Scheme installation directory, instead.

Use the --collection-plt flag to pack one or more collections; sub-collections can be designated by using a / as a path separator on all platforms. In this mode, mzc automatically uses paths relative to the PLT Scheme installation or add-ons directory for the archived files, and the collections will be set-up after unpacking. In addition, mzc consults each collection’s "info.ss" file, as described below, to determine the set of required and conflicting collections. Finally, mzc consults the first collection’s "info.ss" file to obtain a default name for the archive. For example, the following command creates a "sirmail.plt" archive for distributing a "sirmail" collection:

  mzc --collection-plt sirmail.plt sirmail

When packing collections, mzc checks the following fields of each collection’s "info.ss" file (see "info.ss" File Format):

For example, the "info.ss" file in the "sirmail" collection might contain the following info declaration:

  #lang setup/infotab

  (define name "SirMail")

  (define mred-launcher-libraries (list "sirmail.ss"))

  (define mred-launcher-names (list "SirMail"))

  (define requires (list (list "mred")))

Then, the "sirmail.plt" file (created by the command-line example above) will contain the name “SirMail.” When the archive is unpacked, the unpacker will check that the MrEd collection is installed (not just MzScheme), and that MrEd has the same version as when "sirmail.plt" was created.

4.1 Scheme API for Packaging

Although mzc’s command-line interface is sufficient for most purposes, see the setup/pack library for a more general interface for constructing archives.