alire icon indicating copy to clipboard operation
alire copied to clipboard

Enhancement proposal for crate.gpr and crate_config.gpr.

Open Blady-Com opened this issue 2 years ago • 8 comments

The extension of a shared lib, which is depending of the OS, can be easily computed in crate_config.gpr:

   So_Ext := "";
   case Alire_Host_OS is
      when "linux" =>
         So_Ext := ".so";
      when "macos" =>
         So_Ext := ".dylib";
      when "windows" =>
         So_Ext := ".dll";
      when others =>
         So_Ext := ".so";
   end case;

Thus Library_Version can be computed in crate.gpr: for Library_Version use "lib" & Project'Library_Name & Crate_Config.So_Ext & "." & Crate_Config.Crate_Version;

Blady-Com avatar Sep 08 '22 19:09 Blady-Com

Isn't gprbuild already doing the right thing for the file extension?

For the version number, I think this is only done on "UNIX" systems. And with sym-links.

Fabien-Chouteau avatar Sep 12 '22 10:09 Fabien-Chouteau

In my system, there's a symlink from the major number to the precise versioned library:

libX11.so.6 -> libX11.so.6.4.0

Why this isn't done for static libs too I don't know.

mosteo avatar Sep 12 '22 13:09 mosteo

I saw this practice of AdaCore for instance in gnatcoll_sqlite.gpr:

for Library_Version use
            "lib" & project'Library_Name & Gnatcoll.So_Ext & "." & Version;

Blady-Com avatar Sep 15 '22 19:09 Blady-Com

In my system, there's a symlink from the major number to the precise versioned library:

libX11.so.6 -> libX11.so.6.4.0

Why this isn't done for static libs too I don't know.

It’s a runtime thing, I think. You link against libX11.so, which is a symlink to libX11.so.6, which is a symlink to libX11.so.6.4.0, so if at runtime (on another machine, maybe) that final symlink is to libX11.so.6.3.0 the executable can still run.

simonjwright avatar Sep 17 '22 07:09 simonjwright

Why this isn't done for static libs too I don't know.

Static libs are directly linked in the executable. Version can't be anymore change at runtime as Simon explain for dynamic libs. So no need for a version number (when you built the executable you should know which version you linked with :-).

Blady-Com avatar Sep 17 '22 14:09 Blady-Com

Static libs are directly linked in the executable. Version can't be anymore change at runtime as Simon explain for dynamic libs. So no need for a version number (when you built the executable you should know which version you linked with :-).

Yes, but this precludes having two static versions available simultaneously for development. I guess those systems deem one the "current" system-wide.

mosteo avatar Sep 19 '22 08:09 mosteo

@Fabien-Chouteau:

Isn't gprbuild already doing the right thing for the file extension?

Yes.

simonjwright avatar Sep 19 '22 08:09 simonjwright

@mosteo :

Yes, but this precludes having two static versions available simultaneously for development. I guess those systems deem one the "current" system-wide.

I think if you wanted two different relocatable library versions during development you’d keep them in separate directories. Same for static libraries.

simonjwright avatar Sep 19 '22 08:09 simonjwright