GNAT Config

Intended audience: developers and distribution maintainers.

To download click here.

The GNAT Config package allows you to install more than one GNAT on a Linux based operating system.


Make sure you download the "noarch" package and not the "src" package. They both contain basically the same files but install them at different locations. "src" installs them where distribution maintainers need them (as a tar.bz2 file in /work/rpm/SOURCES) - "noarch" where users need them (in /opt/gnat/bin).

Installation Guides

Relocation Guide

You don't actually need to be a system administrator (root password) to install the package at its original position — but you need write access to /opt/gnat! If you have neither then you need to relocate the package:

 rpm --install --prefix=/home/myname/gnat gnat-conf-1.0.0-r2.noarch.rpm

Of corse this only works when you have write access to the RPM database. You can create your own to use. First edit or create the ~/.rpmmacros file to add the follwing two lines:

 %_dbpath         /var/lib/rpm
 %_dbpath_rebuild /home/myname/.rpm

then run

 rpm --rebuilddb

And now you have your own local RPM database. To actually use that database you need to edit ~/.rpmmacros again:

 %_dbpath         /home/myname/.rpm
 %_dbpath_rebuild /home/myname/.rpm

User Installation Guide.

Add the following line to your ~/.bashrc file:

 source /opt/gnat/bin/Setup_GNAT.bash

System Administrator Installation Guide.

If you want to install the GNAT Config package for all users on your system, add a text file named /etc/profile.d/ to your system. The file should contain just one line:

 source /opt/gnat/bin/Setup_GNAT.bash

We could of course provide such a file — but then the package would not be 100% relocatable anymore.

If GNAT Config package is installed from root then it will also create an user and a group called "gnat". You many add any trusted user to that group which will then gain write access to the files of the gnat installation. That way maintanance of the compiler tool chain is not attached to knowing the root password.

If you need a finer tuned access then we suggest read man setfacl.

How does it work?

The /opt/gnat/bin/Setup_GNAT.bash script will add a two functions to your bash shell. They are called Set_GNAT and Show_GNAT.

Shows the current gnat setup - including the all relevant environment variables.
Sets the gnat system you want to use. There are four options open:
switches to GNAT/GPL.
switches to GNAT/GCC.
gcc mingw
switches to GNAT/GCC and activates the MinGW cross compiler.
switches to GNAT/Pro - if you have one.
switches back to the compiler from your system distribution.

On first call the function remembers all environment variables it changes and with Set_GNAT sys it switches back.

For convinience the following aliases are defined:

 alias gnatgcc='Set_GNAT gcc'
 alias gnatgpl='Set_GNAT gpl'
 alias gnatmingw='Set_GNAT gpl mingw'
 alias gnatpro='Set_GNAT pro'
 alias gnatsys='Set_GNAT sys'

Ada programming, © 2005,2006 the Authors, Content is available under GNU Free Documentation License.