Source: libcap2
Version: 1:2.63-1
Severity: important
Justification: libcap2 is relevant to architecture cross bootstrap
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

Since the new upstream release, libcap2 fails to cross build from
source. Part of the reason is building the installed tests without
passing cross tools. Another is not consistently passing FORCELINKPAM to
all targets (which causes a rebuild without cross tools during make
install). A third one is passing neither CROSS_COMPILE nor OBJCOPY, so
the build architecture objcopy is used on host architecture objects. I'm
attaching a patch to fix all of the above for your convenience.

Helmut
diff --minimal -Nru libcap2-2.63/debian/changelog libcap2-2.63/debian/changelog
--- libcap2-2.63/debian/changelog       2022-12-10 14:06:25.000000000 +0100
+++ libcap2-2.63/debian/changelog       2022-12-12 06:20:50.000000000 +0100
@@ -1,3 +1,14 @@
+libcap2 (1:2.63-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_build pass cross tools to test program builds.
+    + Pass FORCELINKPAM to all targets.
+    + Pass CROSS_COMPILE to cover objcopy.
+  * Skip passing CC as dh_auto_build already passes it.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 12 Dec 2022 06:20:50 +0100
+
 libcap2 (1:2.63-1) unstable; urgency=medium
 
   * Upload to unstable.
diff --minimal -Nru libcap2-2.63/debian/rules libcap2-2.63/debian/rules
--- libcap2-2.63/debian/rules   2022-12-10 14:06:25.000000000 +0100
+++ libcap2-2.63/debian/rules   2022-12-12 06:20:50.000000000 +0100
@@ -8,11 +8,6 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
-# Support cross-compiling
-ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-CC := $(DEB_HOST_GNU_TYPE)-gcc
-endif
-
 # One upstream target, "_makenames", requires the BUILD compiler instead of 
HOST
 BUILD_CC ?= cc
 export BUILD_LDFLAGS = $(shell dpkg-architecture -a$(DEB_BUILD_ARCH) -c 
dpkg-buildflags --get LDFLAGS)
@@ -23,33 +18,35 @@
 COPTS = COPTS=-O0
 endif
 
+# See pam_cap/Makefile for FORCELINKPAM
+MAKE_ASSIGNMENTS = \
+       FORCELINKPAM=yes \
+       GOLANG=no
 
 %:
        dh ${@}
 
 
 override_dh_auto_clean:
-       dh_auto_clean -- GOLANG=no
+       dh_auto_clean -- $(MAKE_ASSIGNMENTS)
 
 
 override_dh_auto_build:
-       # See pam_cap/Makefile for FORCELINKPAM
        dh_auto_build -- \
-               CC=$(CC) \
+               $(MAKE_ASSIGNMENTS) \
                BUILD_CC=$(BUILD_CC) \
+               CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)- \
                $(COPTS) \
                DYNAMIC=yes \
-               FORCELINKPAM=yes \
                SUDO=$(DEB_GAIN_ROOT_CMD) \
-               GOLANG=no
        # Some of test suite is only invoked when run as real root. Explicitly
        # build all binaries so we can include them in the autopkgtest.
-       $(MAKE) -C libcap cap_test
-       $(MAKE) -C pam_cap test_pam_cap
-       $(MAKE) -C tests psx_test libcap_psx_test uns_test
-       $(MAKE) -C tests libcap_launch_test libcap_psx_launch_test
-       $(MAKE) -C tests noop exploit noexploit
-       $(MAKE) -C progs tcapsh-static
+       dh_auto_build -D libcap -- $(MAKE_ASSIGNMENTS) cap_test
+       dh_auto_build -D pam_cap -- $(MAKE_ASSIGNMENTS) test_pam_cap
+       dh_auto_build -D tests -- $(MAKE_ASSIGNMENTS) \
+               psx_test libcap_psx_test uns_test libcap_launch_test \
+               libcap_psx_launch_test noop exploit noexploit
+       dh_auto_build -D progs -- $(MAKE_ASSIGNMENTS) tcapsh-static
 
 
 override_dh_installdirs:
@@ -61,10 +58,10 @@
 
 override_dh_auto_install:
        dh_auto_install -- \
+               $(MAKE_ASSIGNMENTS) \
                lib=lib/$(DEB_HOST_MULTIARCH) \
                PKGCONFIGDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
                RAISE_SETFCAP=no \
-               GOLANG=no
 
        # libcap-dev:
        #   Move the development files from lib/ to usr/lib. dh_link will
@@ -81,7 +78,7 @@
 
 
 override_dh_auto_test:
-       dh_auto_test -- GOLANG=no
+       dh_auto_test -- $(MAKE_ASSIGNMENTS)
 
 
 override_dh_makeshlibs:

Reply via email to