Source: usb-modeswitch
Version: 2.4.0+repack0-1
User: helm...@debian.org
Usertags: rebootstrap

Hi Didier,

I noticed that usb-modeswitch fails to cross build from source. The
first issue is pretty obvious: It uses the build architecture compiler.
Passing a suitable CC value into the build solves this (and improves the
ability to build with clang).

Then it fails executing /usr/bin/jimsh.
Here, I'm not sure what the proper solution is. Given that other tcl
implementations (e.g. tcl8.6) are marked Multi-Arch: foreign, maybe
jimsh should also be marked such. Maybe the jimsh maintainer knows. ;)
Either way, the build succeeds as soon as one uses the build
architecture jimsh (and the host architecture libjim-dev), which can be
verified by annotating the jimsh with ":native".

Thus the attached patch makes usb-modeswitch cross buildable. Instead of
simply applying it, I ask you to look into whether jimsh should be
marked Multi-Arch: foreign (and thus dropping the :native annotation) or
whether the patch can be used as is.

A policy-language like checklist for Multi-Arch: foreign can be found at
https://wiki.debian.org/DependencyHell#Multi-Arch:_foreign. I intend to
propose similar wording for the policy and thus would be interested in
whether this is useful for assessing jimsh.

Not tagging this bug with patch, because you cannot blindly apply it.

Thanks for looking into this

Helmut
diff --minimal -Nru usb-modeswitch-2.4.0+repack0/debian/changelog 
usb-modeswitch-2.4.0+repack0/debian/changelog
--- usb-modeswitch-2.4.0+repack0/debian/changelog       2016-06-13 
09:22:43.000000000 +0200
+++ usb-modeswitch-2.4.0+repack0/debian/changelog       2016-08-30 
10:14:07.000000000 +0200
@@ -1,3 +1,12 @@
+usb-modeswitch (2.4.0+repack0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + use triplet prefixed tools (gcc, pkg-config)
+    + Annotate the jimsh Build-Depends with :native
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 30 Aug 2016 10:05:24 +0200
+
 usb-modeswitch (2.4.0+repack0-1) unstable; urgency=medium
 
   * New 2.4.0 upstream release
diff --minimal -Nru usb-modeswitch-2.4.0+repack0/debian/control 
usb-modeswitch-2.4.0+repack0/debian/control
--- usb-modeswitch-2.4.0+repack0/debian/control 2016-06-13 08:57:39.000000000 
+0200
+++ usb-modeswitch-2.4.0+repack0/debian/control 2016-08-30 10:10:15.000000000 
+0200
@@ -5,7 +5,7 @@
 Build-Depends: debhelper (>= 9),
  libusb-1.0-0-dev,
  pkg-config,
- jimsh, libjim-dev (>= 0.75-1~)
+ jimsh:native, libjim-dev (>= 0.75-1~)
 Standards-Version: 3.9.8
 Homepage: http://www.draisberghof.de/usb_modeswitch/
 Vcs-Git: https://alioth.debian.org/anonscm/git/collab-maint/usb-modeswitch.git
diff --minimal -Nru usb-modeswitch-2.4.0+repack0/debian/patches/07_cross.patch 
usb-modeswitch-2.4.0+repack0/debian/patches/07_cross.patch
--- usb-modeswitch-2.4.0+repack0/debian/patches/07_cross.patch  1970-01-01 
01:00:00.000000000 +0100
+++ usb-modeswitch-2.4.0+repack0/debian/patches/07_cross.patch  2016-08-30 
10:06:21.000000000 +0200
@@ -0,0 +1,18 @@
+Description: allow replacing pkg-config with <triplet>-pkg-config
+Author: Helmut Grohne <hel...@subdivi.de>
+Last-Modified: 2016-08-30
+
+Index: usb-modeswitch-2.4.0+repack0/Makefile
+===================================================================
+--- usb-modeswitch-2.4.0+repack0.orig/Makefile
++++ usb-modeswitch-2.4.0+repack0/Makefile
+@@ -2,7 +2,8 @@
+ VERS        = 2.4.0
+ CC          ?= gcc
+ CFLAGS      += -Wall
+-LIBS        = `pkg-config --libs --cflags libusb-1.0`
++PKG_CONFIG  ?= pkg-config
++LIBS        = `$(PKG_CONFIG) --libs --cflags libusb-1.0`
+ RM          = /bin/rm -f
+ OBJS        = usb_modeswitch.c
+ PREFIX      = $(DESTDIR)/usr
diff --minimal -Nru usb-modeswitch-2.4.0+repack0/debian/patches/series 
usb-modeswitch-2.4.0+repack0/debian/patches/series
--- usb-modeswitch-2.4.0+repack0/debian/patches/series  2016-06-13 
09:20:46.000000000 +0200
+++ usb-modeswitch-2.4.0+repack0/debian/patches/series  2016-08-30 
10:03:43.000000000 +0200
@@ -2,3 +2,4 @@
 04_use_system_libjim.patch
 05_upstart_systemd_runtime_detection.patch
 06_set_TMPDIR_in_run.patch
+07_cross.patch
diff --minimal -Nru usb-modeswitch-2.4.0+repack0/debian/rules 
usb-modeswitch-2.4.0+repack0/debian/rules
--- usb-modeswitch-2.4.0+repack0/debian/rules   2016-06-13 08:56:08.000000000 
+0200
+++ usb-modeswitch-2.4.0+repack0/debian/rules   2016-08-30 10:12:30.000000000 
+0200
@@ -1,5 +1,11 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/architecture.mk
+ifeq ($(origin CC),default)
+CC = $(DEB_HOST_GNU_TYPE)-gcc
+endif
+export PKG_CONFIG = $(DEB_HOST_GNU_TYPE)-pkg-config
+
 export DEB_CFLAGS_MAINT_APPEND = $(shell dpkg-buildflags --get CPPFLAGS)
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
@@ -7,11 +13,11 @@
        dh $@
 
 override_dh_auto_build:
-       dh_auto_build -- shared
+       dh_auto_build -- shared CC=$(CC)
 
 # This allows to select what I want instead of deleting what I don't
 override_dh_auto_install:
-       DESTDIR=debian/tmp/ make install-shared
+       DESTDIR=debian/tmp/ make install-shared CC=$(CC)
 
 get-orig-source:
        set -e;\

Reply via email to