Source: sqlite
Version: 2.8.17-13
Tags: patch
User: [email protected]
Usertags: rebootstrap

sqlite fails to cross build from source, because its configure is not
quite up to the task. It has its own detection for build compiler and
host compiler (called target in sqlite), which require the user to set
config_BUILD_CC and config_TARGET_CC. It also fails to find readline.h,
because it wrongly uses AC_CHECK_FILE. The attached patch makes the
cross build succeed. Please consider applying it.

Helmut
diff --minimal -Nru sqlite-2.8.17/debian/changelog 
sqlite-2.8.17/debian/changelog
--- sqlite-2.8.17/debian/changelog      2016-08-10 12:42:12.000000000 +0200
+++ sqlite-2.8.17/debian/changelog      2017-01-06 12:59:25.000000000 +0100
@@ -1,3 +1,12 @@
+sqlite (2.8.17-13.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (closes: #-1).
+    + Tell configure what compilers to use
+    + 06-cross.patch: Fix wrong uses of AC_CHECK_FILE
+
+ -- Helmut Grohne <[email protected]>  Fri, 06 Jan 2017 12:59:25 +0100
+
 sqlite (2.8.17-13) unstable; urgency=low
 
   * Build with hardening.
diff --minimal -Nru sqlite-2.8.17/debian/patches/06-cross.patch 
sqlite-2.8.17/debian/patches/06-cross.patch
--- sqlite-2.8.17/debian/patches/06-cross.patch 1970-01-01 01:00:00.000000000 
+0100
+++ sqlite-2.8.17/debian/patches/06-cross.patch 2017-01-06 12:59:25.000000000 
+0100
@@ -0,0 +1,30 @@
+From: Helmut Grohne <[email protected]>
+Subject: fix wrong uses of AC_CHECK_FILE
+
+AC_CHECK_FILE is meant to exercise the host system, but we have no reasonable
+expectation that headers will be present on a host system nor do we need that.
+It really only matters whether they are present on the build system and we can
+simply test that.
+
+Index: sqlite-2.8.17/configure.ac
+===================================================================
+--- sqlite-2.8.17.orig/configure.ac
++++ sqlite-2.8.17/configure.ac
+@@ -510,13 +510,13 @@
+ fi
+ if test "$found" = "no"; then
+   for dir in /usr /usr/local /usr/local/readline /usr/contrib /mingw; do
+-    AC_CHECK_FILE($dir/include/readline.h, found=yes)
+-    if test "$found" = "yes"; then
++    if test -f "$dir/include/readline.h"; then
++      found=yes
+       TARGET_READLINE_INC="-I$dir/include"
+       break
+     fi
+-    AC_CHECK_FILE($dir/include/readline/readline.h, found=yes)
+-    if test "$found" = "yes"; then
++    if test -f "$dir/include/readline/readline.h"; then
++      found=yes
+       TARGET_READLINE_INC="-I$dir/include/readline"
+       break
+     fi
diff --minimal -Nru sqlite-2.8.17/debian/patches/series 
sqlite-2.8.17/debian/patches/series
--- sqlite-2.8.17/debian/patches/series 2016-08-10 12:42:12.000000000 +0200
+++ sqlite-2.8.17/debian/patches/series 2017-01-06 12:59:25.000000000 +0100
@@ -3,3 +3,4 @@
 03-add-fprintf-format-argument.patch
 04-fix-sort-syntax.patch
 05-link_with_LDFLAGS.patch
+06-cross.patch
diff --minimal -Nru sqlite-2.8.17/debian/rules sqlite-2.8.17/debian/rules
--- sqlite-2.8.17/debian/rules  2016-08-10 12:42:12.000000000 +0200
+++ sqlite-2.8.17/debian/rules  2017-01-06 12:59:25.000000000 +0100
@@ -6,8 +6,14 @@
 
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/buildflags.mk
 
+ifeq ($(origin CC),default)
+CC := $(DEB_HOST_GNU_TYPE)-gcc
+endif
+export config_BUILD_CC:=cc
+export config_TARGET_CC:=$(CC)
 export PATH:=$(PATH):$(CURDIR)/bin
 
 CONFIGURE_EXTRA_FLAGS = config_TARGET_TCL_INC="-I/usr/include/tcl8.6" \

Reply via email to