Skip to content

Instantly share code, notes, and snippets.

@neomantra
Created September 15, 2018 03:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neomantra/419a2516f56b63fc4965f64576fec830 to your computer and use it in GitHub Desktop.
Save neomantra/419a2516f56b63fc4965f64576fec830 to your computer and use it in GitHub Desktop.
# Builds lua_ipython_kernel on centos
ARG IMAGE_BASE="centos"
ARG IMAGE_TAG="7"
FROM ${IMAGE_BASE}:${IMAGE_TAG}
RUN yum install -y \
epel-release \
&& yum install -y \
cmake \
gcc \
gcc-c++ \
gcc-devel \
git \
libtool \
make \
openssl-devel \
pkgconfig \
python-pip \
readline-devel \
tar \
unzip \
uuid-devel \
&& yum clean all
ARG LIBSODIUM_VERSION="1.0.16"
RUN curl -L https://download.libsodium.org/libsodium/releases/libsodium-${LIBSODIUM_VERSION}.tar.gz | tar zx \
&& cd libsodium-${LIBSODIUM_VERSION} \
&& ./configure \
&& make clean \
&& make \
&& make install \
&& cd .. \
&& rm -rf libsodium-${LIBSODIUM_VERSION}
ARG ZMQ_VERSION="4.1.4"
RUN curl -L https://archive.org/download/zeromq_${ZMQ_VERSION}/zeromq-${ZMQ_VERSION}.tar.gz | tar zx \
&& cd zeromq-${ZMQ_VERSION} \
&& PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -rf zeromq-${ZMQ_VERSION}
ARG LUAJIT_VERSION="2.1.0-beta3"
RUN curl -L http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.tar.gz | tar zx \
&& cd LuaJIT-${LUAJIT_VERSION} \
&& make \
&& make install \
&& cd .. \
&& rm -rf LuaJIT-${LUAJIT_VERSION} \
&& ln -sf /usr/local/bin/luajit-2.1.0-beta3 /usr/local/bin/luajit
ARG LUAROCKS_VERSION="2.4.3"
RUN curl -fSL https://github.com/luarocks/luarocks/archive/${LUAROCKS_VERSION}.tar.gz -o luarocks-${LUAROCKS_VERSION}.tar.gz \
&& tar xzf luarocks-${LUAROCKS_VERSION}.tar.gz \
&& cd luarocks-${LUAROCKS_VERSION} \
&& ./configure \
--lua-suffix=jit-${LUAJIT_VERSION} \
--with-lua-include=/usr/local/include/luajit-2.1 \
&& make build \
&& make install \
&& cd /tmp \
&& rm -rf luarocks-${LUAROCKS_VERSION} luarocks-${LUAROCKS_VERSION}.tar.gz
ADD lua-zmq.patch.1 /lua-zmq.patch.1
# Patch is required to fix these two distinct issues:
# https://github.com/zeromq/cppzmq/issues/40
# https://github.com/openresty/lua-cjson/issues/21
RUN git clone git://github.com/Neopallium/lua-zmq.git \
&& cd lua-zmq \
&& git apply /lua-zmq.patch.1 \
&& mkdir build && cd build \
&& PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cmake -DLUA_INCLUDE_DIR=/usr/local/include/luajit-2.1 .. \
&& make \
&& make install
RUN luarocks install dkjson \
&& luarocks install uuid \
diff --git a/src/pre_generated-zmq.nobj.c b/src/pre_generated-zmq.nobj.c
index 8297f96..1188a38 100644
--- a/src/pre_generated-zmq.nobj.c
+++ b/src/pre_generated-zmq.nobj.c
@@ -21,6 +21,7 @@
#endif
/* some Lua 5.1 compatibility support. */
+#if 0
#if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM == 501)
/*
** Adapted from Lua 5.2.0
@@ -43,6 +44,7 @@ static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
#define lua_rawlen(L, idx) lua_objlen(L, idx)
+#endif
#endif
#if LUA_VERSION_NUM == 502
@@ -5825,6 +5827,14 @@ typedef struct ZMQ_recv_event {
const char *err;
} ZMQ_recv_event;
+
+/* Socket event data */
+typedef struct {
+ uint16_t event; // id of the event as bitfield
+ int32_t value ; // value is either error code, fd or reconnect interval
+} zmq_event_t;
+
+
int monitor_recv_event(ZMQ_Socket *s, zmq_msg_t *msg, int flags, ZMQ_recv_event *ev)
{
int rc ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment