TDBC

Check-in [c5f7bcffcb]
Login

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

Overview
Comment: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.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stu-pkgIndex
Files: files | file ages | folders
SHA3-256: c5f7bcffcb6267676c36b40454f8cc10fbf3e326f4c509d0cbf34ab5a64fbcc2
User & Date: stu 2017-12-16 23:03:26
Context
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

01:14
Move tdbc.tcl to its own target. Add tdbc.tcl to BINARIES to ensure it gets copied once during build and removed with "make clean". Fixes [625f0ee464]. check-in: 239b87734b user: stu tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# configuration options) composed of the named objects.
#========================================================================

PKG_LIB_FILE	= @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@

lib_BINARIES	= $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE)
BINARIES	= $(lib_BINARIES) tdbc.tcl

SHELL		= @SHELL@

srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@








|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# configuration options) composed of the named objects.
#========================================================================

PKG_LIB_FILE	= @PKG_LIB_FILE@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@

lib_BINARIES	= $(PKG_LIB_FILE) $(PKG_STUB_LIB_FILE)
BINARIES	= $(lib_BINARIES)

SHELL		= @SHELL@

srcdir		= @srcdir@
prefix		= @prefix@
exec_prefix	= @exec_prefix@

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
pkgdatadir	= $(datadir)/$(PKG_DIR)
pkglibdir	= $(libdir)/$(PKG_DIR)
pkgincludedir	= $(includedir)/$(PKG_DIR)

top_builddir	= .

INSTALL_OPTIONS	=
INSTALL		= @INSTALL@ ${INSTALL_OPTIONS}
INSTALL_DATA_DIR = @INSTALL_DATA_DIR@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_SCRIPT	= @INSTALL_SCRIPT@
INSTALL_LIBRARY	= @INSTALL_LIBRARY@

PACKAGE_NAME	= @PACKAGE_NAME@







|







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
pkgdatadir	= $(datadir)/$(PKG_DIR)
pkglibdir	= $(libdir)/$(PKG_DIR)
pkgincludedir	= $(includedir)/$(PKG_DIR)

top_builddir	= .

INSTALL_OPTIONS	=
INSTALL		= @INSTALL@ $(INSTALL_OPTIONS)
INSTALL_DATA_DIR = @INSTALL_DATA_DIR@
INSTALL_DATA	= @INSTALL_DATA@
INSTALL_PROGRAM	= @INSTALL_PROGRAM@
INSTALL_SCRIPT	= @INSTALL_SCRIPT@
INSTALL_LIBRARY	= @INSTALL_LIBRARY@

PACKAGE_NAME	= @PACKAGE_NAME@
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	done
	@list='$(srcdir)/doc/*.n'; for i in $$list; do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
	done

test: binaries libraries
	@$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS) \
		-load "package ifneeded ${PACKAGE_NAME} ${PACKAGE_VERSION} \
			[list source `@CYGPATH@ $(srcdir)/library/tdbc.tcl`]\;[list load `@CYGPATH@ $(PKG_LIB_FILE)` $(PACKAGE_NAME)]"

shell: binaries libraries
	@$(TCLSH) $(SCRIPT)

gdb:
	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)








|
<
<







234
235
236
237
238
239
240
241


242
243
244
245
246
247
248
	done
	@list='$(srcdir)/doc/*.n'; for i in $$list; do \
	    echo "Installing $$i"; \
	    $(INSTALL_DATA) $$i $(DESTDIR)$(mandir)/mann ; \
	done

test: binaries libraries
	$(TCLSH) `@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)



shell: binaries libraries
	@$(TCLSH) $(SCRIPT)

gdb:
	$(TCLSH_ENV) gdb $(TCLSH_PROG) $(SCRIPT)

276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
	$(RANLIB) $(PKG_LIB_FILE)

$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
	-rm -f $(PKG_STUB_LIB_FILE)
	${MAKE_STUB_LIB}
	$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)

#========================================================================
# Tcl sources.
#========================================================================

tdbc.tcl:
	cp $(srcdir)/library/tdbc.tcl .

#========================================================================
# We need to enumerate the list of .c to .o lines here.
#
# In the following lines, $(srcdir) refers to the toplevel directory
# containing your extension.  If your sources are in a subdirectory,
# you will have to modify the paths to reflect this:
#







<
<
<
<
<
<
<







274
275
276
277
278
279
280







281
282
283
284
285
286
287
	$(RANLIB) $(PKG_LIB_FILE)

$(PKG_STUB_LIB_FILE): $(PKG_STUB_OBJECTS)
	-rm -f $(PKG_STUB_LIB_FILE)
	${MAKE_STUB_LIB}
	$(RANLIB_STUB) $(PKG_STUB_LIB_FILE)








#========================================================================
# We need to enumerate the list of .c to .o lines here.
#
# In the following lines, $(srcdir) refers to the toplevel directory
# containing your extension.  If your sources are in a subdirectory,
# you will have to modify the paths to reflect this:
#
446
447
448
449
450
451
452



453
454
455
456
457
458
459
460
	    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







>
>
>
|







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

Changes to configure.

5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

CLEANFILES="$CLEANFILES tdbc.tcl"

#--------------------------------------------------------------------
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG







|







5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

#CLEANFILES="$CLEANFILES pkgIndex.tcl"

#--------------------------------------------------------------------
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG

Changes to configure.ac.

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

CLEANFILES="$CLEANFILES tdbc.tcl"

#--------------------------------------------------------------------
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG







|







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Add pkgIndex.tcl if it is generated in the Makefile instead of ./configure
# and change Makefile.in to move it from CONFIG_CLEAN_FILES to BINARIES var.
#
# A few miscellaneous platform-specific items:
# TEA_ADD_* any platform specific compiler/build info here.
#--------------------------------------------------------------------

#CLEANFILES="$CLEANFILES pkgIndex.tcl"

#--------------------------------------------------------------------
# Choose which headers you need.  Extension authors should try very
# hard to only rely on the Tcl public header files.  Internal headers
# contain private data structures and are subject to change without
# notice.
# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG

Changes to pkgIndex.tcl.in.

1
2
3
4
5
6
7
8
9
10
11
12
# 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
}
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 @[email protected]]]"
|










|
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 @[email protected]]]"