Source: sunxi-tools
Version: 1.4.2+git20181114.6d598a-3
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

sunxi-tools fails to cross build from source, because it builds the
tools for the build architecture. While its Makefile supports the
CROSS_COMPILE variable, it is not meant for cross building sunxi-tools
but for the target blobs. For cross building the tools, one should pass
CC and stuff. The easiest way of doing so is using dh_auto_build. It
mostly works except for the Makefile hard coding the build architecture
pkg-config. Please consider applying the attached patch to fix both.

Helmut
diff --minimal -Nru sunxi-tools-1.4.2+git20181114.6d598a/debian/changelog 
sunxi-tools-1.4.2+git20181114.6d598a/debian/changelog
--- sunxi-tools-1.4.2+git20181114.6d598a/debian/changelog       2019-01-06 
13:14:53.000000000 +0100
+++ sunxi-tools-1.4.2+git20181114.6d598a/debian/changelog       2021-11-25 
06:28:55.000000000 +0100
@@ -1,3 +1,12 @@
+sunxi-tools (1.4.2+git20181114.6d598a-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + Let dh_auto_build pass cross tools to make.
+    + Make pkg-config substitutable.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 25 Nov 2021 06:28:55 +0100
+
 sunxi-tools (1.4.2+git20181114.6d598a-3) unstable; urgency=medium
 
   * Only trigger a udev event if `udevadm` is available. Discovered by
diff --minimal -Nru 
sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/cross.patch 
sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/cross.patch
--- sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/cross.patch     
1970-01-01 01:00:00.000000000 +0100
+++ sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/cross.patch     
2021-11-25 06:28:55.000000000 +0100
@@ -0,0 +1,28 @@
+--- sunxi-tools-1.4.2+git20181114.6d598a.orig/Makefile
++++ sunxi-tools-1.4.2+git20181114.6d598a/Makefile
+@@ -36,6 +36,8 @@
+ 
+ DEFAULT_CFLAGS += -Iinclude/
+ 
++PKG_CONFIG ?= pkg-config
++
+ # Tools useful on host and target
+ TOOLS = sunxi-fexc sunxi-bootinfo sunxi-fel sunxi-nand-part sunxi-pio
+ 
+@@ -116,12 +118,12 @@
+       script_fex.h script_fex.c
+ 
+ LIBUSB = libusb-1.0
+-LIBUSB_CFLAGS ?= `pkg-config --cflags $(LIBUSB)`
+-LIBUSB_LIBS ?= `pkg-config --libs $(LIBUSB)`
++LIBUSB_CFLAGS ?= `$(PKG_CONFIG) --cflags $(LIBUSB)`
++LIBUSB_LIBS ?= `$(PKG_CONFIG) --libs $(LIBUSB)`
+ 
+ ZLIB = zlib
+-ZLIB_CFLAGS ?= `pkg-config --cflags $(ZLIB)`
+-ZLIB_LIBS ?= `pkg-config --libs $(ZLIB)`
++ZLIB_CFLAGS ?= `$(PKG_CONFIG) --cflags $(ZLIB)`
++ZLIB_LIBS ?= `$(PKG_CONFIG) --libs $(ZLIB)`
+ 
+ ifeq ($(OS),Windows_NT)
+       # Windows lacks mman.h / mmap()
diff --minimal -Nru sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/series 
sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/series
--- sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/series  2019-01-06 
13:14:53.000000000 +0100
+++ sunxi-tools-1.4.2+git20181114.6d598a/debian/patches/series  2021-11-25 
06:28:55.000000000 +0100
@@ -1 +1,2 @@
 debian-changes
+cross.patch
diff --minimal -Nru sunxi-tools-1.4.2+git20181114.6d598a/debian/rules 
sunxi-tools-1.4.2+git20181114.6d598a/debian/rules
--- sunxi-tools-1.4.2+git20181114.6d598a/debian/rules   2018-12-16 
15:42:42.000000000 +0100
+++ sunxi-tools-1.4.2+git20181114.6d598a/debian/rules   2021-11-25 
06:28:52.000000000 +0100
@@ -15,7 +15,7 @@
 
 override_dh_auto_build:
        $(MAKE) -C thunks CROSS_COMPILE=arm-none-eabi-
-       $(MAKE) CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" tools
+       dh_auto_build -- CFLAGS="$(CFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" 
tools
        mkimage -A arm -T script -d bin/ramboot.uboot-sh bin/ramboot.scr
 
 override_dh_auto_install: PKG := debian/sunxi-tools

Reply via email to