Source: lilyterm
Version: 0.9.9.4+git20150208.f600c0-5
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

lilyterm fails to cross build from source, because its autogen.sh hard
codes the build architecture pkg-config and modifies configure.ac based
on the results. The misdetection results in a failure. It is best to
ship such detection in configure.ac, but there is a reason for not doing
that: The AM_PATH_GTK_2_0 macro is not vendored into lilyterm, so using
it would require a gtk2 installation.

I think it is best to drop support for gtk2 here given that gtk4 is
already considered useable. Once doing so, the logic can be moved from
autogen.sh to configure.ac. That in turn results in using the correct
pkg-config and cross builds succeed.

Please consider applying the attached patch.

Helmut
--- lilyterm-0.9.9.4+git20150208.f600c0.orig/autogen.sh
+++ lilyterm-0.9.9.4+git20150208.f600c0/autogen.sh
@@ -48,19 +48,6 @@
 Replace_Parameter BINARY
 echo ""
 
-# for GTK3+
-pkg-config --cflags gtk+-2.0 > /dev/null 2>&1
-if [ $? != 0 ]; then
-  sed -i 's/^AM_PATH_GTK_2_0.*/PKG_CHECK_MODULES([GTK], [gtk+-3.0])/g' configure.ac
-  pkg-config --cflags vte-2.91 > /dev/null 2>&1
-  if [ $? = 0 ]; then
-    sed -i 's/^PKG_CHECK_MODULES(vte, \[vte >= .*/PKG_CHECK_MODULES(vte, [vte-2.91 >= 0.38.0],, AC_MSG_ERROR([You need libvte-2.91 >= 0.38.0 to build $_PACKAGE]))/g' configure.ac
-    sed -i 's/^lilyterm_LDADD\(.*\)$/lilyterm_LDADD\1 -lX11/g' src/Makefile.am
-  else
-    sed -i 's/^PKG_CHECK_MODULES(vte, \[vte >= .*/PKG_CHECK_MODULES(vte, [vte-2.90 >= 0.30.0],, AC_MSG_ERROR([You need libvte-2.90 >= 0.30.0 to build $_PACKAGE]))/g' configure.ac
-  fi
-fi
-
 set -x
 
 aclocal
--- lilyterm-0.9.9.4+git20150208.f600c0.orig/configure.ac
+++ lilyterm-0.9.9.4+git20150208.f600c0/configure.ac
@@ -12,9 +12,15 @@
 AM_PROG_CC_C_O
 
 # Checks for libraries.
-AM_PATH_GTK_2_0(2.8.0,,AC_MSG_ERROR([You need Gtk+ >= 2.8.0 to build $_PACKAGE]))
-AM_PATH_GLIB_2_0(2.12.0,,AC_MSG_ERROR([You need Glib >= 2.12.0 to build $_PACKAGE]))
-PKG_CHECK_MODULES(vte, [vte >= 0.12.0],, AC_MSG_ERROR([You need libvte >= 0.12.0 to build $_PACKAGE]))
+EXTRA_LINK_X11=
+PKG_CHECK_MODULES([GTK],[gtk+-3.0])
+PKG_CHECK_MODULES([VTE291],[vte-2.91],[
+  PKG_CHECK_MODULES([vte],[vte-2.91 >= 0.38.0],, AC_MSG_ERROR([You need libvte-2.91 >= 0.38.0 to build $_PACKAGE]))
+  EXTRA_LINK_X11=-lX11
+],[
+  PKG_CHECK_MODULES([vte],[vte-2.90 >= 0.30.0],, AC_MSG_ERROR([You need libvte-2.90 >= 0.30.0 to build $_PACKAGE]))
+])
+AC_SUBST([EXTRA_LINK_X11])
 
 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [enable debug mode]),
 	      CFLAGS="$CFLAGS -g"
@@ -24,9 +30,6 @@
 	      CFLAGS="$CFLAGS -g"
 	      AC_DEFINE(REALMODE,, [disable run in safe mode]))
 
-PKG_CHECK_EXISTS(gtk+-2.0 < 2.12,
-		 AC_MSG_WARN([Using Gtk+ >= 2.12.0 to build $_PACKAGE is recommended]))
-
 AC_MSG_CHECKING([whether to install GNOME control-center default application definition])
 if $PKG_CONFIG --variable=keysdir gnome-default-applications >/dev/null ; then
      AC_MSG_RESULT([yes])
--- lilyterm-0.9.9.4+git20150208.f600c0.orig/src/Makefile.am
+++ lilyterm-0.9.9.4+git20150208.f600c0/src/Makefile.am
@@ -2,7 +2,7 @@
 
 bin_PROGRAMS = $_BINARY
 lilyterm_CFLAGS  = $(GTK_CFLAGS) $(vte_CFLAGS)
-lilyterm_LDADD   = $(GTK_LIBS) $(vte_LIBS) $(INTLLIBS)
+lilyterm_LDADD   = $(GTK_LIBS) $(vte_LIBS) $(INTLLIBS) $(EXTRA_LINK_X11)
 lilyterm_SOURCES = data.h lilyterm.h \
 		   misc.h misc.c \
 		   console.h console.c \

Reply via email to