Ada

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

Ada is programming language designed for large, long-lived applications — and embedded systems in particular — where safety and security are essential.

Ada is used by a number of the packages in the Gentoo ebuild repository.

Installation

The Ada community has in recent years moved towards Alire, a language-specific package manager. AdaCore discontinued GNAT Community (packaged as dev-lang/gnat-gpl) in favor of this. However, GNAT Community still has value in Gentoo for bootstrapping a newer version of GNAT in sys-devel/gcc.

Following recent changes for bug #547358, installing GCC's Ada compiler (GNAT) should be far easier.

Emerge

Remove any legacy PATH hacks or configuration in /etc/portage/make.conf set from previous attempts to install/use GNAT.

First, enable ada for sys-devel/gcc:

FILE /etc/portage/package.use
sys-devel/gcc ada

Then rebuild GCC:

root #emerge --ask --oneshot --changed-use sys-devel/gcc

Emacs setup

Note
As at 2024-03-13, ada-mode is effectively unmaintained, due to the primary developer having retired.[1]

The recommended way to install ada-mode is via Alire; download and install the current Linux version of Alire if necessary.

If use of Alire is not possible for some reason, ensure dev-ada/gnatcoll-core is installed:

root #emerge --ask dev-ada/gnatcoll-core

Install the latest version of ada-mode, using your preferred method of managing Emacs packages. An app-emacs/ada-mode::gnu-elpa package is available via the gnu-elpa overlay.

On the command line, change to the directory in which ada-mode has been installed, e.g.:

user $cd ~/.config/emacs/elpa/ada-mode-8.1.0/

and then run:

user $./build.sh # This can be memory-intensive!

If the Alire alr binary is installed and configured correctly, it will be used for the build-and-install process. Otherwise, the install.sh will need to be run:

user $./install.sh

By default, files are installed into ${HOME}/.local/bin/, as the appropriate XDG directory. To specify a different location for the bin directory, pass it as the first argument to install.sh.

If not using Alire, version 8.1.0 of ada-mode requires copying the file ada_annex_p_lr1_re2c_parse_table.txt from the top level of the ada-mode-8.1.0 directory to the relevant installation location.

Add the installation location to the PATH, e.g. via .bash_profile:

FILE ~/.bash_profile
export PATH="${PATH}:${HOME}/.local/bin"

and restart the login session.

Depending on the installation method, ada-mode might need to be enabled manually in the Emacs configuration file:

FILE ~/.config/emacs/init.el
(require 'ada-mode)

By default, wisi is used for things like faces (ada-face-backend) and indentation (ada-indent-backend); however, the AdaCore ada_language_server (als) can be used for cross-references, via eglot. Refer to the ada customize-group and the ada-mode home page for further information.

See also

External resources

Learning and reference

Groups

References

  1. Post on forum.ada-lang.io. Retrieved on 2024-03-13.