From f43a1de0b053f48ed6cb137280a85d65101ccebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= Date: Thu, 8 Feb 2024 15:43:11 +0100 Subject: [PATCH] Support external libnanomsg better for --use_system_libnanomsg=true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nanomsg headers are installed in /usr/include/nanomsg but only ancient versions (0.8 and before) provided -I/usr/include/nanomsg in libnanomsg.pc, if ever. The embedded source is for 1.1.0, the previous commit stopped using libnanomsg.pc. Instead, pass -DSYSTEM_NANOMSG=1 to the compiler when using --use_system_libnanomsg=true and use conditional compiling to include headers from the correct location. Signed-off-by: Zoltán Böszörményi --- binding.gyp | 8 +++++++- src/node_nanomsg.cc | 21 ++++++++++++++++++++- src/poll_ctx.cc | 4 ++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/binding.gyp b/binding.gyp index 8395d52..7072e3b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -19,11 +19,14 @@ }], ['OS=="linux" and use_system_libnanomsg=="true"', { 'include_dirs+': [ - '(info[0]).FromJust(); int protocol = Nan::To(info[1]).FromJust(); diff --git a/src/poll_ctx.cc b/src/poll_ctx.cc index 79da123..404cf5f 100644 --- a/src/poll_ctx.cc +++ b/src/poll_ctx.cc @@ -1,4 +1,8 @@ +#ifndef SYSTEM_NANOMSG #include "nn.h" +#else +#include "nanomsg/nn.h" +#endif #include "poll_ctx.h" void PollCtx::on_readable(uv_poll_t* req, int /* status */, int events) {