Package: sqlite3
Version: 3.7.4-2
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu natty ubuntu-patch

Hi Laszlo,

As part of an effort to make the Ubuntu base system cross-compilable, we've
found that several changes are needed to the sqlite3 package for this -
mostly related to the 'lemon' binary, which is normally not installed as
part of the upstream build but instead executed at package build time as a
helper binary.

Attached is a patch that addresses the various issues.  Please consider
including it in Debian and forwarding upstream those changes that apply to
the upstream Makefile.

The changelog entry for this change in Ubuntu is:

  [ Peter Pearse ]
  * Patch to build both build host & target lemon compilers when cross
    building

  [ Steve Langasek ]
  * Refine the patch for upstreamability: always use $(BEXE) for build and
    $(TEXE) for target binaries, and only build a lemon binary for the
    target upon explicit request.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru sqlite3-3.7.4/debian/patches/30-cross.patch sqlite3-3.7.4/debian/patches/30-cross.patch
--- sqlite3-3.7.4/debian/patches/30-cross.patch	1969-12-31 16:00:00.000000000 -0800
+++ sqlite3-3.7.4/debian/patches/30-cross.patch	2011-01-30 17:23:35.000000000 -0800
@@ -0,0 +1,51 @@
+Index: sqlite3-3.7.4/Makefile.in
+===================================================================
+--- sqlite3-3.7.4.orig/Makefile.in
++++ sqlite3-3.7.4/Makefile.in
+@@ -522,10 +522,20 @@
+ 
+ # Rules to build the LEMON compiler generator
+ #
+-lemon$(BEXE):	$(TOP)/tool/lemon.c $(TOP)/src/lempar.c
++lemon-for-build$(BEXE):	$(TOP)/tool/lemon.c $(TOP)/src/lempar.c
+ 	$(BCC) -o $@ $(TOP)/tool/lemon.c
+ 	cp $(TOP)/src/lempar.c .
+ 
++lemon$(TEXE):	$(TOP)/tool/lemon.c $(TOP)/src/lempar.c
++	$(LTLINK) -o $@ $(TOP)/tool/lemon.c
++	cp $(TOP)/src/lempar.c .
++
++ifeq ($(CROSS_BUILDING),yes)
++LEMON_FOR_BUILD = lemon-for-build$(BEXE)
++else
++LEMON_FOR_BUILD = lemon$(TEXE)
++endif
++
+ # Rules to build individual *.o files from generated *.c files. This
+ # applies to:
+ #
+@@ -775,10 +785,10 @@
+ #
+ parse.h:	parse.c
+ 
+-parse.c:	$(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk
++parse.c:	$(TOP)/src/parse.y $(LEMON_FOR_BUILD) $(TOP)/addopcodes.awk
+ 	cp $(TOP)/src/parse.y .
+ 	rm -f parse.h
+-	./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
++	./$(LEMON_FOR_BUILD) $(OPT_FEATURE_FLAGS) $(OPTS) parse.y
+ 	mv parse.h parse.h.temp
+ 	$(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h
+ 
+@@ -913,7 +923,10 @@
+ 	rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
+ 	rm -f sqlite3.h opcodes.*
+ 	rm -rf .libs .deps
+-	rm -f lemon$(BEXE) lempar.c parse.* sqlite*.tar.gz
++	rm -f $(LEMON_FOR_BUILD) lempar.c parse.* sqlite*.tar.gz
++ifeq ($(CROSS_BUILDING), yes)
++	rm -f lemon$(TEXE)
++endif
+ 	rm -f mkkeywordhash$(BEXE) keywordhash.h
+ 	rm -f $(PUBLISH)
+ 	rm -f *.da *.bb *.bbg gmon.out
diff -Nru sqlite3-3.7.4/debian/patches/series sqlite3-3.7.4/debian/patches/series
--- sqlite3-3.7.4/debian/patches/series	2010-10-20 09:24:20.000000000 -0700
+++ sqlite3-3.7.4/debian/patches/series	2011-02-03 15:47:46.000000000 -0800
@@ -3,3 +3,4 @@
 10-520478-squash-bad-deps.patch
 11-update-manpage.patch
 20-hurd-locking-style.patch
+30-cross.patch
diff -Nru sqlite3-3.7.4/debian/rules sqlite3-3.7.4/debian/rules
--- sqlite3-3.7.4/debian/rules	2010-12-26 13:47:51.000000000 -0800
+++ sqlite3-3.7.4/debian/rules	2011-01-30 22:12:56.000000000 -0800
@@ -5,6 +5,13 @@
 include /usr/share/cdbs/1/rules/debhelper.mk
 #include /usr/share/cdbs/1/rules/simple-patchsys.mk
 
+ifeq ($(cdbs_crossbuild),)
+      DEB_MAKE_EXTRA_ARGS += CROSS_BUILDING=no
+else
+      DEB_MAKE_EXTRA_ARGS += CROSS_BUILDING=yes
+      DEB_CONFIGURE_EXTRA_FLAGS += LDFLAGS=-L/usr/$(DEB_HOST_GNU_TYPE)/lib 
+endif
+
 so_version := 0
 
 # Make sure libsqlite0 is built before packages depending on it
@@ -42,9 +49,13 @@
 DEB_AUTO_UPDATE_AUTOMAKE = 1.11
 
 #DEB_CONFIGURE_SCRIPT_ENV += LDFLAGS="-licui18n -licuuc"
-DEB_CONFIGURE_EXTRA_FLAGS = --with-tcl=/usr/lib/tcl8.5 --enable-threadsafe --enable-load-extension
+ifeq ($(cdbs_crossbuild),)
+       DEB_CONFIGURE_EXTRA_FLAGS = --with-tcl=/usr/lib/tcl8.5 --enable-threadsafe --enable-load-extension
+else
+       DEB_CONFIGURE_EXTRA_FLAGS += --with-tcl=/usr/$(DEB_HOST_GNU_TYPE)/lib/tcl8.5 --enable-threadsafe --enable-load-extension
+endif
 
-DEB_MAKE_BUILD_TARGET = all libtclsqlite3.la doc
+DEB_MAKE_BUILD_TARGET = all libtclsqlite3.la doc lemon
 #DEB_MAKE_CHECK_TARGET = test
 
 DEB_DH_INSTALL_ARGS := --sourcedir=debian/tmp

Reply via email to