Alire

Alire

Build

git clone https://github.com/alire-project/alire.git
cd alire
git submodule update --init --recursive
dev/build.sh

Toolchain Configuration

Display the Alire toolchain by entering

alr toolchain

Pick the combination of tools by entering

alr toolchain --select

Hint

Alire manages its own toolchain. Alire can use external tools and manage its own toolchain including cross compilers. If, however, you are using Alire on a machine without internet access then the community index is unavailable including the description of the external toolchain.

Thus, you need to either download and set up the community index or create a local index containing at least the packages gnat_external-external and gprbuild-external.

Toml-based Crate Specification Language

Catalog Format Specification

The following shows a minimal package congiguration:

name = "[name]"
description = "[description]"
version = "[version]"
maintainers = "[maintainers]"

[origin]
commit = "[commit-hash]"
url = "[repo-url]"

Replacing [commit-hash] with a valid commit hash and [repo-url] with the URL of the repository where the crate resides. Herein, the repository URL introduces the protocol by which to fetch the crate.

Hint

git+ssh://[user@]server/project.git, git+https://example.com/gitproject.git, or git+file:///srv/git/project.git are valid protocol schemes.

Diverging Project File

If the GPR project file is different from the crate’s name specify it using the field project-files:

project-files = ["relative/path/to/project.gpr"]

Ada 2022

[build-switches]
"*".ada_version = "Ada2022"

Creating a Private Index

Using Alire with private crates

Any Alire index contains a file stating the minimum allowed Alire version to operate this index. Thus, create index/index.toml with the following content:

version = "1.4.0"

Index Management

Add Index

alr index --add=/home/joergen/git/local-index --name=local

Remove Index

alr index --del=local

Reset Community Index

alr index --reset-community

Publishing to a Private Index

In order to publish a crate to the newly created index, copy the file alire.toml to the index renaming it to index/[first-two-letters-of-name]/[name]/[name]-[version].toml. E.g., when publishing a crate named dungeon with version 0.1.0 then the index file must be index/du/dungeon-0.1.0.toml.

Furthermore, the crate file needs to be extended with the following:

[origin]
commit = "[commit-hash]"
url = "[repo-url]"