comp.lang.ada
 help / color / mirror / Atom feed
From: "Björn Persson" <bjorn@xn--rombobjrn-67a.se>
Subject: Re: One united Ada policy for all Linux distributions?
Date: Wed, 19 May 2010 15:24:07 +0200
Date: 2010-05-19T15:24:07+02:00	[thread overview]
Message-ID: <85i73nF41eU2@mid.individual.net> (raw)
In-Reply-To: 15rwx3bkqj8p9$.18lm12fadj9m7$.dlg@40tude.net

Dmitry A. Kazakov wrote:

> Ideally gpr files should be installed where GPS,
> gprbuild, gnatmake could look after them. GNAT GPL's GPS does it in
> <GNAT-root>/lib/gnat. I think the policy should mandate a directory under
> /usr/lib or /usr/include for all gpr files rather than project-dependent
> directories.

The question of where to store .gpr files is actually rather complicated. 
The .gpr file for a library needs to point to architecture-specific library 
files, which makes the .gpr file itself architecture-specific if the 
location is hard-coded. For example, a multilib system may have a 32-bit 
/usr/lib/lib<library>.so with .ali files in /usr/lib/<library>/, and a 64-
bit /usr/lib64/lib<library>.so with .ali files in /usr/lib64/<library>/. It 
would then need two different .gpr files, one pointing to /usr/lib/<library> 
and the other to /usr/lib64/<library>. One might then try putting the .gpr 
files somewhere in /usr/lib* too, for example /usr/lib/gnat/<library>.gpr 
and /usr/lib64/gnat/<library>.gpr. That doesn't work however, because 
although Gnat can be configured to look for .gpr files in multiple 
directories, it will look in the same set of directories regardless of 
whether it's compiling for 32-bit or 64-bit mode, and use the first .gpr 
file with a matching name that it finds. If it finds the 64-bit 
<library>.gpr first, then compiling 32-bit binaries fails, and vice versa.

To solve this problem in Fedora I parameterize the .gpr files. There is a 
file named common.gpr which defines the variable Lib as either "lib" or 
"lib64" depending on an environment variable named HARDWARE_PLATFORM. 
HARDWARE_PLATFORM is defined by a snippet of shell script in 
/etc/profile.d/, and can be changed with the command "setarch". All the 
other .gpr files import common.gpr and use the variable Lib like this:

   for Library_Dir use "/usr/" & Common.Lib;
   for Library_ALI_Dir use "/usr/" & Common.Lib & "/<library>";

That makes the .gpr files architecture-independent. According to the 
Filesystem Hierarchy Standard they should then be somewhere under 
/usr/share. I keep them in /usr/lib/gnat however, because that's where Gnat 
looks for them (but not in /usr/lib64/gnat, only in /usr/lib/gnat). This is 
controlled by an RPM macro named _GNAT_project_dir, so if I were to move the 
.gpr files I would only need to change the macro and rebuild the packages.

-- 
Bj�rn Persson
PGP key A88682FD



  parent reply	other threads:[~2010-05-19 13:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 10:29 One united Ada policy for all Linux distributions? Ludovic Brenta
2010-05-18  9:32 ` Ludovic Brenta
2010-05-18 10:04   ` Dmitry A. Kazakov
2010-05-18 10:19     ` Ludovic Brenta
2010-05-18 12:16       ` Dmitry A. Kazakov
2010-05-18 13:09         ` Ludovic Brenta
2010-05-18 14:00           ` Dmitry A. Kazakov
2010-05-19 13:24     ` Björn Persson [this message]
2010-05-20 10:49       ` Stephen Leake
2010-05-19 13:23   ` Björn Persson
2010-05-19 14:13     ` Dmitry A. Kazakov
2010-05-19 14:41       ` Ludovic Brenta
2010-05-19 14:47       ` Björn Persson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox