Skip to content

Commit 07749ab

Browse files
committed
support: allow override of ADAFLAGS, LDFLAGS, library soversion
1 parent 4b25d1f commit 07749ab

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

support/langkit_support.gpr

+23-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ library project Langkit_Support is
1212
Library_Kind_Param : Library_Kind_Type := external
1313
("LIBRARY_TYPE", external ("LANGKIT_SUPPORT_LIBRARY_TYPE", "static"));
1414

15+
SO_Name := External ("LANGKIT_SONAME", "");
16+
17+
Ada_Flags := External_As_List ("ADAFLAGS", " ");
18+
Ld_Flags := External_As_List ("LDFLAGS", " ");
19+
1520
for Languages use ("Ada");
1621
for Source_Dirs use (".");
1722
for Object_Dir use "obj/" & Build_Mode;
@@ -65,20 +70,33 @@ library project Langkit_Support is
6570

6671
for Library_Dir use "lib/" & Library_Kind_Param & "/" & Build_Mode;
6772

73+
case Library_Kind_Param is
74+
when "relocatable" =>
75+
case SO_Name is
76+
when "" =>
77+
null;
78+
when others =>
79+
for Library_Version use SO_Name;
80+
end case;
81+
for Leading_Library_Options use Ld_Flags;
82+
when "static" | "static-pic" =>
83+
null;
84+
end case;
85+
6886
Common_Ada_Cargs := ("-gnatwa", "-gnatyg", "-fPIC");
6987

7088
package Compiler is
89+
Mode_Args := ();
7190
case Build_Mode is
7291
when "dev" =>
73-
for Default_Switches ("Ada") use
74-
Common_Ada_Cargs & ("-g", "-O0", "-gnatwe", "-gnata");
75-
92+
Mode_Args := ("-g", "-O0", "-gnatwe", "-gnata");
7693
when "prod" =>
7794
-- Debug information is useful even with optimization for
7895
-- profiling, for instance.
79-
for Default_Switches ("Ada") use
80-
Common_Ada_Cargs & ("-g", "-Ofast");
96+
Mode_Args := ("-g", "-Ofast");
8197
end case;
98+
for Default_Switches ("Ada") use Common_Ada_Cargs & Mode_Args
99+
& Ada_Flags;
82100
end Compiler;
83101

84102
end Langkit_Support;

0 commit comments

Comments
 (0)