Unverified Commit 8e1481f9 authored by Nicolas Boulenguez's avatar Nicolas Boulenguez Committed by Santiago R.R.
Browse files

Simplify passing of build flags.



Use standard CFLAGS/LDFLAGS/CC and so on.
Set LDFLAGS in the debian patch creating the shared library,
not in a patch over a patch.
Pass targets to Make instead of patching upstream.

It would of course be good to submit patches allowing more
flexibility, but inside Debian each divergence has a cost.

Signed-off-by: default avatarSantiago Ruano Rincón <santiagorr@riseup.net>
parent 4b13694f
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -6010,21 +6010,9 @@
 SHELL=/bin/sh
 
 # To assist in cross-compiling
@@ -21,7 +23,7 @@ RANLIB=ranlib
 LDFLAGS=
@@ -35,7 +37,7 @@ OBJS= blocksort.o  \
 
 BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
+CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) $(DEBCFLAGS)
 
 # Where you want it installed when you do 'make install'
 PREFIX=/usr/local
@@ -35,9 +37,9 @@ OBJS= blocksort.o  \
       decompress.o \
       bzlib.o
 
-all: libbz2.a bzip2 bzip2recover test
+all: libbz2.a bzip2 bzip2recover # test
 all: libbz2.a bzip2 bzip2recover test
 
-bzip2: libbz2.a bzip2.o
+bzip2: libbz2.so bzip2.o
@@ -6050,7 +6038,7 @@
+	ln -sf $^ $@
+
+libbz2.so.$(sominor): $(OBJS:%.o=%.sho)
+	$(CC) -o libbz2.so.$(sominor) -shared \
+	$(CC) -o libbz2.so.$(sominor) -shared $(LDFLAGS) \
+	  -Wl,-soname,libbz2.so.$(somajor) $^ -lc
+
+%.sho: %.c
+0 −26
Original line number Diff line number Diff line
Index: bzip2-1.0.6/Makefile
===================================================================
--- bzip2-1.0.6.orig/Makefile	2012-07-01 15:05:07.000000000 +0200
+++ bzip2-1.0.6/Makefile	2012-07-01 15:08:45.586377822 +0200
@@ -20,10 +20,10 @@
 CC=gcc
 AR=ar
 RANLIB=ranlib
-LDFLAGS=
+LDFLAGS= `dpkg-buildflags --get LDFLAGS`
 
 BIGFILES=-D_FILE_OFFSET_BITS=64
-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) $(DEBCFLAGS)
+CFLAGS=-Wall -Winline $(BIGFILES) $(DEBCFLAGS)
 
 # Where you want it installed when you do 'make install'
 PREFIX=/usr/local
@@ -61,7 +61,7 @@
 	ln -sf $^ $@
 
 libbz2.so.$(sominor): $(OBJS:%.o=%.sho)
-	$(CC) -o libbz2.so.$(sominor) -shared \
+	$(CC) $(LDFLAGS) -o libbz2.so.$(sominor) -shared \
 	  -Wl,-soname,libbz2.so.$(somajor) $^ -lc
 
 %.sho: %.c
+0 −1
Original line number Diff line number Diff line
10-bzip2.1.patch
20-legacy.patch
30-bzip2-harden.patch
bzip2recover-CVE-2016-3189.patch
40-bzdiff-l.patch
+8 −7
Original line number Diff line number Diff line
@@ -6,15 +6,14 @@

include /usr/share/dpkg/architecture.mk
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
        CROSS=CC=$(DEB_HOST_GNU_TYPE)-gcc
  CC=$(DEB_HOST_GNU_TYPE)-gcc
else
        CROSS=CC=gcc
  CC=gcc
endif

DEB_BUILD_MAINT_OPTIONS := hardening=+all
DEB_CFLAGS_MAINT_APPEND := -Wall -Winline
include /usr/share/dpkg/buildflags.mk
DEBCFLAGS := $(CFLAGS) $(CPPFLAGS)

include /usr/share/dpkg/pkg-info.mk

@@ -26,7 +25,8 @@ dev_pkg := libbz2-dev

.PHONY: override_dh_auto_build-arch
override_dh_auto_build-arch:
	dh_auto_build -- libbz2.a bzip2 bzip2recover $(CROSS) DEBCFLAGS="$(DEBCFLAGS)"
	dh_auto_build -- libbz2.a bzip2 bzip2recover \
	  $(foreach v,CC CFLAGS CPPFLAGS LDFLAGS,'$(v)=$($(v))')

.PHONY: override_dh_auto_build-indep
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
@@ -39,7 +39,8 @@ bzip2.info: manual.texi
.PHONY: override_dh_auto_test-arch
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
  override_dh_auto_test-arch:
	dh_auto_test -- DEBCFLAGS="$(DEBCFLAGS)"
	dh_auto_test -- \
	  $(foreach v,CC CFLAGS CPPFLAGS LDFLAGS,'$(v)=$($(v))')
endif

# Documentation is not tested.