Skip to content

Commit a784a33

Browse files
committed
libsodium: use meson build system when cross compiling, else system
1 parent 9269a58 commit a784a33

3 files changed

Lines changed: 4 additions & 48 deletions

File tree

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

meson.build

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,52 +25,12 @@ if nacl_impl == 'tweetnacl'
2525
cblk_src += 'src/crypto/tweetnacl.c'
2626
cblk_args += '-DUSE_TWEETNACL'
2727
elif nacl_impl == 'sodium'
28-
29-
# we only support cross compiling to arm-none-eabi targets
30-
if meson.is_cross_build() == true
31-
32-
mod = import('unstable-external_project')
33-
34-
configure_opts = [
35-
'--enable-minimal',
36-
'--disable-ssp',
37-
'--disable-pie',
38-
'--enable-static',
39-
'--disable-shared',
40-
'--without-pthreads',
41-
'--prefix=@PREFIX@',
42-
'--libdir=@PREFIX@/@LIBDIR@',
43-
'--includedir=@PREFIX@/@INCLUDEDIR@',
44-
]
45-
sodium_env = environment()
46-
target_c_args = get_option('c_args')
47-
48-
c_flags_str = '-O3 '
49-
foreach arg : target_c_args
50-
c_flags_str += arg + ' '
51-
endforeach
52-
53-
sodium_env.set('CFLAGS', c_flags_str)
54-
sodium_env.set('LDFLAGS', '-specs=nosys.specs')
55-
56-
cross_configure_opt = [
57-
'--host=arm-none-eabi',
58-
]
59-
60-
libsodium_proj = mod.add_project('src/crypto/sodium/configure',
61-
configure_options : configure_opts,
62-
verbose : false,
63-
cross_configure_options : cross_configure_opt,
64-
env : sodium_env,
65-
)
66-
67-
sodium_dep = libsodium_proj.dependency('sodium')
68-
28+
if meson.is_cross_build()
29+
sodium_proj = subproject('sodium', required: true)
30+
sodium_dep = sodium_proj.get_variable('sodium_dep')
6931
else
70-
sodium_dep = dependency('sodium', required: true)
32+
sodium_dep = dependency('libsodium', required: true)
7133
endif
72-
73-
7434
cblk_deps += sodium_dep
7535
cblk_args += '-DUSE_SODIUM'
7636
endif

src/crypto/sodium

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)