Ada
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
In this blog post of 2 June 2022, AdaCore announced "the end of the GNAT Community releases with 2021 being the last one. We encourage all GNAT Community users to transition to Alire going forward." However, this section nevertheless describes a Portage-based Ada setup based on installing the now-deprecated dev-lang/gnat-gpl package.
USE flags
USE flags for dev-lang/gnat-gpl GNAT Ada Compiler - GPL version
ada
|
Build the ADA language (GNAT) frontend |
bootstrap
|
Used to bootstrap gnat-gpl |
cet
|
Enable support for Intel Control Flow Enforcement Technology (CET) |
cxx
|
Build support for C++ (bindings, extra libraries, code generation, ...) |
d
|
Enable support for the D programming language |
debug
|
Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces |
default-stack-clash-protection
|
Build packages with stack clash protection on by default |
default-znow
|
Request full relocation on start from ld.so by default |
doc
|
Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally |
fixed-point
|
Enable fixed-point arithmetic support for MIPS targets in gcc (Warning: significantly increases compile time!) |
fortran
|
Add support for fortran |
go
|
Build the GCC Go language frontend. |
graphite
|
Add support for the framework for loop optimizations based on a polyhedral intermediate representation |
hardened
|
Activate default security enhancements for toolchain (gcc, glibc, binutils) |
jit
|
Enable just-in-time compilation for improved performance. May prevent use of some PaX memory protection features in Gentoo Hardened. |
libssp
|
Build SSP support into a dedicated library rather than use the code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES) |
lto
|
Enable Link-Time Optimization (LTO) to optimize the build |
modula2
|
Build the GCC Modula-2 language frontend. |
multilib
|
On 64bit systems, if you want to be able to compile 32bit and 64bit binaries |
nls
|
Add Native Language Support (using gettext - GNU locale utilities) |
objc
|
Build support for the Objective C code language |
objc++
|
Build support for the Objective C++ language |
objc-gc
|
Build support for the Objective C code language Garbage Collector |
openmp
|
Build support for the OpenMP (support parallel computing), requires >=sys-devel/gcc-4.2 built with USE="openmp" |
pch
|
Enable precompiled header support for faster compilation at the expense of disk space and memory |
pgo
|
Build GCC using Profile Guided Optimization (PGO) |
pie
|
Build programs as Position Independent Executables (a security hardening technique) |
rust
|
Build support for the Rust language, installs gccrs. |
sanitize
|
Build support for various sanitizer functions (ASAN/TSAN/etc...) |
ssp
|
Build packages with stack smashing protector on by default |
systemtap
|
enable systemtap static probe points |
test
|
Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently) |
vanilla
|
Do not add extra patches which change default behaviour; DO NOT USE THIS ON A GLOBAL SCALE as the severity of the meaning changes drastically |
vtv
|
Build support for virtual table verification (a C++ hardening feature) |
zstd
|
Enable support for ZSTD compression |
Emerge
root #
emerge --ask dev-lang/gnat-gpl
Configuration
Add the location of the installed GNAT binaries to the PATH, e.g. via .bash_profile:
export PATH="${PATH}:/usr/x86_64-pc-linux-gnu/gcc-bin/10/"
Emacs setup
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:
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:
(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
- "Introduction to Ada" on AdaCore.com
- "Ada Programming" WikiBook
- "Introduction to Embedded Systems Programming" using Ada, on AdaCore.com
- GNAT User's Guide for Native Platforms
- GNAT Reference Manual
- GNATcoll Core Components
- ada-mode
Groups
- the Ada Forum on ada-lang.io
- The comp.lang.ada (weblink) newsgroup on Usenet. Also readable via ada-lang.io
References
- ↑ Post on forum.ada-lang.io. Retrieved on 2024-03-13.