Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.

Previous: , Up: Programming in Scheme   [Contents][Index]


4.7 Installing Site Packages

At some point, you will probably want to share your code with other people. To do so effectively, it is important to follow a set of common conventions, to make it easy for the user to install and use your package.

The first thing to do is to install your Scheme files where Guile can find them. When Guile goes to find a Scheme file, it will search a load path to find the file: first in Guile’s own path, then in paths for site packages. A site package is any Scheme code that is installed and not part of Guile itself. See Load Paths, for more on load paths.

There are several site paths, for historical reasons, but the one that should generally be used can be obtained by invoking the %site-dir procedure. See Build Config. If Guile 2.2 is installed on your system in /usr/, then (%site-dir) will be /usr/share/guile/site/2.2. Scheme files should be installed there.

If you do not install compiled .go files, Guile will compile your modules and programs when they are first used, and cache them in the user’s home directory. See Compilation, for more on auto-compilation. However, it is better to compile the files before they are installed, and to just copy the files to a place that Guile can find them.

As with Scheme files, Guile searches a path to find compiled .go files, the %load-compiled-path. By default, this path has two entries: a path for Guile’s files, and a path for site packages. You should install your .go files into the latter directory, whose value is returned by invoking the %site-ccache-dir procedure. As in the previous example, if Guile 2.2 is installed on your system in /usr/, then (%site-ccache-dir) site packages will be /usr/lib/guile/2.2/site-ccache.

Note that a .go file will only be loaded in preference to a .scm file if it is newer. For that reason, you should install your Scheme files first, and your compiled files second. See Load Paths, for more on the loading process.

Finally, although this section is only about Scheme, sometimes you need to install C extensions too. Shared libraries should be installed in the extensions dir. This value can be had from the build config (see Build Config). Again, if Guile 2.2 is installed on your system in /usr/, then the extensions dir will be /usr/lib/guile/2.2/extensions.


Previous: , Up: Programming in Scheme   [Contents][Index]