🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #2502

Bug#1152372: tk9.1 FTCBFS: hard codes the build architecture pkg-config

#2502
From: Helmut Grohne
Date: Wed, 28 Oct 2026 16:00
230 lines
8951 bytes
--4OPKQKiFUi8D2L7u
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Source: tk9.1
Version: 9.1.0-2
Severity: important
Justification: it is expected that tk9.1 enters the bootstrap set
Tags: patch upstream
User: debian-cross@lists.debian.org
Usertags: ftcbfs

tk9.1 fails to cross build from source. On the surface, it fails to find
harfbuzz. Underneath, unix/configure.ac hard codes the build
architecture pkg-config in a lot of places. I suggest rewriting it to
use PKG_CHECK_MODULES. As that macro uses AC_REQUIRE it should not be
used inside an if condition, so I am also replacing a pile of those by
AS_IF. The macro also carries out the version check on harfbuzz, so this
ends up deleting a pile of code. I hope you find this refactoring
acceptable. Please forward it upstream. Also please apply it to the
Debian package before making tk9.1 the default version in Debian.

Helmut

--4OPKQKiFUi8D2L7u
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="cross.patch"
Content-Transfer-Encoding: 8bit

--- tk9.1-9.1.0.orig/unix/configure.ac
+++ tk9.1-9.1.0/unix/configure.ac
@@ -343,7 +343,7 @@
 #	Check for freetype / fontconfig / Xft support and Bidirectional text
 #--------------------------------------------------------------------
 
-if test $tk_aqua = no; then
+AS_IF([test $tk_aqua = no],[
 
     #--------------------------------------------------------------------
     # --enable-xft (default: yes) — independent switch
@@ -369,7 +369,7 @@
 	[enable_bidi=$enableval], [enable_bidi="yes"])
     AC_MSG_RESULT([$enable_bidi])
 
-    if test "$enable_bidi" = "yes"; then
+    AS_IF([test "$enable_bidi" = "yes"],[
 	AC_MSG_NOTICE([Bidi enabled: forcing Xft on as well])
 	if test "$enable_xft" = "no"; then
 	   enable_xft=yes
@@ -385,48 +385,8 @@
 	#--------------------------------------------------------------------
 	# HarfBuzz - version check (minimum 2.8.2)
 	#--------------------------------------------------------------------
-	AC_MSG_CHECKING([for HarfBuzz (required for --enable-bidi)])
-	if pkg-config --exists harfbuzz; then
-	    HB_VERSION=`pkg-config --modversion harfbuzz 2>/dev/null || echo "0.0.0"`
-	    AC_MSG_RESULT([found version $HB_VERSION])
-
-	    # Pure shell version comparison: is HB_VERSION < 2.8.2 ?
-	    if test -n "$HB_VERSION"; then
-		# Normalize version strings (handle cases like 2.8.2, 3.0.0, etc.)
-		HB_MAJOR=`echo $HB_VERSION | cut -d. -f1`
-		HB_MINOR=`echo $HB_VERSION | cut -d. -f2`
-		HB_PATCH=`echo $HB_VERSION | cut -d. -f3 | cut -d- -f1`
-
-		REQ_MAJOR=2
-		REQ_MINOR=8
-		REQ_PATCH=2
-
-		too_old=no
-		if test $HB_MAJOR -lt $REQ_MAJOR; then
-		    too_old=yes
-		elif test $HB_MAJOR -eq $REQ_MAJOR; then
-		    if test $HB_MINOR -lt $REQ_MINOR; then
-			too_old=yes
-		    elif test $HB_MINOR -eq $REQ_MINOR; then
-			if test -n "$HB_PATCH" && test $HB_PATCH -lt $REQ_PATCH; then
-			    too_old=yes
-			fi
-		    fi
-		fi
-
-		if test "$too_old" = "yes"; then
-		    AC_MSG_WARN([HarfBuzz version $HB_VERSION is too old (need >= 2.8.2).])
-		    AC_MSG_WARN([Disabling bidirectional text support (--disable-bidi).])
-		    enable_bidi=no
-		else
-		    AC_MSG_RESULT([HarfBuzz version $HB_VERSION is sufficient (>= 2.8.2).])
-		fi
-	    fi
-
+	PKG_CHECK_MODULES([HB],[harfbuzz >= 2.8.2],[
 	    if test "$enable_bidi" = "yes"; then
-		HB_CFLAGS=`pkg-config --cflags harfbuzz`
-		HB_LIBS=`pkg-config --libs harfbuzz`
-
 		tk_oldCFlags=$CFLAGS
 		tk_oldLibs=$LIBS
 		CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS $HB_CFLAGS"
@@ -447,16 +407,15 @@
 		AC_SUBST(HB_CFLAGS)
 		AC_SUBST(HB_LIBS)
 	    fi
-	else
-	    AC_MSG_RESULT([no])
+	],[
 	    AC_MSG_ERROR([--enable-bidi requires HarfBuzz development files.
 Please install the HarfBuzz development package:
   - Debian/Ubuntu:   sudo apt install libharfbuzz-dev
   - Fedora/RHEL:     sudo dnf install harfbuzz-devel
   - Arch:            sudo pacman -S harfbuzz
   - macOS (Homebrew): brew install harfbuzz])
-	fi
-    fi
+	])
+    ])
 
     if test "$enable_bidi" = "no"; then
 	# Bidi disabled
@@ -472,16 +431,14 @@
     fi
 
     # Now actually enable Xft if requested (or forced by bidi)
-    if test "$enable_xft" = "yes" ; then
+    AS_IF([test "$enable_xft" = "yes"],[
 	found_xft="yes"
 
 	XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
 	XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
-	if test "$found_xft" = "no" ; then
-	    found_xft=yes
-	    XFT_CFLAGS=`pkg-config --cflags xft fontconfig 2>/dev/null` || found_xft="no"
-	    XFT_LIBS=`pkg-config --libs xft fontconfig 2>/dev/null` || found_xft="no"
-	fi
+	AS_IF([test "$found_xft" = "no"],[
+	    PKG_CHECK_MODULES([XFT],[xft],[found_xft=yes],[found_xft=no])
+	])
 
 	if test "$found_xft" = "yes" ; then
 	    tk_oldCFlags=$CFLAGS
@@ -519,7 +476,7 @@
 	else
 	    enable_xft=yes
 	fi
-    fi
+    ])
 
     AC_SUBST(XFT_CFLAGS)
     AC_SUBST(XFT_LIBS)
@@ -540,7 +497,7 @@
     fi
     AC_SUBST(FONTSYSTEM)
 
-else
+],[
     # Aqua (macOS) path
     enable_xft=no
     enable_bidi=no
@@ -550,7 +507,7 @@
     HB_LIBS=""
     FONTSYSTEM="core"
     AC_SUBST(FONTSYSTEM)
-fi
+])
 
 #--------------------------------------------------------------------
 #	Check for the X RENDER extension client library (Xrender), used
@@ -559,7 +516,7 @@
 
 XRENDER_CFLAGS=""
 XRENDER_LIBS=""
-if test $tk_aqua = no; then
+AS_IF([test $tk_aqua = no],[
     AC_MSG_CHECKING([whether to use xrender])
     AC_ARG_ENABLE(xrender,
 	AS_HELP_STRING([--enable-xrender],
@@ -567,10 +524,8 @@
 	[enable_xrender=$enableval], [enable_xrender="yes"])
     AC_MSG_RESULT([$enable_xrender])
 
-    if test "$enable_xrender" = "yes" ; then
-	found_xrender="yes"
-	XRENDER_CFLAGS=`pkg-config --cflags xrender 2>/dev/null` || found_xrender="no"
-	XRENDER_LIBS=`pkg-config --libs xrender 2>/dev/null` || found_xrender="no"
+    AS_IF([test "$enable_xrender" = "yes"],[
+	PKG_CHECK_MODULES([XRENDER],[xrender],[found_xrender=yes],[found_xrender=no])
 	if test "$found_xrender" = "no" ; then
 	    found_xrender="yes"
 	    XRENDER_CFLAGS=""
@@ -599,8 +554,8 @@
 	    XRENDER_CFLAGS=""
 	    XRENDER_LIBS=""
 	fi
-    fi
-fi
+    ])
+])
 AC_SUBST(XRENDER_CFLAGS)
 AC_SUBST(XRENDER_LIBS)
 
@@ -650,21 +605,16 @@
 #	Check for Atk support
 #--------------------------------------------------------------------
 
-if test "$tk_aqua" = no; then
-  AC_MSG_CHECKING([for ATK and Atk-bridge])
-  if pkg-config --exists atk && pkg-config --exists atk-bridge-2.0; then
-    AC_MSG_RESULT([yes])
-    ATK_CFLAGS="`pkg-config --cflags atk atk-bridge-2.0`"
-    ATK_LIBS="`pkg-config --libs atk atk-bridge-2.0`"
+AS_IF([test "$tk_aqua" = no],[
+  PKG_CHECK_MODULES([ATK],[atk atk-bridge-2.0],[
     AC_DEFINE([HAVE_ATK], [1], [Define if ATK and Atk-bridge are available])
-  else
-    AC_MSG_RESULT([no])
+  ],[
     ATK_CFLAGS=""
     ATK_LIBS=""
-  fi
+  ])
   AC_SUBST([ATK_CFLAGS])
   AC_SUBST([ATK_LIBS])
-fi
+])
 
 #--------------------------------------------------------------------
 # XXX Do this last.

--4OPKQKiFUi8D2L7u--
Technical Details
Message-ID: <NTeee-8rU2-37@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Helmut Grohne <helmut@subdivi.de>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1152372: tk9.1 FTCBFS: hard codes the build architecture pkg-config
Date: Wed, 28 Oct 2026 17:00:02 +0100
Message-ID: <NTeee-8rU2-37@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Wed Oct 28 15:51:21 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Helmut Grohne <helmut@subdivi.de>, 1152372@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: pkg-tcltk-devel@lists.alioth.debian.org
X-Debian-Pr-Message: report 1152372
X-Debian-Pr-Package: src:tk9.1
X-Debian-Pr-Keywords: patch upstream
X-Debian-Pr-Source: tk9.1
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="4OPKQKiFUi8D2L7u"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
X-Reportbug-Version: 13.2.0
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/1999391
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 230
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Wed, 28 Oct 2026 07:16:38 +0100
X-Original-Message-ID: <20261028061638.GA1074641@subdivi.de>