Two versions of GtkAda.gpr

Probably as a result of a very troublesome install of GtkAda with Alire on my computer I now have two versions of GtkAda.gpr. The question is which one is the correct one.

with “config/gtkada_config.gpr”;

project Gtkada is

for Library_Name use “Gtkada”;
for Library_Version use Project’Library_Name & “.so.” & Gtkada_Config.Crate_Version;

for Source_Dirs use (“src/”, “config/”);
for Object_Dir use “obj/” & Gtkada_Config.Build_Profile;
for Create_Missing_Dirs use “True”;
for Library_Dir use “lib”;

type Library_Type_Type is (“relocatable”, “static”, “static-pic”);
Library_Type : Library_Type_Type :=
external (“GTKADA_LIBRARY_TYPE”, external (“LIBRARY_TYPE”, “static”));
for Library_Kind use Library_Type;

package Compiler is
for Default_Switches (“Ada”) use Gtkada_Config.Ada_Compiler_Switches;
end Compiler;

package Binder is
for Switches (“Ada”) use (“-Es”); – Symbolic traceback
end Binder;

package Install is
for Artifacts (“.”) use (“share”);
end Install;

end Gtkada;

The second is:

with “../gtkada_shared”;

library project GtkAda is
case GtkAda_Shared.Need_Objective_C is
when “yes” => for Languages use (“C”, “Ada”, “Objective-C”);
when “no” => for Languages use (“C”, “Ada”);
end case;

Version := GtkAda_Shared.Version;

– Put “generated” first, so that files are preferably taken from there
– even if they still exist in “.”
for Source_Dirs use (“generated”, “.”);

for Library_Kind use GtkAda_Shared.Library_Kind;
for Library_Name use “gtkada”;
for Library_Version use
“lib” & Project’Library_Name & GtkAda_Shared.So_Ext & “.” & Version;

case GtkAda_Shared.Library_Kind is
when “static-pic” | “relocatable” =>
– Objects used for static-pic and relocatable are exactly the same
for Object_Dir use “obj/gtkada/relocatable”;
for Library_Dir use “lib/gtkada/relocatable”;
when “static” =>
case GtkAda_Shared.So_Ext is
when “.dll” | “.dylib” =>
– On Windows and Darwin, objects are always position
– independent.
for Object_Dir use “obj/gtkada/relocatable”;
for Library_Dir use “lib/gtkada/relocatable”;
when others =>
– This is not the case in general for Unix systems such
– as Linux.
for Object_Dir use “obj/gtkada/static”;
for Library_Dir use “lib/gtkada/static”;
end case;
end case;

case GtkAda_Shared.Library_Kind is
when “relocatable” =>
for Leading_Library_Options use GtkAda_Shared.Ldflags;
for Library_Options use GtkAda_Shared.Gtk_Libs;
when others =>
null;
end case;

package Builder renames GtkAda_Shared.Builder;
package Naming renames GtkAda_Shared.Naming;
package Compiler renames GtkAda_Shared.Compiler;
package Binder renames GtkAda_Shared.Binder;
package IDE renames GtkAda_Shared.IDE;

package Linker is
for Linker_Options use GtkAda_Shared.Gtk_Libs;
end Linker;

package Install is
for Artifacts (“share/gps/plug-ins”) use (“../xml/gtkada.xml”);
for Artifacts (“share/doc/gtkada/gtkada_ug”) use
(“../docs/gtkada_ug/_build/html/*”,
“../docs/gtkada_ug/_build/latex/GtkAda.pdf”);
for Artifacts (“share/doc/gtkada”) use
(“../docs/gtkada_rm/gtkada_rm”);
end Install;

end GtkAda;

As far as I understand the difference is where it is located:

Within the source code directory - you can see the GtkAda - Ada95 binding for the Gimp Toolkit comment at the beginning of the file - this is part of the GtkAda source code and this file is used to compile GtkAda for you. This file is probably similar to gprada.gpr in the source code repository The source code and this file can usually be removed if the library has been installed with gprinstall in a location accessible to other programs.

Outside the source code - but in a location that can be found by other projects - usually using the GPR_PROJECT_PATH environment variable - this file has a comment that says This project has been generated by GPRINSTALL and it has been generated during the installation, when GtkAda is ready to use.

The generated file will be read by other programs using GtkAda.

For example GNAT Studio is using GtkAda and they have with "gtkada"; statement in their code to refer to the file generated and installed by gprinstall.

The GPRbuild and GPR Companion Tools User’s Guide section Installing with GPRinstall explains why the gprinstall creates the second gtkada.gpr file:

Moreover, GPRinstall will create, when needed, a project to use the installed sources, objects or library. By default, this project file is installed in the GPRbuild’s default path location so that it can be “with”ed easily without further configuration. The installation process keeps record of every file installed for easy and safe removal.

First one looks like expected to be used by Alire environment, while second by “regular” build.

Alire doesn’t use gprinstall as far as I know.

1 Like

I found this piece of code, so it might.