Source: gkrelltop
Version: 2.2.13-1.2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

gkrelltop fails to cross build from source, because it hard codes build
architecture build tools such as gcc or pkg-config all over the place in
configure and Makefile. I'm attaching a patch that turns them
substitutable and also slightly cleans up debian/rules. After applying
it, gkrelltop cross builds successfully.

Helmut

diff --minimal -Nru gkrelltop-2.2.13/debian/changelog 
gkrelltop-2.2.13/debian/changelog
--- gkrelltop-2.2.13/debian/changelog   2024-04-18 08:54:44.000000000 +0200
+++ gkrelltop-2.2.13/debian/changelog   2025-02-11 12:38:43.000000000 +0100
@@ -1,3 +1,10 @@
+gkrelltop (2.2.13-1.3) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use cross tools. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 11 Feb 2025 12:38:43 +0100
+
 gkrelltop (2.2.13-1.2) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --minimal -Nru gkrelltop-2.2.13/debian/control 
gkrelltop-2.2.13/debian/control
--- gkrelltop-2.2.13/debian/control     2024-04-18 08:54:44.000000000 +0200
+++ gkrelltop-2.2.13/debian/control     2025-02-11 12:31:24.000000000 +0100
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Adi Zaimi <adiza...@users.sourceforge.net>
 Uploaders: Yaroslav Halchenko <deb...@onerussian.com>
-Build-Depends: debhelper (>= 7), autotools-dev, libgtk2.0-dev, gkrellm, 
gkrellmd
+Build-Depends: debhelper (>= 7), autotools-dev, libgtk2.0-dev, gkrellm, 
gkrellmd, pkgconf
 Standards-Version: 3.8.2
 
 Package: gkrelltop
