Skip to content

Commit db4ebfb

Browse files
committed
Allow use of the library with an Alire pin
- Allow enabling WOLFSSL_STATIC_PSK via an Alire configuration variable - `gnat.adc` applies unconditionally when using the library through Alire, so it has been renamed and used only in the default project file. - Clean-up of the Alire project file `wolfssl.gpr`.
1 parent 8122181 commit db4ebfb

4 files changed

Lines changed: 27 additions & 25 deletions

File tree

wrapper/Ada/alire.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ licenses = "GPL-2.0-only"
99
website = "https://www.wolfssl.com/"
1010
project-files = ["wolfssl.gpr"]
1111
tags = ["ssl", "tls", "embedded", "spark"]
12+
13+
[configuration.variables]
14+
STATIC_PSK = {type = "Boolean", default = false}

wrapper/Ada/default.gpr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ project Default is
2626
for Spec_Suffix ("C") use ".h";
2727
end Naming;
2828

29+
package Builder is
30+
for Global_Configuration_Pragmas use "restricted.adc";
31+
end Builder;
32+
2933
package Compiler is
3034
for Switches ("C") use
3135
("-DWOLFSSL_USER_SETTINGS", -- Use the user_settings.h file.

wrapper/Ada/wolfssl.gpr

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
with "config/wolfssl_config.gpr";
2+
13
library project WolfSSL is
24

35
for Library_Name use "wolfssl";
4-
-- for Library_Version use Project'Library_Name & ".so";
5-
type OS_Kind is ("Windows", "Linux_Or_Mac");
6-
7-
OS : OS_Kind := external ("OS", "Linux_Or_Mac");
86

97
for Languages use ("C", "Ada");
108

@@ -15,12 +13,13 @@ library project WolfSSL is
1513

1614
-- Don't build the tls client or server application.
1715
-- They are not needed in order to build the library.
18-
for Excluded_Source_Files use ("tls_client_main.adb",
19-
"tls_client.ads",
20-
"tls_client.adb",
21-
"tls_server_main.adb",
22-
"tls_server.ads",
23-
"tls_server.adb");
16+
for Excluded_Source_Files use
17+
("tls_client_main.adb",
18+
"tls_client.ads",
19+
"tls_client.adb",
20+
"tls_server_main.adb",
21+
"tls_server.ads",
22+
"tls_server.adb");
2423

2524
for Object_Dir use "obj";
2625
for Library_Dir use "lib";
@@ -34,12 +33,19 @@ library project WolfSSL is
3433
for Spec_Suffix ("C") use ".h";
3534
end Naming;
3635

37-
package Builder is
38-
for Global_Configuration_Pragmas use "gnat.adc";
39-
end Builder;
36+
C_Compiler_Config := ();
37+
38+
case Wolfssl_Config.STATIC_PSK is
39+
when "True" =>
40+
C_Compiler_Config :=
41+
("-DWOLFSSL_STATIC_PSK" -- Enable the static PSK cipher support
42+
);
43+
when others =>
44+
C_Compiler_Config := ();
45+
end case;
4046

4147
package Compiler is
42-
for Switches ("C") use
48+
for Switches ("C") use C_Compiler_Config &
4349
("-DWOLFSSL_USER_SETTINGS", -- Use the user_settings.h file.
4450
"-Wno-pragmas",
4551
"-Wall",
@@ -81,16 +87,5 @@ library project WolfSSL is
8187
package Binder is
8288
for Switches ("Ada") use ("-Es"); -- To include stack traces.
8389
end Binder;
84-
85-
-- case OS is
86-
-- when "Windows" =>
87-
-- for Library_Options use ("-lm", -- To include the math library (used by WolfSSL).
88-
-- "-lcrypt32"); -- Needed on Windows.
89-
-- when "Linux_Or_Mac" =>
90-
-- for Library_Options use ("-lm"); -- To include the math library (used by WolfSSL).
91-
-- end case;
92-
--
93-
-- -- Put user options in front, for options like --as-needed.
94-
-- for Leading_Library_Options use External_As_List ("LDFLAGS", " ");
9590

9691
end WolfSSl;

0 commit comments

Comments
 (0)