Source: asedriveiiie
Version: 3.7-12
Severity: serious
Justification: policy 4.6
Tags: patch
User: [email protected]
Usertags: ftcbfs

asedriveiiie fails to cross build from source. On the surface, it uses 
the build architecture pkg-config and fails to locate dependencies 
that way. While looking into this problem, I stumbled into a worse 
problem. The upstream Makefile sets CC to "${BUILD}-gcc" and as BUILD 
happens to be empty by default, CC becomes "-gcc". When used in a rule, 
make interprets the "-" as a prefix suppressing errors. Doing so 
violates Debian policy section 4.6. Hence this bug is an rcbug.

Passing --build to configure initializes BUILD and practically fixes the 
policy violation. It also helps with cross compilation. Hence, that's 
what I am proposing. If you fix this aspect only, please downgrade the 
severity of this bug.

The other part is using that prefix on pkg-config. That's also 
implemented in the attached patch. Please consider applying it.

Helmut
diff -Nru asedriveiiie-3.7/debian/changelog asedriveiiie-3.7/debian/changelog
--- asedriveiiie-3.7/debian/changelog   2025-02-22 16:07:46.000000000 +0100
+++ asedriveiiie-3.7/debian/changelog   2025-09-17 10:39:00.000000000 +0200
@@ -1,3 +1,11 @@
+asedriveiiie (3.7-12.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload. (Closes: #-1)
+  * Fix error trapping: Pass --build to configure.
+  * Fix FTCBFS: Add prefix to pkg-config.
+
+ -- Helmut Grohne <[email protected]>  Wed, 17 Sep 2025 10:39:00 +0200
+
 asedriveiiie (3.7-12) unstable; urgency=medium
 
   [ Carles Pina i Estany ]
diff -Nru asedriveiiie-3.7/debian/patches/cross.patch 
asedriveiiie-3.7/debian/patches/cross.patch
--- asedriveiiie-3.7/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ asedriveiiie-3.7/debian/patches/cross.patch 2025-09-17 10:38:59.000000000 
+0200
@@ -0,0 +1,60 @@
+--- asedriveiiie-3.7.orig/asedriveiiie-serial/configure
++++ asedriveiiie-3.7/asedriveiiie-serial/configure
+@@ -44,8 +44,10 @@
+       exit 1
+ fi
+ 
++PKG_CONFIG="${BUILD:+$BUILD-}pkg-config"
++
+ if [ -z "$USBDROPDIR" ]; then
+-      USBDROPDIR=`pkg-config libpcsclite --variable=usbdropdir`
++      USBDROPDIR=`$PKG_CONFIG libpcsclite --variable=usbdropdir`
+ fi
+ 
+ if [ -z "$USBDROPDIR" ]; then
+@@ -54,13 +56,13 @@
+ fi
+ 
+ if [ -z "$PCSC_HEADERS" ]; then
+-      CFLAGS="$CFLAGS `pkg-config libpcsclite --cflags`"
++      CFLAGS="$CFLAGS `$PKG_CONFIG libpcsclite --cflags`"
+ else
+       CFLAGS="$CFLAGS -I${PCSC_HEADERS}"
+ fi
+ 
+ if [ -z "$PCSC_LIBS" ]; then
+-      LDFLAGS="$LDFLAGS `pkg-config libpcsclite --libs`"
++      LDFLAGS="$LDFLAGS `$PKG_CONFIG libpcsclite --libs`"
+ else
+       LDFLAGS="$LDFLAGS -L${PCSC_LIBS} -lpcsclite"
+ fi
+--- asedriveiiie-3.7.orig/asedriveiiie-usb/configure
++++ asedriveiiie-3.7/asedriveiiie-usb/configure
+@@ -44,8 +44,10 @@
+       exit 1
+ fi
+ 
++PKG_CONFIG="${BUILD:+$BUILD-}pkg-config"
++
+ if [ -z "$USBDROPDIR" ]; then
+-      USBDROPDIR=`pkg-config libpcsclite --variable=usbdropdir`
++      USBDROPDIR=`$PKG_CONFIG libpcsclite --variable=usbdropdir`
+ fi
+ 
+ if [ -z "$USBDROPDIR" ]; then
+@@ -54,13 +56,13 @@
+ fi
+ 
+ if [ -z "$PCSC_HEADERS" ]; then
+-      CFLAGS="$CFLAGS `pkg-config libpcsclite --cflags`"
++      CFLAGS="$CFLAGS `$PKG_CONFIG libpcsclite --cflags`"
+ else
+       CFLAGS="$CFLAGS -I${PCSC_HEADERS}"
+ fi
+ 
+ if [ -z "$PCSC_LIBS" ]; then
+-      LDFLAGS="$LDFLAGS `pkg-config libpcsclite --libs`"
++      LDFLAGS="$LDFLAGS `$PKG_CONFIG libpcsclite --libs`"
+ else
+       LDFLAGS="$LDFLAGS -L${PCSC_LIBS} -lpcsclite"
+ fi
diff -Nru asedriveiiie-3.7/debian/patches/series 
asedriveiiie-3.7/debian/patches/series
--- asedriveiiie-3.7/debian/patches/series      2025-02-22 16:07:46.000000000 
+0100
+++ asedriveiiie-3.7/debian/patches/series      2025-09-17 10:34:44.000000000 
+0200
@@ -1,2 +1,3 @@
 06_rules_file_install
 04_configure
+cross.patch
diff -Nru asedriveiiie-3.7/debian/rules asedriveiiie-3.7/debian/rules
--- asedriveiiie-3.7/debian/rules       2025-02-22 16:07:46.000000000 +0100
+++ asedriveiiie-3.7/debian/rules       2025-09-17 10:38:13.000000000 +0200
@@ -1,6 +1,7 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
+include /usr/share/dpkg/architecture.mk
 # https://wiki.debian.org/Hardening
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
@@ -10,8 +11,8 @@
        dh $@
 
 override_dh_auto_configure:
-       cd asedriveiiie-usb ; CFLAGS="$(CFLAGS) $(CPPFLAGS)" ./configure
-       cd asedriveiiie-serial ; CFLAGS="$(CFLAGS) $(CPPFLAGS)" ./configure
+       env -C asedriveiiie-usb CFLAGS="$(CFLAGS) $(CPPFLAGS)" ./configure 
--build=$(DEB_HOST_GNU_TYPE)
+       env -C asedriveiiie-serial CFLAGS="$(CFLAGS) $(CPPFLAGS)" ./configure 
--build=$(DEB_HOST_GNU_TYPE)
 
 override_dh_auto_build:
        $(MAKE) -C asedriveiiie-usb

Reply via email to