commit 4e37d92
shrub
·
2026-07-31 15:21:09 +0000 UTC
parent e66893f
always use libtls-bearssl with a meson wrap
4 files changed,
+63,
-2
+2,
-0
1@@ -3,3 +3,5 @@
2
3 assets/resourcepacks/default
4
5+subprojects/.wraplock
6+subprojects/libtls-bearssl/
+4,
-2
1@@ -11,12 +11,14 @@ cc = meson.get_compiler('c')
2 math_dep = cc.find_library('m', required: false)
3 sdl_dep = dependency('sdl2')
4 zlib_dep = dependency('zlib')
5-tls_dep = dependency('libtls')
6+libtls_sp = subproject('libtls-bearssl', default_options: [ 'default_library=static' ])
7+tls_dep = libtls_sp.get_variable('libtls_dep')
8 bearssl_dep = cc.find_library('bearssl')
9 renderer_backend = get_option('renderer')
10
11 sources = [
12 'source/main.c',
13+ 'source/mg_random.c',
14 'source/util.c',
15 'source/world/chunk.c',
16 'source/client/camera.c',
17@@ -25,7 +27,7 @@ sources = [
18 'source/mcproto/client.c',
19 'source/mcproto/crypto.c',
20 'source/platform/platform.c',
21- 'vendor/stb_image_c89.c',
22+ 'vendor/stb_image_c89.c',
23 ]
24
25 include_dirs = [
+8,
-0
1@@ -0,0 +1,8 @@
2+[wrap-git]
3+url = https://github.com/michaelforney/libtls-bearssl.git
4+revision = 9cf87946fb300fb0c534338cb8a6ad36741fe8fb
5+depth = 1
6+patch_directory = libtls-bearssl
7+
8+[provide]
9+libtls = libtls_dep
1@@ -0,0 +1,49 @@
2+project(
3+ 'libtls-bearssl',
4+ 'c',
5+ version: '0.6',
6+ default_options: [ 'c_std=c99' ],
7+)
8+
9+cc = meson.get_compiler('c')
10+bearssl_dep = cc.find_library('bearssl')
11+thread_dep = dependency('threads')
12+
13+libtls_sources = [
14+ 'tls.c',
15+ 'tls_bio_cb.c',
16+ 'tls_client.c',
17+ 'tls_config.c',
18+ 'tls_conninfo.c',
19+ 'tls_keypair.c',
20+ 'tls_ocsp.c',
21+ 'tls_peer.c',
22+ 'tls_server.c',
23+ 'tls_util.c',
24+ 'tls_verify.c',
25+ 'bearssl.c',
26+ 'compat/explicit_bzero.c',
27+ 'compat/freezero.c',
28+ 'compat/reallocarray.c',
29+ 'compat/timingsafe_memcmp.c',
30+]
31+
32+libtls_inc = include_directories('.')
33+
34+libtls_lib = static_library(
35+ 'tls',
36+ libtls_sources,
37+ include_directories: libtls_inc,
38+ dependencies: [ bearssl_dep, thread_dep ],
39+ c_args: [
40+ '-D_GNU_SOURCE',
41+ '-DLIBRESSL_INTERNAL',
42+ '-Wno-shadow',
43+ ],
44+)
45+
46+libtls_dep = declare_dependency(
47+ include_directories: libtls_inc,
48+ link_with: libtls_lib,
49+ dependencies: [ bearssl_dep, thread_dep ],
50+)