Source: redis
Version: 2.8.13
Severity: normal
Tags: patch

Hi,

Please find attached a proposal that use dpkg-buildflags (and hardening
flags) and enable multiple make jobs in your package.

Please note that *FLAGS are defined and exported manually in debian/rules since
the package use debhelper 7 (these 4 lines can be removed if debhelper 9 used).

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-67-generic (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
diff -Nru redis-2.8.13/debian/changelog redis-2.8.13/debian/changelog
--- redis-2.8.13/debian/changelog	2014-08-05 18:16:56.000000000 +0200
+++ redis-2.8.13/debian/changelog	2014-09-05 14:31:00.000000000 +0200
@@ -1,3 +1,12 @@
+redis (2:2.8.13-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Use dpkg-buildflags CFLAGS, CPPFLAGS (patch upstream Makefile) and
+    LDFLAGS, also use pie and relro via DEB_BUILD_MAINT_OPTIONS
+  * Call make V=1 to show gcc command lines (blhc) and enable parallel build
+
+ -- Guillaume Delacour <g...@iroqwa.org>  Fri, 05 Sep 2014 09:49:19 +0200
+
 redis (2:2.8.13-3) unstable; urgency=low
 
   * Correct permissions of our /var directories by chowning them recursively.
diff -Nru redis-2.8.13/debian/patches/04-dpkg-buildflags.diff redis-2.8.13/debian/patches/04-dpkg-buildflags.diff
--- redis-2.8.13/debian/patches/04-dpkg-buildflags.diff	1970-01-01 01:00:00.000000000 +0100
+++ redis-2.8.13/debian/patches/04-dpkg-buildflags.diff	2014-09-05 12:16:02.000000000 +0200
@@ -0,0 +1,43 @@
+Author: Guillaume Delacour <g...@iroqwa.org>
+Subject: Add CPPFLAGS in upstream makefiles
+Last-Update: 2014-09-05
+
+Index: redis-2.8.13/src/Makefile
+===================================================================
+--- redis-2.8.13.orig/src/Makefile
++++ redis-2.8.13/src/Makefile
+@@ -87,7 +87,7 @@ ifeq ($(MALLOC),jemalloc)
+ 	FINAL_LIBS+= -ljemalloc
+ endif
+ 
+-REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
++REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) $(CPPFLAGS)
+ REDIS_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS)
+ REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL)
+ 
+Index: redis-2.8.13/deps/linenoise/Makefile
+===================================================================
+--- redis-2.8.13.orig/deps/linenoise/Makefile
++++ redis-2.8.13/deps/linenoise/Makefile
+@@ -6,7 +6,7 @@ R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG)
+ R_LDFLAGS= $(LDFLAGS)
+ DEBUG= -g
+ 
+-R_CC=$(CC) $(R_CFLAGS)
++R_CC=$(CC) $(R_CFLAGS) $(CPPFLAGS)
+ R_LD=$(CC) $(R_LDFLAGS)
+ 
+ linenoise.o: linenoise.h linenoise.c
+Index: redis-2.8.13/deps/hiredis/Makefile
+===================================================================
+--- redis-2.8.13.orig/deps/hiredis/Makefile
++++ redis-2.8.13/deps/hiredis/Makefile
+@@ -28,7 +28,7 @@ CC:=$(shell sh -c 'type $(CC) >/dev/null
+ OPTIMIZATION?=-O3
+ WARNINGS=-Wall -W -Wstrict-prototypes -Wwrite-strings
+ DEBUG?= -g -ggdb
+-REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG) $(ARCH)
++REAL_CFLAGS=$(OPTIMIZATION) -fPIC $(CFLAGS) $(WARNINGS) $(DEBUG) $(ARCH) $(CPPFLAGS)
+ REAL_LDFLAGS=$(LDFLAGS) $(ARCH)
+ 
+ DYLIBSUFFIX=so
diff -Nru redis-2.8.13/debian/patches/series redis-2.8.13/debian/patches/series
--- redis-2.8.13/debian/patches/series	2014-08-05 18:16:56.000000000 +0200
+++ redis-2.8.13/debian/patches/series	2014-09-05 14:04:24.000000000 +0200
@@ -1,3 +1,4 @@
 01-fix-ftbfs-on-kfreebsd.diff -p1
 02-fix-ftbfs-on-kfreebsd -p1
 03-use-system-jemalloc.diff -p1
+04-dpkg-buildflags.diff -p1
diff -Nru redis-2.8.13/debian/rules redis-2.8.13/debian/rules
--- redis-2.8.13/debian/rules	2014-08-05 18:16:56.000000000 +0200
+++ redis-2.8.13/debian/rules	2014-09-05 14:18:15.000000000 +0200
@@ -1,6 +1,17 @@
 #!/usr/bin/make -f
 
-unexport CFLAGS
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
+CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
+LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
+export CPPFLAGS CFLAGS LDFLAGS
+
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+	MAKEFLAGS += -j$(NUMJOBS)
+	export MAKEFLAGS
+endif
 
 ifneq (,$(filter $(shell dpkg-architecture -qDEB_HOST_ARCH),armel hurd-i386 kfreebsd-amd64 kfreebsd-i386 s390 sparc))
 export FORCE_LIBC_MALLOC = yes
@@ -14,6 +25,9 @@
 
 override_dh_auto_install:
 
+override_dh_auto_build:
+	dh_auto_build --parallel -- V=1
+
 clean:
 	dh $@
 	rm -f src/release.h

Reply via email to