Source: tdom
Version: 0.9.5.1-2
Severity: normal
Tags: patch

Dear Maintainer,

Please, consider enabling build of tDom for Tcl 9.0 which is already
in unstable and testing, so the more extensions support Tcl 9.0 the
better.

I've created a branch on salsa: 
https://salsa.debian.org/tcltk-team/tdom/-/tree/tcl9?ref_type=heads
The main change is in debian/rules: code which configures/builds all
three extensions is now wrapped by a loop on Tcl versions (9.0 and 8.6).
Actual build happens in debian/9.0 and debian/8.6 subdirectories.

It's worth menitioning that one test fails for tDom under Tcl 9 for me:
parsing of a very long string fails with an out of memory error (this
test doesn't run for Tcl 8.6). I guess it's not too bad to allow tDom
with this failed test to the Debian archive, but it definitely needs
to be investigated.

Also, I did not adapt the autopkgtest code to Tcl 9 yet.

For convenience, I've attached the diff between the current
debian/latest and tcl9 branches here.

-- System Information:
Debian Release: 12.10
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'proposed-updates'), (500, 
'stable'), (1, 'experimental'), (1, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.12.9+bpo-amd64 (SMP w/24 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

-- no debconf information
diff --git a/debian/changelog b/debian/changelog
index 60d37f7..60a9d0e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ tdom (0.9.5.1-3) UNRELEASED; urgency=medium
   [ Hector Romojaro ]
   * Remove build-stamp and debian/rules cleanup
 
+  [ Sergei Golovan ]
+  * Build two sets of libraries, one for Tcl 8.6 and another for Tcl 9.0.
+
  -- Hector Romojaro <[email protected]>  Fri, 28 Feb 2025 15:08:48 
+0100
 
 tdom (0.9.5.1-2) unstable; urgency=medium
diff --git a/debian/control b/debian/control
index e3d3168..8e394b1 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: libs
 Priority: optional
 Maintainer: Tcl/Tk Debian Packagers <[email protected]>
 Uploaders: Hector Romojaro <[email protected]>, Stefan Sobernig 
<[email protected]>
-Build-Depends: debhelper (>= 13), tcl-dev, libexpat1-dev, libgumbo-dev, 
pkgconf, debhelper-compat (= 13)
+Build-Depends: debhelper (>= 13), tcl-dev, tcl8.6-dev, tcl9.0-dev, 
libexpat1-dev, libgumbo-dev, pkgconf, debhelper-compat (= 13)
 Rules-Requires-Root: no
 Standards-Version: 4.7.2
 Homepage: http://tdom.org/
@@ -14,6 +14,7 @@ Package: tdom
 Architecture: any
 Multi-Arch: same
 Depends: ${tclsh:Depends}, ${shlibs:Depends}, ${misc:Depends}
+Provides: tcl-tdom (= ${binary:Version}), tcl8.6-tdom (= ${binary:Version}), 
tcl9.0-tdom (= ${binary:Version})
 Description: fast XML/DOM/XPath/XSLT/HTML/JSON extension for Tcl written in C
  tDOM takes advantage of Expat, the XML parser from James Clark,
  including namespace and DTD support. It includes a modified version
diff --git a/debian/rules b/debian/rules
index fe976f3..a580c4a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,6 +3,8 @@
 #export DH_VERBOSE=1
 #export DH_OPTIONS=-v
 
+TCLVERSIONS = 9.0 8.6
+
 # Hardening
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
 
@@ -25,70 +27,102 @@ DEV=$(CURDIR)/debian/tdom-dev
 ARCH_DEPENDENT=$(CURDIR)/debian/tdom/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)
 STUB_LIBDIR=/usr/lib/tcltk/$(DEB_HOST_MULTIARCH)/tdom$(VERSION)
 
+override_dh_autoreconf:
+       [ -f configure.backup ] || cp configure configure.backup
+       dh_autoreconf
+
 override_dh_auto_configure:
+       for v in $(TCLVERSIONS) ; do \
+               mkdir -p debian/$$v ; \
+       done
        #
-       # Configure tDOM
+       # Configure tDOM"
        #
-       ( cd unix ; ../configure --host=$(DEB_HOST_GNU_TYPE) \
+       for v in $(TCLVERSIONS) ; do \
+       mkdir -p debian/$$v/unix ; \
+       ( cd debian/$$v/unix ; \
+         ../../../configure --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=$(CURDIR)/debian/tdom/usr \
                --mandir=\$${prefix}/share/man \
                --infodir=\$${prefix}/share/info \
-               --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/ \
+               --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl$$v \
                --libdir=\$${prefix}/lib/tcltk/$(DEB_HOST_MULTIARCH) \
                --enable-threads \
                --includedir=$(DEV)/usr/include/tdom \
                --with-expat=/usr \
-               --enable-html5 )
+               --enable-html5 ) ; \
+       done
        #
        # Configure tnc extension
        #
-       ( cd extensions/tnc ; ./configure \
+       for v in $(TCLVERSIONS) ; do \
+       mkdir -p debian/$$v/extensions/tnc ; \
+       ( cd debian/$$v/extensions/tnc ; \
+         ../../../../extensions/tnc/configure \
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=$(CURDIR)/debian/tdom/usr \
                --mandir=\$${prefix}/share/man \
                --infodir=\$${prefix}/share/info \
-               --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/ \
+               --with-tcl=/usr/lib/$(DEB_HOST_MULTIARCH)/tcl$$v \
                --libdir=\$${prefix}/lib/tcltk/$(DEB_HOST_MULTIARCH) \
                --enable-threads \
-               --includedir=$(DEV)/usr/include/tdom )
+               --includedir=$(DEV)/usr/include/tdom ) ; \
+       done
        #
        # Configure tdomhtml extension
        #
-       ( cd extensions/tdomhtml ; ./configure \
+       for v in $(TCLVERSIONS) ; do \
+       mkdir -p debian/$$v/extensions/tdomhtml ; \
+       ( cd debian/$$v/extensions/tdomhtml ; \
+         ../../../../extensions/tdomhtml/configure \
                --host=$(DEB_HOST_GNU_TYPE) \
                --build=$(DEB_BUILD_GNU_TYPE) \
                --prefix=$(CURDIR)/debian/tdom/usr \
                --mandir=\$${prefix}/share/man \
                --infodir=\$${prefix}/share/info \
                --libdir=\$${prefix}/lib/tcltk/$(DEB_HOST_MULTIARCH) \
-               --includedir=$(DEV)/usr/include/tdom )
+               --includedir=$(DEV)/usr/include/tdom ) ; \
+       done
 
 override_dh_auto_build:
        #
        # Build tDOM and extensions
        #
-       ( cd unix ; $(MAKE) )
-       ( cd extensions/tnc ; $(MAKE) )
-       ( cd extensions/tdomhtml ; $(MAKE) )
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/unix ; $(MAKE) ) ; \
+       done
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/extensions/tnc ; $(MAKE) ) ; \
+       done
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/extensions/tdomhtml ; $(MAKE) ) ; \
+       done
 
 override_dh_clean:
        #
        # Cleanup
        #
