Bug#1123910: tinysparql FTCBFS: fails running checks

Helmut Grohne helmut at subdivi.de
Sun Dec 21 11:52:23 GMT 2025


Source: tinysparql
Version: 3.10.1-4
Tags: patch
User: debian-cross at lists.debian.org
Usertags: ftcbfs
Control: affects 1060838 + src:tinysparql

tinysparql fails to cross build from source. The meson.build file is
aware of cross building and knows that it cannot figure out whether
sqlite3 supports fts5 in a cross build. Instead, a user is supposed to
supply this result. It is less equipped when it comes to figuring out
what format string to pass to strftime for emitting a four-digit year,
but that support is easily extendable. I propose including these
detection results in the source package, because Debian's sqlite3
unconditionally enables fts5 support and all C libraries supported by
Debian work with %Y. The attached patch implements the proposed
solution. Once applying it, a cross build runs into #1060838.

Helmut
-------------- next part --------------
diff -Nru tinysparql-3.10.1/debian/changelog tinysparql-3.10.1/debian/changelog
--- tinysparql-3.10.1/debian/changelog	2025-12-09 19:43:40.000000000 +0100
+++ tinysparql-3.10.1/debian/changelog	2025-12-21 08:56:25.000000000 +0100
@@ -1,3 +1,11 @@
+tinysparql (3.10.1-4.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building. (Closes: #-1)
+    + Preseed two meson check results.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sun, 21 Dec 2025 08:56:25 +0100
+
 tinysparql (3.10.1-4) unstable; urgency=medium
 
   * Mark other -doc package as Multi-Arch: foreign also
diff -Nru tinysparql-3.10.1/debian/meson-cross-file.txt tinysparql-3.10.1/debian/meson-cross-file.txt
--- tinysparql-3.10.1/debian/meson-cross-file.txt	1970-01-01 01:00:00.000000000 +0100
+++ tinysparql-3.10.1/debian/meson-cross-file.txt	2025-12-21 08:56:25.000000000 +0100
@@ -0,0 +1,6 @@
+[properties]
+# We cannot detect this during a cross build, but Debian's sqlite3 always enables fts5.
+sqlite3_has_fts5 = 'true'
+
+# We cannot detect this during a cross build, but all C libraries supported by Debian use this.
+year_modifier = '%Y'
diff -Nru tinysparql-3.10.1/debian/patches/cross.patch tinysparql-3.10.1/debian/patches/cross.patch
--- tinysparql-3.10.1/debian/patches/cross.patch	1970-01-01 01:00:00.000000000 +0100
+++ tinysparql-3.10.1/debian/patches/cross.patch	2025-12-21 08:56:25.000000000 +0100
@@ -0,0 +1,75 @@
+Index: tinysparql-3.10.1/meson.build
+===================================================================
+--- tinysparql-3.10.1.orig/meson.build
++++ tinysparql-3.10.1/meson.build
+@@ -197,36 +197,43 @@ endif
+ ##################################################################
+ # Get an appropriate 4-digit year modifier for strftime
+ ##################################################################
+-result = cc.run('''
+-  #define _TIME_BITS 64
+-  #define _GNU_SOURCE
+-  #include <stdio.h>
+-  #include <string.h>
+-  #include <time.h>
+-
+-  int main (int argc, char *argv[]) {
+-    char *modifiers[] = { "%Y", "%C%y", "%4Y", "%2C%y", NULL };
+-    time_t timestamp = -58979923200; /* 0101-01-01T01:01:01Z */
+-    char buf[100];
+-    struct tm tm;
+-    int i;
+-    gmtime_r (&timestamp, &tm);
+-    for (i = 0; modifiers[i]; i++) {
+-      strftime (buf, sizeof buf, modifiers[i], &tm);
+-      if (strcmp (buf, "0101") == 0) {
+-        printf ("%s", modifiers[i]);
+-        return 0;
++if meson.is_cross_build() and not meson.has_exe_wrapper()
++  year_modifier = meson.get_cross_property('year_modifier')
++  if year_modifier == ''
++    error('Please assign an appropriate value for year_modifier in the [properties] section of your crossfile')
++  endif
++else
++  result = cc.run('''
++    #define _TIME_BITS 64
++    #define _GNU_SOURCE
++    #include <stdio.h>
++    #include <string.h>
++    #include <time.h>
++  
++    int main (int argc, char *argv[]) {
++      char *modifiers[] = { "%Y", "%C%y", "%4Y", "%2C%y", NULL };
++      time_t timestamp = -58979923200; /* 0101-01-01T01:01:01Z */
++      char buf[100];
++      struct tm tm;
++      int i;
++      gmtime_r (&timestamp, &tm);
++      for (i = 0; modifiers[i]; i++) {
++        strftime (buf, sizeof buf, modifiers[i], &tm);
++        if (strcmp (buf, "0101") == 0) {
++          printf ("%s", modifiers[i]);
++          return 0;
++        }
+       }
++      return -1;
+     }
+-    return -1;
+-  }
+-  ''',
+-  name: 'strftime 4-digit year modifier')
++    ''',
++    name: 'strftime 4-digit year modifier')
+ 
+-if not result.compiled() or result.returncode() != 0
+-  error('Libc implementation has broken 4-digit years implementation.')
+-else
+-  year_modifier = result.stdout()
++  if not result.compiled() or result.returncode() != 0
++    error('Libc implementation has broken 4-digit years implementation.')
++  else
++    year_modifier = result.stdout()
++  endif
+ endif
+ 
+ ##################################################################
diff -Nru tinysparql-3.10.1/debian/patches/series tinysparql-3.10.1/debian/patches/series
--- tinysparql-3.10.1/debian/patches/series	2025-12-09 19:43:40.000000000 +0100
+++ tinysparql-3.10.1/debian/patches/series	2025-12-21 08:56:25.000000000 +0100
@@ -1,3 +1,4 @@
 disable-some-failing-tests.patch
 exclude-web-ide.patch
 skip-manpage-test.patch
+cross.patch
diff -Nru tinysparql-3.10.1/debian/rules tinysparql-3.10.1/debian/rules
--- tinysparql-3.10.1/debian/rules	2025-12-09 19:43:40.000000000 +0100
+++ tinysparql-3.10.1/debian/rules	2025-12-21 08:56:25.000000000 +0100
@@ -7,6 +7,8 @@
 # needed for Ubuntu
 export DEB_LDFLAGS_MAINT_STRIP = -Wl,-Bsymbolic-functions
 
+include /usr/share/dpkg/architecture.mk
+
 %:
 	dh $@
 
@@ -19,7 +21,8 @@
 		-Ddocs=$(if $(filter %-doc,$(shell dh_listpackages)),true,false) \
 		-Dsystemd_user_services=true \
 		-Dsystemd_user_services_dir=/usr/lib/systemd/user \
-		-Dtests=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),false,true)
+		-Dtests=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),false,true) \
+		$(if $(filter ${DEB_BUILD_ARCH},${DEB_HOST_ARCH}),,--cross-file=$(CURDIR)/debian/meson-cross-file.txt)
 
 override_dh_auto_test:
 	dbus-run-session -- dh_auto_test -- --timeout-multiplier 7


More information about the pkg-gnome-maintainers mailing list