TDBC

Check-in [daa7ace8b7]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Another way:

Have pkgIndex.tcl make use of TDBC_LIBRARY.

This is better than mangling the pkgIndex.tcl on install.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stu-pkgIndex2
Files: files | file ages | folders
SHA3-256:daa7ace8b716df5b4c2e49d49c033c59de6f40000ef6e7b42e7700d5d18b8ae5
User & Date: stu 2017-12-17 16:13:23
Original Comment: Another way:

Have pkgIndex.tcl make use of TDBC_LIBRARY.

This is better than mangling the pkgIndex.tcl on install but has the security drawback of still using TDBC_LIBRARY when installed.

Context
2018-01-05
05:38
Merge trunk. Closed-Leaf check-in: 8d7e50c2f8 user: stu tags: stu-pkgIndex2
2017-12-17
16:13
Another way:

Have pkgIndex.tcl make use of TDBC_LIBRARY.

This is better than mangling the pkgIndex.tcl on install. check-in: daa7ace8b7 user: stu tags: stu-pkgIndex2

2017-12-16
23:03
When testing (against) tdbc in the build dir, tdbc.tcl is presumed found in $srcdir/library, not in the same dir as the built shared object.

When testing against an installed tdbc, tdbc.tcl is presumed found in the same dir as the shared object.

This makes the pkgIndex.tcl in the build dir unusable for testing. Makefile targets affected: test, shell, gdb, valgrind, etc.

This can be a problem for other extensions as well.

One solution has been to have a [package ifneeded script] generated and used by the Makefile. This is a bit messy and is needed for all affected targets. Extensions building against tdbc would also have to act accordingly, which can be argued is not their responsibility.

This solution uses a pkgIndex.tcl that looks for tdbc.tcl in $srcdir/library. The $srcdir/library path is stripped-out when pkgIndex.tcl is installed. With this in place, [package require] simply works. It is, admittedly, a bit ugly but I think it's the better than:

- Use two pkgIndex.tcl files: one to use when testing and one to install. - The original method: copy file(s) from the library dir into the build dir and remember to clean them up.

The implementation on this branch also removes the extra copying and cleaning-up of tdbc.tcl, which is no longer necessary. This has been done in this branch for tdbc.

The tdbc-* extensions building against tdbc would simply have to add $(TDBC_BIN_DIR) to the existing $(TCLLIBPATH) in their Makefiles to work with this new scheme.

This has been done in this branch for tdbc-*.

The remaining tdbc-* Makefile targets (shell, gdb, valgrind, etc.) remain broken but can be fixed as was done with tdbc. Closed-Leaf check-in: c5f7bcffcb user: stu tags: stu-pkgIndex

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
	    destp=`basename $$p`; \
	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
	  fi; \
	done
	@if test "x$(SHARED_BUILD)" = "x1"; then \
	    echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \
	    sed -e "s/`echo $(srcdir)|sed -e 's/[.]/[&]/g'` library //" \
		-e "s/ when building//" \
		< pkgIndex.tcl > $(DESTDIR)$(pkglibdir)/pkgIndex.tcl \
		&& chmod 644 $(DESTDIR)$(pkglibdir)/pkgIndex.tcl; \
	fi
	@echo " Install tdbcConfig.sh $(DESTDIR)$(pkglibdir)"; \
	$(INSTALL_DATA) tdbcConfig.sh $(DESTDIR)$(pkglibdir)/tdbcConfig.sh

#========================================================================
# Install binary executables (e.g. .exe files and dependent .dll files)
# This is for files that must go in the bin directory (located next to







<
<
<
|







437
438
439
440
441
442
443



444
445
446
447
448
449
450
451
	    destp=`basename $$p`; \
	    echo " Install $$destp $(DESTDIR)$(pkglibdir)/$$destp"; \
	    $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(pkglibdir)/$$destp; \
	  fi; \
	done
	@if test "x$(SHARED_BUILD)" = "x1"; then \
	    echo " Install pkgIndex.tcl $(DESTDIR)$(pkglibdir)"; \



	    $(INSTALL_DATA) pkgIndex.tcl $(DESTDIR)$(pkglibdir); \
	fi
	@echo " Install tdbcConfig.sh $(DESTDIR)$(pkglibdir)"; \
	$(INSTALL_DATA) tdbcConfig.sh $(DESTDIR)$(pkglibdir)/tdbcConfig.sh

#========================================================================
# Install binary executables (e.g. .exe files and dependent .dll files)
# This is for files that must go in the bin directory (located next to

Changes to pkgIndex.tcl.in.

1
2
3
4
5
6
7
8





9
10
11
12


# Index file to load the TDBC package when building.

# Make sure that TDBC is running in a compatible version of Tcl, and
# that TclOO is available.

if {[catch {package present Tcl @TCL_VERSION_REQ@}]} {
    return
}





package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \
    "package require TclOO @TCLOO_VERSION_REQ@-;\
    [list load [file join $dir @PKG_LIB_FILE@] @PACKAGE_NAME@]\;\
    [list source [file join $dir @srcdir@ library @PACKAGE_NAME@.tcl]]"


|







>
>
>
>
>
|
|
|
<
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

17
18
# Index file to load the TDBC package.

# Make sure that TDBC is running in a compatible version of Tcl, and
# that TclOO is available.

if {[catch {package present Tcl @TCL_VERSION_REQ@}]} {
    return
}
apply {{dir} {
    set libraryfile [file join $dir @PACKAGE_NAME@.tcl]
    if {![file exists $libraryfile] && [info exists ::env(TDBC_LIBRARY)]} {
	set libraryfile [file join $::env(TDBC_LIBRARY) @PACKAGE_NAME@.tcl]
    }
    package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \
	"package require TclOO @TCLOO_VERSION_REQ@-;\
	[list load [file join $dir @PKG_LIB_FILE@] @PACKAGE_NAME@]\;\

	[list source $libraryfile]"
}} $dir