Source: radeontop
Version: 1.0-1
Tags: patch
User: helm...@debian.org
Usertags: rebootstrap

radeontop fails to cross build from source, because the upstream
Makefile hard codes the build architecture pkg-config. After making it
substitutable, it still fails, because make install insists on
rebuilding radeontop, but dh_auto_install does not supply cross tools
(unlike dh_auto_build). This is because it expects a .git directory to
derive the version from. The embedded version for Debian builds will
always be "unknown". I didn't figure out how to fix that, but simply
passing cross tools there as well works. Please consider applying the
attached patch.

Helmut
diff --minimal -Nru radeontop-1.0/debian/changelog 
radeontop-1.0/debian/changelog
--- radeontop-1.0/debian/changelog      2017-04-08 19:26:11.000000000 +0200
+++ radeontop-1.0/debian/changelog      2018-06-10 20:47:20.000000000 +0200
@@ -1,3 +1,10 @@
+radeontop (1.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    + cross.patch: make pkg-config substitutable
+    + Use dpkg's buildtools.mk to supply cross tools for make install.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Sun, 10 Jun 2018 20:47:20 +0200
+
 radeontop (1.0-1) unstable; urgency=medium
 
   * New upstream release.
diff --minimal -Nru radeontop-1.0/debian/patches/cross.patch 
radeontop-1.0/debian/patches/cross.patch
--- radeontop-1.0/debian/patches/cross.patch    1970-01-01 01:00:00.000000000 
+0100
+++ radeontop-1.0/debian/patches/cross.patch    2018-06-10 20:47:17.000000000 
+0200
@@ -0,0 +1,47 @@
+--- radeontop-1.0.orig/Makefile
++++ radeontop-1.0/Makefile
+@@ -27,17 +27,18 @@
+ CFLAGS_SECTIONED = -ffunction-sections -fdata-sections
+ LDFLAGS_SECTIONED = -Wl,-gc-sections
+ 
++PKG_CONFIG ?= pkg-config
+ CFLAGS ?= -Os
+ CFLAGS += -Wall -Wextra -pthread
+ CFLAGS += -Iinclude
+ CFLAGS += $(CFLAGS_SECTIONED)
+-CFLAGS += $(shell pkg-config --cflags pciaccess)
+-CFLAGS += $(shell pkg-config --cflags libdrm)
++CFLAGS += $(shell $(PKG_CONFIG) --cflags pciaccess)
++CFLAGS += $(shell $(PKG_CONFIG) --cflags libdrm)
+ ifeq ($(xcb), 1)
+-      CFLAGS += $(shell pkg-config --cflags xcb xcb-dri2)
++      CFLAGS += $(shell $(PKG_CONFIG) --cflags xcb xcb-dri2)
+       CFLAGS += -DENABLE_XCB=1
+ endif
+-CFLAGS += $(shell pkg-config --cflags ncurses 2>/dev/null)
++CFLAGS += $(shell $(PKG_CONFIG) --cflags ncurses 2>/dev/null)
+ 
+ # Comment this if you don't want translations
+ ifeq ($(nls), 1)
+@@ -58,16 +59,16 @@
+ 
+ LDFLAGS ?= -Wl,-O1
+ LDFLAGS += $(LDFLAGS_SECTIONED)
+-LIBS += $(shell pkg-config --libs pciaccess)
+-LIBS += $(shell pkg-config --libs libdrm)
++LIBS += $(shell $(PKG_CONFIG) --libs pciaccess)
++LIBS += $(shell $(PKG_CONFIG) --libs libdrm)
+ ifeq ($(xcb), 1)
+-      xcb_LIBS += $(shell pkg-config --libs xcb xcb-dri2)
++      xcb_LIBS += $(shell $(PKG_CONFIG) --libs xcb xcb-dri2)
+       LIBS += -ldl
+ endif
+ 
+ # On some distros, you might have to change this to ncursesw
+-LIBS += $(shell pkg-config --libs ncursesw 2>/dev/null || \
+-              shell pkg-config --libs ncurses 2>/dev/null || \
++LIBS += $(shell $(PKG_CONFIG) --libs ncursesw 2>/dev/null || \
++              $(PKG_CONFIG) --libs ncurses 2>/dev/null || \
+               echo "-lncurses")
+ 
+ .PHONY: all clean install man dist
diff --minimal -Nru radeontop-1.0/debian/patches/series 
radeontop-1.0/debian/patches/series
--- radeontop-1.0/debian/patches/series 1970-01-01 01:00:00.000000000 +0100
+++ radeontop-1.0/debian/patches/series 2018-06-10 20:46:34.000000000 +0200
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru radeontop-1.0/debian/rules radeontop-1.0/debian/rules
--- radeontop-1.0/debian/rules  2017-04-08 19:03:34.000000000 +0200
+++ radeontop-1.0/debian/rules  2018-06-10 20:47:20.000000000 +0200
@@ -1,6 +1,9 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
+DPKG_EXPORT_BUILDTOOLS=1
+-include /usr/share/dpkg/buildtools.mk
+
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 export debug=1

Reply via email to