Skip to content

Commit

Permalink
Enable building with system hiredis
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Jan 18, 2025
1 parent 45e3179 commit e01cb04
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ RUN apt-get update \
g++ \
gcc \
git \
jq \
libboost-filesystem-dev \
libboost-log-dev \
libboost-system-dev \
libboost-thread-dev \
libcurl4-openssl-dev \
libgoogle-perftools-dev \
libhiredis-dev \
libssl-dev \
libtool \
libtool-bin \
Expand All @@ -31,7 +33,6 @@ RUN ../configure --enable-tcmalloc=yes CPPFLAGS='-DNDEBUG' CXXFLAGS='-O2'
RUN make -j$(nproc) MYVERSION=${MYVERSION}

FROM debian:bookworm-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
Expand All @@ -42,6 +43,7 @@ RUN apt-get update \
libboost-system1.74.0 \
libboost-thread1.74.0 \
libgoogle-perftools4 \
libhiredis0.14 \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*

COPY --from=build /usr/local/src/drachtio-server/build/drachtio /usr/local/bin/
Expand Down
13 changes: 12 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ drachtio_CPPFLAGS= -I${srcdir}/deps/sofia-sip/libsofia-sip-ua/su -I${srcdir}/dep
-D_REENTRANT -DBOOST_LOG_DYN_LINK -DDRACHTIO_VERSION=\"$(MYVERSION)\" -Wno-error=deprecated-declarations \
-DBOOST_ALLOW_DEPRECATED_HEADERS -O2

if DEP_HIREDIS
drachtio_CPPFLAGS += -I${srcdir}/deps
AM_LDFLAGS += -L${srcdir}/deps/hiredis
endif

drachtio_LDADD= ${srcdir}/deps/sofia-sip/libsofia-sip-ua/.libs/libsofia-sip-ua.a \
${srcdir}/deps/jansson/src/.libs/libjansson.a \
${srcdir}/deps/hiredis/libhiredis.a -lcurl -lpthread -lssl -lcrypto -lz
-lhiredis -lcurl -lpthread -lssl -lcrypto -lz

if LINUX
drachtio_CPPFLAGS += -Wno-stringop-overflow
Expand All @@ -54,6 +59,10 @@ endif
BUILT_SOURCES=${srcdir}/deps/sofia-sip/libsofia-sip-ua/.libs/libsofia-sip-ua.a \
${srcdir}/deps/jansson/src/.libs/libjansson.a ${srcdir}/deps/prometheus-cpp/build/lib/libprometheus-cpp-core.a

if DEP_HIREDIS
BUILT_SOURCES += ${srcdir}/deps/hiredis/libhiredis.a
endif

clean-local:

${srcdir}/deps/sofia-sip/libsofia-sip-ua/.libs/libsofia-sip-ua.a:
Expand All @@ -67,5 +76,7 @@ ${srcdir}/deps/prometheus-cpp/build/lib/libprometheus-cpp-core.a ${srcdir}/deps/
cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX=`pwd` && \
$(MAKE) && make install

if DEP_HIREDIS
${srcdir}/deps/hiredis/libhiredis.a:
cd ${srcdir}/deps/hiredis && cmake -DBUILD_SHARED_LIBS=OFF -DENABLE_SSL=ON . && $(MAKE)
endif
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AC_LANG(C++)
AX_CXX_COMPILE_STDCXX_11()
AX_CXX_COMPILE_STDCXX_17(noext, optional)

AM_CONDITIONAL([DEP_HIREDIS], [test -f "${srcdir}/deps/hiredis/CMakeLists.txt"])
AM_CONDITIONAL(OSX, false)
AM_CONDITIONAL(LINUX, false)

Expand Down
2 changes: 1 addition & 1 deletion src/blacklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ THE SOFTWARE.
#include <boost/variant.hpp>
#include <regex>

#include "hiredis.h"
#include <hiredis/hiredis.h>

#include "blacklist.hpp"
#include "controller.hpp"
Expand Down

0 comments on commit e01cb04

Please sign in to comment.