Package: libusb Version: 0.1.12 Severity: wishlist Tags: patch User: [EMAIL PROTECTED] Usertags: crossbuilt
This doesn't relate to Lenny, it is part of my ongoing mass bug filing for cross-build support. I am gradually migrating the patches that I use for Emdebian Lenny. libusb fails to cross-build without patches due to an upstream bug in tests/Makefile.am. A separate issue with how pkg-config and libtool are handled in libusb means that the Debian support also needs a tweak. In line with the autotools-dev guidance, --host should not be passed unless cross-building so the first part of the patch moves the --build and --host instructions to a conditional, only passing --build for native builds. The new conditional also implements the libtool fix to ensure that the build looks for /usr/arm-linux-gnu/lib/libm.so instead of /usr/lib/libm.so which would fail when cross-building (for ARM). These changes have no effect on the Debian build, only the cross-build. The attached patches are intended to be forwarded upstream but have been implemented via dpatch because this is the simplest way to handle upstream changes within Emdebian. libusb already includes some changes outside the debian/ directory in the .diff.gz so implementing the upstream change with dpatch will result in these new lintian warnings: W: libusb source: patch-system-but-direct-changes-in-diff Makefile.in W: libusb source: patch-system-but-direct-changes-in-diff aclocal.m4 W: libusb source: patch-system-but-direct-changes-in-diff bsd.c W: libusb source: patch-system-but-direct-changes-in-diff configure W: libusb source: patch-system-but-direct-changes-in-diff darwin.c W: libusb source: patch-system-but-direct-changes-in-diff doc/Makefile.in W: libusb source: patch-system-but-direct-changes-in-diff linux.c W: libusb source: patch-system-but-direct-changes-in-diff tests/Makefile.in W: libusb source: patch-system-but-direct-changes-in-diff usb.h.in W: libusb source: patch-system-but-direct-changes-in-diff usbpp.h If the effect of the 10_emdebian_libs.dpatch file is implemented upstream (or via a direct change in the .diff.gz) and you would like an updated patch for debian/rules that does not implement dpatch, let me know. The dpatch changes are as advised at: http://matrixhasu.altervista.org/index.php?view=use_dpatch You can see the history of libusb cross-builds here: http://www.emdebian.org/buildd/history.php?pkg=libusb The main change for tests/Makefile.am is: - ... $(top_builddir)/libusbpp.la @OSLIBS@ + ... $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ i.e. for each case where libusbpp is linked against the built binaries, the libusb from the build directory also needs to be linked (as libusbpp requires -lusb in normal usage). This has no effect on the dependencies or NEEDED linkages in the final binaries, it merely states explicitly what can be inferred from the existing rules. An alternative method could be for upstream to implement a ./configure switch to disable tests/ completely - the binaries are not used in Debian. This is an awkward bug for Emdebian because it does not tend to show up in a "dirty" build environment, only in a clean chroot build. Once the Lenny freeze is over, I would appreciate it if you would include these changes. *** ../crossbuild.diff --- libusb-0.1.12.debian/debian/rules +++ libusb-0.1.12.emdebian/debian/rules @@ -12,10 +12,17 @@ # This has to be exported to make some magic below work. export DH_OPTIONS +include /usr/share/dpatch/dpatch.make # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) +CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) \ + LDFLAGS="-L/usr/$(DEB_HOST_GNU_TYPE)/lib" +else +CROSS= --build $(DEB_BUILD_GNU_TYPE) +endif CFLAGS = -Wall -g CFLAGS_UDEB = $(CFLAGS) -Os @@ -56,9 +63,7 @@ # run configure with build tree $(objdir) cd $(objdir) && \ - CFLAGS="$(CFLAGS)" ../configure \ - --host=$(DEB_HOST_GNU_TYPE) \ - --build=$(DEB_BUILD_GNU_TYPE) \ + CFLAGS="$(CFLAGS)" ../configure $(CROSS) \ --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info @@ -74,9 +79,7 @@ # run configure with build tree $(objdir_udeb) cd $(objdir_udeb) && \ - CFLAGS="$(CFLAGS_UDEB)" ../configure \ - --host=$(DEB_HOST_GNU_TYPE) \ - --build=$(DEB_BUILD_GNU_TYPE) \ + CFLAGS="$(CFLAGS_UDEB)" ../configure $(CROSS) \ --prefix=/usr \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ @@ -84,7 +87,8 @@ touch $@ -build: build-arch build-indep +build: build-stamp +build-stamp: patch-stamp build-arch build-indep build-arch: build-arch-deb build-arch-udeb build-arch-deb: build-arch-deb-stamp @@ -111,7 +115,7 @@ touch $@ -clean: +clean: unpatch dh_testdir dh_testroot rm -f *-stamp *** ../control.diff --- libusb-0.1.12.debian/debian/control +++ libusb-0.1.12.emdebian/debian/control @@ -2,7 +2,7 @@ Section: libs Priority: optional Maintainer: Aurelien Jarno <[EMAIL PROTECTED]> -Build-Depends: debhelper (>= 5.0.22), autotools-dev, pkg-config, docbook, docbook-dsssl +Build-Depends: debhelper (>= 5.0.22), autotools-dev, pkg-config, docbook, docbook-dsssl, dpatch Standards-Version: 3.8.0 Package: libusb-0.1-4 -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash
#! /bin/sh /usr/share/dpatch/dpatch-run ## 10_emdebian_libs.dpatch by Neil Williams <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Add libusb.la to each build so that cross builds find ## DP: the correct symbols. @DPATCH@ diff -urNad libusb-0.1.12~/tests/Makefile.am libusb-0.1.12/tests/Makefile.am --- libusb-0.1.12~/tests/Makefile.am 2008-07-27 00:19:19.000000000 +0100 +++ libusb-0.1.12/tests/Makefile.am 2008-07-27 00:19:20.000000000 +0100 @@ -11,25 +11,25 @@ testlibusb_LDADD = $(top_builddir)/libusb.la @OSLIBS@ descriptor_test_SOURCES = descriptor_test.cpp -descriptor_test_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +descriptor_test_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ id_test_SOURCES = id_test.cpp -id_test_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +id_test_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ find_hubs_SOURCES = find_hubs.cpp -find_hubs_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +find_hubs_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ find_mice_SOURCES = find_mice.cpp -find_mice_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +find_mice_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ get_resolution_SOURCES = get_resolution.cpp -get_resolution_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +get_resolution_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ hub_strings_SOURCES = hub_strings.cpp -hub_strings_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +hub_strings_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ driver_name_SOURCES = driver_name.cpp -driver_name_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +driver_name_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ TESTS = testlibusb descriptor_test id_test find_hubs find_mice \ get_resolution hub_strings $(OS_SPECIFIC) diff -urNad libusb-0.1.12~/tests/Makefile.in libusb-0.1.12/tests/Makefile.in --- libusb-0.1.12~/tests/Makefile.in 2008-07-27 00:19:19.000000000 +0100 +++ libusb-0.1.12/tests/Makefile.in 2008-07-27 00:20:44.000000000 +0100 @@ -54,28 +54,28 @@ PROGRAMS = $(noinst_PROGRAMS) am_descriptor_test_OBJECTS = descriptor_test.$(OBJEXT) descriptor_test_OBJECTS = $(am_descriptor_test_OBJECTS) -descriptor_test_DEPENDENCIES = $(top_builddir)/libusbpp.la +descriptor_test_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_driver_name_OBJECTS = driver_name.$(OBJEXT) driver_name_OBJECTS = $(am_driver_name_OBJECTS) -driver_name_DEPENDENCIES = $(top_builddir)/libusbpp.la +driver_name_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_find_hubs_OBJECTS = find_hubs.$(OBJEXT) find_hubs_OBJECTS = $(am_find_hubs_OBJECTS) -find_hubs_DEPENDENCIES = $(top_builddir)/libusbpp.la +find_hubs_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_find_mice_OBJECTS = find_mice.$(OBJEXT) find_mice_OBJECTS = $(am_find_mice_OBJECTS) -find_mice_DEPENDENCIES = $(top_builddir)/libusbpp.la +find_mice_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_get_resolution_OBJECTS = get_resolution.$(OBJEXT) get_resolution_OBJECTS = $(am_get_resolution_OBJECTS) -get_resolution_DEPENDENCIES = $(top_builddir)/libusbpp.la +get_resolution_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_hub_strings_OBJECTS = hub_strings.$(OBJEXT) hub_strings_OBJECTS = $(am_hub_strings_OBJECTS) -hub_strings_DEPENDENCIES = $(top_builddir)/libusbpp.la +hub_strings_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la am_id_test_OBJECTS = id_test.$(OBJEXT) id_test_OBJECTS = $(am_id_test_OBJECTS) -id_test_DEPENDENCIES = $(top_builddir)/libusbpp.la +id_test_DEPENDENCIES = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la testlibusb_SOURCES = testlibusb.c testlibusb_OBJECTS = testlibusb.$(OBJEXT) -testlibusb_DEPENDENCIES = $(top_builddir)/libusb.la +testlibusb_DEPENDENCIES = $(top_builddir)/libusb.la $(top_builddir)/libusb.la DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -242,19 +242,19 @@ @[EMAIL PROTECTED] = driver_name testlibusb_LDADD = $(top_builddir)/libusb.la @OSLIBS@ descriptor_test_SOURCES = descriptor_test.cpp -descriptor_test_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +descriptor_test_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ id_test_SOURCES = id_test.cpp -id_test_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +id_test_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ find_hubs_SOURCES = find_hubs.cpp -find_hubs_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +find_hubs_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ find_mice_SOURCES = find_mice.cpp -find_mice_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +find_mice_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ get_resolution_SOURCES = get_resolution.cpp -get_resolution_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +get_resolution_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ hub_strings_SOURCES = hub_strings.cpp -hub_strings_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +hub_strings_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ driver_name_SOURCES = driver_name.cpp -driver_name_LDADD = $(top_builddir)/libusbpp.la @OSLIBS@ +driver_name_LDADD = $(top_builddir)/libusbpp.la $(top_builddir)/libusb.la @OSLIBS@ TESTS = testlibusb descriptor_test id_test find_hubs find_mice \ get_resolution hub_strings $(OS_SPECIFIC)
10_emdebian_libs

