From: Sebastian Poeplau <[email protected]>
The GPR files can be used to build the Ada runtime, usually via
libada.gpr as the entry point. This commits extends the GPR project
definitions to make them suitable for shared and static PIC runtime
builds.
When LIBRARY_KIND is "static-pic", the libraries gain a "_pic" suffix,
as expected by the build tools. When it's "dynamic", we configure the
Library_Version attribute in order to set the right SONAME on Unix, as
well as the expected symlinks.
Finally, libgnarl.gpr now depends on libgnat.gpr; the missing dependency
hasn't caused problems so far because static libraries don't resolve
missing symbols at build time, but it's necessary to build shared
libraries.
gcc/ada/ChangeLog:
* libgnarl/libgnarl.gpr: Add dependency on libgnat.gpr.
Set Library_Name and Library_Version depending on Library_Kind.
* libgnat/libgnat.gpr: Likewise.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/libgnarl/libgnarl.gpr | 13 ++++++++++++-
gcc/ada/libgnat/libgnat.gpr | 12 +++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/libgnarl/libgnarl.gpr b/gcc/ada/libgnarl/libgnarl.gpr
index 3933f6f2f3a..c2c0e7eb40e 100644
--- a/gcc/ada/libgnarl/libgnarl.gpr
+++ b/gcc/ada/libgnarl/libgnarl.gpr
@@ -1,4 +1,5 @@
with "libgnat_common";
+with "libgnat";
library project Libgnarl is
@@ -7,7 +8,17 @@ library project Libgnarl is
for Source_List_File use "libgnarl.lst";
for Object_Dir use "../obj-" & Libgnat_Common.Library_Kind;
- for Library_Name use "gnarl";
+ case Libgnat_Common.Library_Kind is
+ when "static-pic" =>
+ for Library_Name use "gnarl_pic";
+ when "dynamic" =>
+ for Library_Name use "gnarl";
+ for Library_Version use
+ "libgnarl-" & Libgnat_Common.Version & ".so";
+ when others =>
+ for Library_Name use "gnarl";
+ end case;
+
for Library_Dir use "../adalib";
for Library_Kind use Libgnat_Common.Library_Kind;
diff --git a/gcc/ada/libgnat/libgnat.gpr b/gcc/ada/libgnat/libgnat.gpr
index 006ff2d8da0..fd2f225381b 100644
--- a/gcc/ada/libgnat/libgnat.gpr
+++ b/gcc/ada/libgnat/libgnat.gpr
@@ -7,7 +7,17 @@ library project Libgnat is
for Source_List_File use "libgnat.lst";
for Object_Dir use "../obj-" & Libgnat_Common.Library_Kind;
- for Library_Name use "gnat";
+ case Libgnat_Common.Library_Kind is
+ when "static-pic" =>
+ for Library_Name use "gnat_pic";
+ when "dynamic" =>
+ for Library_Name use "gnat";
+ for Library_Version use
+ "libgnat-" & Libgnat_Common.Version & ".so";
+ when others =>
+ for Library_Name use "gnat";
+ end case;
+
for Library_Dir use "../adalib";
for Library_Kind use Libgnat_Common.Library_Kind;
--
2.53.0