Hi László,

I've looked into the new sqlite3 3.53.1 and here's the first attempt to update
it and to build two Tcl libraries: one for Tcl 8.6 and the other for Tcl 9.0.

The package definitely need polishing and even completing:

1. Since upstream totally redid the build system switching from autotools to
some in-house written tool, one has to rewrite the clean target in debian/rules
(I've only commented out deleting the configure script at the moment)
2. As for now I've just dropped patches which did not apply cleanly,
one has to review them to understand if they are still relevant
3. In the view of changed build system, I have no idea on how
cross-build of sqlite3 will work now
4. Currently, all the library is built twice, which might be not
desirable, as only
for the Tcl related package it is absolutely necessary. I don't know how to fix
this cleanly
5. I didn't touch the www component, it should be updated to the current
documentation I suppose

There is one unnecessary but desired change in addition to updating to 3.53.1
and porting to Tcl 9: making the libsqlite3-tcl package multi-arch same.


Here are the comments on most changes in the debian/ directory along the
diff (I've attached the compressed debian directory as well):

Just a dummy changelog entry:

--- sqlite3-3.46.1/debian/changelog 2026-01-24 11:48:16.000000000 +0300
+++ sqlite3-3.53.1/debian/changelog 2026-05-31 12:13:25.279526579 +0300
@@ -1,3 +1,9 @@
+sqlite3 (3.53.1-1) unstable; urgency=medium
+
+  * New upstream release.
+
+ -- Sergei Golovan <[email protected]>  Sun, 31 May 2026 12:13:22 +0300
+
 sqlite3 (3.46.1-9) unstable; urgency=medium

   * Add pkgconf build dependency to fix link problem with ICU extension

A few changes in debian/control

--- sqlite3-3.46.1/debian/control 2026-01-24 11:48:16.000000000 +0300
+++ sqlite3-3.53.1/debian/control 2026-05-31 19:22:54.716534584 +0300
@@ -2,7 +2,7 @@
 Section: devel
 Priority: optional
 Maintainer: Laszlo Boszormenyi (GCS) <[email protected]>

Added tcl9.0-dev to build dependencies.

-Build-Depends: debhelper-compat (= 13), autoconf (>= 2.59), libtool
(>= 1.5.2), automake, pkgconf, chrpath, lynx, libreadline-dev,
tcl8.6-dev, libicu-dev
+Build-Depends: debhelper-compat (= 13), autoconf (>= 2.59), libtool
(>= 1.5.2), automake, pkgconf, chrpath, lynx, libreadline-dev,
tcl8.6-dev, tcl9.0-dev, libicu-dev
 Build-Conflicts: tcl8.4, tcl8.4-dev, tcl8.5, tcl8.5-dev
 Standards-Version: 4.7.2
 Homepage: https://www.sqlite.org/
@@ -76,7 +76,8 @@
 Suggests: sqlite3-doc
 Section: interpreters
 Architecture: any

Add dependencies on libtcl8.6 | libtcl9.0 (libsqlite3-tcl is hardly
usable without Tcl)

-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: libtcl8.6 | libtcl9.0, ${shlibs:Depends}, ${misc:Depends}

Make it multi-arch same

+Multi-Arch: same
 Description: SQLite 3 Tcl bindings
  SQLite is a C library that implements an SQL database engine.
  Programs that link with the SQLite library can have SQL database

There are many new symbols in the library (I've dropped them from this message)
and a few (three) missing symbols. Hopefully, nobody used them,
otherwise you'll have to bump
the soname and make a proper transition (ohhhh).

--- sqlite3-3.46.1/debian/libsqlite3-0.symbols 2025-05-28
08:02:22.000000000 +0300
+++ sqlite3-3.53.1/debian/libsqlite3-0.symbols 2026-05-31
14:10:02.183210627 +0300

Probably I've messed up somewhere since libsqlite3-0 is changed by libsqlite3

@@ -1,4 +1,4 @@
-libsqlite3.so.0 libsqlite3-0 #MINVER#
+libsqlite3.so.0 libsqlite3 #MINVER#
  sqlite3AbsInt32@Base 3.37.0
  sqlite3AddCheckConstraint@Base 3.37.0
  sqlite3AddCollateType@Base 3.37.0

Delete a bunch of added symbols. Here are the missing ones:

@@ -470,7 +481,8 @@
  sqlite3JournalModename@Base 3.37.0
  sqlite3JournalOpen@Base 3.37.0
  sqlite3JournalSize@Base 3.37.0
- sqlite3JsonTableFunctions@Base 3.38.0
+#MISSING: 3.53.1# sqlite3JsonTableFunctions@Base 3.38.0
+ sqlite3JsonVtabRegister@Base 3.53.1
  sqlite3KeyInfoAlloc@Base 3.37.0
  sqlite3KeyInfoFromExprList@Base 3.37.0
  sqlite3KeyInfoOfIndex@Base 3.37.0
@@ -804,7 +822,7 @@
  sqlite3TriggerInsertStep@Base 3.37.0
  sqlite3TriggerList@Base 3.37.0
  sqlite3TriggerSelectStep@Base 3.37.0
- sqlite3TriggerStepSrc@Base 3.37.0
+#MISSING: 3.53.1# sqlite3TriggerStepSrc@Base 3.37.0
  sqlite3TriggerUpdateStep@Base 3.37.0
  sqlite3TriggersExist@Base 3.37.0
  sqlite3TwoPartName@Base 3.37.0
@@ -862,7 +880,9 @@
  sqlite3VdbeChangeP4@Base 3.37.0
  sqlite3VdbeChangeP5@Base 3.37.0
  sqlite3VdbeChangeToNoop@Base 3.37.0
- sqlite3VdbeCheckFk@Base 3.37.0
+#MISSING: 3.53.1# sqlite3VdbeCheckFk@Base 3.37.0
+ sqlite3VdbeCheckFkDeferred@Base 3.53.1
+ sqlite3VdbeCheckFkImmediate@Base 3.53.1
  sqlite3VdbeCloseStatement@Base 3.37.0
  sqlite3VdbeCountChanges@Base 3.37.0
  sqlite3VdbeCreate@Base 3.37.0

I've moved the Tcl library to /usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/sqlite3
to make the package multi-arch same.

--- sqlite3-3.46.1/debian/libsqlite3-tcl.install 2011-03-27
14:09:20.000000000 +0400
+++ sqlite3-3.53.1/debian/libsqlite3-tcl.install 2026-05-31
15:40:16.694026200 +0300
@@ -1 +1 @@
-usr/lib/tcltk/sqlite3          usr/lib/tcltk/
+usr/lib/tcltk/*          usr/lib/tcltk/

Upstream links libsqlite3.so into the Tcl library statically, I took
the liberty of patching
main.mk to do that dynamically. I think it's better that way, if you
don't agree you may
drop the patch

--- sqlite3-3.46.1/debian/patches/60-dynamic-libtclsqlite.patch
1970-01-01 03:00:00.000000000 +0300
+++ sqlite3-3.53.1/debian/patches/60-dynamic-libtclsqlite.patch
2026-05-31 15:27:46.210009655 +0300
@@ -0,0 +1,11 @@
+--- a/main.mk
++++ b/main.mk
+@@ -1641,7 +1643,7 @@
+ $(T.tcl.env.source); \
+ $(T.link.shared) -o $@ tclsqlite.o \
+ $$TCL_INCLUDE_SPEC $$TCL_STUB_LIB_SPEC $(LDFLAGS.libsqlite3) \
+- $(LIBOBJ) -Wl,-rpath,$$TCLLIBDIR
++ -L. -lsqlite3 -Wl,-rpath,$$TCLLIBDIR
+ # ^^^ that rpath bit is defined as TCL_LD_SEARCH_FLAGS in
+ # tclConfig.sh, but it's defined in such a way as to be useless for a
+ # _static_ makefile.

Quite a few patches did not apply cleanly. For now I've disabled them:

--- sqlite3-3.46.1/debian/patches/series 2025-09-09 19:47:18.000000000 +0300
+++ sqlite3-3.53.1/debian/patches/series 2026-05-31 14:16:51.245956685 +0300
@@ -1,14 +1,15 @@
-10-520466-libsqlite3-depends-on-libdl.patch
-10-520478-squash-bad-deps.patch
+#10-520466-libsqlite3-depends-on-libdl.patch
+#10-520478-squash-bad-deps.patch
 20-hurd-locking-style.patch
-30-cross.patch
-10-665363-disable-malloc-usable-size.patch
+#30-cross.patch
+#10-665363-disable-malloc-usable-size.patch
 31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch
-32-dynamic_link.patch
+#32-dynamic_link.patch
 02-use-packaged-lempar.c.patch
-40-amalgamation_configure.patch
-41-fix_a_bug_in_the_NOT_NULL-IS_NULL_optimization.patch
-50-CVE-2025-29087.patch
-51-CVE-2025-29088.patch
-52-CVE-2025-6965.patch
-53-CVE-2025-7709.patch
+#40-amalgamation_configure.patch
+#41-fix_a_bug_in_the_NOT_NULL-IS_NULL_optimization.patch
+#50-CVE-2025-29087.patch
+#51-CVE-2025-29088.patch
+#52-CVE-2025-6965.patch
+#53-CVE-2025-7709.patch
+60-dynamic-libtclsqlite.patch

And now massive changes in debian/rules

--- sqlite3-3.46.1/debian/rules 2025-09-09 19:47:18.000000000 +0300
+++ sqlite3-3.53.1/debian/rules 2026-05-31 19:25:39.967186317 +0300
@@ -24,12 +24,15 @@
 export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

We build two versions: for 8.6 and 9.0

+TCLV_PRIMARY = 8.6
+TCLV_SECONDARY = 9.0
+
 export LDFLAGS += -Wl,--as-needed
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))

Move --with-tcl to the actual list of configure options. The custom
configure script does not
support "--build whatever" it needs "--build=whatever" with =

-  confflags += --build $(DEB_HOST_GNU_TYPE)
--with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6
+  confflags += --build=$(DEB_HOST_GNU_TYPE)
   export CROSS_BUILDING=no
 else
-  confflags += --build $(DEB_BUILD_GNU_TYPE) --host
$(DEB_HOST_GNU_TYPE) --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl8.6
+  confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
   LDFLAGS += -L/usr/lib/$(DEB_HOST_MULTIARCH)
   export CROSS_BUILDING=yes
 endif
@@ -64,23 +67,34 @@
 configure: configure-stamp
 configure-stamp:
  dh_testdir
- dh_autoreconf --as-needed
- dh_update_autotools_config
- ./configure --prefix=/usr --mandir="/usr/share/man" \
-   $(confflags) --enable-threadsafe \
-   --enable-load-extension \
-   --enable-json \
-   --enable-fts4 \
-   --enable-fts5 \
-   --disable-amalgamation \
-   --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
-   --libexecdir=\$${libdir}/sqlite3 \
-   TCLLIBDIR=/usr/lib/tcltk/sqlite3 \
-   SHELL=/bin/sh \
-   $(DDEBUG)

Drop autoreconf and updating autotools config since autoconf is not used

+ #dh_autoreconf --as-needed
+ #dh_update_autotools_config

A loop for the Tcl versions, building the library not in the root of
the package,
but in debian/8.6 and debian/9.0 (this also makes cleanup easier).

+ for v in $(TCLV_PRIMARY) $(TCLV_SECONDARY) ; do \
+     mkdir -p $(CURDIR)/debian/$$v && \
+     cd $(CURDIR)/debian/$$v && \
+     ../../configure \
+   $(confflags) \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+   --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl$$v \
+ --enable-threadsafe \
+   --enable-load-extension \
+   --enable-json \
+   --enable-fts4 \
+   --enable-fts5 \
+   --disable-amalgamation \

New options

--soname=legacy adds soname libsqlite3.so.0 which is what we need
--disable-rpath makes disabling rpath by hand unnecessary
--dynlink-tools links some tools to libsqlite3.so dynamically and not
statically (I'm not sure what are these tools exactly)

+   --soname=legacy \
+   --disable-rpath \
+   --dynlink-tools \
+   --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
+   --libexecdir=\$${libdir}/sqlite3 \
+   TCLLIBDIR=/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/sqlite3 \
+   SHELL=/bin/sh \
+   $(DDEBUG) ; \
+ done

There is no -ldl in sqlite3.pc

  # remove double -ldl from sqlite3.pc
- sed -i "s/\([-ldl .+]\) -ldl/\1/" sqlite3.pc
+ #sed -i "s/\([-ldl .+]\) -ldl/\1/" sqlite3.pc

  touch $@

@@ -90,16 +104,18 @@
 build: build-arch build-indep
 build-stamp: configure
  dh_testdir
- $(MAKE)

Again, make the library twice in a loop.

+ for v in $(TCLV_PRIMARY) $(TCLV_SECONDARY) ; do \
+     $(MAKE) -C$(CURDIR)/debian/$$v ; \
+ done
 ifeq (,$(findstring $(DEB_BUILD_ARCH_OS),kfreebsd))
  # build tools

Build tools only once in debian/8.6

- $(MAKE) showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer
+ $(MAKE) -C$(CURDIR)/debian/$(TCLV_PRIMARY) showdb showjournal
showstat4 showwal sqldiff sqlite3_analyzer
 endif
 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
- $(MAKE) lemon
+ $(MAKE) -C$(CURDIR)/debian/$(TCLV_PRIMARY) lemon
 endif

Use the headers from debian/8.6 to build csv.so and icu.so

- cd ext/misc && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC
-I../.. -shared csv.c -o csv.so
- cd ext/icu  && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC
-I../.. -I../../src -shared icu.c $(shell pkg-config --libs --cflags
icu-uc icu-io) -o icu.so
+ cd ext/misc && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC
-I$(CURDIR)/debian/$(TCLV_PRIMARY) -shared csv.c -o csv.so
+ cd ext/icu  && $(HOST_CC) $(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -g -fPIC
-I$(CURDIR)/debian/$(TCLV_PRIMARY) -I../../src -shared icu.c $(shell
pkg-config --libs --cflags icu-uc icu-io) -o icu.so

  touch $@

The clean target needs to be rewritten.

@@ -107,30 +123,31 @@
  dh_testdir
  dh_testroot
  rm -f configure-stamp build-stamp
- rm -f config.log config.h pkgIndex.tcl configure
+ #rm -f config.log config.h pkgIndex.tcl configure
  [ ! -f Makefile ] || $(MAKE) distclean
  rm -f config.h sqlite3session.h mksourceid
  rm -f ext/misc/csv.so
  rm -f ext/icu/icu.so
- dh_autoreconf_clean
+ #dh_autoreconf_clean
  dh_clean

 install: build
  dh_testdir
  dh_testroot

Install everything from debian/8.6 and only the Tcl library from debian/tcl9.0.
The filenames differ so the latter will not overwrite the former. pkgIndex.tcl
will be overwritten, but we'd have to manually alter it anyway.

- $(MAKE) install DESTDIR=$(DESTDIR)
+ $(MAKE) -C$(CURDIR)/debian/$(TCLV_PRIMARY) install DESTDIR=$(DESTDIR)
+ $(MAKE) -C$(CURDIR)/debian/$(TCLV_SECONDARY) install-tcl DESTDIR=$(DESTDIR)

I did not remove chrpath calls, maybe I should've.

  chrpath -d $(DESTDIR)/usr/bin/sqlite3
- chrpath -d $(DESTDIR)/usr/lib/tcltk/sqlite3/libtclsqlite3.so
- install -m 0664 libtclsqlite3.la $(DESTDIR)/usr/lib/tcltk/sqlite3/
+ chrpath -d $(DESTDIR)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/sqlite3/lib*.so

There is no libtclsqlite3.la anymore.

+ #install -m 0664 libtclsqlite3.la $(DESTDIR)/usr/lib/tcltk/sqlite3/
  install -d $(DESTDIR)/usr/share/lemon
  install -m 0664 tool/lempar.c $(DESTDIR)/usr/share/lemon/
 ifeq (,$(findstring $(DEB_BUILD_ARCH_OS),kfreebsd))

Install tools from debian/8.6

- install -m 0775 showdb showjournal showstat4 showwal \
- sqldiff sqlite3_analyzer \
-         $(DESTDIR)/usr/bin/
+ for f in showdb showjournal showstat4 showwal sqldiff sqlite3_analyzer ; do \
+     install -m 0775 $(CURDIR)/debian/$(TCLV_PRIMARY)/$$f
$(DESTDIR)/usr/bin/ ; \
+ done
 endif
- install -m 0775 lemon $(DESTDIR)/usr/bin/
+ install -m 0775 $(CURDIR)/debian/$(TCLV_PRIMARY)/lemon $(DESTDIR)/usr/bin/
  install -d $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/
  install -m 0775 ext/misc/csv.so \
  $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/
@@ -138,19 +155,20 @@
  $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/sqlite/

  # Remove *.la files per policy 3.9.1.0

There is no libsqlite3.la anymore.

- rm $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libsqlite3.la
+ #rm $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/libsqlite3.la

sqlite3 generates a very simple pkgIndex.tcl which isn't suitable for
multiple Tcl versions. So, some tweaking is necessary:

- # Create the pkgIndex.tcl file for the Tcl module. This generated file
- # actually turns out to be relocatable.
+ # Enhance the pkgIndex.tcl file for the Tcl module. The file generated
+ # by default does not support multiple Tcl versions
 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
- echo "pkg_mkIndex -verbose $(DESTDIR)/usr/lib/tcltk/sqlite3" | \
- LD_LIBRARY_PATH=$(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH) \
- tclsh8.6
- grep -q 'package ifneeded sqlite3' \
- $(DESTDIR)/usr/lib/tcltk/sqlite3/pkgIndex.tcl || \
- (echo "pkgIndex.tcl seems to be wrong" && exit 1)
+ PKGINDEX="$(DESTDIR)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/sqlite3/pkgIndex.tcl"
; \
+ VER=$$(cat VERSION) ; \
+ echo "if {[package vsatisfies [package provide Tcl] 9]} {" > $$PKGINDEX ; \
+ echo "    package ifneeded sqlite3 $$VER [list load [file join $$dir
libtcl9sqlite$$VER.so] Sqlite3]" >> $$PKGINDEX ; \
+ echo "} {" >> $$PKGINDEX ; \
+ echo "    package ifneeded sqlite3 $$VER [list load [file join $$dir
libsqlite$$VER.so] Sqlite3]" >> $$PKGINDEX ; \
+ echo "}" >> $$PKGINDEX
 else
- echo "" > $(DESTDIR)/usr/lib/tcltk/sqlite3/pkgIndex.tcl
+ echo "" > $(DESTDIR)/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/sqlite3/pkgIndex.tcl
 endif

Cheers!
-- 
Sergei Golovan

Attachment: sqlite3_3.53.1-1.debian.tar.xz
Description: application/xz

Reply via email to