[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#893988: wide-dhcpv6-client-udeb: not installable: depends on non-udeb libfl2



Control: tag -1 patch

Hi Roger,

Roger Shimizu <rogershimizu@gmail.com> (2018-03-25):
> Do you have any suggestion, except adding udeb support to package flex?

It looks acceptable to me to use the static library in the udeb, so I've
tried building it against libfl.a, and that seems to do the job since
the libfl2 dependency goes away. I'm not sure it's reasonable to do that
for both the deb and the udeb, though; so I've looked into making it
conditional, and only building the udeb against the static library.

Unfortunately, it looks like the build system doesn't support out of
tree builds, so I've had to copy all files under build-{deb,udeb},
instead of just running ../configure, make, make install from there.
I've picked rsync to do this, but feel free to use anything else.

I've also chosen to clean things up using an override_dh_auto_clean
target, so that most modifications are seen at once in debian/rules, but
you may want to use debian/clean instead.

You'll find a patch series attached. I haven't tested the runtime
though.


Cheers,
-- 
Cyril Brulebois (kibi@debian.org)            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant
From e63dad86c15e39c56505f0e22428b4d3a158b17e Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 09:40:23 +0200
Subject: [PATCH 1/8] Build under build-deb.

This is a first step to introduce separate deb vs. udeb builds.
---
 debian/rules | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/debian/rules b/debian/rules
index 67e9104..96b2b3b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,12 +9,19 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 %:
 	dh $@
 
-override_dh_auto_configure:
+build-deb/.stamp:
+	rsync --exclude debian/ --exclude .pc/ -a * build-deb && touch $@
+
+override_dh_auto_configure: build-deb/.stamp
+	cd build-deb && \
 	./configure --prefix=/usr --mandir=\$${prefix}/share/man \
 		--with-localdbdir=/var/lib/dhcpv6 --sysconfdir=/etc/wide-dhcpv6
 
+override_dh_auto_build:
+	$(MAKE) -C build-deb
+
 override_dh_auto_install:
-	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
+	$(MAKE) -C build-deb prefix=$(CURDIR)/debian/tmp/usr install
 
 override_dh_installinit:
 	dh_installinit --error-handler=true --restart-after-upgrade
@@ -22,3 +29,7 @@ override_dh_installinit:
 override_dh_fixperms:
 	dh_fixperms
 	chmod +x debian/wide-dhcpv6-client/etc/wide-dhcpv6/dhcp6c-*
+
+override_dh_auto_clean:
+	dh_auto_clean
+	rm -rf build-deb
-- 
2.16.2

From 1f71d9b7fa5f05655fcfe1e7a6a974cdc18d2309 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 09:40:27 +0200
Subject: [PATCH 2/8] Duplicate the deb build into a udeb build.

Let the main (deb) build install everything under debian/tmp as usual
which will let most helpers do the right thing as previously, and
install the results of the udeb build under debian/tmp-udeb.
---
 debian/rules | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 96b2b3b..a9ee5a3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,16 +12,24 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 build-deb/.stamp:
 	rsync --exclude debian/ --exclude .pc/ -a * build-deb && touch $@
 
-override_dh_auto_configure: build-deb/.stamp
+build-udeb/.stamp:
+	rsync --exclude debian/ --exclude .pc/ -a * build-udeb && touch $@
+
+override_dh_auto_configure: build-deb/.stamp build-udeb/.stamp
 	cd build-deb && \
 	./configure --prefix=/usr --mandir=\$${prefix}/share/man \
 		--with-localdbdir=/var/lib/dhcpv6 --sysconfdir=/etc/wide-dhcpv6
+	cd build-udeb && \
+	./configure --prefix=/usr --mandir=\$${prefix}/share/man \
+		--with-localdbdir=/var/lib/dhcpv6 --sysconfdir=/etc/wide-dhcpv6
 
 override_dh_auto_build:
 	$(MAKE) -C build-deb
+	$(MAKE) -C build-udeb
 
 override_dh_auto_install:
 	$(MAKE) -C build-deb prefix=$(CURDIR)/debian/tmp/usr install
+	$(MAKE) -C build-udeb prefix=$(CURDIR)/debian/tmp-udeb/usr install
 
 override_dh_installinit:
 	dh_installinit --error-handler=true --restart-after-upgrade
@@ -33,3 +41,4 @@ override_dh_fixperms:
 override_dh_auto_clean:
 	dh_auto_clean
 	rm -rf build-deb
+	rm -rf build-udeb
-- 
2.16.2

From 0e9c3a98ec202285076bb3c44d79158b17a15b38 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 09:47:05 +0200
Subject: [PATCH 3/8] wide-dhcpv6-client-udeb: ship the dhcp6c binary built in
 the udeb tree.

---
 debian/wide-dhcpv6-client-udeb.install | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/wide-dhcpv6-client-udeb.install b/debian/wide-dhcpv6-client-udeb.install
index 0af1fb6..04fb328 100644
--- a/debian/wide-dhcpv6-client-udeb.install
+++ b/debian/wide-dhcpv6-client-udeb.install
@@ -1 +1,2 @@
-usr/sbin/dhcp6c
+# Pick the binary built in the udeb tree:
+../tmp-udeb/usr/sbin/dhcp6c /usr/sbin/
-- 
2.16.2

From 10e34fb743810dea9ffad69824e1c45e35ac6157 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 09:40:34 +0200
Subject: [PATCH 4/8] Build the udeb dhcp6c against static flex library
 (Closes: #893988).

This makes the run-time dependency on libfl2 go away for the udeb.
---
 debian/rules | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/debian/rules b/debian/rules
index a9ee5a3..f34f6cc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -14,6 +14,8 @@ build-deb/.stamp:
 
 build-udeb/.stamp:
 	rsync --exclude debian/ --exclude .pc/ -a * build-udeb && touch $@
+	# Build against the static flex library to avoid picking an extra dependency on libfl2 (#893988):
+	sed "s,^CLIENTLIBS=.*,CLIENTLIBS=$$(find /usr/lib/$$(dpkg-architecture -qDEB_BUILD_MULTIARCH) -name libfl.a)," -i build-udeb/Makefile.in
 
 override_dh_auto_configure: build-deb/.stamp build-udeb/.stamp
 	cd build-deb && \
-- 
2.16.2

From bc5d01b8d8704543347e96c295ebdcea9b164e1d Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 09:40:39 +0200
Subject: [PATCH 5/8] Update patch to warn about the extra modification for the
 udeb build.

---
 debian/patches/0017-Remove-unused-linking-with-libfl.patch | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/patches/0017-Remove-unused-linking-with-libfl.patch b/debian/patches/0017-Remove-unused-linking-with-libfl.patch
index 7af1032..96981ac 100644
--- a/debian/patches/0017-Remove-unused-linking-with-libfl.patch
+++ b/debian/patches/0017-Remove-unused-linking-with-libfl.patch
@@ -23,10 +23,11 @@ index 1ad6c25..4b78c5a 100644
  CC=	@CC@
  TARGET=	dhcp6c dhcp6s dhcp6relay dhcp6ctl
  
-@@ -63,11 +63,14 @@ RELAYOBJS =	dhcp6relay.o dhcp6relay_script.o common.o timer.o
+@@ -63,11 +63,15 @@ RELAYOBJS =	dhcp6relay.o dhcp6relay_script.o common.o timer.o
  CTLOBJS= dhcp6_ctlclient.o base64.o auth.o
  CLEANFILES+=	y.tab.h
  
++# Note: CLIENTLIBS gets overwritten with path to libfl.a for the udeb build
 +CLIENTLIBS=@LEXLIB@
 +SERVLIBS=  @LEXLIB@
 +
-- 
2.16.2

From b05515c0601ffbdfe326c561a2d7b0142542b24e Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 07:56:13 +0000
Subject: [PATCH 6/8] Add changelog entry for the udeb changes.

---
 debian/changelog | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 218df9e..53c51c4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
+wide-dhcpv6 (20080615-21) UNRELEASED; urgency=medium
+
+  * debian/rules:
+    - Introduce separate deb/udeb builds, copying source files under
+      build-{deb,udeb} since support for out-of-tree build seems broken.
+    - Don't try to build only the dhcp6c binary in the udeb tree, as the
+      install target tries to install everything anyway.
+    - Patch Makefile.in to build the dhcp6c binary against static flex
+      library in the udeb tree, to avoid a runtime dependency on libfl2
+      (Closes: #893988).
+  * debian/wide-dhcpv6-client-udeb.install:
+    - Update to pick the dhcp6c binary built in the udeb tree and
+      installed under the debian/tmp-udeb directory.
+  * debian/patches/0017-Remove-unused-linking-with-libfl.patch:
+    - Add a comment mentioning the tweak for the udeb build.
+
+ -- Cyril Brulebois <kibi@debian.org>  Sun, 25 Mar 2018 07:51:10 +0000
+
 wide-dhcpv6 (20080615-20) unstable; urgency=medium
 
   * debian/patches:
-- 
2.16.2

From 4c8e251deeff9a6266b5bb4154b441785c0e79d2 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 10:06:29 +0200
Subject: [PATCH 7/8] Remove debian/tmp-udeb manually.

It doesn't get cleaned up automatically like debian/tmp.
---
 debian/rules | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/rules b/debian/rules
index f34f6cc..1f021df 100755
--- a/debian/rules
+++ b/debian/rules
@@ -44,3 +44,4 @@ override_dh_auto_clean:
 	dh_auto_clean
 	rm -rf build-deb
 	rm -rf build-udeb
+	rm -rf debian/tmp-udeb
-- 
2.16.2

From 7f3ef843aafaa204d51865112f8a1f77031a62c9 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Sun, 25 Mar 2018 08:16:35 +0000
Subject: [PATCH 8/8] debian/control: Add a build-dep on rsync for the build
 tree handling.

---
 debian/changelog | 2 ++
 debian/control   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 53c51c4..200cc24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ wide-dhcpv6 (20080615-21) UNRELEASED; urgency=medium
       installed under the debian/tmp-udeb directory.
   * debian/patches/0017-Remove-unused-linking-with-libfl.patch:
     - Add a comment mentioning the tweak for the udeb build.
+  * debian/control:
+    - Add a build-dep on rsync for the build tree handling.
 
  -- Cyril Brulebois <kibi@debian.org>  Sun, 25 Mar 2018 07:51:10 +0000
 
diff --git a/debian/control b/debian/control
index a721a74..365b20b 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,8 @@ Build-Depends:
  bison,
  debhelper (>= 10),
  flex,
- libfl-dev
+ libfl-dev,
+ rsync
 Standards-Version: 3.9.8
 Vcs-Git: https://github.com/rogers0/packaging_wide-dhcpv6.git
 Vcs-Browser: https://github.com/rogers0/packaging_wide-dhcpv6
-- 
2.16.2

Attachment: signature.asc
Description: PGP signature


Reply to: