1. Getting Started

Alire is a source package manager for Ada/SPARK. Its purpose is to manage the dependencies of Ada/SPARK projects, and to provide a simple way to manage their build process. Day-to-day interactions with Alire are mediated by the alr command-line tool.

The basic unit of source code in Alire is a crate, which can be a library for use by other crates, or a standalone executable. Alire provides convenient means to create new crates, manage dependencies on other crates, and fetch, build, test and install crates and their dependencies.

1.1. About Alire for GNAT Pro

Alire for GNAT Pro differs from the version intended for the open-source community (maintained here) in that it is geared primarily towards private development, though it still supports the use of crates from the open-source community if configured to do so. Once configured appropriately for your hosting arrangement, the usage of the two versions is virtually identical. The community documentation (available here) is therefore likely to be a useful resource for most purposes, and this documentation will focus on the configuration required for developing private crates.

1.2. Installation

To install alr, navigate to the root of the extracted package and run the provided install script with

./doinstall <installation-directory>

where <installation-directory> is a suitable location of your choice, then ensure that <installation-directory>/bin is in your PATH.

1.3. Configuring an Index

Before you can use most of Alire’s features, you will need to configure it with an index it can search for crates. If you haven’t already set up your own index and crate origins (see Alire Indexes for full details of this process), you can get started using either the example index which accompanies Alire for GNAT Pro (under share/examples/alire/), or the community index of open-source crates. In any case, this is achieved with the alr index command. The example index can be added with

alr index --add "file:/absolute/path/to/share/examples/alire/index/" --name example

while the community index can be added with

alr index --add "git+https://github.com/alire-project/alire-index" --name community

You can test that the index is working with alr search --list, which will display all the crates recorded in the index. For the example index, you should see hello, hello_registry, and libhello.

If you are using your own index, additional configuration may be required. In particular, you may need to set the value of origins.git.trusted_sites and origins.archive.download_cmd with the alr settings command. See Alire Origins and the output of alr settings --help for full details.

1.4. Using Alire

You can now begin using alr, for example by creating a new crate with alr init, or fetching an existing crate with alr get <crate-name>. A step-by-step introduction can be found here. For detailed information on all of alr’s functionality, use the alr help command.