Source: mesaflash Version: 3.4.6-1 Tags: patch User: debian-cr...@lists.debian.org Usertags: ftcbfs
mesaflash fails to cross build from source for multiple reasons. The immediate failure is misdetections due to using the build architecture pkg-config as it is hard coded in the upstream Makefile. Turning it substitutable helps a bit, but only dh_auto_build provides a substitution by default so clean fails unless exporting it for all targets. Beyond that, MESAFLASH_IO detection relies on uname, which will produce wrong results during cross builds, so provide a result for it. I'm attaching a patch for your convenience. Helmut
diff --minimal -Nru mesaflash-3.4.6/debian/changelog mesaflash-3.4.6/debian/changelog --- mesaflash-3.4.6/debian/changelog 2022-11-05 19:38:09.000000000 +0100 +++ mesaflash-3.4.6/debian/changelog 2024-04-28 21:16:32.000000000 +0200 @@ -1,3 +1,13 @@ +mesaflash (3.4.6-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Fix FTCBFS: (Closes: #-1) + + cross.patch: Make pkg-config substitutable. + + Seed MESAFLASH_IO as the Makefile misdetects it. + + Export PKG_CONFIG for all targets as clean needs it. + + -- Helmut Grohne <hel...@subdivi.de> Sun, 28 Apr 2024 21:16:32 +0200 + mesaflash (3.4.6-1) unstable; urgency=medium * Add new Mesa boards: 7C81, 7I96S, 7I92T diff --minimal -Nru mesaflash-3.4.6/debian/patches/cross.patch mesaflash-3.4.6/debian/patches/cross.patch --- mesaflash-3.4.6/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100 +++ mesaflash-3.4.6/debian/patches/cross.patch 2024-04-28 21:16:32.000000000 +0200 @@ -0,0 +1,43 @@ +--- mesaflash-3.4.6.orig/Makefile ++++ mesaflash-3.4.6/Makefile +@@ -25,6 +25,7 @@ + RM = rm -f + AR = ar + RANLIB = ranlib ++PKG_CONFIG ?= pkg-config + + OWNERSHIP ?= --owner root --group root + +@@ -46,25 +47,25 @@ + CFLAGS += -std=c99 + + ifeq ($(TARGET),linux) +- $(shell which pkg-config > /dev/null) ++ $(shell which $(PKG_CONFIG) > /dev/null) + ifeq ($(.SHELLSTATUS), 1) + $(error "can't find pkg-config") + endif + +- $(shell pkg-config --exists libpci > /dev/null) ++ $(shell $(PKG_CONFIG) --exists libpci > /dev/null) + ifeq ($(.SHELLSTATUS), 1) + $(error "pkg-config can't find libpci") + endif + +- $(shell pkg-config --exists libmd > /dev/null) ++ $(shell $(PKG_CONFIG) --exists libmd > /dev/null) + ifeq ($(.SHELLSTATUS), 1) + $(error "pkg-config can't find libmd") + endif + +- LIBPCI_CFLAGS := $(shell pkg-config --cflags libpci) +- LIBPCI_LDFLAGS := $(shell pkg-config --libs libpci) +- LIBMD_CFLAGS := $(shell pkg-config --cflags libmd) +- LIBMD_LDFLAGS := $(shell pkg-config --libs libmd) ++ LIBPCI_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpci) ++ LIBPCI_LDFLAGS := $(shell $(PKG_CONFIG) --libs libpci) ++ LIBMD_CFLAGS := $(shell $(PKG_CONFIG) --cflags libmd) ++ LIBMD_LDFLAGS := $(shell $(PKG_CONFIG) --libs libmd) + BIN = mesaflash + LDFLAGS = -lm $(LIBPCI_LDFLAGS) $(LIBMD_LDFLAGS) + CFLAGS += -D_GNU_SOURCE $(LIBPCI_CFLAGS) $(LIBMD_CFLAGS) -D_FILE_OFFSET_BITS=64 diff --minimal -Nru mesaflash-3.4.6/debian/patches/series mesaflash-3.4.6/debian/patches/series --- mesaflash-3.4.6/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ mesaflash-3.4.6/debian/patches/series 2024-04-28 21:10:03.000000000 +0200 @@ -0,0 +1 @@ +cross.patch diff --minimal -Nru mesaflash-3.4.6/debian/rules mesaflash-3.4.6/debian/rules --- mesaflash-3.4.6/debian/rules 2022-01-15 20:13:35.000000000 +0100 +++ mesaflash-3.4.6/debian/rules 2024-04-28 21:16:27.000000000 +0200 @@ -1,6 +1,13 @@ #!/usr/bin/make -f +include /usr/share/dpkg/architecture.mk +DPKG_EXPORT_BUILDTOOLS=1 +include /usr/share/dpkg/buildtools.mk include /usr/share/dpkg/pkg-info.mk +# Makefile uses uname, which is wrong for cross builds. +MESAFLASH_IO:=$(if $(wildcard /usr/include/$(DEB_HOST_MULTIARCH)/asm/io.h),1,0) +export MESAFLASH_IO + %: dh $@