alire
alire copied to clipboard
Enhancement proposal for crate.gpr and crate_config.gpr.
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;
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.
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.
I saw this practice of AdaCore for instance in gnatcoll_sqlite.gpr:
for Library_Version use
"lib" & project'Library_Name & Gnatcoll.So_Ext & "." & Version;
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.
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 :-).
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.
@Fabien-Chouteau:
Isn't gprbuild already doing the right thing for the file extension?
Yes.
@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.