[Pkg-geany-team] Bug#1057659: geany-plugins FTCBFS: runs host code

Helmut Grohne helmut at subdivi.de
Wed Dec 6 15:03:20 GMT 2023


Source: geany-plugins
Version: 2.0-4
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs
X-Debbugs-Cc: debian-cross at lists.debian.org

Hi,

geany-plugins fails to cross build from source. I think this actually is
a relatively, exciting bug so I'm Ccing d-cross at l.d.o.

Ultimately, debian/rules compiles and runs a dumpabiver thing to get the
value of a C macro. That running part cannot work at all. Hence, I am
proposing to use AC_COMPUTE_INT from autoconf to determine the relevant
values. In a native build, it'll do much the same thing as before
(running stuff to print the value) albeit wrapped up in autoconf. In a
cross build, it'll automatically degrade to bisecting the value. This
takes a little longer, but it makes things just work. I'm attaching a
patch for your convenience.

Helmut
-------------- next part --------------
diff --minimal -Nru geany-plugins-2.0/debian/autoreconf geany-plugins-2.0/debian/autoreconf
--- geany-plugins-2.0/debian/autoreconf	1970-01-01 01:00:00.000000000 +0100
+++ geany-plugins-2.0/debian/autoreconf	2023-12-05 19:30:01.000000000 +0100
@@ -0,0 +1,2 @@
+.
+debian/dumpabiver
diff --minimal -Nru geany-plugins-2.0/debian/changelog geany-plugins-2.0/debian/changelog
--- geany-plugins-2.0/debian/changelog	2023-11-18 10:29:26.000000000 +0100
+++ geany-plugins-2.0/debian/changelog	2023-12-05 19:30:01.000000000 +0100
@@ -1,3 +1,10 @@
+geany-plugins (2.0-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use AC_COMPUTE_INT to determine ABI version. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Tue, 05 Dec 2023 19:30:01 +0100
+
 geany-plugins (2.0-4) unstable; urgency=medium
 
   * Acknowledge NMUs (2.0-2.1 and 2.0-2.2)
diff --minimal -Nru geany-plugins-2.0/debian/clean geany-plugins-2.0/debian/clean
--- geany-plugins-2.0/debian/clean	2023-11-18 10:29:26.000000000 +0100
+++ geany-plugins-2.0/debian/clean	2023-12-05 19:30:01.000000000 +0100
@@ -1,2 +1,5 @@
-debian/dumpabiver
-debian/abiversion.sh
+debian/dumpabiver/aclocal.m4
+debian/dumpabiver/autom4te.cache
+debian/dumpabiver/config.cache
+debian/dumpabiver/config.log
+debian/dumpabiver/configure
diff --minimal -Nru geany-plugins-2.0/debian/dumpabiver/configure.ac geany-plugins-2.0/debian/dumpabiver/configure.ac
--- geany-plugins-2.0/debian/dumpabiver/configure.ac	1970-01-01 01:00:00.000000000 +0100
+++ geany-plugins-2.0/debian/dumpabiver/configure.ac	2023-12-05 19:30:01.000000000 +0100
@@ -0,0 +1,17 @@
+AC_INIT([abidumper],[0.0])
+AC_PROG_CC
+PKG_CHECK_MODULES([GEANY],[geany])
+CFLAGS="$CFLAGS $GEANY_CFLAGS"
+AC_COMPUTE_INT([GEANY_ABI_VERSION],[GEANY_ABI_VERSION],[
+#include <geany/geany.h>
+#include <geany/plugindata.h>
+])
+AC_COMPUTE_INT([GEANY_API_VERSION],[GEANY_API_VERSION],[
+#include <geany/geany.h>
+#include <geany/plugindata.h>
+])
+cat >config.cache <<EOF
+GEANY_ABI_VERSION=$GEANY_ABI_VERSION
+GEANY_API_VERSION=$GEANY_API_VERSION
+EOF
+
diff --minimal -Nru geany-plugins-2.0/debian/dumpabiver.c geany-plugins-2.0/debian/dumpabiver.c
--- geany-plugins-2.0/debian/dumpabiver.c	2023-11-18 10:29:26.000000000 +0100
+++ geany-plugins-2.0/debian/dumpabiver.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,9 +0,0 @@
-#include <geany/geany.h>
-#include <geany/plugindata.h>
-
-int main()
-{
-    printf("GEANY_ABI=geany-abi-%d\nGEANY_API=geany-api-%d\n",
-           GEANY_ABI_VERSION, GEANY_API_VERSION);
-    return 0;
-}
diff --minimal -Nru geany-plugins-2.0/debian/rules geany-plugins-2.0/debian/rules
--- geany-plugins-2.0/debian/rules	2023-11-18 10:29:26.000000000 +0100
+++ geany-plugins-2.0/debian/rules	2023-12-05 19:30:01.000000000 +0100
@@ -1,10 +1,12 @@
 #!/usr/bin/make -f
 
 include /usr/share/dpkg/buildflags.mk
+-include /usr/share/dpkg/buildtools.mk
+PKG_CONFIG ?= pkg-config
 
 export LDFLAGS += -Wl,--as-needed -Wl,-z,defs
 
-GEANY_VERSION = $(shell pkg-config --modversion geany)
+GEANY_VERSION = $(shell $(PKG_CONFIG) --modversion geany)
 
 override_dh_autoreconf:
 	rm -rf build/cache
@@ -74,18 +76,15 @@
 	dh_installchangelogs
 
 # add geany:Version substvar to debian/*.substvars
-debian/dumpabiver: debian/dumpabiver.c
-	$(CC) -o $@ $< $(shell pkg-config --cflags geany)
-
-debian/abiversion.sh: debian/dumpabiver
-	$< > $@
+debian/dumpabiver/config.cache: debian/dumpabiver/configure.ac
+	dh_auto_configure --sourcedirectory=debian/dumpabiver
 
-override_dh_gencontrol: debian/abiversion.sh
-	. debian/abiversion.sh && \
+override_dh_gencontrol: debian/dumpabiver/config.cache
+	. debian/dumpabiver/config.cache && \
 	dh_gencontrol -- \
 		"-Vgeany:Version=$(GEANY_VERSION)" \
-		"-Vgeany:API=$${GEANY_ABI}" \
-		"-Vgeany:ABI=$${GEANY_ABI}"
+		"-Vgeany:API=geany-api-$${GEANY_ABI_VERSION}" \
+		"-Vgeany:ABI=geany-abi-$${GEANY_ABI_VERSION}"
 
 # Don't make shlibs (false positive on pretty-printer.so
 override_dh_makeshlibs:


More information about the Pkg-geany-team mailing list