For Gauche 0.9.5


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

3.8 Using extension packages

Building and installing packages

Gauche comes with some amount of libraries, but they aren’t enough at all to use Gauche in the production environment. There are number of additional libraries available. We call them extension packages, or simply packages. Each package usually provides one or more modules that adds extra functionality. Most of the packages provide binding to other C libraries, such as graphics libraries or database clients. If the package has some C code, it is likely that you need to compile it on your machine with the installed Gauche system.

Usually a package is in the form of compressed tarball, and the standard "ungzip + untar + configure + make + make install" sequence does the job. Read the package’s document, for you may be able to tailor the library for your own needs by giving command-line options to the configure script.

From Gauche 0.8, an utility script called gauche-package is installed for the convenience. It automates the build and install process of packages.

Suppose you have downloaded a package Package-1.0.tar.gz. If the package follows the convention, all you have to do is to type this:

$ gauche-package install Package-1.0.tar.gz

It ungzips and untars the package, cd into the Package-1.0 subdirectory, run configure, make, and make install. By default, gauche-package untars the tarball in the current working directory. You can change it by a customization file; see below.

If you need a special priviledge to install the files, you can use --install-as option which runs make install part via the sudo program.

$ gauche-package install --install-as=root Package-1.0.tar.gz

If it doesn’t work for you, you can just build the package by gauche-package build Package-1.0.tar.gz, then manually cd to the Package-1.0 directory and run make install.

You can give configuration options via -C or --configure-options command-line argument, like this:

$ gauche-package install -C "--prefix=/usr/local" Package-1.0.tar.gz

If the package has adopted the new package description file, it can remember the configuration options you have specified, and it will automatically reuse them when you install the package again. (If you’re a package developer, check out examples/spigot/README file in the Gauche source tree to see how to cooperate with Gauche’s package management system.)

If you don’t have a tarball in your local directory, but you know the URL where you can download it, you can directly give the URL to gauche-package. It understands http and ftp, and uses either wget or ncftpget to download the tarball, then runs configure and make.

$ gauche-package install http://www.example.com/Package-1.0.tar.gz

Customizing gauche-package

The gauche-package program reads ~/.gauche-package if it exists. It must contain an associative list of parameters. It may look like this:

(
 (build-dir . "/home/shiro/tmp")
 (gzip      . "/usr/local/bin/gzip")
 (bzip2     . "/usr/local/bin/bzip2")
 (tar       . "/usr/local/bin/gtar")
)

The following is a list of recognized parameters. If the program isn’t given in the configuration file, gauche-package searches PATH to find one.

build-dir

A directory where the tarball is extracted. If URL is given, the downloaded file is also placed in this directory.

bzip2

Path to the program bzip2.

cat

Path to the program cat.

make

Path to the program make.

ncftpget

Path to the program ncftpget.

rm

Path to the program rm.

sudo

Path to the program sudo.

tar

Path to the program tar.

wget

Path to the program wget.


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