mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 12:51:51 +03:00
blargh fighting with meson
This commit is contained in:
parent
7a7e7b30f8
commit
8ef34bea65
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
@ -3,6 +3,8 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <ent/config.h>
|
||||
|
||||
/*
|
||||
* Fills buf with high-quality entropy.
|
||||
*
|
23
include/ent/meson.build
Normal file
23
include/ent/meson.build
Normal file
@ -0,0 +1,23 @@
|
||||
conf_data = configuration_data()
|
||||
compiler = meson.get_compiler('c')
|
||||
|
||||
code = '''#include <unistd.h>
|
||||
#include <sys/random.h>
|
||||
int main() { return getentropy((void*)0, 0); }
|
||||
'''
|
||||
have_getentropy = compiler.links(code, name : 'system getentropy')
|
||||
conf_data.set('ENT_USE_GETENTROPY', have_getentropy)
|
||||
|
||||
if not have_getentropy
|
||||
code = '''#include <fcntl.h>
|
||||
int main() { return -1 != open("/dev/urandom", O_RDONLY) ? 0 : 1; }
|
||||
'''
|
||||
use_urandom = compiler.run(code, name : 'open /dev/urandom')
|
||||
conf_data.set('ENT_USE_URANDOM', use_urandom.returncode() == 0)
|
||||
endif
|
||||
|
||||
configure_file(output : 'config.h',
|
||||
configuration : conf_data,
|
||||
install_dir : 'include/ent')
|
||||
|
||||
install_headers('ent.h', subdir : 'ent')
|
29
meson.build
29
meson.build
@ -3,34 +3,13 @@ project('libent', 'c', 'cpp',
|
||||
version : '0.0.1',
|
||||
license : 'MIT')
|
||||
|
||||
conf_data = configuration_data()
|
||||
compiler = meson.get_compiler('c')
|
||||
subdir('include/ent')
|
||||
|
||||
code = '''#include <unistd.h>
|
||||
#include <sys/random.h>
|
||||
int main() { return getentropy((void*)0, 0); }
|
||||
'''
|
||||
have_getentropy = compiler.links(code,name : 'system getentropy')
|
||||
conf_data.set('USE_GETENTROPY', have_getentropy)
|
||||
inc = include_directories('include')
|
||||
|
||||
if not have_getentropy
|
||||
code = '''#include <fcntl.h>
|
||||
int main() { return -1 != open("/dev/urandom", O_RDONLY) ? 0 : 1; }
|
||||
'''
|
||||
use_urandom = compiler.run(code, name : 'open /dev/urandom')
|
||||
conf_data.set('USE_URANDOM', use_urandom.returncode() == 0)
|
||||
endif
|
||||
ent_sources = ['ent.c']
|
||||
|
||||
configure_file(output : 'config.h',
|
||||
configuration : conf_data)
|
||||
|
||||
inc = include_directories('.', 'include')
|
||||
|
||||
install_headers('include/ent.h')
|
||||
|
||||
ent_sources = ['src/ent.c']
|
||||
|
||||
libent = shared_library('ent',
|
||||
libent = both_libraries('ent',
|
||||
ent_sources,
|
||||
include_directories : inc,
|
||||
install : true)
|
||||
|
Loading…
Reference in New Issue
Block a user