Source: cyrus-sasl2
Source-Version: 2.1.28+dfsg1-7
Severity: normal
Tags: patch
X-Debbugs-Cc: Helmut Grohne <hel...@subdivi.de>

Hi!

Helmut (CCed) noticed that during the build there were a couple of
errors from dpkg-buildapi. Investigating this I noticed that the packaging
is building the sample/ server and client by changing directory and
including the dpkg fragment Makefile files, but these assume to be
included from the source tree root directory, thus the emitted errors.

I'm attaching a patch (test built), which solves this, and simplifies
the building.

Thanks,
Guillem
From 39c9e6a3123a02d7d8e173d367fcda7a9382b80c Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Sun, 18 Aug 2024 02:18:12 +0200
Subject: [PATCH] debian: Fix and simplify sample server/client build

We can use make's implicit rules to simplify the Makefile. We should
also run the Makefile from the source tree root directory, otherwise
the dpkg make fragments will misbehave. Do not pass -g, as whether to
pass it will be decided by dpkg-buildflags.
---
 debian/rules           |  2 +-
 debian/sample/Makefile | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/debian/rules b/debian/rules
index 88117ef..125756b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -166,7 +166,7 @@ override_dh_auto_build:
 	dh_auto_build -B$(TMPBUILD_MIT) -- sasldir=/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2 all doc-html
 
 	# Build sample-{client,server}
-	$(MAKE) -f ../debian/sample/Makefile -C sample T=../$(TMPBUILD_MIT)
+	$(MAKE) -f debian/sample/Makefile T=$(TMPBUILD_MIT)
 
 	# Build the sasl-sample-client and sasl-sample-server man pages.
 	/usr/bin/docbook-to-man debian/sasl-sample-client.sgml \
diff --git a/debian/sample/Makefile b/debian/sample/Makefile
index a472b84..29b9228 100644
--- a/debian/sample/Makefile
+++ b/debian/sample/Makefile
@@ -8,10 +8,8 @@ INCDIR1=$(T)/../include
 INCDIR2=$(T)/include
 LIBDIR=$(T)/lib/.libs
 
-all: sample-server sample-client
+CPPFLAGS += -DPLUGINDIR=\"/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2\"
+CPPFLAGS += -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR)
+LDLIBS = -lsasl2
 
-sample-server: sample-server.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -DPLUGINDIR=\"/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2\" $(LDFLAGS) -g -o sample-server sample-server.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
-
-sample-client: sample-client.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -DPLUGINDIR=\"/usr/lib/$(DEB_HOST_MULTIARCH)/sasl2\" $(LDFLAGS) -g -o sample-client sample-client.c -I. -I$(T) -I$(INCDIR1) -I$(INCDIR2) -L$(LIBDIR) -lsasl2
+all: sample/sample-server sample/sample-client
-- 
2.45.2

Reply via email to