diff --minimal -Nru gkrelltop-2.2.13/debian/patches/cross.patch 
gkrelltop-2.2.13/debian/patches/cross.patch
--- gkrelltop-2.2.13/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ gkrelltop-2.2.13/debian/patches/cross.patch 2025-02-11 12:37:47.000000000 
+0100
@@ -0,0 +1,161 @@
+--- gkrelltop-2.2.13.orig/configure
++++ gkrelltop-2.2.13/configure
+@@ -4,8 +4,10 @@
+ # There is no need to run this configure before doing a make.
+ #
+ 
+-GLIB_INCLUDE=`pkg-config --cflags glib-2.0`
+-GLIB_LIBS=`pkg-config --libs glib-2.0`
++PKG_CONFIG="${PKG_CONFIG-pkg-config}"
++
++GLIB_INCLUDE=`$PKG_CONFIG --cflags glib-2.0`
++GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0`
+ 
+ for i
+ do
+@@ -17,8 +19,8 @@
+ done
+ 
+ 
+-PKG_INCLUDE=`pkg-config gkrellm --cflags --silence-errors`
+-PKG_LIBS=`pkg-config gkrellm --libs --silence-errors`
++PKG_INCLUDE=`$PKG_CONFIG gkrellm --cflags --silence-errors`
++PKG_LIBS=`$PKG_CONFIG gkrellm --libs --silence-errors`
+ 
+ if [ "$PKG_INCLUDE" = "" ]
+ then
+@@ -31,7 +33,7 @@
+ fi
+ 
+ 
+-rm -f configure.h configure.log test test.o test.c
++rm -f configure.h configure.log test.o test.c
+ 
+ touch configure.h
+ 
+@@ -47,23 +49,20 @@
+ cat << EOF > test.c
+ #include <gkrellm2/gkrellmd.h>
+ 
++#if !defined(GKRELLMD_VERSION_MAJOR)
++#error GKRELLMD_VERSION_MAJOR is not defined
++#endif
++
+ int main()
+       {
+-#if defined(GKRELLMD_VERSION_MAJOR)
+       return 0;
+-#else
+-      return 1;
+-#endif
+       }
+ 
+ EOF
+ 
+ # echo $CC ${PKG_INCLUDE} -c test.c -o test.o
+ 
+-$CC ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
+-$CC test.o -o test ${PKG_LIBS}  2>& 5
+-
+-if [ -e ./test ] && ./test
++if $CC ${PKG_INCLUDE} -c test.c -o test.o 2>& 5
+ then
+       echo "OK, defining HAVE_GKRELLMD" 1>& 5
+       echo "" 1>& 5
+@@ -78,5 +77,5 @@
+ 
+ #-------------------------------------------------------------------
+ 
+-rm -f test test.o test.c
++rm -f test.o test.c
+ exit 0
+--- gkrelltop-2.2.13.orig/Makefile
++++ gkrelltop-2.2.13/Makefile
+@@ -28,9 +28,10 @@
+ OSFLAG = $(shell uname | tr '[:lower:]' '[:upper:]')
+ SHELL=/bin/sh
+ 
++PKG_CONFIG ?= pkg-config
+ GKRELL1FLAG=1
+ #find out if we have gkrellm 2 or 1 (from the gtk+ version)
+-GKRELL1FLAG=$(shell bash -c 'pkg-config gtk+-2.0 --cflags &>/dev/null && echo 
0')
++GKRELL1FLAG=$(shell bash -c '$(PKG_CONFIG) gtk+-2.0 --cflags &>/dev/null && 
echo 0')
+ GKRELLTOP = gkrelltop.so
+ OBJ = top_three.o gkrelltop.o 
+ EXTRA = krell_panel1.xpm
+@@ -43,16 +44,12 @@
+ 
+ ifeq ($(GKRELL1FLAG),0)
+ # Parameters for gkrellm version 2.*
+-CFLAGS2 = -g -D$(OSFLAG) -DGKRELLM2 -fPIC -Wall `pkg-config gtk+-2.0 --cflags`
+-LIBS =  
+-CC=/usr/bin/gcc $(CFLAGS2)
+-
++CFLAGS += -g -D$(OSFLAG) -DGKRELLM2 -fPIC -Wall `$(PKG_CONFIG) gtk+-2.0 
--cflags`
++LIBS = `$(PKG_CONFIG) gtk+-2.0 --libs`
+ else 
+ # Parameters for gkrellm version 1.*
+-CC=/usr/bin/cc
+-CFLAGS = -D$(OSFLAG) -Wall -fPIC `gtk-config --cflags` `imlib-config 
--cflags-gdk` 
++CFLAGS = -D$(OSFLAG) -Wall -fPIC `gtk-config --cflags` `imlib-config 
--cflags-gdk`
+ LIBS=
+-
+ endif
+ 
+ 
+@@ -70,15 +67,14 @@
+ LIBSD = 
+ CONFIGURE_ARGS += --with-glib12
+ else
+-CFLAGSD = -D$(OSFLAG) -fPIC -Wall `pkg-config glib-2.0 --cflags`
+-LIBSD = `pkg-config glib-2.0 --libs`
++CFLAGSD = -D$(OSFLAG) -fPIC -Wall `$(PKG_CONFIG) glib-2.0 --cflags`
++LIBSD = `$(PKG_CONFIG) glib-2.0 --libs`
+ LIBSD = 
+ endif
+ INSTALLDIRD ?= $(PREFIXD)/$(DESTDIR)
+ ifeq ($(INSTALLDIRD),)
+       INSTALLDIRD=$(HOME)/.gkrellm2/plugins-gkrellmd
+ endif
+-CCD=/usr/bin/gcc $(CFLAGSD)
+ OBJD = gkrelltopd.o top_three.o
+ 
+ DUMMY_VAR := $(shell ./configure $(CONFIGURE_ARGS))
+@@ -100,23 +96,23 @@
+ warn: ; $(WARN)
+ 
+ $(GKRELLTOP): $(OBJ) warn
+-      $(CC)  -shared $(OBJ) -o $(GKRELLTOP) 
++      $(CC) $(CFLAGS) -shared $(OBJ) $(LIBS) -o $(GKRELLTOP) 
+ 
+ # Compile gkrelltopd.so server plugin
+ server: $(GKRELLTOPD) warn
+       @echo ""
+ 
+ $(GKRELLTOPD): $(OBJD) 
+-      $(CCD)  $(LIBSD) -shared $(OBJD) -o $(GKRELLTOPD)
++      $(CC) $(CFLAGSD) $(LIBSD) -shared $(OBJD) -o $(GKRELLTOPD)
+ 
+ gkrelltop.o: gkrelltop.c
+-      $(CC) -c gkrelltop.c -o gkrelltop.o
++      $(CC) $(CFLAGS) -c gkrelltop.c -o gkrelltop.o
+ 
+ top_three.o: top_three.c
+-      $(CC) -c top_three.c -o top_three.o
++      $(CC) $(CFLAGS) -c top_three.c -o top_three.o
+ 
+ gkrelltopd.o: gkrelltopd.c
+-      $(CCD) -c gkrelltopd.c -o gkrelltopd.o
++      $(CC) $(CFLAGSD) -c gkrelltopd.c -o gkrelltopd.o
+ 
+ install: $(GKRELLTOP)
+       install -c -m 644 $(GKRELLTOP) $(INSTALLDIR)
+@@ -125,7 +121,7 @@
+       install -c -m 644 $(GKRELLTOPD) $(INSTALLDIRD)
+ 
+ ttest: top_three.o ttest.o 
+-      $(CC)  top_three.o ttest.o -o ttest
++      $(CC) $(CFLAGS) top_three.o ttest.o -o ttest
+ 
+ view: $(GKRELLTOP)
+       gkrellm -p $(GKRELLTOP)
diff --minimal -Nru gkrelltop-2.2.13/debian/patches/series 
gkrelltop-2.2.13/debian/patches/series
--- gkrelltop-2.2.13/debian/patches/series      1970-01-01 01:00:00.000000000 
+0100
+++ gkrelltop-2.2.13/debian/patches/series      2025-02-11 12:28:54.000000000 
+0100
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru gkrelltop-2.2.13/debian/rules gkrelltop-2.2.13/debian/rules
--- gkrelltop-2.2.13/debian/rules       2024-04-18 08:54:44.000000000 +0200
+++ gkrelltop-2.2.13/debian/rules       2025-02-11 12:38:39.000000000 +0100
@@ -9,12 +9,8 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
-
-# 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)
-
+DPKG_EXPORT_BUILDTOOLS=1
+include /usr/share/dpkg/buildtools.mk
 
 CFLAGS = -Wall -g
 
@@ -26,19 +22,14 @@
 
 config.status: configure
        dh_testdir
-       dh_autoreconf
-       # configure the package.
-       ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) 
--prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info 
CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+       ./configure
 
 
 build: build-stamp
 
 build-stamp:  config.status
        dh_testdir
-
-       # Compile the package.
-       $(MAKE)
-
+       dh_auto_build --buildsystem=makefile
        touch $@
 
 clean:

Reply via email to