Source: stella
Version: 7.0+dfsg-1
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

stella fails to cross build from source, because ./configure hard codes
the build architecture pkg-config and thus fails finding libraries. It
already has a bit of knowledge about cross compilation and actually
considers a _host_prefix for some tools. Unfortunately, _host_prefix is
not yet generally initialized (and we earlier worked around that by
export CXX) and it also does not prepend _host_prefix to pkg-config. I'm
attaching a patch that fixes these. As a result, we no longer need to
include dpkg's buildtools.mk as configure now correctly determines CXX
by itself. Consider applying and forwarding the attached patch.

Helmut
diff --minimal -Nru stella-7.0+dfsg/debian/changelog 
stella-7.0+dfsg/debian/changelog
--- stella-7.0+dfsg/debian/changelog    2024-10-06 15:48:32.000000000 +0200
+++ stella-7.0+dfsg/debian/changelog    2025-01-30 09:37:16.000000000 +0100
@@ -1,3 +1,11 @@
+stella (7.0+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Add cross.patch prepending _host_prefix to pkg-config.
+    (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 30 Jan 2025 09:37:16 +0100
+
 stella (7.0+dfsg-1) unstable; urgency=medium
 
   * New upstream release.
diff --minimal -Nru stella-7.0+dfsg/debian/patches/cross.patch 
stella-7.0+dfsg/debian/patches/cross.patch
--- stella-7.0+dfsg/debian/patches/cross.patch  1970-01-01 01:00:00.000000000 
+0100
+++ stella-7.0+dfsg/debian/patches/cross.patch  2025-01-30 09:37:16.000000000 
+0100
@@ -0,0 +1,93 @@
+--- stella-7.0+dfsg.orig/configure
++++ stella-7.0+dfsg/configure
+@@ -45,6 +45,7 @@
+ _install=install
+ _ar="ar cru"
+ _strip=strip
++_pkg_config=pkg-config
+ _mkdir="mkdir -p"
+ _echo=printf
+ _cat=cat
+@@ -343,12 +344,17 @@
+       _host_cpu=i386
+       _host_prefix=i386-mingw32msvc
+       ;;
+-*)
++"")
+       guessed_host=`$_srcdir/config.guess`
+       _host_cpu=`echo $guessed_host | sed 
's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+       _host_os=`echo $guessed_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+       _host_vendor=`echo $guessed_host | sed 
's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+       ;;
++*)
++      _host_cpu=`echo "$_host" | sed 's/^\([^-]*\)-.*/\1/'`
++      _host_os=`echo "$_host" | sed 's/-\([^-]*\)-[^-]*$/\1/'`
++      _host_prefix="$_host"
++      ;;
+ esac
+ 
+ #
+@@ -626,6 +632,9 @@
+ # Cross-compilers use their own commands for the following functions
+ if test -n "$_host_prefix"; then
+       _strip="$_host_prefix-$_strip"
++      if command -v "$_host_prefix-$_pkg_config" >/dev/null 2>&1; then
++              _pkg_config="$_host_prefix-$_pkg_config"
++      fi
+ fi
+ 
+ #
+@@ -639,7 +648,7 @@
+ #include <zlib.h>
+ int main(void) { return strcmp(ZLIB_VERSION, zlibVersion()); }
+ EOF
+-      cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS `pkg-config --libs 
zlib` && _zlib=yes
++      cc_check $LDFLAGS $CXXFLAGS $ZLIB_CFLAGS $ZLIB_LIBS `$_pkg_config 
--libs zlib` && _zlib=yes
+ 
+   if test "$_zlib" = yes ; then
+     echo "$_zlib"
+@@ -665,7 +674,7 @@
+ #include <png.h>
+ int main(void) { return printf("%s\n", PNG_HEADER_VERSION_STRING); }
+ EOF
+-  cc_check $LDFLAGS $CXXFLAGS $LIBPNG_CFLAGS $LIBPNG_LIBS `pkg-config --libs 
libpng` && _libpng=yes
++  cc_check $LDFLAGS $CXXFLAGS $LIBPNG_CFLAGS $LIBPNG_LIBS `$_pkg_config 
--libs libpng` && _libpng=yes
+ 
+   if test "$_libpng" = yes ; then
+     echo "$_libpng"
+@@ -689,7 +698,7 @@
+ #include <sqlite3.h>
+ int main(void) { return printf("%s\n", SQLITE_VERSION); }
+ EOF
+-  cc_check $LDFLAGS $CXXFLAGS `pkg-config --libs sqlite3` && _libsqlite3=yes
++  cc_check $LDFLAGS $CXXFLAGS `$_pkg_config --libs sqlite3` && _libsqlite3=yes
+ 
+   if test "$_libsqlite3" = yes ; then
+     echo "$_libsqlite3"
+@@ -922,7 +931,7 @@
+       INCLUDES="$INCLUDES -I$LIBJPG -I$LIBJPGEXIF"
+       MODULES="$MODULES $LIBJPGEXIF"
+   if test "$_libpng" = yes ; then
+-    LIBS="$LIBS `pkg-config --libs libpng`"
++    LIBS="$LIBS `$_pkg_config --libs libpng`"
+   else
+     MODULES="$MODULES $LIBPNG"
+     INCLUDES="$INCLUDES -I$LIBPNG"
+@@ -930,7 +939,7 @@
+ fi
+ 
+ if test "$_libsqlite3" = yes ; then
+-  LIBS="$LIBS `pkg-config --libs sqlite3`"
++  LIBS="$LIBS `$_pkg_config --libs sqlite3`"
+ else
+   MODULES="$MODULES $SQLITE_LIB"
+   INCLUDES="$INCLUDES -I$SQLITE_LIB"
+@@ -939,7 +948,7 @@
+ if test "$_build_zip" = yes ; then
+       DEFINES="$DEFINES -DZIP_SUPPORT"
+   if test "$_zlib" = yes ; then
+-    LIBS="$LIBS `pkg-config --libs zlib`"
++    LIBS="$LIBS `$_pkg_config --libs zlib`"
+   else
+     MODULES="$MODULES $ZLIB"
+     INCLUDES="$INCLUDES -I$ZLIB"
diff --minimal -Nru stella-7.0+dfsg/debian/patches/series 
stella-7.0+dfsg/debian/patches/series
--- stella-7.0+dfsg/debian/patches/series       2024-10-06 15:45:52.000000000 
+0200
+++ stella-7.0+dfsg/debian/patches/series       2025-01-30 09:33:20.000000000 
+0100
@@ -1 +1,2 @@
 remove-update-check.patch
+cross.patch
diff --minimal -Nru stella-7.0+dfsg/debian/rules stella-7.0+dfsg/debian/rules
--- stella-7.0+dfsg/debian/rules        2024-10-06 15:04:51.000000000 +0200
+++ stella-7.0+dfsg/debian/rules        2025-01-30 09:37:16.000000000 +0100
@@ -12,8 +12,6 @@
 export DEB_LDFLAGS_MAINT_APPEND = -flto=$(CPUS)
 
 include /usr/share/dpkg/architecture.mk
-DPKG_EXPORT_BUILDTOOLS=1
--include /usr/share/dpkg/buildtools.mk
 
 %:
        dh $@

Reply via email to