1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
Description: let projects allow build flags and dynamic linking.
Allow the user to set ADAFLAGS (and LDFLAGS for dynamic links).
.
Stop testing if LIBDIR and OBJDIR exist.
The Makefile does not set them.
.
If SOVERSION is not empty, build a shared library.
This should not affect the default behaviour,
since the Makefile does not set this variable.
.
Use different object and library directories for shared and static
builds, so the patch modifies the directory names.
As far as I know, in normal usage, these directories are only used
internally by gprbuild/install/clean.
Author: Nicolas Boulenguez <nicolas@debian.org>
Forwarded: https://github.com/AdaCore/aunit/pull/4
--- a/lib/gnat/aunit.gpr
+++ b/lib/gnat/aunit.gpr
@@ -15,14 +15,27 @@
"../../include/aunit/framework/" & AUnit_Shared.Memory,
"../../include/aunit/framework/" & AUnit_Shared.FileIO);
- for Library_Dir use AUnit_Shared.Library_Dir;
-
- Obj_Dir := external ("AUNIT_OBJDIR", "../aunit-obj/"
- & AUnit_Shared.Target & "-" & AUnit_Shared.Runtime);
- for Object_Dir use Obj_Dir;
+ for Library_Dir use "../aunit/"
+ & Aunit_Shared.Target & "-"
+ & Aunit_Shared.Runtime & "-"
+ & Aunit_Shared.Library_Kind;
+
+ for Object_Dir use "../aunit-obj/"
+ & AUnit_Shared.Target & "-"
+ & AUnit_Shared.Runtime & "-"
+ & Aunit_Shared.Library_Kind;
for Library_Name use "aunit";
- for Library_Kind use "static";
+ for Library_Kind use AUnit_Shared.Library_Kind;
+ case AUnit_Shared.Library_Kind is
+ when "dynamic" =>
+ for Library_Version use "lib" & Project'Library_Name & ".so."
+ & Aunit_Shared.Soversion;
+ -- Put options like --as-needed before the libraries.
+ for Leading_Library_Options use Aunit_Shared.Ldflags;
+ when "static" =>
+ null;
+ end case;
--------------
-- Compiler --
@@ -39,6 +52,9 @@
for Default_Switches ("ada") use
("-O2", "-gnatp", "-gnatn", "-gnatwa.X");
end case;
+ -- Allow user flags to override default flags.
+ for Default_Switches ("ada") use Compiler'Default_Switches ("ada")
+ & Aunit_Shared.Adaflags;
for Switches ("aunit.adb") use
Compiler'Default_Switches ("ada") & ("-fno-strict-aliasing");
--- a/lib/gnat/aunit_shared.gpr
+++ b/lib/gnat/aunit_shared.gpr
@@ -14,7 +14,20 @@
Runtime : Runtime_Type := external ("AUNIT_RUNTIME", "full");
- Library_Dir := external ("AUNIT_LIBDIR", "../aunit/" & Target & "-" & Runtime);
+ -- The default is empty, and requires a static build.
+ -- A non-empty soversion requires a shared library.
+ Soversion := External ("SOVERSION", "");
+ type A_Library_Kind is ("dynamic", "static");
+ Library_Kind : A_Library_Kind := "static";
+ case Soversion is
+ when "" =>
+ null;
+ when others =>
+ Library_Kind := "dynamic";
+ end case;
+
+ Adaflags := External_As_List ("ADAFLAGS", " ");
+ Ldflags := External_As_List ("LDFLAGS", " ");
for Source_Dirs use ();
|