summaryrefslogtreecommitdiff
path: root/net-libs/rustls-ffi/files/rustls-ffi-0.10.0-cargo-c.patch
blob: e51cb398a37fcc1b8a8a7d2326c4f1c52f5a5d3b (plain)
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
https://github.com/rustls/rustls-ffi/pull/274

From ea8c871eba61af4f656cb20d8b1b62a3e50c8a0a Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Sat, 10 Dec 2022 12:00:41 +0100
Subject: [PATCH 1/2] Move the language configuration to cbindgen.toml

---
 Makefile      | 2 +-
 cbindgen.toml | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index efd5beba..e9fdff1c 100644
--- a/Makefile
+++ b/Makefile
@@ -39,7 +39,7 @@ target:
 	mkdir -p $@
 
 src/rustls.h: src/*.rs cbindgen.toml
-	cbindgen --lang C > $@
+	cbindgen > $@
 
 target/$(PROFILE)/librustls_ffi.a: src/*.rs Cargo.toml
 	RUSTFLAGS="-C metadata=rustls-ffi" ${CARGO} build $(CARGOFLAGS)
diff --git a/cbindgen.toml b/cbindgen.toml
index ffcc0fcf..a5a6cf1c 100644
--- a/cbindgen.toml
+++ b/cbindgen.toml
@@ -1,4 +1,5 @@
 include_guard = "RUSTLS_H"
+language = "C"
 
 usize_is_size_t = true
 

From 76542bbc4634fddf17f3e575cea60da63a3a9ad9 Mon Sep 17 00:00:00 2001
From: Luca Barbato <lu_zero@gentoo.org>
Date: Sat, 10 Dec 2022 12:29:23 +0100
Subject: [PATCH 2/2] Initial cargo-c support

---
 Cargo.toml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Cargo.toml b/Cargo.toml
index d90689cf..b16e9d98 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ rust-version = "1.57"
 # libraries.
 no_log_capture = []
 read_buf = ["rustls/read_buf"]
+capi = []
 
 [dependencies]
 # Keep in sync with RUSTLS_CRATE_VERSION in build.rs
@@ -34,3 +35,16 @@ num_enum = "0.5.10"
 [lib]
 name = "rustls_ffi"
 crate-type = ["lib", "staticlib"]
+
+
+[package.metadata.capi.header]
+name = "rustls"
+subdirectory = false
+
+[package.metadata.capi.library]
+name = "rustls"
+rustflags = "-Cmetadata=rustls-ffi"
+
+[package.metadata.capi.pkg_config]
+name = "rustls"
+filename = "rustls"