Source: gambas3
Version: 3.16.3-3
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

gambas3 fails to cross build from source, because it hard codes the
build architecture pkg-config in various places and thus fails finding
required components that are only installed for the host architecture.
I'm attaching a patch that employs PKG_PROG_PKG_CONFIG to discover the
host architecture pkg-config and lets the build proceed quite a bit
further. Please consider applying it.

Helmut
--- gambas3-3.16.3.orig/acinclude.m4
+++ gambas3-3.16.3/acinclude.m4
@@ -963,6 +963,7 @@
 
 AC_DEFUN([GB_COMPONENT_PKG_CONFIG],
 [
+  AC_REQUIRE([PKG_PROG_PKG_CONFIG])
   AC_ARG_ENABLE(
     $1,
     [  --enable-$1                enable $3 (default: yes)],
@@ -990,17 +991,17 @@
     have_$1=yes
     gb_testval=""
 
-    pkg-config --silence-errors --exists $5
+    $PKG_CONFIG --silence-errors --exists $5
     if test $? -eq "0"; then
 
       ## Checking for headers
 
-      $2_INC="`pkg-config --cflags $5`"
+      $2_INC="`$PKG_CONFIG --cflags $5`"
 
       ## Checking for libraries
 
-      $2_LIB="`pkg-config --libs-only-l $5`"
-      $2_LDFLAGS="`pkg-config --libs-only-L $5` `pkg-config --libs-only-other $5`"
+      $2_LIB="`$PKG_CONFIG --libs-only-l $5`"
+      $2_LDFLAGS="`$PKG_CONFIG --libs-only-L $5` `$PKG_CONFIG --libs-only-other $5`"
       $2_DIR=$4
 
     else
@@ -1027,7 +1028,7 @@
     for pkgcmp in $5
     do
 
-      pkg-config --silence-errors --exists $pkgcmp
+      $PKG_CONFIG --silence-errors --exists $pkgcmp
       if test $? -eq "1"; then
         GB_WARNING([Unable to met pkg-config requirement: $pkgcmp])
       fi
--- gambas3-3.16.3.orig/gb.ncurses/configure.ac
+++ gambas3-3.16.3/gb.ncurses/configure.ac
@@ -6,6 +6,7 @@
 
 GB_INIT(gb.ncurses)
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 # Most distributions I have seen apparently provide the ncurses and panel
 # pkg-config files (which may be synonymous with ncursesw and panelw for
@@ -13,7 +14,7 @@
 #
 # We should prefer linking with the wide-character version but still
 # allow to compile on systems that don't have ncursesw pkg-config files.
-pkg-config --silence-errors --exists ncursesw panelw
+$PKG_CONFIG --silence-errors --exists ncursesw panelw
 if test $? -eq "0"
   then gb_ncurses_pkgconfig_names="ncursesw panelw"
   else gb_ncurses_pkgconfig_names="ncurses panel"
--- gambas3-3.16.3.orig/gb.pdf/configure.ac
+++ gambas3-3.16.3/gb.pdf/configure.ac
@@ -6,6 +6,7 @@
 
 GB_INIT(gb.pdf)
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 GB_COMPONENT_PKG_CONFIG(
   poppler, POPPLER, gb.pdf, [src],
@@ -13,23 +14,23 @@
 )
 
 if test "$have_poppler" = "yes"; then
-  pkg-config --atleast-version=0.58.0 poppler
+  $PKG_CONFIG --atleast-version=0.58.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_58, $((1-$?)), Poppler version >= 0.58)
-  pkg-config --atleast-version=0.64.0 poppler
+  $PKG_CONFIG --atleast-version=0.64.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_64, $((1-$?)), Poppler version >= 0.64)
-  pkg-config --atleast-version=0.71.0 poppler
+  $PKG_CONFIG --atleast-version=0.71.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_71, $((1-$?)), Poppler version >= 0.71)
-  pkg-config --atleast-version=0.72.0 poppler
+  $PKG_CONFIG --atleast-version=0.72.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_72, $((1-$?)), Poppler version >= 0.72)
-  pkg-config --atleast-version=0.76.0 poppler
+  $PKG_CONFIG --atleast-version=0.76.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_76, $((1-$?)), Poppler version >= 0.76)
-  pkg-config --atleast-version=0.83.0 poppler
+  $PKG_CONFIG --atleast-version=0.83.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_83, $((1-$?)), Poppler version >= 0.83)
-  pkg-config --atleast-version=0.85.0 poppler
+  $PKG_CONFIG --atleast-version=0.85.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_85, $((1-$?)), Poppler version >= 0.85)
-  pkg-config --atleast-version=0.86.0 poppler
+  $PKG_CONFIG --atleast-version=0.86.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_86, $((1-$?)), Poppler version >= 0.86)
-  pkg-config --atleast-version=21.06.0 poppler
+  $PKG_CONFIG --atleast-version=21.06.0 poppler
   AC_DEFINE_UNQUOTED(POPPLER_VERSION_21_06_0, $((1-$?)), Poppler version >= 21.06.0)
 fi
 
--- gambas3-3.16.3.orig/gb.qt4/configure.ac
+++ gambas3-3.16.3/gb.qt4/configure.ac
@@ -6,6 +6,7 @@
 
 GB_INIT(gb.qt4)
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 AC_ARG_ENABLE(
   qt-translation,
@@ -46,7 +47,7 @@
   'QtCore >= 4.5.0' QtGui QtOpenGL x11 gl
 )
 
-MOC=`pkg-config --variable=moc_location QtCore`
+MOC=`$PKG_CONFIG --variable=moc_location QtCore`
 AC_SUBST(MOC)
 
 AC_OUTPUT( \
--- gambas3-3.16.3.orig/gb.qt5/configure.ac
+++ gambas3-3.16.3/gb.qt5/configure.ac
@@ -6,6 +6,7 @@
 
 GB_INIT(gb.qt5)
 AC_PROG_LIBTOOL
+PKG_PROG_PKG_CONFIG
 
 GB_CHECK_XWINDOW
 AM_CONDITIONAL(XWINDOW, test x"$have_x" = xyes)
@@ -35,7 +36,7 @@
   'Qt5Core >= 5.5.0' Qt5WebEngineWidgets
 )
 
-pkg-config --atleast-version 5.4.0 Qt5Core
+$PKG_CONFIG --atleast-version 5.4.0 Qt5Core
 if test $? != 0; then
 	AC_DEFINE_UNQUOTED(QT_OLD_OPENGL, 1, Use deprecated OpenGL widget)
 	QT_OPENGL_SUPPORT=Qt5OpenGL
@@ -54,7 +55,7 @@
   'Qt5Core >= 5.3.0' Qt5Gui Qt5Widgets x11
 )
 
-MOC=`pkg-config --variable=host_bins Qt5Core`/moc
+MOC=`$PKG_CONFIG --variable=host_bins Qt5Core`/moc
 AC_SUBST(MOC)
 
 AC_OUTPUT( \

Reply via email to