Drop libuv dependency
libuv was only ever used for the tcp server for almost 4 years. Since the non-libuv implementation of that is working now, it can be dropped entirely without sacrificing functionality.
This commit is contained in:
parent
5f97d93327
commit
b85636317c
14 changed files with 3 additions and 490 deletions
|
|
@ -36,7 +36,6 @@ build*
|
|||
test/.tmp/*
|
||||
subprojects/capstone-*/
|
||||
!subprojects/capstone-*.wrap
|
||||
subprojects/libuv-*/
|
||||
subprojects/libzip-*/
|
||||
subprojects/lz4-*/
|
||||
subprojects/packagecache/
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -117,7 +117,6 @@ peda-session-*
|
|||
.cache/
|
||||
test/.tmp/*
|
||||
subprojects/capstone-*/
|
||||
subprojects/libuv-*/
|
||||
subprojects/libzip-*/
|
||||
subprojects/lz4-*/
|
||||
subprojects/packagecache/
|
||||
|
|
|
|||
1
dist/deb/debian.rules
vendored
1
dist/deb/debian.rules
vendored
|
|
@ -16,7 +16,6 @@ EXTRA_FLAGS+= -Duse_sys_libzip=disabled
|
|||
EXTRA_FLAGS+= -Duse_sys_zlib=disabled
|
||||
EXTRA_FLAGS+= -Duse_sys_lz4=disabled
|
||||
EXTRA_FLAGS+= -Duse_sys_xxhash=disabled
|
||||
EXTRA_FLAGS+= -Duse_sys_libuv=disabled
|
||||
EXTRA_FLAGS+= -Duse_sys_openssl=disabled
|
||||
|
||||
# architectures with debugging support
|
||||
|
|
|
|||
2
dist/osx/build_osx_package.sh
vendored
2
dist/osx/build_osx_package.sh
vendored
|
|
@ -9,7 +9,7 @@ OSXPKGDIR=/tmp/osxpkgtmp
|
|||
|
||||
rm -rf buildtmp
|
||||
mkdir buildtmp
|
||||
meson buildtmp --buildtype=release -Duse_libuv=false -Denable_tests=false -Dlocal=disabled --prefix=/usr/local
|
||||
meson buildtmp --buildtype=release -Denable_tests=false -Dlocal=disabled --prefix=/usr/local
|
||||
rm -rf "${RIZININSTALL}"
|
||||
DESTDIR="${RIZININSTALL}" ninja -C buildtmp install
|
||||
rm -rf buildtmp
|
||||
|
|
|
|||
2
dist/rpm/rizin.spec
vendored
2
dist/rpm/rizin.spec
vendored
|
|
@ -66,8 +66,6 @@ information
|
|||
%ifarch s390x
|
||||
-Ddebugger=false \
|
||||
%endif
|
||||
-Duse_sys_libuv=disabled \
|
||||
-Duse_libuv=true \
|
||||
-Denable_tests=false \
|
||||
-Denable_rz_test=false \
|
||||
-Dlocal=disabled \
|
||||
|
|
|
|||
|
|
@ -150,10 +150,6 @@ rz_core_deps = [
|
|||
mth,
|
||||
]
|
||||
|
||||
if libuv_dep.found()
|
||||
rz_core_deps += libuv_dep
|
||||
endif
|
||||
|
||||
rz_core = library('rz_core', rz_core_sources,
|
||||
include_directories: rz_core_inc,
|
||||
dependencies: rz_core_deps,
|
||||
|
|
|
|||
205
librz/core/rtr.c
205
librz/core/rtr.c
|
|
@ -8,10 +8,6 @@
|
|||
#include <libgdbr.h>
|
||||
#include <gdbserver/core.h>
|
||||
|
||||
#if HAVE_LIBUV
|
||||
#include <uv.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
SECURITY IMPLICATIONS
|
||||
=====================
|
||||
|
|
@ -1002,205 +998,6 @@ RZ_API bool rz_core_rtr_init(RZ_NONNULL RzCore *core) {
|
|||
return rtr_host;
|
||||
}
|
||||
|
||||
#if HAVE_LIBUV
|
||||
|
||||
typedef struct rtr_cmds_context_t {
|
||||
uv_tcp_t server;
|
||||
RzPVector clients;
|
||||
void *bed;
|
||||
} rtr_cmds_context;
|
||||
|
||||
typedef struct rtr_cmds_client_context_t {
|
||||
RzCore *core;
|
||||
char buf[4096];
|
||||
char *res;
|
||||
size_t len;
|
||||
uv_tcp_t *client;
|
||||
} rtr_cmds_client_context;
|
||||
|
||||
static void rtr_cmds_client_close(uv_tcp_t *client, bool remove) {
|
||||
uv_loop_t *loop = client->loop;
|
||||
rtr_cmds_context *context = loop->data;
|
||||
if (remove) {
|
||||
size_t i;
|
||||
for (i = 0; i < rz_pvector_len(&context->clients); i++) {
|
||||
if (rz_pvector_at(&context->clients, i) == client) {
|
||||
rz_pvector_remove_at(&context->clients, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rtr_cmds_client_context *client_context = client->data;
|
||||
uv_close((uv_handle_t *)client, (uv_close_cb)free);
|
||||
free(client_context->res);
|
||||
free(client_context);
|
||||
}
|
||||
|
||||
static void rtr_cmds_alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) {
|
||||
rtr_cmds_client_context *context = handle->data;
|
||||
buf->base = context->buf + context->len;
|
||||
buf->len = sizeof(context->buf) - context->len - 1;
|
||||
}
|
||||
|
||||
static void rtr_cmds_write(uv_write_t *req, int status) {
|
||||
rtr_cmds_client_context *context = req->data;
|
||||
|
||||
if (status) {
|
||||
eprintf("Write error: %s\n", uv_strerror(status));
|
||||
}
|
||||
|
||||
free(req);
|
||||
rtr_cmds_client_close(context->client, true);
|
||||
}
|
||||
|
||||
static void rtr_cmds_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) {
|
||||
rtr_cmds_context *context = client->loop->data;
|
||||
rtr_cmds_client_context *client_context = client->data;
|
||||
|
||||
if (nread < 0) {
|
||||
if (nread != UV_EOF) {
|
||||
eprintf("Failed to read: %s\n", uv_err_name((int)nread));
|
||||
}
|
||||
rtr_cmds_client_close((uv_tcp_t *)client, true);
|
||||
return;
|
||||
} else if (nread == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
buf->base[nread] = '\0';
|
||||
char *end = strchr(buf->base, '\n');
|
||||
if (!end) {
|
||||
return;
|
||||
}
|
||||
*end = '\0';
|
||||
|
||||
rz_cons_sleep_end(context->bed);
|
||||
client_context->res = rz_core_cmd_str(client_context->core, (const char *)client_context->buf);
|
||||
context->bed = rz_cons_sleep_begin();
|
||||
|
||||
if (!client_context->res || !*client_context->res) {
|
||||
free(client_context->res);
|
||||
client_context->res = strdup("\n");
|
||||
}
|
||||
|
||||
if (!client_context->res || (!rz_config_get_i(client_context->core->config, "scr.prompt") && !strcmp((char *)buf, "q!")) ||
|
||||
!strcmp((char *)buf, ".--")) {
|
||||
rtr_cmds_client_close((uv_tcp_t *)client, true);
|
||||
return;
|
||||
}
|
||||
|
||||
uv_write_t *req = RZ_NEW(uv_write_t);
|
||||
if (req) {
|
||||
req->data = client_context;
|
||||
uv_buf_t wrbuf = uv_buf_init(client_context->res, (unsigned int)strlen(client_context->res));
|
||||
uv_write(req, client, &wrbuf, 1, rtr_cmds_write);
|
||||
}
|
||||
uv_read_stop(client);
|
||||
}
|
||||
|
||||
static void rtr_cmds_new_connection(uv_stream_t *server, int status) {
|
||||
if (status < 0) {
|
||||
eprintf("New connection error: %s\n", uv_strerror(status));
|
||||
return;
|
||||
}
|
||||
|
||||
rtr_cmds_context *context = server->loop->data;
|
||||
|
||||
uv_tcp_t *client = RZ_NEW(uv_tcp_t);
|
||||
if (!client) {
|
||||
return;
|
||||
}
|
||||
|
||||
uv_tcp_init(server->loop, client);
|
||||
if (uv_accept(server, (uv_stream_t *)client) == 0) {
|
||||
rtr_cmds_client_context *client_context = RZ_NEW(rtr_cmds_client_context);
|
||||
if (!client_context) {
|
||||
uv_close((uv_handle_t *)client, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
client_context->core = server->data;
|
||||
client_context->len = 0;
|
||||
client_context->buf[0] = '\0';
|
||||
client_context->res = NULL;
|
||||
client_context->client = client;
|
||||
client->data = client_context;
|
||||
|
||||
uv_read_start((uv_stream_t *)client, rtr_cmds_alloc_buffer, rtr_cmds_read);
|
||||
|
||||
rz_pvector_push(&context->clients, client);
|
||||
} else {
|
||||
uv_close((uv_handle_t *)client, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtr_cmds_stop(uv_async_t *handle) {
|
||||
uv_close((uv_handle_t *)handle, NULL);
|
||||
|
||||
rtr_cmds_context *context = handle->loop->data;
|
||||
|
||||
uv_close((uv_handle_t *)&context->server, NULL);
|
||||
|
||||
void **it;
|
||||
rz_pvector_foreach (&context->clients, it) {
|
||||
uv_tcp_t *client = *it;
|
||||
rtr_cmds_client_close(client, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void rtr_cmds_break(uv_async_t *async) {
|
||||
uv_async_send(async);
|
||||
}
|
||||
|
||||
RZ_API void rz_core_rtr_cmds(RzCore *core, const char *port) {
|
||||
if (!port || port[0] == '?') {
|
||||
rz_cons_printf("Usage: .:[tcp-port] run rizin commands for clients\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uv_loop_t *loop = RZ_NEW(uv_loop_t);
|
||||
if (!loop) {
|
||||
return;
|
||||
}
|
||||
uv_loop_init(loop);
|
||||
|
||||
rtr_cmds_context context;
|
||||
rz_pvector_init(&context.clients, NULL);
|
||||
loop->data = &context;
|
||||
|
||||
context.server.data = core;
|
||||
uv_tcp_init(loop, &context.server);
|
||||
|
||||
struct sockaddr_in addr;
|
||||
bool local = (bool)rz_config_get_i(core->config, "tcp.islocal");
|
||||
int porti = rz_socket_port_by_name(port);
|
||||
uv_ip4_addr(local ? "127.0.0.1" : "0.0.0.0", porti, &addr);
|
||||
|
||||
uv_tcp_bind(&context.server, (const struct sockaddr *)&addr, 0);
|
||||
int r = uv_listen((uv_stream_t *)&context.server, 32, rtr_cmds_new_connection);
|
||||
if (r) {
|
||||
eprintf("Failed to listen: %s\n", uv_strerror(r));
|
||||
goto beach;
|
||||
}
|
||||
|
||||
uv_async_t stop_async;
|
||||
uv_async_init(loop, &stop_async, rtr_cmds_stop);
|
||||
|
||||
rz_cons_break_push((RzConsBreak)rtr_cmds_break, &stop_async);
|
||||
context.bed = rz_cons_sleep_begin();
|
||||
uv_run(loop, UV_RUN_DEFAULT);
|
||||
rz_cons_sleep_end(context.bed);
|
||||
rz_cons_break_pop();
|
||||
|
||||
beach:
|
||||
uv_loop_close(loop);
|
||||
free(loop);
|
||||
rz_pvector_clear(&context.clients);
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/**
|
||||
* Command TCP Server
|
||||
*
|
||||
|
|
@ -1302,5 +1099,3 @@ err_socket:
|
|||
err_sp:
|
||||
rz_stop_pipe_free(sp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#define HAVE_LIB_XXHASH @HAVE_LIB_XXHASH@
|
||||
#define USE_LIB_XXHASH @USE_LIB_XXHASH@
|
||||
#define HAVE_LIB_SSL @HAVE_OPENSSL@
|
||||
#define HAVE_LIBUV @HAVE_LIBUV@
|
||||
#define HAVE_PTRACE @HAVE_PTRACE@
|
||||
#define USE_PTRACE_WRAP @USE_PTRACE_WRAP@
|
||||
#define HAVE_FORK @HAVE_FORK@
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ if meson.is_cross_build()
|
|||
userconf_native.set10('HAVE_LIB_XXHASH', false)
|
||||
userconf_native.set10('USE_LIB_XXHASH', false)
|
||||
userconf_native.set10('HAVE_OPENSSL', false)
|
||||
userconf_native.set10('HAVE_LIBUV', false)
|
||||
userconf_native.set10('HAVE_LZMA', false)
|
||||
userconf_native.set10('HAVE_ZLIB', false)
|
||||
|
||||
|
|
|
|||
17
meson.build
17
meson.build
|
|
@ -283,21 +283,6 @@ libdemangle_dep = libdemangle_proj.get_variable('libdemangle_dep')
|
|||
# handle openssl library
|
||||
sys_openssl = dependency('openssl', required: get_option('use_sys_openssl'), static: is_static_build)
|
||||
|
||||
# handle libuv library
|
||||
libuv_dep = disabler()
|
||||
if get_option('use_libuv')
|
||||
r = run_command(py3_exe, check_meson_subproject_py, 'libuv', check: false)
|
||||
if r.returncode() == 1 and get_option('subprojects_check')
|
||||
error('Subprojects are not updated. Please run `git clean -dxff subprojects/` to delete all local subprojects directories. If you want to compile against current subprojects then set option `subprojects_check=false`.')
|
||||
endif
|
||||
|
||||
libuv_dep = dependency('libuv', version: '>=1.0.0', required: get_option('use_sys_libuv'), static: is_static_build)
|
||||
if not libuv_dep.found()
|
||||
libuv_proj = subproject('libuv', default_options: ['default_library=static'])
|
||||
libuv_dep = libuv_proj.get_variable('libuv_dep')
|
||||
endif
|
||||
endif
|
||||
|
||||
# handle tree-sitter
|
||||
r = run_command(py3_exe, check_meson_subproject_py, 'tree-sitter', check: false)
|
||||
if r.returncode() == 1 and get_option('subprojects_check')
|
||||
|
|
@ -392,7 +377,6 @@ foreach it : ccs
|
|||
it_userconf.set('PLUGINS', rizin_plugins)
|
||||
it_userconf.set('BINDINGS', rizin_bindings)
|
||||
it_userconf.set10('HAVE_OPENSSL', sys_openssl.found())
|
||||
it_userconf.set10('HAVE_LIBUV', libuv_dep.found())
|
||||
it_userconf.set10('WANT_DYLINK', true)
|
||||
it_userconf.set10('HAVE_PTRACE', have_ptrace)
|
||||
it_userconf.set10('USE_PTRACE_WRAP', use_ptrace_wrap)
|
||||
|
|
@ -758,7 +742,6 @@ summary({
|
|||
'System xxhash library': xxhash_dep.found() and xxhash_dep.type_name() != 'internal',
|
||||
'System libmspack library': libmspack_dep.found() and libmspack_dep.type_name() != 'internal',
|
||||
'System openssl library': sys_openssl.found() and sys_openssl.type_name() != 'internal',
|
||||
'System libuv library': libuv_dep.found() and libuv_dep.type_name() != 'internal',
|
||||
'System capstone library': capstone_dep.found() and capstone_dep.type_name() != 'internal',
|
||||
'System tree-sitter library': tree_sitter_dep.found() and tree_sitter_dep.type_name() != 'internal',
|
||||
'System lz4 library': lz4_dep.found() and lz4_dep.type_name() != 'internal',
|
||||
|
|
|
|||
|
|
@ -32,8 +32,6 @@ option('use_sys_xxhash', type: 'feature', value: 'disabled')
|
|||
option('use_sys_openssl', type: 'feature', value: 'disabled')
|
||||
option('use_sys_libmspack', type: 'feature', value: 'disabled')
|
||||
option('use_sys_tree_sitter', type: 'feature', value: 'disabled')
|
||||
option('use_sys_libuv', type: 'feature', value: 'auto', description: 'Whether to force, suggest or not use at all the system version of libuv. If system version is not found, one is built statically, unless use_libuv is false.')
|
||||
option('use_libuv', type: 'boolean', value: true, description: 'If true, libuv is used to handle remote features')
|
||||
option('use_swift_demangler', type: 'boolean', value: true, description: 'If false, disables the swift demangler')
|
||||
option('use_gpl', type: 'boolean', value: true, description: 'Set to false when you want to disable gpl code')
|
||||
option('install_sigdb', type: 'boolean', value: false, description: 'Downloads and installs rizin sigdb')
|
||||
|
|
|
|||
|
|
@ -80,6 +80,3 @@ parts:
|
|||
- libssl-dev
|
||||
- libbsd-dev
|
||||
- libcapstone-dev
|
||||
- libuv1-dev
|
||||
stage-packages:
|
||||
- libuv1
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
[wrap-file]
|
||||
directory = libuv-v1.40.0
|
||||
|
||||
source_url = https://raw.githubusercontent.com/rizinorg/fallback-repo/main/libuv-v1.40.0.tar.gz
|
||||
source_filename = libuv-v1.40.0.tar.gz
|
||||
source_hash = 61a90db95bac00adec1cc5ddc767ebbcaabc70242bd1134a7a6b1fb1d498a194
|
||||
source_fallback_url = https://dist.libuv.org/dist/v1.40.0/libuv-v1.40.0.tar.gz
|
||||
|
||||
patch_directory = libuv-v1.40.0
|
||||
|
|
@ -1,240 +0,0 @@
|
|||
project('libuv', 'c', version : '1.40.0', license : 'libuv', default_options: ['werror=false'])
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
uvsrc = [
|
||||
'src/fs-poll.c',
|
||||
'src/idna.c',
|
||||
'src/inet.c',
|
||||
'src/random.c',
|
||||
'src/strscpy.c',
|
||||
'src/threadpool.c',
|
||||
'src/timer.c',
|
||||
'src/uv-common.c',
|
||||
'src/uv-data-getter-setters.c',
|
||||
'src/version.c',
|
||||
]
|
||||
|
||||
uvdefines = [ ]
|
||||
|
||||
pthread = dependency('threads')
|
||||
libuv_deps = [
|
||||
cc.find_library('m', required: false),
|
||||
cc.find_library('dl', required: false),
|
||||
pthread
|
||||
]
|
||||
|
||||
if host_machine.system() == 'windows'
|
||||
uvsrc += [
|
||||
'src/win/async.c',
|
||||
'src/win/core.c',
|
||||
'src/win/detect-wakeup.c',
|
||||
'src/win/dl.c',
|
||||
'src/win/error.c',
|
||||
'src/win/fs.c',
|
||||
'src/win/fs-event.c',
|
||||
'src/win/getaddrinfo.c',
|
||||
'src/win/getnameinfo.c',
|
||||
'src/win/handle.c',
|
||||
'src/win/loop-watcher.c',
|
||||
'src/win/pipe.c',
|
||||
'src/win/thread.c',
|
||||
'src/win/poll.c',
|
||||
'src/win/process.c',
|
||||
'src/win/process-stdio.c',
|
||||
'src/win/signal.c',
|
||||
'src/win/snprintf.c',
|
||||
'src/win/stream.c',
|
||||
'src/win/tcp.c',
|
||||
'src/win/tty.c',
|
||||
'src/win/udp.c',
|
||||
'src/win/util.c',
|
||||
'src/win/winapi.c',
|
||||
'src/win/winsock.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-DWIN32_LEAN_AND_MEAN',
|
||||
'-D_WIN32_WINNT=0x0602',
|
||||
]
|
||||
libuv_deps += [
|
||||
cc.find_library('psapi'),
|
||||
cc.find_library('user32'),
|
||||
cc.find_library('advapi32'),
|
||||
cc.find_library('iphlpapi'),
|
||||
cc.find_library('userenv'),
|
||||
cc.find_library('ws2_32'),
|
||||
]
|
||||
else
|
||||
uvsrc += [
|
||||
'src/unix/async.c',
|
||||
'src/unix/core.c',
|
||||
'src/unix/dl.c',
|
||||
'src/unix/fs.c',
|
||||
'src/unix/getaddrinfo.c',
|
||||
'src/unix/getnameinfo.c',
|
||||
'src/unix/loop-watcher.c',
|
||||
'src/unix/loop.c',
|
||||
'src/unix/pipe.c',
|
||||
'src/unix/poll.c',
|
||||
'src/unix/process.c',
|
||||
'src/unix/random-devurandom.c',
|
||||
'src/unix/signal.c',
|
||||
'src/unix/stream.c',
|
||||
'src/unix/tcp.c',
|
||||
'src/unix/thread.c',
|
||||
'src/unix/tty.c',
|
||||
'src/unix/udp.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D_FILE_OFFSET_BITS=64',
|
||||
'-D_LARGEFILE_SOURCE'
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'android'
|
||||
uvsrc += [
|
||||
'src/unix/android-ifaddrs.c',
|
||||
'src/unix/linux-core.c',
|
||||
'src/unix/linux-inotify.c',
|
||||
'src/unix/linux-syscalls.c',
|
||||
'src/unix/procfs-exepath.c',
|
||||
'src/unix/pthread-fixes.c',
|
||||
'src/unix/random-getentropy.c',
|
||||
'src/unix/random-getrandom.c',
|
||||
'src/unix/random-sysctl-linux.c',
|
||||
'src/unix/proctitle.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D_GNU_SOURCE',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'dragonfly' or host_machine.system() == 'freebsd'
|
||||
uvsrc += [
|
||||
'src/unix/freebsd.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system().endswith('bsd') or host_machine.system() == 'dragonfly'
|
||||
uvsrc += [
|
||||
'src/unix/posix-hrtime.c',
|
||||
'src/unix/bsd-proctitle.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system().endswith('bsd') or host_machine.system() == 'dragonfly' or host_machine.system() == 'darwin'
|
||||
uvsrc += [
|
||||
'src/unix/bsd-ifaddrs.c',
|
||||
'src/unix/kqueue.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'freebsd'
|
||||
uvsrc += [
|
||||
'src/unix/random-getrandom.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'openbsd' or host_machine.system() == 'darwin'
|
||||
uvsrc += [
|
||||
'src/unix/random-getentropy.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'darwin'
|
||||
uvsrc += [
|
||||
'src/unix/darwin-proctitle.c',
|
||||
'src/unix/darwin.c',
|
||||
'src/unix/fsevents.c',
|
||||
'src/unix/proctitle.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D_DARWIN_USE_64_BIT_INODE=1',
|
||||
'-D_DARWIN_UNLIMITED_SELECT=1'
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'linux'
|
||||
uvsrc += [
|
||||
'src/unix/linux-core.c',
|
||||
'src/unix/linux-inotify.c',
|
||||
'src/unix/linux-syscalls.c',
|
||||
'src/unix/procfs-exepath.c',
|
||||
'src/unix/pthread-fixes.c', # useful for e.g. Termux, identified as Linux
|
||||
'src/unix/random-getrandom.c',
|
||||
'src/unix/random-sysctl-linux.c',
|
||||
'src/unix/proctitle.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D_GNU_SOURCE',
|
||||
'-D_POSIX_C_SOURCE=200112',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'netbsd'
|
||||
uvsrc += [
|
||||
'src/unix/netbsd.c',
|
||||
]
|
||||
libuv_deps += [
|
||||
cc.find_library('kvm', required: true),
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'openbsd'
|
||||
uvsrc += [
|
||||
'src/unix/openbsd.c',
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'sunos'
|
||||
uvsrc += [
|
||||
'src/unix/no-proctitle.c',
|
||||
'src/unix/sunos.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D__EXTENSIONS__',
|
||||
'-D_XOPEN_SOURCE=500',
|
||||
]
|
||||
libuv_deps += [
|
||||
cc.find_library('kstat', required: true),
|
||||
cc.find_library('nsl', required: true),
|
||||
cc.find_library('sendfile', required: true),
|
||||
cc.find_library('socket', required: true),
|
||||
]
|
||||
endif
|
||||
|
||||
if host_machine.system() == 'haiku'
|
||||
uvsrc += [
|
||||
'src/unix/haiku.c',
|
||||
'src/unix/bsd-ifaddrs.c',
|
||||
'src/unix/no-fsevents.c',
|
||||
'src/unix/no-proctitle.c',
|
||||
'src/unix/posix-hrtime.c',
|
||||
'src/unix/posix-poll.c',
|
||||
]
|
||||
uvdefines += [
|
||||
'-D_BSD_SOURCE',
|
||||
]
|
||||
libuv_deps += [
|
||||
cc.find_library('bsd', required: true),
|
||||
cc.find_library('network', required: true),
|
||||
]
|
||||
endif
|
||||
|
||||
add_project_arguments(
|
||||
# https://github.com/libuv/libuv/issues/2603
|
||||
cc.get_supported_arguments('-fcommon'),
|
||||
language: 'c',
|
||||
)
|
||||
uvincdir = include_directories('include', 'src', 'src/unix')
|
||||
|
||||
libuv = library('uv',
|
||||
uvsrc,
|
||||
c_args: uvdefines,
|
||||
dependencies: libuv_deps,
|
||||
include_directories: uvincdir,
|
||||
install: false,
|
||||
)
|
||||
|
||||
libuv_dep = declare_dependency(link_with: libuv,
|
||||
include_directories: include_directories('include'))
|
||||
Loading…
Reference in a new issue