Source: gentle
Version: 1.9.5~alpha2+dfsg1-2
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

gentle fails to cross build from source, because upstream hard codes
build architecture build tools in multiple places. The most difficult
one is the use of mysql_config. It is fundamentally incompatible with
cross compilation (as you can either run it or get sensible values, but
not both at the same time). The other aspect is hard coding the build
architecture pkg-config. I'm attaching a patch that converts this to
pkg-config via PKG_CHECK_MODULES in a way that seamlessly falls back to
mysql_config when pkg-config does not work out. Please consider applying
the patch in forky.

Helmut
--- gentle-1.9.5~alpha2+dfsg1.orig/configure.ac
+++ gentle-1.9.5~alpha2+dfsg1/configure.ac
@@ -57,15 +57,13 @@
 WX_CXXFLAGS="`$WXCONFIG --cxxflags | sed -e 's/-fno-exceptions//'`"
 WX_LIBS="`$WXCONFIG --libs`"
 
-#TINYXML_CPPFLAGS="`pkg-config --cppflags tinyxml`"
-TINYXML_CXXFLAGS="`pkg-config --cflags tinyxml`"
-TINYXML_LIBS="`pkg-config --libs tinyxml`"
+PKG_CHECK_MODULES([TINYXML],[tinyxml])
 
 GTEST_INCLUDE="`pkg-config --cflags gtest`"
 GTEST_LIBS="`pkg-config --libs gtest`"
 
-CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS $TINYXML_CPPFLAGS"
-CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS $TINYXML_CXXFLAGS"
+CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
+CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS $TINYXML_CFLAGS"
 LDFLAGS="$LDFLAGS $TINYXML_LIBS"
 
 if [[ "x" != "x$PREFIX" ]]; then
--- gentle-1.9.5~alpha2+dfsg1.orig/m4/mysql.m4
+++ gentle-1.9.5~alpha2+dfsg1/m4/mysql.m4
@@ -5,31 +5,51 @@
 dnl
 
 AC_DEFUN([WITH_MYSQL], [
-  AC_MSG_CHECKING(for mysql_config executable)
-
+  MYSQL_ENABLE=auto
   AC_ARG_WITH(mysql, AS_HELP_STRING([--with-mysql=PATH],[path to mysql_config binary or mysql prefix dir]), [
-  if test -x $withval -a -f $withval -a "no" != "$withval"
+  if test "$withval" = yes || test "$withval" = no
+  then
+      MYSQL_ENABLE=$withval
+    elif test -x $withval -a -f $withval
     then
       MYSQL_CONFIG=$withval
+      MYSQL_ENABLE=mysql_config
     elif test -x $withval/bin/mysql_config -a -f $withval/bin/mysql_config
     then
-     MYSQL_CONFIG=$withval/bin/mysql_config
-    fi
-  ], [
-  if test -x /usr/local/mysql/bin/mysql_config -a -f /usr/local/mysql/bin/mysql_config
-    then
-      MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
-    elif test -x /usr/bin/mysql_config -a -f /usr/bin/mysql_config
-    then
-      MYSQL_CONFIG=/usr/bin/mysql_config
+      MYSQL_CONFIG=$withval/bin/mysql_config
+      MYSQL_ENABLE=mysql_config
     fi
   ])
+  AS_IF([test "$MYSQL_ENABLE" = yes || test "$MYSQL_ENABLE" = auto],[
+    PKG_CHECK_MODULES([MYSQLCLIENT],[mysqlclient],[MYSQL_ENABLE=pkg-config],[])
+  ])
+  AC_MSG_CHECKING(for mysql_config executable)
+  AS_IF([test "$MYSQL_ENABLE" = yes || test "$MYSQL_ENABLE" = auto],[
+    if test -x /usr/local/mysql/bin/mysql_config -a -f /usr/local/mysql/bin/mysql_config
+      then
+        MYSQL_CONFIG=/usr/local/mysql/bin/mysql_config
+        MYSQL_ENABLE=mysql_config
+      elif test -x /usr/bin/mysql_config -a -f /usr/bin/mysql_config
+      then
+        MYSQL_CONFIG=/usr/bin/mysql_config
+        MYSQL_CONFIG=mysql_config
+      fi
+  ])
 
-  if test "x$MYSQL_CONFIG" = "x" -o "x$MYSQL_CONFIG" = "xno"
+  if test "$MYSQL_ENABLE=pkg-config"
+  then
+    CXXFLAGS="$CXXFLAGS $MYSQLCLIENT_CFLAGS"
+    LDFLAGS="$LDFLAGS $MYSQLCLIENT_LIBS"
+
+    AC_MSG_RESULT(found via pkg-config)
+  elif test "$MYSQL_ENABLE" = yes
+  then
+    AC_MSG_ERROR(no)
+  elif test "$MYSQL_ENABLE" = auto
+  then
+    AC_MSG_RESULT(no)
+  elif test "$MYSQL_ENABLE" = mysql_config
   then
-    AC_MSG_RESULT("MySQL support not configured.")
-    #exit 3
-  else
     AC_PROG_CC
     AC_PROG_CXX
 

Reply via email to