tags 907258 + patch
block 907258 by 907259
severity 907258 wishlist
severity 907259 wishlist
thanks

Hi,

> redis: Please use system hiredis to avoid embedded code copy

Patch attached, but it's blocked by #907259.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
From 898710cd226af02dcc2cf8f0899d5eb2f4132087 Mon Sep 17 00:00:00 2001
From: Chris Lamb <la...@debian.org>
Date: Sat, 25 Aug 2018 15:58:19 +0200
Subject: [PATCH] Add an enable support for USE_SYSTEM_HIREDIS

---
 debian/control                                |  1 +
 ...-support-for-USE_SYSTEM_HIREDIS-flag.patch | 84 +++++++++++++++++++
 debian/patches/series                         |  1 +
 debian/rules                                  |  2 +-
 4 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 debian/patches/0011-Add-support-for-USE_SYSTEM_HIREDIS-flag.patch

diff --git a/debian/control b/debian/control
index 600d3d35..1b6c8f54 100644
--- a/debian/control
+++ b/debian/control
@@ -5,6 +5,7 @@ Maintainer: Chris Lamb <la...@debian.org>
 Build-Depends:
  debhelper (>= 11~),
  dpkg-dev (>= 1.17.14),
+ libhiredis-dev,
  libjemalloc-dev [linux-any],
  procps <!nocheck>,
  tcl <!nocheck>,
diff --git a/debian/patches/0011-Add-support-for-USE_SYSTEM_HIREDIS-flag.patch b/debian/patches/0011-Add-support-for-USE_SYSTEM_HIREDIS-flag.patch
new file mode 100644
index 00000000..61381d70
--- /dev/null
+++ b/debian/patches/0011-Add-support-for-USE_SYSTEM_HIREDIS-flag.patch
@@ -0,0 +1,84 @@
+From: Chris Lamb <la...@debian.org>
+Date: Sat, 25 Aug 2018 15:59:51 +0200
+Subject: Add support for USE_SYSTEM_HIREDIS flag.
+
+---
+ deps/Makefile |  2 ++
+ src/Makefile  | 19 ++++++++++++++-----
+ 2 files changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/deps/Makefile b/deps/Makefile
+index eb35c1e..3cff67c 100644
+--- a/deps/Makefile
++++ b/deps/Makefile
+@@ -33,7 +33,9 @@ ifneq ($(shell sh -c '[ -f .make-ldflags ] && cat .make-ldflags || echo none'),
+ endif
+ 
+ distclean:
++ifeq ($(USE_SYSTEM_HIREDIS),yes)
+ 	-(cd hiredis && $(MAKE) clean) > /dev/null || true
++endif
+ 	-(cd linenoise && $(MAKE) clean) > /dev/null || true
+ 	-(cd lua && $(MAKE) clean) > /dev/null || true
+ 	-(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
+diff --git a/src/Makefile b/src/Makefile
+index 85c62d5..251f484 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -16,7 +16,7 @@ release_hdr := $(shell sh -c './mkreleasehdr.sh')
+ uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
+ uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
+ OPTIMIZATION?=-O2
+-DEPENDENCY_TARGETS=hiredis linenoise lua
++DEPENDENCY_TARGETS=linenoise lua
+ NODEPS:=clean distclean
+ 
+ # Default settings
+@@ -107,7 +107,7 @@ endif
+ endif
+ endif
+ # Include paths to dependencies
+-FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src
++FINAL_CFLAGS+= -I../deps/linenoise -I../deps/lua/src
+ 
+ ifeq ($(MALLOC),tcmalloc)
+ 	FINAL_CFLAGS+= -DUSE_TCMALLOC
+@@ -124,6 +124,15 @@ ifeq ($(MALLOC),jemalloc)
+ 	FINAL_LIBS := -ljemalloc $(FINAL_LIBS)
+ endif
+ 
++ifeq ($(USE_SYSTEM_HIREDIS),yes)
++	FINAL_LIBS+= -lhiredis
++	FINAL_CFLAGS+= -I/usr/include/hiredis
++else
++	DEPENDENCY_TARGETS += hiredis
++	FINAL_LIBS+= ../deps/hiredis/libhiredis.a
++	FINAL_CFLAGS+= -I../deps/hiredis
++endif
++
+ REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) $(CPPFLAGS)
+ REDIS_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS)
+ REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL)
+@@ -195,7 +204,7 @@ endif
+ 
+ # redis-server
+ $(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ)
+-	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(FINAL_LIBS)
++	$(REDIS_LD) -o $@ $^ ../deps/lua/src/liblua.a $(FINAL_LIBS)
+ 
+ # redis-sentinel
+ $(REDIS_SENTINEL_NAME): $(REDIS_SERVER_NAME)
+@@ -211,11 +220,11 @@ $(REDIS_CHECK_AOF_NAME): $(REDIS_SERVER_NAME)
+ 
+ # redis-cli
+ $(REDIS_CLI_NAME): $(REDIS_CLI_OBJ)
+-	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(FINAL_LIBS)
++	$(REDIS_LD) -o $@ $^ ../deps/linenoise/linenoise.o $(FINAL_LIBS)
+ 
+ # redis-benchmark
+ $(REDIS_BENCHMARK_NAME): $(REDIS_BENCHMARK_OBJ)
+-	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a $(FINAL_LIBS)
++	$(REDIS_LD) -o $@ $^ $(FINAL_LIBS)
+ 
+ dict-benchmark: dict.c zmalloc.c sds.c siphash.c
+ 	$(REDIS_CC) $(FINAL_CFLAGS) $^ -D DICT_BENCHMARK_MAIN -o $@ $(FINAL_LIBS)
diff --git a/debian/patches/series b/debian/patches/series
index 65aa9685..a7cce243 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -8,3 +8,4 @@ debian-packaging/0007-Set-Debian-configuration-defaults.patch
 0009-Drop-memory-efficiency-tests-on-advice-from-upstream.patch
 0010-Use-get_current_dir_name-over-PATHMAX-etc.patch
 0010-Drop-non-determinstic-dump-test.patch
+0011-Add-support-for-USE_SYSTEM_HIREDIS-flag.patch
diff --git a/debian/rules b/debian/rules
index 16b1cebe..ffea6fbf 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,7 @@ override_dh_auto_install:
 	debian/bin/generate-systemd-service-files
 
 override_dh_auto_build:
-	dh_auto_build --parallel -- V=1
+	dh_auto_build --parallel -- V=1 USE_SYSTEM_HIREDIS=yes
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-- 
2.18.0

Reply via email to