-       -( cd unix; [ ! -f Makefile ] || $(MAKE) distclean; )
-       -( cd extensions/tnc; [ ! -f Makefile ] || $(MAKE) distclean; )
-       -( cd extensions/tdomhtml; [ ! -f Makefile ] || $(MAKE) distclean; )
+       for v in $(TCLVERSIONS) ; do \
+       rm -rf debian/$$v ; \
+       done
+       [ ! -f configure.backup ] || mv configure.backup configure
        dh_clean config.log config.status config.cache config.guess config.sub
 
 override_dh_auto_install:
        #
        # Install the package into debian/tdom.
        #
-       ( cd unix/ ; $(MAKE) install )
-       ( cd extensions/tnc ; $(MAKE) install )
-       ( cd extensions/tdomhtml ; $(MAKE) install)
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/unix ; $(MAKE) install ) ; \
+       done
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/extensions/tnc ; $(MAKE) install ) ; \
+       done
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/extensions/tdomhtml ; $(MAKE) install) ; \
+       done
        #
        # Remove >empty< man page for tdomhtml extension (note, there is no
        # --without-man target available)
@@ -122,9 +156,9 @@ override_dh_auto_install:
        #
        # Wrapper for tdomConfig on /usr/lib/$(DEB_HOST_MULTIARCH)
        #
-       sed -i "s/TDOM_VERSION/$(VERSION)/" $(CURDIR)/debian/tdomConfig.sh
        install -d -m 755 $(DEV)/usr/lib/$(DEB_HOST_MULTIARCH)
-       install $(CURDIR)/debian/tdomConfig.sh 
$(DEV)/usr/lib/$(DEB_HOST_MULTIARCH)/
+       sed "s/TDOM_VERSION/$(VERSION)/" $(CURDIR)/debian/tdomConfig.sh \
+               >$(DEV)/usr/lib/$(DEB_HOST_MULTIARCH)/tdomConfig.sh
        #
        # Move tDOM stub library
        #
@@ -139,5 +173,7 @@ override_dh_installdeb:
 
 override_dh_auto_test:
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-       (cd unix/; $(MAKE) test)
+       for v in $(TCLVERSIONS) ; do \
+       ( cd debian/$$v/unix ; $(MAKE) test) ; \
+       done
 endif

Reply via email to