Nicolas Boulenguez wrote: > The debian-ada-policy says that the libfoo package should provide the > /usr/share/ada/adainclude/foo.gpr GNAT project file, mentioning the > right path to Library_Dir and Library_ALI_Dir. These path depend on > the current architecture (/usr/lib/DEB_HOST_MULTIARCH and > /usr/lib/DEB_HOST_MULTIARCH/ada/adalib). > > The content of the gpr file should not depend on the architecture, > because it lives in /usr/share. > > I guess we will have to change the policy, and set the default search > path for gpr files to something like > > /usr/share/ada/adainclude (for compatibility) > /usr/lib/DEB_HOST_MULTIARCH/ada/gnat_projects > > Any ideas? I faced the same problem in Fedora. I considered making architecture-dependent variants of all project files, but I found that approach to be problematic. The project search path would have to depend not on the host architecture but on the target architecture. Defining the search path when compiling the Gnat tools wouldn't suffice, because the very same compiler binary can be used to compile both 32-bit and 64-bit programs, so it would be necessary to use different search paths in different invocations of the builder. My solution was to keep the project files architecture-independent, and make them point to different library directories depending on the environment. All Gnat project files that are packaged in Fedora are patched to import a file named directories.gpr. This file defines a variable named Libdir, which the project files use in defining Library_Dir and Library_ALI_Dir, for example like this: for Library_Dir use Directories.Libdir; for Library_ALI_Dir use Directories.Libdir & "/example_library"; The value of Libdir depends on an environment variable named HARDWARE_PLATFORM, which in turn gets its value from the command "uname -i", so that it changes accordingly if the command "setarch" is used. Thus the same project file will point to libraries in either /usr/lib or /usr/lib64 depending on the current architecture. HARDWARE_PLATFORM can also be overridden with a command line parameter if needed. Having introduced a common, distribution-provided Gnat project file, I realized that it was also useful for other purposes. By defining Includedir in the common file I could get rid of all hard-coded directory names in project files. That's why I decided to call it directories.gpr. If we were to change the locations of Ada libraries in Fedora we would only need to edit the RPM spec file that configures directories.gpr, and then just rebuild the packages. I also defined Bindir and Libexecdir for good measure. You can see the template here: http://svn.fedorahosted.org/svn/fedora-gnat-project- common/tags/version-3.3/directories.gpr.in If Debian would adopt this approach it might become possible for project files to look exactly the same in Debian and Fedora. Each distribution would have its own directories.gpr, but all other project files would just import directories.gpr and use the variables the same way in both distributions. Björn
Attachment:
signature.asc
Description: This is a digitally signed message part.