[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: arch-dependant gpr files

Nicolas Boulenguez wrote:
> GNAT projects may be considered a particular case of headers varying
> across architectures, but located in /usr/share by policy.
> Many Ada -dev packages contain such headers, for example generated C
> bindings, and would remain buggy even with a sensible GNAT project
> structure.

This shouldn't be too hard to solve. One C library that has such a header file, 
that I happen to know about, is Glib. Glib keeps its architecture-dependent 
bits in glibconfig.h, which is located in an architecture-specific directory, 
for example /usr/lib/x86_64-linux-gnu/glib-2.0/include/glibconfig.h. The rest 
of the Glib headers are in /usr/include/glib-2.0. When compiling against Glib 
you're supposed to run "pkg-config --cflags glib-2.0", which outputs something 
like "-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include".

It's easy to do the equivalent with GNAT project files. Having imported 
directories.gpr you can write:

for Source_Dirs use (Directories.Includedir & "/example",
                     Directories.Libdir & "/example/include");

Other layouts are also possible. One could for example make architecture-
specific subdirectories in /usr/include and refer to them as 
«Directories.Includedir & "/" & Directories.Hardware_Platform».

It would of course be best if we could do this similarly enough across 
distributions that the same project file can still work in all distributions. 
Perhaps we could define a variable, "Archincludedir" or something, if that 
would improve compatibility, although there is no such variable in the GNU 
Coding Standards. (For the "*dir" variables I've defined so far I've used the 
same names as in the GNU Coding Standards.)


Attachment: signature.asc
Description: This is a digitally signed message part.

Reply to: