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: [email protected]
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
--- 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.