Import Tcl 8.6.12

This commit is contained in:
Steve Dower
2021-11-08 17:30:58 +00:00
parent 1aadb2455c
commit 674867e7e6
608 changed files with 78089 additions and 60360 deletions

View File

@@ -0,0 +1,384 @@
2014-01-23 Don Porter <dgp@users.sourceforge.net>
* configure.in:
* README: Advanced version number to 1.0.3.
* configure: TEA update; autoconf 2.69
2014-10-23 Don Porter <dgp@users.sourceforge.net>
* configure.in:
* README: Advanced version number to 1.0.2.
* configure: TEA update; autoconf 2.68
* doc/*.n: [TDBC Bug 00b792] OpenBSD friendly docs.
2014-08-14 Don Porter <dgp@users.sourceforge.net>
* configure.in:
* README: Advanced version number to 1.0.1.
* configure: autoconf 2.68
2012-11-15 KevinB. Kenny <kennykb@acm.org>
* configure.in: Made change so that `make test` works even
* Makefile.in: against an uninstalled version of tdbc.
* configure: autoconf 2.68
*** ADVANCED THE VERSION OF AUTOCONF IN USE ***
2012-11-08 Don Porter <dgp@users.sourceforge.net>
* configure.in:
* README: Advanced version number to 1.0.0.
* configure: autoconf 2.59
2012-07-26 Jan Nijtmans <jan.nijtmans@gmail.com>
* generic/mysqlStubInit.c: Fix [14a8b7c3bd]: package tdbc::mysql fails
to load under Fedora 17. Make some tables "const".
* tclconfig/install-sh: Update to latest TEA
* tclconfig/tcl.m4
* configure: autoconf-2.59
2012-07-13 Kevin B. Kenny <kennykb@acm.org>
* test/tdbcmysql.test: Make functional tests refuse to run unless
the environment variable TDBCMYSQL_TEST_DB
explicitly designates a database.
2012-07-10 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c: Fixed a non-static table argument to
Tcl_GetIndexFromObjStruct.
2012-06-10 Jan Nijtmans <jan.nijtmans@gmail.com>
* configure.in: make TDBC API functions MODULE_SCOPE
* configure: autoconf-2.59
2012-06-08 Jan Nijtmans <jan.nijtmans@gmail.com>
* tclconfig/tcl.m4: Update to latest TEA
* configure: autoconf-2.59
2011-09-19 Kevin B. Kenny <kennykb@acm.org>
* Makefie.in: Added a 'valgrind' rule for memory leak checking.
* tests/all.tcl: Changed behaviour to 'fall off the end' to
facilitate 'valgrind.
2011-07-19 Kevin B. Kenny <kennykb@acm.org>
* configure.in:
* Makefile.in:
* README: Advanced version number to 1.0b17.
* configure: autoconf 2.59
2011-07-18 Don Porter <dgp@users.sourceforge.net>
* configure.in: Update to latest TEA 3.9 revisions.
* Makefile.in:
* tclconfig/*:
* configure: autoconf-2.59
2011-02-20 Kevin B. Kenny <kennykb@acm.org>
* tests/tdbcmysql.test:
Added rudimentary test for 'nextresults' - the method
is a dummy because the calls supported by tdbc::mysql
do not allow for multiple result sets.
2011-01-26 Kevin B. Kenny <kennykb@acm.org>
* doc/tdbc_mysql.n:
Added empty comment at the start of each manpage because 'man'
interprets comments there as directives. Thanks to Konstantin
Kohmoutov for reporting and diagnosing this error.
2011-01-25 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c: Fixed a bug in data types of small integers
on 64-bit machines. Who would have imagined
that MSYQL_TYPE_LONG doesn't mean 'long' but
rather 'int'?
* tests/tdbcmysql.test (tdbc::mysql-1.6,24.[4567]):
Quieted test cases on 64-bit machines and on MySQL earlier
than 5.1.16, which is the first version on which
'foreignkeys' functions correctly.
Thanks to Damon Courtney for reporting these bugs.
2010-12-28 Kevin B. Kenny <kennykb@acm.org>
* generic/fakemysql.h: Added the MYSQL data structure and the
nest of other definitions that it depends on.
* generic/mysqlStubDefs.txt: Added mysql_affected_rows and
mysql_field_count.
* generic/mysqlStubInit.c, generic/mysqlStubs.h: Regenerated.
* generic/tdbcmysql.c: Added 'evaldirect' method that allows
executing statements that are unimplemented
in the MySQL prepared statement API.
* generic/tdbcmysql.tcl: Did a rough (not really functional) hack
at formatting prepared statements.
* tests/tdbcmysql.test (tdbc::mysql-25.*): Added two tests for
creating a (parameterless) stored procedure and executing it.
2010-09-03 Kevin B. Kenny <kennykb@acm.org>
* configure.in: Added missing TCLOO_CFLAGS because Windows build
failed to link without it.
* configure: autoconf 2-59
* generic/mysqlStubInit.c:
Made changes to attempt to open the
MySQL client library by SONAME as well as
pathname, in an effort to fit in better
with systems where libmysqlclient-devel
is not installed.
* library/tdbcmysql.tcl:
* tests/tdbcmysql.test:
Changed 'keySequence' to 'ordinalPosition' in
'foreignkeys' for consistency with 'primarykeys'.
* configure.in:
* Makefile.in:
* pkgIndex.tcl.in (new file):
* README:
* tclconfig/: Upgraded the build to use TEA 3.9. Changed the
approach to pkgIndex.tcl generation. (It's now built
at configure time, rather than from the Makefile.)
Advanced version number to 1.0b16.
* configure: autoconf 2.59
2010-06-19 Kevin B. Kenny <kennykb@acm.org>
* Makefile.in: Revised the code at the suggestion
* generic/tdbcmysql.c: of Andreas Kupries to avoid using
* tests/all.tcl: 'tcl_findLibrary' and instead execute
* tests/tdbcmysql.test: both 'source' and 'load' commands from
'pkgIndex.tcl'. Revised the 'make test'
rule, and the test scripts, to
test successfully under the new regime.
Thanks to Andreas for providing the
original patch, and to Joe English
for providing ideas for simplifying
and repairing 'make test' under the
new regime.
2010-05-23 Kevin B. Kenny <kennykb@acm.org>
* library/tdbcmysql.tcl: Added a 'BuildForeignKeysStatement' method
to tdbcmysql::connection that overrides the
one in the base class and accommodates the
nonstandard INFORMATION_SCHEMA provided in
MySQL.
* tests/tdbcmysql.test: Added test cases for '$db primarykeys'
and '$db foreignkeys'
2010-05-12 Kevin B. Kenny <kennykb@acm.org>
* generic/fakesql.h:
Added dual definitions of data structures that change
between MySQL 5.0 and 5.1.
* generic/mysqlStubDefs.h:
Added code to link to mysqlclient_r and mysqlclient
as well as mysql so that client libs can be found
on Unix. Added query of the client lib version.
* generic/mysqlStubInit.c:
Regenerate
* generic/mysqlStubs.h:
Regenerate
* generic/tdbcmysql.c:
Modified to make MYSQL_BIND and MYSQL_FIELD accesses
go through accessor functions that hit the correct
versions of the structures according to the client
library version. (Tcl can provide ABI stability,
even if MySQL can't!)
* configure.in: Advance release to 1.0b15.1
* README: Advance release to 1.0b15.1
* configure: autoconf-2.59
2010-05-10 Kevin B. Kenny <kennykb@acm.org>
* aclocal.m4: Synchronize with tdbc.
* configure.in: Advance TEA version to 3.7. Advance release to 1.0b15.
Corrected the TDBC stub library specification so that
it works under MSVC.
* generic/mysqlStubDefs.txt:
Split out the linkage convention so that
genExtStubs.tcl can generate syntactically correct
VC++ pointer-to-function declarations.
* generic/mysqlStubInit.c:
* generic/mysqlStubs.h:
Regenerate
* generic/tdbcmysql.c:
Added code to silence VC++ warnings.
* README: Advance release to 1.0b15
* tclconfig/: Advance to TEA 3.7
* configure: autoconf-2.59
2010-05-10 Andreas Kupries <andreask@activestate.com>
* generic/tdbcmysql.c: Fixed violations of strict C89.
* Makefile.in: Removed attempt to generate a stub library. Drivers
do not export stub tables.
2010-05-07 Andreas Kupries <andreask@activestate.com>
* configure.in: Disabled TEA_*_TKCONFIG. Code doesn't depend on Tk.
* configure: Regenerated.
2010-04-30 Kevin B. Kenny <kennykb@acm.org>
* Makefile.in: Added explicit reference to the TDBC library in the
TCLSH_ENV. Updated the 'dist' rule to include new files.
Added a 'genstubs' rule to make the stubs to load
the MySQL libraries at run time.
* configure.in: Removed compile-time references to the MySQL headers
and libraries. Added new files to SOURCES and HEADERS.
* generic/fakemysql.h (new file):
Minimal subset of mysql.h needed to make tdbc::mysql compile.
* generic/mysqlStubDefs.txt (new file):
Definitions of MySQL runtime library routines brought
in by dynamic loading.
* generic/mysqlStubInit.c (new file):
Code to load the MySQL runtime library and build a stub
table for it.
* generic/mysqlStubDefs.txt (new file):
Definitions of the routines to be resolved when loading
the MySQL library at run time.
* generic/tdbcmysql.c:
Changed tdbc::mysql to load the MySQL library at run time
and to have no compile-time dependencies on MySQL.
* tests/tdbcodbc.test (tdbc::mysql-14.8):
Corrected a misnamed test.
2010-04-25 Kevin B. Kenny <kennykb@acm.org>
* configure.in: Adjusted TDBC_* environment vars to be tdbc_*
* README: for better TEA compatibility. Advanced version number
to 1.0b14.
* configure: autoconf-2.59
2009-09-29 Kevin B. Kenny <kennykb@acm.org>
* tests/tdbcmysql.test: Changed all TEST_* environment variables
to TDBCMYSQL_* for easier high-level scripting
of the tests.
2009-09-20 Kevin B. Kenny <kennykb@acm.org>
* README:
* configure.in: Advance version number to 1.0b13
* configure: autoconf-2.59
2009-07-03 Kevin B. Kenny <kennykb@acm.org>
* README:
* configure.in: Advance version number to 1.0b12
* configure: autoconf-2.59
2009-05-29 Kevin B. Kenny <kennykb@acm.org>
* README:
* configure.in: Advance version number to 1.0b11
* configure: autoconf-2.59
2009-04-19 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c: Silenced a compiler warning about 'fields'
being used uninitialized.
* doc/tdbc_mysql.n: Added missing documentation for 'new' constructors.
2009-04-18 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c: Changed so that an inappropriate access to
an array or a failing read trace yields NULL.
* tests/tdbcmysql.test: Revised test cases according to the above
change.
* doc/tdbc_mysql.n: Made changes so that NROFF formatting matches
the Tcl standard.
2009-04-16 Kevin B. Kenny <kennykb@acm.org>
* README:
* configure.in: Advance version number to 1.0b10
* configure: autoconf-2.59
* generic/tdbcmysql.c: Reworked the allocation of result buffers
so that they belong to the result set and
are not allocated per row. Pushed binding the
results up before mysql_stmt_execute,
avoiding a crash if the same statement handle
has been used before [Ticket 39a78606aa].
No update made to test suite because
valgrind detected the error with existing
tests on a -DPURIFY build.
2009-03-03 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c:
* library/tdbcmysql.tcl: Replaced 'init' methods with constructors
written in C. Added 'statementCreate' and 'resultSetCreate' forwarding
in place of the 'statementClass' and 'resultSetClass' variables.
Removed some classes that were the result of overeager copying
from tclodbc. Replaced 'my variable' with variables declared at
class level.
2009-02-14 Kevin B. Kenny <kennykb@acm.org>
* doc/tdbc_mysql.n: Many small format changes to make 'man2html'
work.
* README:
* configure.in: Advance version number to 1.0b8
* configure: autoconf-2.59
2009-02-01 Kevin B. Kenny <kennykb@acm.org>
* generic/tdbcmysql.c:
* configure.in: Changed the <my_global.h> tests to use the
correct conditionals on mingw.
* configure: Autoconf 2.59
2009-01-31 Kevin B. Kenny <kennykb@acm.org>
* README:
* configure.in: Advanced version to 1.0b7.
* configure: Regenerated.
* generic/tdbcmysql.c: Revised errorCode generation to be
more [try]-friendly. Changed include to <mysql/mysql.h> so that
the include path isn't necessary.
* tests/tdbcmysql.test: Added test flags so that a nonstandard port
or socket can be specified. Changed errorCode-dependent tests to
look for the new form of errorCode.
2009-01-05 Kevin B. Kenny <kennykb@acm.org>
* README: Added a few more hints for building on Windows.
* configure.in: Changes to make tdbcmysql build on Windows.
* generic/tdbcmysql.c: Changed to #include <my_global.h> on Windows.
Advanced release to 1.0b6
* configure: autoconf 2.59
2009-01-04 Kevin B. Kenny <kennykb@acm.org>
* README:
* Makefile.in:
* doc/tdbc_mysql.n: Updated so that files are no longer clones
of the 'tdbcodbc' package. Added installation and distribution code.
* configure.in: Advanced version to 1.0b5
* generic/tdbcmysql.c: Added code to track the declared data types
of parameters and the actual data types of results. Added code to
do direct binary conversions of integers, floating point numbers,
and bit strings. Added checks for binary data on results.
Added disambiguation of duplicated colmn names.
* tests/tdbcmysql.test: Revised test cases to include all the
MySQL data types handled in this driver. Added a test case that
column names are correctly disambiguated.
* configure: autoconf 2.59
2009-01-02 Kevin B. Kenny <kennykb@acm.org>
Initial baseline of a TDBC driver for MySQL.

View File

@@ -0,0 +1,496 @@
# Makefile.in --
#
# This file is a Makefile for Sample TEA Extension. If it has the name
# "Makefile.in" then it is a template for a Makefile; to generate the
# actual Makefile, run "./configure", which is a configuration script
# generated by the "autoconf" program (constructs like "@foo@" will get
# replaced in the actual Makefile.
#
# Copyright (c) 1999 Scriptics Corporation.
# Copyright (c) 2002-2005 ActiveState Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#========================================================================
# Add additional lines to handle any additional AC_SUBST cases that
# have been added in a customized configure script.
#========================================================================
#SAMPLE_NEW_VAR = @SAMPLE_NEW_VAR@
#========================================================================
# Nothing of the variables below this line should need to be changed.
# Please check the TARGETS section below to make sure the make targets
# are correct.
#========================================================================
#========================================================================
# The names of the source files is defined in the configure script.
# The object files are used for linking into the final library.
# This will be used when a dist target is added to the Makefile.
# It is not important to specify the directory, as long as it is the
# $(srcdir) or in the generic, win or unix subdirectory.
#========================================================================
PKG_SOURCES = @PKG_SOURCES@
PKG_OBJECTS = @PKG_OBJECTS@
PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
#========================================================================
# PKG_TCL_SOURCES identifies Tcl runtime files that are associated with
# this package that need to be installed, if any.
#========================================================================
PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
#========================================================================
# This is a list of public header files to be installed, if any.
#========================================================================
PKG_HEADERS = @PKG_HEADERS@
#========================================================================
# "PKG_LIB_FILE" refers to the library (dynamic or static as per
# configuration options) composed of the named objects.
#========================================================================
PKG_LIB_FILE = @PKG_LIB_FILE@
PKG_LIB_FILE8 = @PKG_LIB_FILE8@
PKG_LIB_FILE9 = @PKG_LIB_FILE9@
PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
lib_BINARIES = $(PKG_LIB_FILE)
BINARIES = $(lib_BINARIES)
SHELL = @SHELL@
srcdir = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
runstatedir = @runstatedir@
datadir = @datadir@
mandir = @mandir@
DESTDIR =
PKG_DIR = $(PACKAGE_NAME)$(PACKAGE_VERSION)
pkgdatadir = $(datadir)/$(PKG_DIR)
pkglibdir = $(libdir)/$(PKG_DIR)
pkgincludedir = $(includedir)/$(PKG_DIR)
top_builddir = @abs_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@
PACKAGE_VERSION = @PACKAGE_VERSION@
CC = @CC@
CFLAGS_DEFAULT = @CFLAGS_DEFAULT@
CFLAGS_WARNING = @CFLAGS_WARNING@
EXEEXT = @EXEEXT@
LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
MAKE_LIB = @MAKE_LIB@
MAKE_SHARED_LIB = @MAKE_SHARED_LIB@
MAKE_STATIC_LIB = @MAKE_STATIC_LIB@
MAKE_STUB_LIB = @MAKE_STUB_LIB@
OBJEXT = @OBJEXT@
RANLIB = @RANLIB@
RANLIB_STUB = @RANLIB_STUB@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_LD = @SHLIB_LD@
SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
STLIB_LD = @STLIB_LD@
#TCL_DEFS = @TCL_DEFS@
TCL_BIN_DIR = @TCL_BIN_DIR@
TCL_SRC_DIR = @TCL_SRC_DIR@
#TK_BIN_DIR = @TK_BIN_DIR@
#TK_SRC_DIR = @TK_SRC_DIR@
TDBC_VERSION = @TDBC_VERSION@
TDBC_SRC_DIR = @tdbc_SRC_DIR@
TDBC_BIN_DIR = @tdbc_BIN_DIR@
TDBC_LIB_FILE = @TDBC_LIB_FILE@
# Not used, but retained for reference of what libs Tcl required
#TCL_LIBS = @TCL_LIBS@
#========================================================================
# TCLLIBPATH seeds the auto_path in Tcl's init.tcl so we can test our
# package without installing. The other environment variables allow us
# to test against an uninstalled Tcl. Add special env vars that you
# require for testing here (like TCLX_LIBRARY).
#========================================================================
EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR)
#EXTRA_PATH = $(top_builddir):$(TCL_BIN_DIR):$(TK_BIN_DIR)
TCLLIBPATH = $(top_builddir) $(TDBC_BIN_DIR)
TCLSH_ENV = TCL_LIBRARY=`@CYGPATH@ $(TCL_SRC_DIR)/library`
PKG_ENV = @LD_LIBRARY_PATH_VAR@="$(EXTRA_PATH):$(@LD_LIBRARY_PATH_VAR@)" \
PATH="$(EXTRA_PATH):$(PATH)" \
TDBCMYSQL_LIBRARY=`@CYGPATH@ $(srcdir)/library` \
TDBC_LIBRARY=`@CYGPATH@ @tdbc_LIBRARY_PATH@` \
TCLLIBPATH="$(TCLLIBPATH)"
TCLSH_PROG = @TCLSH_PROG@
TCLSH = $(TCLSH_ENV) $(PKG_ENV) $(TCLSH_PROG)
#WISH_ENV = TK_LIBRARY=`@CYGPATH@ $(TK_SRC_DIR)/library`
#WISH_PROG = @WISH_PROG@
#WISH = $(TCLSH_ENV) $(WISH_ENV) $(PKG_ENV) $(WISH_PROG)
SHARED_BUILD = @SHARED_BUILD@
INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@
#INCLUDES = @PKG_INCLUDES@ @TCL_INCLUDES@ @TK_INCLUDES@ @TK_XINCLUDES@
PKG_CFLAGS = @PKG_CFLAGS@
# TCL_DEFS is not strictly need here, but if you remove it, then you
# must make sure that configure.ac checks for the necessary components
# that your library may use. TCL_DEFS can actually be a problem if
# you do not compile with a similar machine setup as the Tcl core was
# compiled with.
#DEFS = $(TCL_DEFS) @DEFS@ $(PKG_CFLAGS)
DEFS = @DEFS@ $(PKG_CFLAGS) -DTCL_NO_DEPRECATED=1
# Move pkgIndex.tcl to 'BINARIES' var if it is generated in the Makefile
CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
CLEANFILES = @CLEANFILES@
CPPFLAGS = @CPPFLAGS@
LIBS = @PKG_LIBS@ @LIBS@
AR = @AR@
CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@
LDFLAGS_DEFAULT = @LDFLAGS_DEFAULT@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) \
$(CFLAGS_DEFAULT) $(CFLAGS_WARNING) $(SHLIB_CFLAGS) $(CFLAGS)
GDB = gdb
VALGRIND = valgrind
VALGRINDARGS = --tool=memcheck --num-callers=8 --leak-resolution=high \
--leak-check=yes --show-reachable=yes -v
.SUFFIXES: .c .$(OBJEXT)
#========================================================================
# Start of user-definable TARGETS section
#========================================================================
#========================================================================
# TEA TARGETS. Please note that the "libraries:" target refers to platform
# independent files, and the "binaries:" target includes executable programs and
# platform-dependent libraries. Modify these targets so that they install
# the various pieces of your package. The make and install rules
# for the BINARIES that you specified above have already been done.
#========================================================================
all: binaries libraries doc
#========================================================================
# The binaries target builds executable programs, Windows .dll's, unix
# shared/static libraries, and any other platform-dependent files.
# The list of targets to build for "binaries:" is specified at the top
# of the Makefile, in the "BINARIES" variable.
#========================================================================
binaries: $(BINARIES)
libraries:
#========================================================================
# Your doc target should differentiate from doc builds (by the developer)
# and doc installs (see install-doc), which just install the docs on the
# end user machine when building from source.
#========================================================================
doc:
install: all install-binaries install-libraries install-doc
install-binaries: binaries install-lib-binaries install-bin-binaries
#========================================================================
# This rule installs platform-independent files, such as header files.
# The list=...; for p in $$list handles the empty list case x-platform.
#========================================================================
install-libraries: libraries
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(includedir)"
@echo "Installing header files in $(DESTDIR)$(includedir)"
@list='$(PKG_HEADERS)'; for i in $$list; do \
echo "Installing $(srcdir)/$$i" ; \
$(INSTALL_DATA) $(srcdir)/$$i "$(DESTDIR)$(includedir)" ; \
done;
#========================================================================
# Install documentation. Unix manpages should go in the $(mandir)
# directory.
#========================================================================
install-doc: doc
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(mandir)/mann"
@echo "Installing documentation in $(DESTDIR)$(mandir)"
@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 tdbc::mysql $(PACKAGE_VERSION) \
[list source `@CYGPATH@ $(srcdir)/library/tdbcmysql.tcl`]\;[list load `@CYGPATH@ $(PKG_LIB_FILE)` [string totitle $(PACKAGE_NAME)]]"
shell: binaries libraries
@$(TCLSH) $(SCRIPT)
gdb:
$(TCLSH_ENV) $(PKG_ENV) $(GDB) $(TCLSH_PROG) $(SCRIPT)
gdb-test: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) $(GDB) \
--args $(TCLSH_PROG) `@CYGPATH@ $(srcdir)/tests/all.tcl` \
$(TESTFLAGS) -singleproc 1 \
-load "package ifneeded $(PACKAGE_NAME) $(PACKAGE_VERSION) \
[list load `@CYGPATH@ $(PKG_LIB_FILE)` [string totitle $(PACKAGE_NAME)]]"
valgrind: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) \
`@CYGPATH@ $(srcdir)/tests/all.tcl` $(TESTFLAGS)
valgrindshell: binaries libraries
$(TCLSH_ENV) $(PKG_ENV) $(VALGRIND) $(VALGRINDARGS) $(TCLSH_PROG) $(SCRIPT)
depend:
#========================================================================
# $(PKG_LIB_FILE) should be listed as part of the BINARIES variable
# mentioned above. That will ensure that this target is built when you
# run "make binaries".
#
# The $(PKG_OBJECTS) objects are created and linked into the final
# library. In most cases these object files will correspond to the
# source files above.
#========================================================================
$(PKG_LIB_FILE): $(PKG_OBJECTS)
-rm -f $(PKG_LIB_FILE)
${MAKE_LIB}
$(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:
#
# sample.$(OBJEXT): $(srcdir)/generic/sample.c
# $(COMPILE) -c `@CYGPATH@ $(srcdir)/generic/sample.c` -o $@
#
# Setting the VPATH variable to a list of paths will cause the makefile
# to look into these paths when resolving .c to .obj dependencies.
# As necessary, add $(srcdir):$(srcdir)/compat:....
#========================================================================
VPATH = $(srcdir):$(srcdir)/generic:$(srcdir)/unix:$(srcdir)/win:$(srcdir)/macosx
.c.@OBJEXT@:
$(COMPILE) -c `@CYGPATH@ $<` -o $@
#========================================================================
# Distribution creation
# You may need to tweak this target to make it work correctly.
#========================================================================
#COMPRESS = tar cvf $(PKG_DIR).tar $(PKG_DIR); compress $(PKG_DIR).tar
COMPRESS = tar zcvf $(PKG_DIR).tar.gz $(PKG_DIR)
DIST_ROOT = /tmp/dist
DIST_DIR = $(DIST_ROOT)/$(PKG_DIR)
DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644
DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755
dist-clean:
rm -rf $(DIST_DIR) $(DIST_ROOT)/$(PKG_DIR).tar.*
dist: dist-clean
$(INSTALL_DATA_DIR) $(DIST_DIR)
# TEA files
$(DIST_INSTALL_DATA) $(srcdir)/Makefile.in \
$(srcdir)/aclocal.m4 $(srcdir)/configure.ac \
$(DIST_DIR)/
$(DIST_INSTALL_SCRIPT) $(srcdir)/configure $(DIST_DIR)/
$(INSTALL_DATA_DIR) $(DIST_DIR)/tclconfig
$(DIST_INSTALL_DATA) $(srcdir)/tclconfig/README.txt \
$(srcdir)/tclconfig/tcl.m4 $(srcdir)/tclconfig/install-sh \
$(DIST_DIR)/tclconfig/
# Extension files
$(DIST_INSTALL_DATA) \
$(srcdir)/ChangeLog \
$(srcdir)/license.terms \
$(srcdir)/README \
$(srcdir)/pkgIndex.tcl.in \
$(DIST_DIR)/
$(INSTALL_DATA_DIR) $(DIST_DIR)/doc
$(DIST_INSTALL_DATA) $(srcdir)/doc/tdbc_mysql.n $(DIST_DIR)/doc/
$(INSTALL_DATA_DIR) $(DIST_DIR)/generic
$(DIST_INSTALL_DATA) \
$(srcdir)/generic/fakemysql.h \
$(srcdir)/generic/mysqlStubDefs.txt \
$(srcdir)/generic/mysqlStubInit.c \
$(srcdir)/generic/mysqlStubs.h \
$(srcdir)/generic/tdbcmysql.c \
$(srcdir)/generic/int2ptr_ptr2int.h \
$(DIST_DIR)/generic/
$(INSTALL_DATA_DIR) $(DIST_DIR)/library
$(DIST_INSTALL_DATA) $(srcdir)/library/tdbcmysql.tcl $(DIST_DIR)/library/
$(INSTALL_DATA_DIR) $(DIST_DIR)/tests
$(DIST_INSTALL_DATA) $(srcdir)/tests/all.tcl $(srcdir)/tests/tdbcmysql.test \
$(DIST_DIR)/tests/
$(INSTALL_DATA_DIR) $(DIST_DIR)/win
$(DIST_INSTALL_DATA) $(srcdir)/win/makefile.vc $(srcdir)/win/nmakehlp.c \
$(srcdir)/win/targets.vc $(srcdir)/win/rules-ext.vc \
$(srcdir)/win/rules.vc $(DIST_DIR)/win/
(cd $(DIST_ROOT); $(COMPRESS);)
#========================================================================
# How to rebuild the package's stub table.
#========================================================================
genstubs: $(TDBC_SRC_DIR)/tools/genExtStubs.tcl $(srcdir)/generic/mysqlStubDefs.txt
@echo $(TCLSH_PROGRAM) $(TDBC_SRC_DIR)/tools/genExtStubs.tcl \
$(srcdir)/generic/mysqlStubDefs.txt \
$(srcdir)/generic/mysqlStubs.h \
$(srcdir)/generic/mysqlStubInit.c
@$(TCLSH) $(TDBC_SRC_DIR)/tools/genExtStubs.tcl \
$(srcdir)/generic/mysqlStubDefs.txt \
$(srcdir)/generic/mysqlStubs.h \
$(srcdir)/generic/mysqlStubInit.c
#========================================================================
# End of user-definable section
#========================================================================
#========================================================================
# Don't modify the file to clean here. Instead, set the "CLEANFILES"
# variable in configure.ac
#========================================================================
clean:
-test -z "$(BINARIES)" || rm -f $(BINARIES)
-rm -f *.$(OBJEXT) core *.core
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean: clean
-rm -f *.tab.c
-rm -f $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log config.status
#========================================================================
# Install binary object libraries. On Windows this includes both .dll and
# .lib files. Because the .lib files are not explicitly listed anywhere,
# we need to deduce their existence from the .dll file of the same name.
# Library files go into the lib directory.
# In addition, this will generate the pkgIndex.tcl
# file in the install location (assuming it can find a usable tclsh shell)
#
# You should not have to modify this target.
#========================================================================
install-lib-binaries: binaries
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(pkglibdir)"
@list='$(lib_BINARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_LIBRARY) $$p $(DESTDIR)$(pkglibdir)/$$p"; \
$(INSTALL_LIBRARY) $$p "$(DESTDIR)$(pkglibdir)/$$p"; \
ext=`echo $$p|sed -e "s/.*\.//"`; \
if test "x$$ext" = "xdll"; then \
lib=`basename $$p|sed -e 's/.[^.]*$$//'`.lib; \
if test -f $$lib; then \
echo " $(INSTALL_DATA) $$lib $(DESTDIR)$(pkglibdir)/$$lib"; \
$(INSTALL_DATA) $$lib "$(DESTDIR)$(pkglibdir)/$$lib"; \
fi; \
fi; \
fi; \
done
@list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
if test -f $(srcdir)/$$p; then \
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
#========================================================================
# 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
# wish and tclsh), like dependent .dll files on Windows.
#
# You should not have to modify this target, except to define bin_BINARIES
# above if necessary.
#========================================================================
install-bin-binaries: binaries
@$(INSTALL_DATA_DIR) "$(DESTDIR)$(bindir)"
@list='$(bin_BINARIES)'; for p in $$list; do \
if test -f $$p; then \
echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$p"; \
$(INSTALL_PROGRAM) $$p "$(DESTDIR)$(bindir)/$$p"; \
fi; \
done
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
uninstall-binaries:
list='$(lib_BINARIES)'; for p in $$list; do \
rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
done
list='$(PKG_TCL_SOURCES)'; for p in $$list; do \
p=`basename $$p`; \
rm -f "$(DESTDIR)$(pkglibdir)/$$p"; \
done
list='$(bin_BINARIES)'; for p in $$list; do \
rm -f "$(DESTDIR)$(bindir)/$$p"; \
done
.PHONY: all binaries clean depend distclean doc install libraries test
.PHONY: gdb gdb-test valgrind valgrindshell
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,80 @@
README: tdbcmysql
This is the 1.1.3 source distribution of the driver for Tcl
Database Connectivity (TDBC) to access MySQL databases.. TDBC and
its drivers are available from a Fossil version control repository
at http://tdbc.tcl.tk/
RCS: @(#) $Id: $
1. Introduction
This directory contains the source code, documentation, and test
scripts for the MySQL driver for Tcl Database Connectivity. This
module, plus TDBC itself, allow you to access MySQL databases using a
standard application programming interface (API) from a Tcl script.
This module is also available from http://tdbc.tcl.tk along with the
source code of TDBC itself. A bug database and Wiki are available at
the same location.
Tdbc::mysql is a freely-available open source package. You can do
virtually anything you like with it, such as modifying it,
redistributing it, and selling it either in whole or in part. See the
file "license.terms" for complete information.
2. Compilation and Installation
This module follows the general configuration and installation
rules described in the README file for tdbc. In addition to the
options described there, the 'configure' script for tdbcmysql
accepts the following two options:
--with-mysql-includedir=PATH
Specifies PATH as the path to the directory that contains
'mysql.h' and related header files.
--with-mysql-libdir=PATH
Specifies PATH as the path to the directory that contains
the MySQL link libraries.
Building on Windows is tested only with msys/mingw, and only with
the version of MySQL present in XAMPP (https://sourceforge.net/projects/xampp)
You need the 'xampp-win32-devel' package as well as the 'xampp-win32'
package.
In order to build the code under msys/mingw, you need to rebuild the
import library for use by mingw. (This also requires the 'reimp'
utility from mingw-utils.) The recipe for this step is:
reimp -d drive:/path/to/xampp/lib/mysql/libmysql.lib
dlltool -k -d libmysql.def -l libmysql.a
cp libmysql.a drive:/path/to/mingw/lib
It is also convenient to make sure that the MySQL headers are available
without the --with option:
cp -r drive:/path/to/xampp/include/mysql/* drive:/path/to/mingw/include/
Then an ordinary 'configure' and 'make' should function to build the
load module.
NOTE THAT ON WINDOWS, THE 'libmysql.dll' LIBRARY MUST BE ON THE PATH
AT RUNTIME. Probably the easiest way to ensure this happens is to
put it either in the Windows 'system32' directory or the 'bin'
directory of your Tcl distribution.
3. Documentation
The 'doc' subdirectory in this release contains a set of reference
manual entries for tdbc::mysql. Files with an extension '.n' are for
Tcl classes and commands; files with an extension '.3' are for C
library functions. The file, 'doc/tdbcmysql.n' gives an overview,
listing the classes and functions
4. See also
More information about TDBC and its drivers are available in the
README file for TDBC itself; refer to that file for compilation and
installation instructions, and support information.

86
pkgs/tdbcmysql1.1.3/aclocal.m4 vendored Normal file
View File

@@ -0,0 +1,86 @@
#
# Include the TEA standard macro set
#
builtin(include,tclconfig/tcl.m4)
#
# Add here whatever m4 macros you want to define for your package
#
dnl Helper macros
AC_DEFUN([TEAX_LAPPEND], [$1="[$]{$1} $2"])
AC_DEFUN([TEAX_FOREACH], [for $1 in $2; do $3; done])
AC_DEFUN([TEAX_IFEQ], [AS_IF([test "x$1" = "x$2"], [$3])])
AC_DEFUN([TEAX_IFNEQ], [AS_IF([test "x$1" != "x$2"], [$3])])
AC_DEFUN([TEAX_SWITCH], [case "$1" in TEAX_SWITCH_Cases(m4_shift($@)) esac])
AC_DEFUN([TEAX_SWITCH_Cases], [m4_if([$#],0,,[$#],1,,[TEAX_SWITCH_OneCase($1,$2)TEAX_SWITCH_Cases(m4_shift(m4_shift($@)))])])
AC_DEFUN([TEAX_SWITCH_OneCase],[ $1) $2;;])
AC_DEFUN([CygPath],[`${CYGPATH} $1`])
dnl Interesting macros
AC_DEFUN([TEAX_SUBST_RESOURCE], [
AC_REQUIRE([TEA_CONFIG_CFLAGS])dnl
TEAX_IFEQ($TEA_PLATFORM, windows, [
AC_CHECK_PROGS(RC_, 'windres -o' 'rc -nologo -fo', none)
TEAX_SWITCH($RC_,
windres*, [
rcdef_inc="--include "
rcdef_start="--define "
rcdef_q='\"'
AC_SUBST(RES_SUFFIX, [res.o])
TEAX_LAPPEND(PKG_OBJECTS, ${PACKAGE_NAME}.res.o)],
rc*, [
rcdef_inc="-i "
rcdef_start="-d "
rcdef_q='"'
AC_SUBST(RES_SUFFIX, [res])
TEAX_LAPPEND(PKG_OBJECTS, ${PACKAGE_NAME}.res)],
*, [
AC_MSG_WARN([could not find resource compiler])
RC_=: ])])
# This next line is because of the brokenness of TEA...
AC_SUBST(RC, $RC_)
TEAX_FOREACH(i, $1, [
TEAX_LAPPEND(RES_DEFS, ${rcdef_inc}\"CygPath($i)\")])
TEAX_FOREACH(i, $2, [
TEAX_LAPPEND(RES_DEFS, ${rcdef_start}$i='${rcdef_q}\$($i)${rcdef_q}')])
AC_SUBST(RES_DEFS)])
AC_DEFUN([TEAX_ADD_PRIVATE_HEADERS], [
TEAX_FOREACH(i, $@, [
# check for existence, be strict because it should be present!
AS_IF([test ! -f "${srcdir}/$i"], [
AC_MSG_ERROR([could not find header file '${srcdir}/$i'])])
TEAX_LAPPEND(PKG_PRIVATE_HEADERS, $i)])
AC_SUBST(PKG_PRIVATE_HEADERS)])
AC_DEFUN([TEAX_SDX], [
AC_PATH_PROG(SDX, sdx, none)
TEAX_IFEQ($SDX, none, [
AC_PATH_PROG(SDX_KIT, sdx.kit, none)
TEAX_IFNEQ($SDX_KIT, none, [
# We assume that sdx.kit is on the path, and that the default
# tclsh is activetcl
SDX="tclsh '${SDX_KIT}'"])])
TEAX_IFEQ($SDX, none, [
AC_MSG_WARN([cannot find sdx; building starkits will fail])
AC_MSG_NOTICE([building as a normal library still supported])])])
dnl TODO: Adapt this for OSX Frameworks...
dnl This next bit is a bit ugly, but it makes things for tclooConfig.sh...
AC_DEFUN([TEAX_PATH_LINE], [
eval "$1=\"[]CygPath($2)\""
AC_SUBST($1)])
AC_DEFUN([TEAX_INCLUDE_LINE], [
eval "$1=\"-I[]CygPath($2)\""
AC_SUBST($1)])
AC_DEFUN([TEAX_LINK_LINE], [
AS_IF([test ${TCL_LIB_VERSIONS_OK} = nodots], [
eval "$1=\"-L[]CygPath($2) -l$3${TCL_TRIM_DOTS}\""
], [
eval "$1=\"-L[]CygPath($2) -l$3${PACKAGE_VERSION}\""
])
AC_SUBST($1)])
dnl Local Variables:
dnl mode: autoconf
dnl End:

10824
pkgs/tdbcmysql1.1.3/configure vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,239 @@
#!/bin/bash -norc
dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#-----------------------------------------------------------------------
# Sample configure.ac for Tcl Extensions. The only places you should
# need to modify this file are marked by the string __CHANGE__
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# __CHANGE__
# Set your package name and version numbers here.
#
# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION
# set as provided. These will also be added as -D defs in your Makefile
# so you can encode the package version directly into the source files.
# This will also define a special symbol for Windows (BUILD_<PACKAGE_NAME>
# so that we create the export library with the dll.
#-----------------------------------------------------------------------
AC_INIT([tdbcmysql],[1.1.3])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
# This will define a ${TEA_PLATFORM} variable == "unix" or "windows"
# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
#--------------------------------------------------------------------
TEA_INIT()
AC_CONFIG_AUX_DIR(tclconfig)
#--------------------------------------------------------------------
# Load the tclConfig.sh file
#--------------------------------------------------------------------
TEA_PATH_TCLCONFIG
TEA_LOAD_TCLCONFIG
#--------------------------------------------------------------------
# Load the tkConfig.sh file if necessary (Tk extension)
#--------------------------------------------------------------------
#TEA_PATH_TKCONFIG
#TEA_LOAD_TKCONFIG
#--------------------------------------------------------------------
# Load the tclooConfig.sh file on Tcl versions where oo is an
# extension.
#--------------------------------------------------------------------
if test "${TCL_MAJOR_VERSION}" -lt 8 ; then
AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer.
Found configuration for Tcl ${TCL_VERSION}.])
fi
if test "${TCL_MAJOR_VERSION}" -eq 8 ; then
if test "${TCL_MINOR_VERSION}" -lt 6 ; then
AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6 or newer.
Found configuration for Tcl ${TCL_VERSION}.])
fi
TCLOO_CFLAGS=''
fi
TCL_VERSION_REQ=8.6; AC_SUBST(TCL_VERSION_REQ)
TEA_PATH_CONFIG(tdbc)
TEA_LOAD_CONFIG(tdbc)
# The next bit probably ought to be in TEA_LOAD_CONFIG
AC_MSG_WARN([Looking for "${tdbc_BIN_DIR}/Makefile"])
if test -f "${tdbc_BIN_DIR}/Makefile" ; then
AC_MSG_WARN([Found Makefile - using build include spec and lib specs for tdbc])
tdbc_INCLUDE_SPEC=${tdbc_BUILD_INCLUDE_SPEC}
tdbc_LIBRARY_PATH=${tdbc_BUILD_LIBRARY_PATH}
fi
AC_SUBST(tdbc_LIBRARY_PATH)
AC_SUBST(TDBC_VERSION)
AC_SUBST(tdbc_SRC_DIR)
AC_SUBST(tdbc_BIN_DIR)
AC_SUBST(TDBC_LIB_FILE)
#-----------------------------------------------------------------------
# Handle the --prefix=... option by defaulting to what Tcl gave.
# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
#-----------------------------------------------------------------------
TEA_PREFIX
#-----------------------------------------------------------------------
# Standard compiler checks.
# This sets up CC by using the CC env var, or looks for gcc otherwise.
# This also calls AC_PROG_CC and a few others to create the basic setup
# necessary to compile executables.
#-----------------------------------------------------------------------
TEA_SETUP_COMPILER
#-----------------------------------------------------------------------
# Setup inlining if available. Check sizeof long long, long.
#-----------------------------------------------------------------------
AC_C_INLINE
AC_CHECK_TYPE([long long],[
AC_DEFINE([HAVE_LONG_LONG],[1])
AC_CHECK_SIZEOF([long long])
],[],[])
AC_CHECK_SIZEOF([long])
#-----------------------------------------------------------------------
# __CHANGE__
# Specify the C source files to compile in TEA_ADD_SOURCES,
# public headers that need to be installed in TEA_ADD_HEADERS,
# stub library C source files to compile in TEA_ADD_STUB_SOURCES,
# and runtime Tcl library files in TEA_ADD_TCL_SOURCES.
# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS
# and PKG_TCL_SOURCES.
#-----------------------------------------------------------------------
TEA_ADD_SOURCES(generic/tdbcmysql.c generic/mysqlStubInit.c)
TEA_ADD_HEADERS(generic/fakemysql.h generic/mysqlStubs.h)
if test "${TCL_MAJOR_VERSION}" -eq 8 ; then
if test "${TCL_MINOR_VERSION}" -eq 5 ; then
TEA_ADD_INCLUDES([${TCLOO_INCLUDE_SPEC}])
TEA_ADD_LIBS([${TCLOO_STUB_LIB_SPEC}])
fi
fi
TEA_ADD_CFLAGS([${TCLOO_CFLAGS}])
TEA_ADD_INCLUDES([${tdbc_INCLUDE_SPEC}])
if test "x${TEA_PLATFORM}" = "xwindows" -a "x${GCC}" != "xyes" ; then
TEA_ADD_LIBS([\"`${CYGPATH} ${tdbc_STUB_LIB_PATH}`\"])
else
TEA_ADD_LIBS([${tdbc_STUB_LIB_SPEC}])
fi
TEA_ADD_CFLAGS([${tdbc_CFLAGS}])
TEA_ADD_STUB_SOURCES()
TEA_ADD_TCL_SOURCES([library/tdbcmysql.tcl])
#--------------------------------------------------------------------
# __CHANGE__
#
# You can add more files to clean if your extension creates any extra
# files by extending CLEANFILES.
# 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"
if test "${TEA_PLATFORM}" = "windows" ; then
# Ensure no empty if clauses
:
#TEA_ADD_SOURCES([win/winFile.c])
#TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"])
else
# Ensure no empty else clauses
:
#TEA_ADD_SOURCES([unix/unixFile.c])
#TEA_ADD_LIBS([-lsuperfly])
fi
#--------------------------------------------------------------------
# __CHANGE__
# 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
#--------------------------------------------------------------------
TEA_PUBLIC_TCL_HEADERS
#TEA_PRIVATE_TCL_HEADERS
#TEA_PUBLIC_TK_HEADERS
#TEA_PRIVATE_TK_HEADERS
#TEA_PATH_X
#--------------------------------------------------------------------
# Check whether --enable-threads or --disable-threads was given.
# This auto-enables if Tcl was compiled threaded.
#--------------------------------------------------------------------
TEA_ENABLE_THREADS
#--------------------------------------------------------------------
# The statement below defines a collection of symbols related to
# building as a shared library instead of a static library.
#--------------------------------------------------------------------
TEA_ENABLE_SHARED
#--------------------------------------------------------------------
# This macro figures out what flags to use with the compiler/linker
# when building shared/static debug/optimized objects. This information
# can be taken from the tclConfig.sh file, but this figures it all out.
#--------------------------------------------------------------------
TEA_CONFIG_CFLAGS
#--------------------------------------------------------------------
# Set the default compiler switches based on the --enable-symbols option.
#--------------------------------------------------------------------
TEA_ENABLE_SYMBOLS
#--------------------------------------------------------------------
# Integer pointer types used by the (U)INT2PTR / PTR2(U)INT macros.
#--------------------------------------------------------------------
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
#--------------------------------------------------------------------
# This macro generates a line to use when building a library. It
# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS,
# and TEA_LOAD_TCLCONFIG macros above.
#--------------------------------------------------------------------
TEA_MAKE_LIB
#--------------------------------------------------------------------
# Determine the name of the tclsh and/or wish executables in the
# Tcl and Tk build directories or the location they were installed
# into. These paths are used to support running test cases only,
# the Makefile should not be making use of these paths to generate
# a pkgIndex.tcl file or anything else at extension build time.
#--------------------------------------------------------------------
TEA_PROG_TCLSH
#TEA_PROG_WISH
#--------------------------------------------------------------------
# Finally, substitute all of the various values into the Makefile.
# You may alternatively have a special pkgIndex.tcl.in or other files
# which require substituting the AC variables in. Include these here.
#--------------------------------------------------------------------
AC_CONFIG_FILES([Makefile pkgIndex.tcl])
AC_OUTPUT

View File

@@ -0,0 +1,175 @@
'\"
.\" tdbc_mysql.n --
.\"
.\" Copyright (c) 2008 by Kevin B. Kenny.
.\"
.\" See the file "license.terms" for information on usage and redistribution of
.\" this file, and for a DISCLAIMER OF ALL WARRANTIES.
.TH "tdbc::mysql" n 8.6 Tcl "Tcl Database Connectivity"
.\" .so man.macros
.if t .wh -1.3i ^B
.nr ^l \n(.l
.ad b
.\" # BS - start boxed text
.\" # ^y = starting y location
.\" # ^b = 1
.de BS
.br
.mk ^y
.nr ^b 1u
.if n .nf
.if n .ti 0
.if n \l'\\n(.lu\(ul'
.if n .fi
..
.\" # BE - end boxed text (draw box now)
.de BE
.nf
.ti 0
.mk ^t
.ie n \l'\\n(^lu\(ul'
.el \{\
.\" Draw four-sided box normally, but don't draw top of
.\" box if the box started on an earlier page.
.ie !\\n(^b-1 \{\
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.el \}\
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
.\}
.\}
.fi
.br
.nr ^b 0
..
.\" # CS - begin code excerpt
.de CS
.RS
.nf
.ta .25i .5i .75i 1i
..
.\" # CE - end code excerpt
.de CE
.fi
.RE
..
.BS
.SH "NAME"
tdbc::mysql \- TDBC-MYSQL bridge
.SH "SYNOPSIS"
package require \fBtdbc::mysql 1.0\fR
.sp
\fBtdbc::mysql::connection create\fR \fIdb\fR ?\fI-option value...\fR?
.br
\fBtdbc::mysql::connection new\fR ?\fI-option value...\fR?
.sp
\fBtdbc::mysql::datasources\fR ?\fB-system\fR|\fB-user\fR?
.sp
\fBtdbc::mysql::drivers\fR
.sp
\fBtdbc::mysql::datasource\fR \fIcommand\fR \fIdriverName\fR ?\fIkeyword\fR-\fIvalue\fR?...
.BE
.SH "DESCRIPTION"
.PP
The \fBtdbc::mysql\fR driver provides a database interface that conforms
to Tcl DataBase Connectivity (TDBC) and allows a Tcl script to connect
to a MySQL database.
.PP
Connection to an MYSQL database is established by invoking
\fBtdbc::mysql::connection create\fR, passing it the name to give the
database handle and a set of \fI-option-value\fR pairs. The available
options are enumerated under CONNECTION OPTIONS below.
As an alternative, \fBtdbc::mysql::connection new\fR may be used to create
a database connection with an automatically assigned name. The return value
from \fBtdbc::mysql::connection new\fR is the name that was chosen for the
connection handle.
.PP
The side effect of \fBtdbc::mysql::connection create\fR is to create a
new database connection.. See \fBtdbc::connection(n)\fR for the
details of how to use the connection to manipulate a database.
.SH "CONNECTION OPTIONS"
.PP
The \fBtdbc::mysql::connection create\fR object command supports the
\fB-encoding\fR, \fB-isolation\fR, \fB-readonly\fR and \fB-timeout\fR
options common to all TDBC drivers. The \fB-encoding\fR option will
always fail unless the encoding is \fButf-8\fR; the database connection
always uses UTF-8 encoding to be able to transfer arbitrary Unicode
characters. The \fB-readonly\fR option must be \fB0\fR, because
MySQL does not offer read-only connections.
.PP
In addition, the following options are recognized:
.IP "\fB-host\fR \fIhostname\fR"
Connects to the host specified by \fIhostname\fR. This option must be
set on the initial creation of the connection; it cannot be changed
after connecting. Default is to connect to the local host.
.IP "\fB-port\fR \fInumber\fR"
Connects to a MySQL server listening on the port specified by \fInumber\fR.
This option may not be changed after connecting. It is used only when
\fIhost\fR is specified and is not \fBlocalhost\fR.
.IP "\fB-socket\fR \fIpath\fR"
Connects to a MySQL server listening on the Unix socket or named
pipe specified by \fIpath\fR . This option may not be changed after connecting.
It is used only when \fI-host\fR is not specified or is \fBlocalhost\fR.
.IP "\fB-user\fR \fIname\fR"
Presents \fIname\fR as the user name to the MySQL server. Default is the
current user ID.
.IP "\fB-passwd\fR \fIpassword\fR"
.IP "\fB-password\fR \fIpassword\fR"
These two options are synonymous. They present the given \fIpassword\fR as
the user's password to the MySQL server. Default is not to present a password.
.IP "\fB-database\fR \fIname\fR"
.IP "\fB-db\fR \fIname\fR"
These two options are synonymous. They present the given \fIname\fR as the
name of the default database to use in MySQL queries. If not specified,
the default database for the current user is used.
.IP "\fB-interactive\fR \fIflag\fR"
The \fIflag\fR value must be a Boolean value. If it is \fBtrue\fR (or
any equivalent), the default timeout is set for an interactive user,
otherwise, the default timeout is set for a batch user. This option
is meaningful only on initial connection. When using the \fBconfigure\fR
method on a MySQL connection use the \fB-timeout\fR option to set the
timeout desired.
.IP \fB-ssl_ca\fR \fIstring\fR
.IP \fB-ssl_capath\fR \fIstring\fR
.IP \fB-ssl_cert\fR \fIstring\fR
.IP \fB-ssl_cipher\fR \fIstring\fR
.IP \fB-ssl_key\fR \fIstring\fR
These five options set the certificate authority, certificate authority
search path, SSL certificate, transfer cipher, and SSL key to the
given \fIstring\fR arguments. These options may be specified only
on initial connection to a database, not in the \fBconfigure\fR method
of an existing connection. Default is not to use SSL.
.SH EXAMPLES
.PP
.CS
tdbc::mysql::connection -user joe -passwd sesame -db joes_database
.CE
Connects to the MySQL server on the local host using the default
connection method, presenting user ID 'joe' and password 'sesame'.
Uses 'joes_database' as the default database name.
.SH "ADDITIONAL CONNECTION METHODS"
In addition to the usual methods on the tdbc::connection(n) object,
connections to a MySQL database support one additional method:
.IP "\fI$connection\fR \fBevaldirect\fR \fIsqlStatement\fR"
This method takes the given \fIsqlStatement\fR and interprets as
MySQL native SQL code and evaluates it without preparing it. The
statement may not contain variable substitutions. The result set
is returned as a list of lists, with each sublist being the list
of columns of a result row formatted as character strings. Note that
the string formatting is done by MySQL and not by Tcl, so details
like the appearance of floating point numbers may differ.
\fIThis command is not recommended\fR for anything where the usual
\fIprepare\fR or \fIpreparecall\fR methods work correctly. It is
provided so that data management language statements that are
not implemented in MySQL's prepared statement API, such as
\fBCREATE DATABASE\fR or \fBCREATE PROCEDURE\fR, can be executed.
.SH "SEE ALSO"
tdbc(n), tdbc::connection(n), tdbc::resultset(n), tdbc::statement(n)
.SH "KEYWORDS"
TDBC, SQL, MySQL, database, connectivity, connection
.SH "COPYRIGHT"
Copyright (c) 2009 by Kevin B. Kenny.
.\" Local Variables:
.\" mode: nroff
.\" End:
.\"

View File

@@ -0,0 +1,335 @@
/*
* fakemysql.h --
*
* Fake definitions of the MySQL API sufficient to build tdbc::mysql
* without having an MySQL installation on the build system. This file
* comprises only data type, constant and function definitions.
*
* The programmers of this file believe that it contains material not
* subject to copyright under the doctrines of scenes a faire and
* of merger of idea and expression. Accordingly, this file is in the
* public domain.
*
*-----------------------------------------------------------------------------
*/
#ifndef FAKEMYSQL_H_INCLUDED
#define FAKEMYSQL_H_INCLUDED
#include <stddef.h>
#ifndef MODULE_SCOPE
#define MODULE_SCOPE extern
#endif
MODULE_SCOPE Tcl_LoadHandle MysqlInitStubs(Tcl_Interp*);
#ifdef _WIN32
#define STDCALL __stdcall
#else
#define STDCALL /* nothing */
#endif
enum enum_field_types {
MYSQL_TYPE_DECIMAL=0,
MYSQL_TYPE_TINY=1,
MYSQL_TYPE_SHORT=2,
MYSQL_TYPE_LONG=3,
MYSQL_TYPE_FLOAT=4,
MYSQL_TYPE_DOUBLE=5,
MYSQL_TYPE_NULL=6,
MYSQL_TYPE_TIMESTAMP=7,
MYSQL_TYPE_LONGLONG=8,
MYSQL_TYPE_INT24=9,
MYSQL_TYPE_DATE=10,
MYSQL_TYPE_TIME=11,
MYSQL_TYPE_DATETIME=12,
MYSQL_TYPE_YEAR=13,
MYSQL_TYPE_NEWDATE=14,
MYSQL_TYPE_VARCHAR=15,
MYSQL_TYPE_BIT=16,
MYSQL_TYPE_NEWDECIMAL=246,
MYSQL_TYPE_ENUM=247,
MYSQL_TYPE_SET=248,
MYSQL_TYPE_TINY_BLOB=249,
MYSQL_TYPE_MEDIUM_BLOB=250,
MYSQL_TYPE_LONG_BLOB=251,
MYSQL_TYPE_BLOB=252,
MYSQL_TYPE_VAR_STRING=253,
MYSQL_TYPE_STRING=254,
MYSQL_TYPE_GEOMETRY=255
};
enum mysql_option {
MYSQL_SET_CHARSET_NAME=7,
};
enum mysql_status {
MYSQL_STATUS_READY=0,
};
#define CLIENT_COMPRESS 32
#define CLIENT_INTERACTIVE 1024
#define MYSQL_DATA_TRUNCATED 101
#define MYSQL_ERRMSG_SIZE 512
#define MYSQL_NO_DATA 100
#define SCRAMBLE_LENGTH 20
#define SQLSTATE_LENGTH 5
typedef struct st_list LIST;
typedef struct st_mem_root MEM_ROOT;
typedef struct st_mysql MYSQL;
typedef struct st_mysql_bind MYSQL_BIND;
typedef struct st_mysql_field MYSQL_FIELD;
typedef struct st_mysql_res MYSQL_RES;
typedef char** MYSQL_ROW;
typedef struct st_mysql_stmt MYSQL_STMT;
typedef char my_bool;
#ifndef Socket_defined
typedef int my_socket;
#define INVALID_SOCKET -1
#endif
typedef Tcl_WideUInt my_ulonglong;
typedef struct st_net NET;
typedef struct st_used_mem USED_MEM;
typedef struct st_vio Vio;
struct st_mem_root {
USED_MEM *free;
USED_MEM *used;
USED_MEM *pre_alloc;
size_t min_malloc;
size_t block_size;
unsigned int block_num;
unsigned int first_block_usage;
void (*error_handler)(void);
};
struct st_mysql_options {
unsigned int connect_timeout;
unsigned int read_timeout;
unsigned int write_timeout;
unsigned int port;
unsigned int protocol;
unsigned long client_flag;
char *host;
char *user;
char *password;
char *unix_socket;
char *db;
struct st_dynamic_array *init_commands;
char *my_cnf_file;
char *my_cnf_group;
char *charset_dir;
char *charset_name;
char *ssl_key;
char *ssl_cert;
char *ssl_ca;
char *ssl_capath;
char *ssl_cipher;
char *shared_memory_base_name;
unsigned long max_allowed_packet;
my_bool use_ssl;
my_bool compress,named_pipe;
my_bool rpl_probe;
my_bool rpl_parse;
my_bool no_master_reads;
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY)
my_bool separate_thread;
#endif
enum mysql_option methods_to_use;
char *client_ip;
my_bool secure_auth;
my_bool report_data_truncation;
int (*local_infile_init)(void **, const char *, void *);
int (*local_infile_read)(void *, char *, unsigned int);
void (*local_infile_end)(void *);
int (*local_infile_error)(void *, char *, unsigned int);
void *local_infile_userdata;
void *extension;
};
struct st_net {
#if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY)
Vio *vio;
unsigned char *buff;
unsigned char *buff_end;
unsigned char *write_pos;
unsigned char *read_pos;
my_socket fd;
unsigned long remain_in_buf;
unsigned long length;
unsigned long buf_length;
unsigned long where_b;
unsigned long max_packet;
unsigned long max_packet_size;
unsigned int pkt_nr;
unsigned int compress_pkt_nr;
unsigned int write_timeout;
unsigned int read_timeout;
unsigned int retry_count;
int fcntl;
unsigned int *return_status;
unsigned char reading_or_writing;
char save_char;
my_bool unused0;
my_bool unused;
my_bool compress;
my_bool unused1;
#endif
unsigned char *query_cache_query;
unsigned int last_errno;
unsigned char error;
my_bool unused2;
my_bool return_errno;
char last_error[MYSQL_ERRMSG_SIZE];
char sqlstate[SQLSTATE_LENGTH+1];
void *extension;
#if defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY)
my_bool skip_big_packet;
#endif
};
/*
* st_mysql differs between 5.0 and 5.1, but the 5.0 version is a
* strict subset, we don't use any of the 5.1 fields, and we don't
* ever allocate the structure ourselves.
*/
struct st_mysql {
NET net;
unsigned char *connector_fd;
char *host;
char *user;
char *passwd;
char *unix_socket;
char *server_version;
char *host_info;
char *info;
char *db;
struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id;
my_ulonglong extra_info;
unsigned long thread_id;
unsigned long packet_length;
unsigned int port;
unsigned long client_flag;
unsigned long server_capabilities;
unsigned int protocol_version;
unsigned int field_count;
unsigned int server_status;
unsigned int server_language;
unsigned int warning_count;
struct st_mysql_options options;
enum mysql_status status;
my_bool free_me;
my_bool reconnect;
char scramble[SCRAMBLE_LENGTH+1];
my_bool rpl_pivot;
struct st_mysql *master;
struct st_mysql *next_slave;
struct st_mysql* last_used_slave;
struct st_mysql* last_used_con;
LIST *stmts;
const struct st_mysql_methods *methods;
void *thd;
my_bool *unbuffered_fetch_owner;
char *info_buffer;
};
/*
* There are different version of the MYSQL_BIND structure before and after
* MySQL 5.1. We go after the fields of the structure using accessor functions
* so that the code in this file is compatible with both versions.
*/
struct st_mysql_bind_51 { /* Post-5.1 */
unsigned long* length;
my_bool* is_null;
void* buffer;
my_bool* error;
unsigned char* row_ptr;
void (*store_param_func)(NET* net, MYSQL_BIND* param);
void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
unsigned long buffer_length;
unsigned long offset;
unsigned long length_value;
unsigned int param_number;
unsigned int pack_length;
enum enum_field_types buffer_type;
my_bool error_value;
my_bool is_unsigned;
my_bool long_data_used;
my_bool is_null_value;
void* extension;
};
struct st_mysql_bind_50 { /* Pre-5.1 */
unsigned long* length;
my_bool* is_null;
void* buffer;
my_bool* error;
enum enum_field_types buffer_type;
unsigned long buffer_length;
unsigned char* row_ptr;
unsigned long offset;
unsigned long length_value;
unsigned int param_number;
unsigned int pack_length;
my_bool error_value;
my_bool is_unsigned;
my_bool long_data_used;
my_bool is_null_value;
void (*store_param_func)(NET* net, MYSQL_BIND* param);
void (*fetch_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
void (*skip_result)(MYSQL_BIND*, MYSQL_FIELD*, unsigned char**);
};
/*
* There are also different versions of the MYSQL_FIELD structure; fortunately,
* the 5.1 version is a strict extension of the 5.0 version.
*/
struct st_mysql_field {
char* name;
char *org_name;
char* table;
char* org_table;
char* db;
char* catalog;
char* def;
unsigned long length;
unsigned long max_length;
unsigned int name_length;
unsigned int org_name_length;
unsigned int table_length;
unsigned int org_table_length;
unsigned int db_length;
unsigned int catalog_length;
unsigned int def_length;
unsigned int flags;
unsigned int decimals;
unsigned int charsetnr;
enum enum_field_types type;
};
struct st_mysql_field_50 {
struct st_mysql_field field;
};
struct st_mysql_field_51 {
struct st_mysql_field field;
void* extension;
};
#define NOT_NULL_FLAG 1
#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define mysql_library_init mysql_server_init
#define mysql_library_end mysql_server_end
#include "mysqlStubs.h"
#endif /* not FAKEMYSQL_H_INCLUDED */

View File

@@ -0,0 +1,24 @@
/*
* Macros used to cast between pointers and integers (e.g. when storing an int
* in ClientData), on 64-bit architectures they avoid gcc warning about "cast
* to/from pointer from/to integer of different size".
*/
#if !defined(INT2PTR) && !defined(PTR2INT)
# if defined(HAVE_INTPTR_T) || defined(intptr_t)
# define INT2PTR(p) ((void *)(intptr_t)(p))
# define PTR2INT(p) ((int)(intptr_t)(p))
# else
# define INT2PTR(p) ((void *)(p))
# define PTR2INT(p) ((int)(p))
# endif
#endif
#if !defined(UINT2PTR) && !defined(PTR2UINT)
# if defined(HAVE_UINTPTR_T) || defined(uintptr_t)
# define UINT2PTR(p) ((void *)(uintptr_t)(p))
# define PTR2UINT(p) ((unsigned int)(uintptr_t)(p))
# else
# define UINT2PTR(p) ((void *)(p))
# define PTR2UINT(p) ((unsigned int)(p))
# endif
#endif

View File

@@ -0,0 +1,58 @@
# mysqlStubDefs.txt --
#
# Definitions of routines in the MySQL libraries that will be
# resolved and imported at run time.
#
# This file contains only function declarations necessary to interoperability
# with the SQL/CLI application programming interface. The programmers believe
# that the material in this file is not subject to copyright, under the
# doctrines of scenes a faire and of the merger of idea and expression.
# Accordingly, this file is in the public domain.
#
#-----------------------------------------------------------------------------
* STUBSTRUCT: mysqlStubs
* LIBRARY: mysqlclient_r mysqlclient mysql
* CONVENTION: STDCALL
int mysql_server_init(int, char**, char**);
void mysql_server_end(void);
my_ulonglong mysql_affected_rows(MYSQL*);
my_bool mysql_autocommit(MYSQL*, my_bool);
my_bool mysql_change_user(MYSQL*, const char*, const char*, const char*);
my_bool mysql_close(MYSQL*);
my_bool mysql_commit(MYSQL*);
unsigned int mysql_errno(MYSQL*);
const char* mysql_error(MYSQL*);
MYSQL_FIELD* mysql_fetch_fields(MYSQL_RES*);
unsigned long* mysql_fetch_lengths(MYSQL_RES*);
MYSQL_ROW mysql_fetch_row(MYSQL_RES*);
unsigned int mysql_field_count(MYSQL*);
void mysql_free_result(MYSQL_RES*);
unsigned long mysql_get_client_version(void);
MYSQL* mysql_init(MYSQL*);
MYSQL_RES* mysql_list_fields(MYSQL*, const char*, const char*);
MYSQL_RES* mysql_list_tables(MYSQL*, const char*);
unsigned int mysql_num_fields(MYSQL_RES*);
int mysql_options(MYSQL*, enum mysql_option, const void*);
int mysql_query(MYSQL*, const char*);
MYSQL* mysql_real_connect(MYSQL*, const char*, const char*, const char*, const char*, unsigned int, const char*, unsigned long);
my_bool mysql_rollback(MYSQL*);
int mysql_select_db(MYSQL*, const char*);
const char* mysql_sqlstate(MYSQL*);
my_bool mysql_ssl_set(MYSQL*, const char*, const char*, const char*, const char*, const char*);
my_ulonglong mysql_stmt_affected_rows(MYSQL_STMT*);
my_bool mysql_stmt_bind_param(MYSQL_STMT*, MYSQL_BIND*);
my_bool mysql_stmt_bind_result(MYSQL_STMT*, MYSQL_BIND*);
my_bool mysql_stmt_close(MYSQL_STMT*);
unsigned int mysql_stmt_errno(MYSQL_STMT*);
const char* mysql_stmt_error(MYSQL_STMT*);
int mysql_stmt_execute(MYSQL_STMT*);
int mysql_stmt_fetch(MYSQL_STMT*);
int mysql_stmt_fetch_column(MYSQL_STMT*, MYSQL_BIND*, unsigned int, unsigned long);
MYSQL_STMT* mysql_stmt_init(MYSQL*);
int mysql_stmt_prepare(MYSQL_STMT*, const char*, unsigned long);
MYSQL_RES* mysql_stmt_result_metadata(MYSQL_STMT*);
const char* mysql_stmt_sqlstate(MYSQL_STMT*);
int mysql_stmt_store_result(MYSQL_STMT*);
MYSQL_RES* mysql_store_result(MYSQL*);

View File

@@ -0,0 +1,178 @@
/*
* mysqlStubInit.c --
*
* Stubs tables for the foreign MySQL libraries so that
* Tcl extensions can use them without the linker's knowing about them.
*
* @CREATED@ 2017-05-26 05:57:32Z by genExtStubs.tcl from ../generic/mysqlStubDefs.txt
*
* Copyright (c) 2010 by Kevin B. Kenny.
*
* Please refer to the file, 'license.terms' for the conditions on
* redistribution of this file and for a DISCLAIMER OF ALL WARRANTIES.
*
*-----------------------------------------------------------------------------
*/
#include <tcl.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include "fakemysql.h"
/*
* Static data used in this file
*/
/*
* Names of the libraries that might contain the MySQL API
*/
#if defined(__CYGWIN__) && !defined(LIBPREFIX)
# define LIBPREFIX "cyg"
#else
# define LIBPREFIX "lib"
#endif
static const char *const mysqlStubLibNames[] = {
/* @LIBNAMES@: DO NOT EDIT THESE NAMES */
"mysqlclient_r", "mysqlclient", "mysql", "mariadbclient", "mariadb", NULL
/* @END@ */
};
/* ABI Version numbers of the MySQL API that we can cope with */
static const char mysqlSuffixes[][4] = {
"", ".20", ".19", ".18", ".17", ".16", ".15"
};
/* Names of the functions that we need from MySQL */
static const char *const mysqlSymbolNames[] = {
/* @SYMNAMES@: DO NOT EDIT THESE NAMES */
"mysql_server_init",
"mysql_server_end",
"mysql_affected_rows",
"mysql_autocommit",
"mysql_change_user",
"mysql_close",
"mysql_commit",
"mysql_errno",
"mysql_error",
"mysql_fetch_fields",
"mysql_fetch_lengths",
"mysql_fetch_row",
"mysql_field_count",
"mysql_free_result",
"mysql_get_client_version",
"mysql_init",
"mysql_list_fields",
"mysql_list_tables",
"mysql_num_fields",
"mysql_options",
"mysql_query",
"mysql_real_connect",
"mysql_rollback",
"mysql_select_db",
"mysql_sqlstate",
"mysql_ssl_set",
"mysql_stmt_affected_rows",
"mysql_stmt_bind_param",
"mysql_stmt_bind_result",
"mysql_stmt_close",
"mysql_stmt_errno",
"mysql_stmt_error",
"mysql_stmt_execute",
"mysql_stmt_fetch",
"mysql_stmt_fetch_column",
"mysql_stmt_init",
"mysql_stmt_prepare",
"mysql_stmt_result_metadata",
"mysql_stmt_sqlstate",
"mysql_stmt_store_result",
"mysql_store_result",
NULL
/* @END@ */
};
/*
* Table containing pointers to the functions named above.
*/
static mysqlStubDefs mysqlStubsTable;
const mysqlStubDefs* mysqlStubs = &mysqlStubsTable;
/*
*-----------------------------------------------------------------------------
*
* MysqlInitStubs --
*
* Initialize the Stubs table for the MySQL API
*
* Results:
* Returns the handle to the loaded MySQL client library, or NULL
* if the load is unsuccessful. Leaves an error message in the
* interpreter.
*
*-----------------------------------------------------------------------------
*/
MODULE_SCOPE Tcl_LoadHandle
MysqlInitStubs(Tcl_Interp* interp)
{
int status; /* Status of Tcl library calls */
Tcl_Obj* path; /* Path name of a module to be loaded */
Tcl_Obj* shlibext; /* Extension to use for load modules */
Tcl_LoadHandle handle = NULL;
/* Handle to a load module */
int i;
size_t j;
/* Determine the shared library extension */
status = Tcl_EvalEx(interp, "::info sharedlibextension", -1,
TCL_EVAL_GLOBAL);
if (status != TCL_OK) return NULL;
shlibext = Tcl_GetObjResult(interp);
Tcl_IncrRefCount(shlibext);
/* Walk the list of possible library names to find an MySQL client */
status = TCL_ERROR;
for (i = 0; status == TCL_ERROR && mysqlStubLibNames[i] != NULL; ++i) {
for (j = 0; status == TCL_ERROR && (j < sizeof(mysqlSuffixes)/sizeof(mysqlSuffixes[0])); ++j) {
path = Tcl_NewStringObj(LIBPREFIX, -1);
Tcl_AppendToObj(path, mysqlStubLibNames[i], -1);
#ifdef __CYGWIN__
if (*mysqlSuffixes[j]) {
Tcl_AppendToObj(path, "-", -1);
Tcl_AppendToObj(path, mysqlSuffixes[j]+1, -1);
}
#endif
Tcl_AppendObjToObj(path, shlibext);
#ifndef __CYGWIN__
Tcl_AppendToObj(path, mysqlSuffixes[j], -1);
#endif
Tcl_IncrRefCount(path);
/* Try to load a client library and resolve symbols within it. */
Tcl_ResetResult(interp);
status = Tcl_LoadFile(interp, path, mysqlSymbolNames, 0,
&mysqlStubsTable, &handle);
Tcl_DecrRefCount(path);
}
}
/*
* Either we've successfully loaded a library (status == TCL_OK),
* or we've run out of library names (in which case status==TCL_ERROR
* and the error message reflects the last unsuccessful load attempt).
*/
Tcl_DecrRefCount(shlibext);
if (status != TCL_OK) {
return NULL;
}
return handle;
}

View File

@@ -0,0 +1,101 @@
/*
*-----------------------------------------------------------------------------
*
* ../generic/mysqlStubs.h --
*
* Stubs for procedures in mysqlStubDefs.txt
*
* Generated by genExtStubs.tcl: DO NOT EDIT
* 2017-05-26 05:57:32Z
*
*-----------------------------------------------------------------------------
*/
typedef struct mysqlStubDefs {
/* Functions from libraries: mysqlclient_r mysqlclient mysql */
int (STDCALL*mysql_server_initPtr)(int, char**, char**);
void (STDCALL*mysql_server_endPtr)(void);
my_ulonglong (STDCALL*mysql_affected_rowsPtr)(MYSQL*);
my_bool (STDCALL*mysql_autocommitPtr)(MYSQL*, my_bool);
my_bool (STDCALL*mysql_change_userPtr)(MYSQL*, const char*, const char*, const char*);
my_bool (STDCALL*mysql_closePtr)(MYSQL*);
my_bool (STDCALL*mysql_commitPtr)(MYSQL*);
unsigned int (STDCALL*mysql_errnoPtr)(MYSQL*);
const char* (STDCALL*mysql_errorPtr)(MYSQL*);
MYSQL_FIELD* (STDCALL*mysql_fetch_fieldsPtr)(MYSQL_RES*);
unsigned long* (STDCALL*mysql_fetch_lengthsPtr)(MYSQL_RES*);
MYSQL_ROW (STDCALL*mysql_fetch_rowPtr)(MYSQL_RES*);
unsigned int (STDCALL*mysql_field_countPtr)(MYSQL*);
void (STDCALL*mysql_free_resultPtr)(MYSQL_RES*);
unsigned long (STDCALL*mysql_get_client_versionPtr)(void);
MYSQL* (STDCALL*mysql_initPtr)(MYSQL*);
MYSQL_RES* (STDCALL*mysql_list_fieldsPtr)(MYSQL*, const char*, const char*);
MYSQL_RES* (STDCALL*mysql_list_tablesPtr)(MYSQL*, const char*);
unsigned int (STDCALL*mysql_num_fieldsPtr)(MYSQL_RES*);
int (STDCALL*mysql_optionsPtr)(MYSQL*, enum mysql_option, const void*);
int (STDCALL*mysql_queryPtr)(MYSQL*, const char*);
MYSQL* (STDCALL*mysql_real_connectPtr)(MYSQL*, const char*, const char*, const char*, const char*, unsigned int, const char*, unsigned long);
my_bool (STDCALL*mysql_rollbackPtr)(MYSQL*);
int (STDCALL*mysql_select_dbPtr)(MYSQL*, const char*);
const char* (STDCALL*mysql_sqlstatePtr)(MYSQL*);
my_bool (STDCALL*mysql_ssl_setPtr)(MYSQL*, const char*, const char*, const char*, const char*, const char*);
my_ulonglong (STDCALL*mysql_stmt_affected_rowsPtr)(MYSQL_STMT*);
my_bool (STDCALL*mysql_stmt_bind_paramPtr)(MYSQL_STMT*, MYSQL_BIND*);
my_bool (STDCALL*mysql_stmt_bind_resultPtr)(MYSQL_STMT*, MYSQL_BIND*);
my_bool (STDCALL*mysql_stmt_closePtr)(MYSQL_STMT*);
unsigned int (STDCALL*mysql_stmt_errnoPtr)(MYSQL_STMT*);
const char* (STDCALL*mysql_stmt_errorPtr)(MYSQL_STMT*);
int (STDCALL*mysql_stmt_executePtr)(MYSQL_STMT*);
int (STDCALL*mysql_stmt_fetchPtr)(MYSQL_STMT*);
int (STDCALL*mysql_stmt_fetch_columnPtr)(MYSQL_STMT*, MYSQL_BIND*, unsigned int, unsigned long);
MYSQL_STMT* (STDCALL*mysql_stmt_initPtr)(MYSQL*);
int (STDCALL*mysql_stmt_preparePtr)(MYSQL_STMT*, const char*, unsigned long);
MYSQL_RES* (STDCALL*mysql_stmt_result_metadataPtr)(MYSQL_STMT*);
const char* (STDCALL*mysql_stmt_sqlstatePtr)(MYSQL_STMT*);
int (STDCALL*mysql_stmt_store_resultPtr)(MYSQL_STMT*);
MYSQL_RES* (STDCALL*mysql_store_resultPtr)(MYSQL*);
} mysqlStubDefs;
#define mysql_server_init (mysqlStubs->mysql_server_initPtr)
#define mysql_server_end (mysqlStubs->mysql_server_endPtr)
#define mysql_affected_rows (mysqlStubs->mysql_affected_rowsPtr)
#define mysql_autocommit (mysqlStubs->mysql_autocommitPtr)
#define mysql_change_user (mysqlStubs->mysql_change_userPtr)
#define mysql_close (mysqlStubs->mysql_closePtr)
#define mysql_commit (mysqlStubs->mysql_commitPtr)
#define mysql_errno (mysqlStubs->mysql_errnoPtr)
#define mysql_error (mysqlStubs->mysql_errorPtr)
#define mysql_fetch_fields (mysqlStubs->mysql_fetch_fieldsPtr)
#define mysql_fetch_lengths (mysqlStubs->mysql_fetch_lengthsPtr)
#define mysql_fetch_row (mysqlStubs->mysql_fetch_rowPtr)
#define mysql_field_count (mysqlStubs->mysql_field_countPtr)
#define mysql_free_result (mysqlStubs->mysql_free_resultPtr)
#define mysql_get_client_version (mysqlStubs->mysql_get_client_versionPtr)
#define mysql_init (mysqlStubs->mysql_initPtr)
#define mysql_list_fields (mysqlStubs->mysql_list_fieldsPtr)
#define mysql_list_tables (mysqlStubs->mysql_list_tablesPtr)
#define mysql_num_fields (mysqlStubs->mysql_num_fieldsPtr)
#define mysql_options (mysqlStubs->mysql_optionsPtr)
#define mysql_query (mysqlStubs->mysql_queryPtr)
#define mysql_real_connect (mysqlStubs->mysql_real_connectPtr)
#define mysql_rollback (mysqlStubs->mysql_rollbackPtr)
#define mysql_select_db (mysqlStubs->mysql_select_dbPtr)
#define mysql_sqlstate (mysqlStubs->mysql_sqlstatePtr)
#define mysql_ssl_set (mysqlStubs->mysql_ssl_setPtr)
#define mysql_stmt_affected_rows (mysqlStubs->mysql_stmt_affected_rowsPtr)
#define mysql_stmt_bind_param (mysqlStubs->mysql_stmt_bind_paramPtr)
#define mysql_stmt_bind_result (mysqlStubs->mysql_stmt_bind_resultPtr)
#define mysql_stmt_close (mysqlStubs->mysql_stmt_closePtr)
#define mysql_stmt_errno (mysqlStubs->mysql_stmt_errnoPtr)
#define mysql_stmt_error (mysqlStubs->mysql_stmt_errorPtr)
#define mysql_stmt_execute (mysqlStubs->mysql_stmt_executePtr)
#define mysql_stmt_fetch (mysqlStubs->mysql_stmt_fetchPtr)
#define mysql_stmt_fetch_column (mysqlStubs->mysql_stmt_fetch_columnPtr)
#define mysql_stmt_init (mysqlStubs->mysql_stmt_initPtr)
#define mysql_stmt_prepare (mysqlStubs->mysql_stmt_preparePtr)
#define mysql_stmt_result_metadata (mysqlStubs->mysql_stmt_result_metadataPtr)
#define mysql_stmt_sqlstate (mysqlStubs->mysql_stmt_sqlstatePtr)
#define mysql_stmt_store_result (mysqlStubs->mysql_stmt_store_resultPtr)
#define mysql_store_result (mysqlStubs->mysql_store_resultPtr)
MODULE_SCOPE const mysqlStubDefs *mysqlStubs;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,193 @@
# tdbcmysql.tcl --
#
# Class definitions and Tcl-level methods for the tdbc::mysql bridge.
#
# Copyright (c) 2008 by Kevin B. Kenny
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: tdbcmysql.tcl,v 1.47 2008/02/27 02:08:27 kennykb Exp $
#
#------------------------------------------------------------------------------
package require tdbc
::namespace eval ::tdbc::mysql {
namespace export connection datasources drivers
}
#------------------------------------------------------------------------------
#
# tdbc::mysql::connection --
#
# Class representing a connection to a database through MYSQL.
#
#-------------------------------------------------------------------------------
::oo::class create ::tdbc::mysql::connection {
superclass ::tdbc::connection
# The constructor is written in C. It takes alternating keywords
# and values pairs as its argumenta. (See the manual page for the
# available options.)
variable foreignKeysStatement
# The 'statementCreate' method delegates to the constructor of the
# statement class
forward statementCreate ::tdbc::mysql::statement create
# The 'columns' method returns a dictionary describing the tables
# in the database
method columns {table {pattern %}} {
# To return correct lengths of CHARACTER and BINARY columns,
# we need to know the maximum lengths of characters in each
# collation. We cache this information only once, on the first
# call to 'columns'.
if {[my NeedCollationInfo]} {
my SetCollationInfo {*}[my allrows -as lists {
SELECT coll.id, cs.maxlen
FROM INFORMATION_SCHEMA.COLLATIONS coll,
INFORMATION_SCHEMA.CHARACTER_SETS cs
WHERE cs.CHARACTER_SET_NAME = coll.CHARACTER_SET_NAME
ORDER BY coll.id DESC
}]
}
return [my Columns $table $pattern]
}
# The 'preparecall' method gives a portable interface to prepare
# calls to stored procedures. It delegates to 'prepare' to do the
# actual work.
method preparecall {call} {
regexp {^[[:space:]]*(?:([A-Za-z_][A-Za-z_0-9]*)[[:space:]]*=)?(.*)} \
$call -> varName rest
if {$varName eq {}} {
my prepare "CALL $rest"
} else {
my prepare \\{:$varName=$rest\\}
}
}
# The 'init', 'begintransaction', 'commit, 'rollback', 'tables'
# 'NeedCollationInfo', 'SetCollationInfo', and 'Columns' methods
# are implemented in C.
# The 'BuildForeignKeysStatements' method builds a SQL statement to
# retrieve the foreign keys from a database. (It executes once the
# first time the 'foreignKeys' method is executed, and retains the
# prepared statements for reuse.) It is slightly nonstandard because
# MYSQL doesn't name the PRIMARY constraints uniquely.
method BuildForeignKeysStatement {} {
foreach {exists1 clause1} {
0 {}
1 { AND fkc.REFERENCED_TABLE_NAME = :primary}
} {
foreach {exists2 clause2} {
0 {}
1 { AND fkc.TABLE_NAME = :foreign}
} {
set stmt [my prepare "
SELECT rc.CONSTRAINT_SCHEMA AS \"foreignConstraintSchema\",
rc.CONSTRAINT_NAME AS \"foreignConstraintName\",
rc.UPDATE_RULE AS \"updateAction\",
rc.DELETE_RULE AS \"deleteAction\",
fkc.REFERENCED_TABLE_SCHEMA AS \"primarySchema\",
fkc.REFERENCED_TABLE_NAME AS \"primaryTable\",
fkc.REFERENCED_COLUMN_NAME AS \"primaryColumn\",
fkc.TABLE_SCHEMA AS \"foreignSchema\",
fkc.TABLE_NAME AS \"foreignTable\",
fkc.COLUMN_NAME AS \"foreignColumn\",
fkc.ORDINAL_POSITION AS \"ordinalPosition\"
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE fkc
ON fkc.CONSTRAINT_NAME = rc.CONSTRAINT_NAME
AND fkc.CONSTRAINT_SCHEMA = rc.CONSTRAINT_SCHEMA
WHERE 1=1
$clause1
$clause2
"]
dict set foreignKeysStatement $exists1 $exists2 $stmt
}
}
}
}
#------------------------------------------------------------------------------
#
# tdbc::mysql::statement --
#
# The class 'tdbc::mysql::statement' models one statement against a
# database accessed through an MYSQL connection
#
#------------------------------------------------------------------------------
::oo::class create ::tdbc::mysql::statement {
superclass ::tdbc::statement
# The 'resultSetCreate' method forwards to the constructor of the
# result set.
forward resultSetCreate ::tdbc::mysql::resultset create
# Methods implemented in C:
#
# constructor connection SQLCode
# The constructor accepts the handle to the connection and the SQL code
# for the statement to prepare. It creates a subordinate namespace to
# hold the statement's active result sets, and then delegates to the
# 'init' method, written in C, to do the actual work of preparing the
# statement.
# params
# Returns descriptions of the parameters of a statement.
# paramtype paramname ?direction? type ?precision ?scale??
# Declares the type of a parameter in the statement
}
#------------------------------------------------------------------------------
#
# tdbc::mysql::resultset --
#
# The class 'tdbc::mysql::resultset' models the result set that is
# produced by executing a statement against an MYSQL database.
#
#------------------------------------------------------------------------------
::oo::class create ::tdbc::mysql::resultset {
superclass ::tdbc::resultset
# Methods implemented in C include:
# constructor statement ?dictionary?
# -- Executes the statement against the database, optionally providing
# a dictionary of substituted parameters (default is to get params
# from variables in the caller's scope).
# columns
# -- Returns a list of the names of the columns in the result.
# nextdict
# -- Stores the next row of the result set in the given variable in
# the caller's scope as a dictionary whose keys are
# column names and whose values are column values, or else
# as a list of cells.
# nextlist
# -- Stores the next row of the result set in the given variable in
# the caller's scope as a list of cells.
# rowcount
# -- Returns a count of rows affected by the statement, or -1
# if the count of rows has not been determined.
}

View File

@@ -0,0 +1,38 @@
This software is copyrighted by Kevin B. Kenny, and by other parties.
The following terms apply to all files associated with the software
unless explicitly disclaimed in individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.

View File

@@ -0,0 +1,14 @@
# Index file to load the TDBC MySQL package.
if {![package vsatisfies [package provide Tcl] 8.6-]} {
return
}
if {[package vsatisfies [package provide Tcl] 9.0-]} {
package ifneeded tdbc::mysql @PACKAGE_VERSION@ \
"[list source [file join $dir @PACKAGE_NAME@.tcl]]\;\
[list load [file join $dir @PKG_LIB_FILE9@] [string totitle @PACKAGE_NAME@]]"
} else {
package ifneeded tdbc::mysql @PACKAGE_VERSION@ \
"[list source [file join $dir @PACKAGE_NAME@.tcl]]\;\
[list load [file join $dir @PKG_LIB_FILE8@] [string totitle @PACKAGE_NAME@]]"
}

View File

@@ -0,0 +1,26 @@
These files comprise the basic building blocks for a Tcl Extension
Architecture (TEA) extension. For more information on TEA see:
http://www.tcl.tk/doc/tea/
This package is part of the Tcl project at SourceForge, but sources
and bug/patch database are hosted on fossil here:
https://core.tcl-lang.org/tclconfig
This package is a freely available open source package. You can do
virtually anything you like with it, such as modifying it, redistributing
it, and selling it either in whole or in part.
CONTENTS
========
The following is a short description of the files you will find in
the sample extension.
README.txt This file
install-sh Program used for copying binaries and script files
to their install locations.
tcl.m4 Collection of Tcl autoconf macros. Included by a package's
aclocal.m4 to define TEA_* macros.

View File

@@ -0,0 +1,518 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2020-07-26.22; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# 'make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
tab=' '
nl='
'
IFS=" $tab$nl"
# Set DOITPROG to "echo" to test this script.
doit=${DOITPROG-}
doit_exec=${doit:-exec}
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_mkdir=
# Desired mode of installed file.
mode=0755
# Create dirs (including intermediate dirs) using mode 755.
# This is like GNU 'install' as of coreutils 8.32 (2020).
mkdir_umask=22
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
is_target_a_directory=possibly
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-S OPTION $stripprog installed files using OPTION.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-S) stripcmd="$stripprog $2"
shift;;
-t)
is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names problematic for 'test' and other utilities.
case $src in
-* | [=\(\)!]) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# If destination is a directory, append the input filename.
if test -d "$dst"; then
if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dstbase=`basename "$src"`
case $dst in
*/) dst=$dst$dstbase;;
*) dst=$dst/$dstbase;;
esac
dstdir_status=0
else
dstdir=`dirname "$dst"`
test -d "$dstdir"
dstdir_status=$?
fi
fi
case $dstdir in
*/) dstdirslash=$dstdir;;
*) dstdirslash=$dstdir/;;
esac
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
# The $RANDOM variable is not portable (e.g., dash). Use it
# here however when possible just to lower collision chance.
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap '
ret=$?
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
exit $ret
' 0
# Because "mkdir -p" follows existing symlinks and we likely work
# directly in world-writeable /tmp, make sure that the '$tmpdir'
# directory is successfully created first before we actually test
# 'mkdir -p'.
if (umask $mkdir_umask &&
$mkdirprog $mkdir_mode "$tmpdir" &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
test_tmpdir="$tmpdir/a"
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
fi
trap '' 0;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
[-=\(\)!]*) prefix='./';;
*) prefix='';;
esac
oIFS=$IFS
IFS=/
set -f
set fnord $dstdir
shift
set +f
IFS=$oIFS
prefixes=
for d
do
test X"$d" = X && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=${dstdirslash}_inst.$$_
rmtmp=${dstdirslash}_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask &&
{ test -z "$stripcmd" || {
# Create $dsttmp read-write so that cp doesn't create it read-only,
# which would cause strip to fail.
if test -z "$doit"; then
: >"$dsttmp" # No need to fork-exec 'touch'.
else
$doit touch "$dsttmp"
fi
}
} &&
$doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
# all.tcl --
#
# This file contains a top-level script to run all of the Tcl
# tests. Execute it by invoking "source all.test" when running tcltest
# in this directory.
#
# Copyright (c) 1998-2000 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: all.tcl,v 1.4 2004/07/04 22:04:20 patthoyts Exp $
package require Tcl 8.6-
package require tcltest 2.2
::tcltest::configure \
-testdir [file dirname [file normalize [info script]]] \
{*}$argv
::tcltest::runAllTests
rename exit {}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,113 @@
#------------------------------------------------------------- -*- makefile -*-
#
# Makefile for TBDC MySQL interface
#
# Basic build, test and install
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir install
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir test
#
# For other build options (debug, static etc.)
# See TIP 477 (https://core.tcl-lang.org/tips/doc/trunk/tip/477.md) for
# detailed documentation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
#------------------------------------------------------------------------------
PROJECT = tdbcmysql
# Tcl 8.6 etc. compile with /DUNICODE. TDBC pre-nmake reform compiled
# without -DUNICODE. Keep that behaviour for now. TBD
USE_WIDECHAR_API = 0
!include "rules-ext.vc"
# nmakehelp -V <file> <tag> will search the file for tag, skips until a
# number and returns all character until a character not in [0-9.ab]
# is read.
!if [echo REM = This file is generated from Makefile.vc > versions.vc]
!endif
!if [echo TCL_VERSION_REQ = \>> versions.vc] \
&& [nmakehlp -V ..\configure.ac TCL_VERSION_REQ >> versions.vc]
!endif
!include "versions.vc"
PRJ_OBJS = \
$(TMP_DIR)\tdbcmysql.obj \
$(TMP_DIR)\mysqlStubInit.obj
# Uncomment the following line if you want to build and install stubs
# PRJ_STUBOBJS = $(TMP_DIR)\mysqlStubInit.obj
PRJ_HEADERS = \
$(GENERICDIR)\fakemysql.h \
$(GENERICDIR)\mysqlStubs.h
# Locate TDBC headers and libraries.
# In principle, we don't need the TDBC source directory, and an installed
# TDBC should suffice. But that needs additional machinery not implemented
# yet.
!if [echo TDBC_DIR = \> nmakehlp.out] \
|| [nmakehlp -L generic\tdbcInt.h >> nmakehlp.out]
!error Could not locate TDBC source directory.
!endif
!include nmakehlp.out
# Get the TDBC version from its configure.ac
!if [echo TDBC_DOTVERSION = \> versions.vc] \
&& [nmakehlp -V "$(TDBC_DIR)\configure.ac" tdbc >> versions.vc]
!error Could not retrieve TDBC version.
!endif
!include versions.vc
TDBC_VERSION = $(TDBC_DOTVERSION:.=)
TDBC_GENERIC_DIR = $(TDBC_DIR)\generic
TDBCSTUBLIBNAME = tdbcstub$(TDBC_VERSION).lib
TDBCSTUBLIB = $(TDBC_DIR)\win\$(BUILDDIRTOP)\$(TDBCSTUBLIBNAME)
TDBC_LIB_FILE = tdbc$(TDBC_VERSION).dll
TDBC_BIN_DIR = $(TDBC_DIR)/win/$(BUILDDIRTOP)
PRJ_INCLUDES = -I"$(TDBC_GENERIC_DIR)"
!if !$(STATIC_BUILD)
PRJ_LIBS = $(TDBCSTUBLIB)
!endif
# Disable standard test target because we have a custom one
DISABLE_TARGET_test = 1
!include "$(_RULESDIR)\targets.vc"
# Our install has a few more steps than the default install
install: default-install-docs-n
# The TIP 477 generation of pkgIndex.tcl from pkgIndex.tcl.in does not include
# all replacements below so define our own.
pkgindex: $(OUT_DIR)\pkgIndex.tcl
$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
@nmakehlp -s << $** > $@
@PACKAGE_NAME@ $(PROJECT)
@PACKAGE_VERSION@ $(DOTVERSION)
@TCL_VERSION_REQ@ $(TCL_VERSION_REQ)
@PKG_LIB_FILE@ $(PRJLIBNAME)
@PKG_LIB_FILE8@ $(PRJLIBNAME8)
@PKG_LIB_FILE9@ $(PRJLIBNAME9)
<<
test: setup $(PROJECT)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
@set TDBC_LIBRARY=$(LIBDIR:\=/)
@$(CPY) $(LIBDIR)\*.tcl $(OUT_DIR)
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
$(DEBUGGER) $(TCLSH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
$(DEBUGGER) $(TCLSH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) \
-load "package ifneeded tdbc::mysql $(DOTVERSION) \
{source {$(LIBDIR:\=/)/tdbcmysql.tcl};load {$(PRJLIB:\=/)} $(PROJECT)};\
package ifneeded tdbc $(TDBC_DOTVERSION) \
{source {$(TDBC_BIN_DIR:\=/)/tdbc.tcl};load {$(TDBC_BIN_DIR:\=/)/$(TDBC_LIB_FILE)} tdbc}"
!endif

View File

@@ -0,0 +1,815 @@
/*
* ----------------------------------------------------------------------------
* nmakehlp.c --
*
* This is used to fix limitations within nmake and the environment.
*
* Copyright (c) 2002 by David Gravereaux.
* Copyright (c) 2006 by Pat Thoyts
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
* ----------------------------------------------------------------------------
*/
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")
#include <stdio.h>
#include <math.h>
/*
* This library is required for x64 builds with _some_ versions of MSVC
*/
#if defined(_M_IA64) || defined(_M_AMD64)
#if _MSC_VER >= 1400 && _MSC_VER < 1500
#pragma comment(lib, "bufferoverflowU")
#endif
#endif
/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
/* protos */
static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static int LocateDependency(const char *keyfile);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
#define CHUNK 25
#define STATICBUFFERSIZE 1000
typedef struct {
HANDLE pipe;
char buffer[STATICBUFFERSIZE];
} pipeinfo;
pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'};
pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'};
/*
* exitcodes: 0 == no, 1 == yes, 2 == error
*/
int
main(
int argc,
char *argv[])
{
char msg[300];
DWORD dwWritten;
int chars;
const char *s;
/*
* Make sure children (cl.exe and link.exe) are kept quiet.
*/
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
/*
* Make sure the compiler and linker aren't effected by the outside world.
*/
SetEnvironmentVariable("CL", "");
SetEnvironmentVariable("LINK", "");
if (argc > 1 && *argv[1] == '-') {
switch (*(argv[1]+1)) {
case 'c':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c <compiler option>\n"
"Tests for whether cl.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForCompilerFeature(argv[2]);
case 'l':
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForLinkerFeature(&argv[2], argc-2);
case 'f':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -f <string> <substring>\n"
"Find a substring within another\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
} else if (argc == 3) {
/*
* If the string is blank, there is no match.
*/
return 0;
} else {
return IsIn(argv[2], argv[3]);
}
case 's':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -s <substitutions file> <file>\n"
"Perform a set of string map type substutitions on a file\n"
"exitcodes: 0\n",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return SubstituteFile(argv[2], argv[3]);
case 'V':
if (argc != 4) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -V filename matchstring\n"
"Extract a version from a file:\n"
"eg: pkgIndex.tcl \"package ifneeded http\"",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 0;
}
s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
if (s && *s) {
printf("%s\n", s);
return 0;
} else
return 1; /* Version not found. Return non-0 exit code */
case 'Q':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -Q path\n"
"Emit the fully qualified path\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return QualifyPath(argv[2]);
case 'L':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -L keypath\n"
"Emit the fully qualified path of directory containing keypath\n"
"exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return LocateDependency(argv[2]);
}
}
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c|-f|-l|-Q|-s|-V ...\n"
"This is a little helper app to equalize shell differences between WinNT and\n"
"Win9x and get nmake.exe to accomplish its job.\n",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
return 2;
}
static int
CheckForCompilerFeature(
const char *option)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
DWORD threadID;
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
char cmdline[100];
hProcess = GetCurrentProcess();
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = FALSE;
/*
* Create a non-inheritible pipe.
*/
CreatePipe(&Out.pipe, &h, &sa, 0);
/*
* Dupe the write side, make it inheritible, and close the original.
*/
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Same as above, but for the error side.
*/
CreatePipe(&Err.pipe, &h, &sa, 0);
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Base command line.
*/
lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch ");
/*
* Append our option for testing
*/
lstrcat(cmdline, option);
/*
* Filename to compile, which exists, but is nothing and empty.
*/
lstrcat(cmdline, " .\\nul");
ok = CreateProcess(
NULL, /* Module name. */
cmdline, /* Command line. */
NULL, /* Process handle not inheritable. */
NULL, /* Thread handle not inheritable. */
TRUE, /* yes, inherit handles. */
DETACHED_PROCESS, /* No console for you. */
NULL, /* Use parent's environment block. */
NULL, /* Use parent's starting directory. */
&si, /* Pointer to STARTUPINFO structure. */
&pi); /* Pointer to PROCESS_INFORMATION structure. */
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
return 2;
}
/*
* Close our references to the write handles that have now been inherited.
*/
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
/*
* Start the pipe reader threads.
*/
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
/*
* Block waiting for the process to end.
*/
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
/*
* Wait for our pipe to get done reading, should it be a little slow.
*/
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
/*
* Look for the commandline warning code in both streams.
* - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
*/
return !(strstr(Out.buffer, "D4002") != NULL
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
|| strstr(Err.buffer, "D9002") != NULL
|| strstr(Out.buffer, "D2021") != NULL
|| strstr(Err.buffer, "D2021") != NULL);
}
static int
CheckForLinkerFeature(
const char **options,
int count)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
DWORD threadID;
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
int i;
char cmdline[255];
hProcess = GetCurrentProcess();
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
/*
* Create a non-inheritible pipe.
*/
CreatePipe(&Out.pipe, &h, &sa, 0);
/*
* Dupe the write side, make it inheritible, and close the original.
*/
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Same as above, but for the error side.
*/
CreatePipe(&Err.pipe, &h, &sa, 0);
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Base command line.
*/
lstrcpy(cmdline, "link.exe -nologo ");
/*
* Append our option for testing.
*/
for (i = 0; i < count; i++) {
lstrcat(cmdline, " \"");
lstrcat(cmdline, options[i]);
lstrcat(cmdline, "\"");
}
ok = CreateProcess(
NULL, /* Module name. */
cmdline, /* Command line. */
NULL, /* Process handle not inheritable. */
NULL, /* Thread handle not inheritable. */
TRUE, /* yes, inherit handles. */
DETACHED_PROCESS, /* No console for you. */
NULL, /* Use parent's environment block. */
NULL, /* Use parent's starting directory. */
&si, /* Pointer to STARTUPINFO structure. */
&pi); /* Pointer to PROCESS_INFORMATION structure. */
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
return 2;
}
/*
* Close our references to the write handles that have now been inherited.
*/
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
/*
* Start the pipe reader threads.
*/
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
/*
* Block waiting for the process to end.
*/
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
/*
* Wait for our pipe to get done reading, should it be a little slow.
*/
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
/*
* Look for the commandline warning code in the stderr stream.
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
strstr(Err.buffer, "LNK1117") != NULL ||
strstr(Out.buffer, "LNK4044") != NULL ||
strstr(Err.buffer, "LNK4044") != NULL ||
strstr(Out.buffer, "LNK4224") != NULL ||
strstr(Err.buffer, "LNK4224") != NULL);
}
static DWORD WINAPI
ReadFromPipe(
LPVOID args)
{
pipeinfo *pi = (pipeinfo *) args;
char *lastBuf = pi->buffer;
DWORD dwRead;
BOOL ok;
again:
if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
CloseHandle(pi->pipe);
return (DWORD)-1;
}
ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L);
if (!ok || dwRead == 0) {
CloseHandle(pi->pipe);
return 0;
}
lastBuf += dwRead;
goto again;
return 0; /* makes the compiler happy */
}
static int
IsIn(
const char *string,
const char *substring)
{
return (strstr(string, substring) != NULL);
}
/*
* GetVersionFromFile --
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
*/
static const char *
GetVersionFromFile(
const char *filename,
const char *match,
int numdots)
{
size_t cbBuffer = 100;
static char szBuffer[100];
char *szResult = NULL;
FILE *fp = fopen(filename, "rt");
if (fp != NULL) {
/*
* Read data until we see our match string.
*/
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
LPSTR p, q;
p = strstr(szBuffer, match);
if (p != NULL) {
/*
* Skip to first digit after the match.
*/
p += strlen(match);
while (*p && !isdigit(*p)) {
++p;
}
/*
* Find ending whitespace.
*/
q = p;
while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
&& (!strchr("ab", q[-1])) || --numdots))) {
++q;
}
memcpy(szBuffer, p, q - p);
szBuffer[q-p] = 0;
szResult = szBuffer;
break;
}
}
fclose(fp);
}
return szResult;
}
/*
* List helpers for the SubstituteFile function
*/
typedef struct list_item_t {
struct list_item_t *nextPtr;
char * key;
char * value;
} list_item_t;
/* insert a list item into the list (list may be null) */
static list_item_t *
list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
{
list_item_t *itemPtr = malloc(sizeof(list_item_t));
if (itemPtr) {
itemPtr->key = strdup(key);
itemPtr->value = strdup(value);
itemPtr->nextPtr = NULL;
while(*listPtrPtr) {
listPtrPtr = &(*listPtrPtr)->nextPtr;
}
*listPtrPtr = itemPtr;
}
return itemPtr;
}
static void
list_free(list_item_t **listPtrPtr)
{
list_item_t *tmpPtr, *listPtr = *listPtrPtr;
while (listPtr) {
tmpPtr = listPtr;
listPtr = listPtr->nextPtr;
free(tmpPtr->key);
free(tmpPtr->value);
free(tmpPtr);
}
}
/*
* SubstituteFile --
* As windows doesn't provide anything useful like sed and it's unreliable
* to use the tclsh you are building against (consider x-platform builds -
* eg compiling AMD64 target from IX86) we provide a simple substitution
* option here to handle autoconf style substitutions.
* The substitution file is whitespace and line delimited. The file should
* consist of lines matching the regular expression:
* \s*\S+\s+\S*$
*
* Usage is something like:
* nmakehlp -S << $** > $@
* @PACKAGE_NAME@ $(PACKAGE_NAME)
* @PACKAGE_VERSION@ $(PACKAGE_VERSION)
* <<
*/
static int
SubstituteFile(
const char *substitutions,
const char *filename)
{
size_t cbBuffer = 1024;
static char szBuffer[1024], szCopy[1024];
char *szResult = NULL;
list_item_t *substPtr = NULL;
FILE *fp, *sp;
fp = fopen(filename, "rt");
if (fp != NULL) {
/*
* Build a list of substutitions from the first filename
*/
sp = fopen(substitutions, "rt");
if (sp != NULL) {
while (fgets(szBuffer, cbBuffer, sp) != NULL) {
unsigned char *ks, *ke, *vs, *ve;
ks = (unsigned char*)szBuffer;
while (ks && *ks && isspace(*ks)) ++ks;
ke = ks;
while (ke && *ke && !isspace(*ke)) ++ke;
vs = ke;
while (vs && *vs && isspace(*vs)) ++vs;
ve = vs;
while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
*ke = 0, *ve = 0;
list_insert(&substPtr, (char*)ks, (char*)vs);
}
fclose(sp);
}
/* debug: dump the list */
#ifndef NDEBUG
{
int n = 0;
list_item_t *p = NULL;
for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
}
}
#endif
/*
* Run the substitutions over each line of the input
*/
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
list_item_t *p = NULL;
for (p = substPtr; p != NULL; p = p->nextPtr) {
char *m = strstr(szBuffer, p->key);
if (m) {
char *cp, *op, *sp;
cp = szCopy;
op = szBuffer;
while (op != m) *cp++ = *op++;
sp = p->value;
while (sp && *sp) *cp++ = *sp++;
op += strlen(p->key);
while (*op) *cp++ = *op++;
*cp = 0;
memcpy(szBuffer, szCopy, sizeof(szCopy));
}
}
printf(szBuffer);
}
list_free(&substPtr);
}
fclose(fp);
return 0;
}
BOOL FileExists(LPCTSTR szPath)
{
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
#endif
DWORD pathAttr = GetFileAttributes(szPath);
return (pathAttr != INVALID_FILE_ATTRIBUTES &&
!(pathAttr & FILE_ATTRIBUTE_DIRECTORY));
}
/*
* QualifyPath --
*
* This composes the current working directory with a provided path
* and returns the fully qualified and normalized path.
* Mostly needed to setup paths for testing.
*/
static int
QualifyPath(
const char *szPath)
{
char szCwd[MAX_PATH + 1];
GetFullPathName(szPath, sizeof(szCwd)-1, szCwd, NULL);
printf("%s\n", szCwd);
return 0;
}
/*
* Implements LocateDependency for a single directory. See that command
* for an explanation.
* Returns 0 if found after printing the directory.
* Returns 1 if not found but no errors.
* Returns 2 on any kind of error
* Basically, these are used as exit codes for the process.
*/
static int LocateDependencyHelper(const char *dir, const char *keypath)
{
HANDLE hSearch;
char path[MAX_PATH+1];
int dirlen, keylen, ret;
WIN32_FIND_DATA finfo;
if (dir == NULL || keypath == NULL)
return 2; /* Have no real error reporting mechanism into nmake */
dirlen = strlen(dir);
if ((dirlen + 3) > sizeof(path))
return 2;
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
#if 0 /* This function is not available in Visual C++ 6 */
/*
* Use numerics 0 -> FindExInfoStandard,
* 1 -> FindExSearchLimitToDirectories,
* as these are not defined in Visual C++ 6
*/
hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
#else
hSearch = FindFirstFile(path, &finfo);
#endif
if (hSearch == INVALID_HANDLE_VALUE)
return 1; /* Not found */
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
do {
int sublen;
/*
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
sublen = strlen(finfo.cFileName);
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
continue; /* Path does not fit, assume not matched */
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
if (FileExists(path)) {
/* Found a match, print to stdout */
path[dirlen+1+sublen] = '\0';
QualifyPath(path);
ret = 0;
break;
}
} while (FindNextFile(hSearch, &finfo));
FindClose(hSearch);
return ret;
}
/*
* LocateDependency --
*
* Locates a dependency for a package.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
int i, ret;
static const char *paths[] = {"..", "..\\..", "..\\..\\.."};
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
if (ret == 0)
return ret;
}
return ret;
}
/*
* Local variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* indent-tabs-mode: t
* tab-width: 8
* End:
*/

View File

@@ -0,0 +1,118 @@
# This file should only be included in makefiles for Tcl extensions,
# NOT in the makefile for Tcl itself.
!ifndef _RULES_EXT_VC
# We need to run from the directory the parent makefile is located in.
# nmake does not tell us what makefile was used to invoke it so parent
# makefile has to set the MAKEFILEVC macro or we just make a guess and
# warn if we think that is not the case.
!if "$(MAKEFILEVC)" == ""
!if exist("$(PROJECT).vc")
MAKEFILEVC = $(PROJECT).vc
!elseif exist("makefile.vc")
MAKEFILEVC = makefile.vc
!endif
!endif # "$(MAKEFILEVC)" == ""
!if !exist("$(MAKEFILEVC)")
MSG = ^
You must run nmake from the directory containing the project makefile.^
If you are doing that and getting this message, set the MAKEFILEVC^
macro to the name of the project makefile.
!message WARNING: $(MSG)
!endif
!if "$(PROJECT)" == "tcl"
!error The rules-ext.vc file is not intended for Tcl itself.
!endif
# We extract version numbers using the nmakehlp program. For now use
# the local copy of nmakehlp. Once we locate Tcl, we will use that
# one if it is newer.
!if [$(CC) -nologo -DNDEBUG "nmakehlp.c" -link -subsystem:console > nul]
!endif
# First locate the Tcl directory that we are working with.
!if "$(TCLDIR)" != ""
_RULESDIR = $(TCLDIR:/=\)
!else
# If an installation path is specified, that is also the Tcl directory.
# Also Tk never builds against an installed Tcl, it needs Tcl sources
!if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
_RULESDIR=$(INSTALLDIR:/=\)
!else
# Locate Tcl sources
!if [echo _RULESDIR = \> nmakehlp.out] \
|| [nmakehlp -L generic\tcl.h >> nmakehlp.out]
_RULESDIR = ..\..\tcl
!else
!include nmakehlp.out
!endif
!endif # defined(INSTALLDIR)....
!endif # ifndef TCLDIR
# Now look for the targets.vc file under the Tcl root. Note we check this
# file and not rules.vc because the latter also exists on older systems.
!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl
_RULESDIR = $(_RULESDIR)\lib\nmake
!elseif exist("$(_RULESDIR)\win\targets.vc") # Building against Tcl sources
_RULESDIR = $(_RULESDIR)\win
!else
# If we have not located Tcl's targets file, most likely we are compiling
# against an older version of Tcl and so must use our own support files.
_RULESDIR = .
!endif
!if "$(_RULESDIR)" != "."
# Potentially using Tcl's support files. If this extension has its own
# nmake support files, need to compare the versions and pick newer.
!if exist("rules.vc") # The extension has its own copy
!if [echo TCL_RULES_MAJOR = \> versions.vc] \
&& [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc]
!endif
!if [echo TCL_RULES_MINOR = \>> versions.vc] \
&& [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc]
!endif
!if [echo OUR_RULES_MAJOR = \>> versions.vc] \
&& [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc]
!endif
!if [echo OUR_RULES_MINOR = \>> versions.vc] \
&& [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc]
!endif
!include versions.vc
# We have a newer version of the support files, use them
!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR))
_RULESDIR = .
!endif
!endif # if exist("rules.vc")
!endif # if $(_RULESDIR) != "."
# Let rules.vc know what copy of nmakehlp.c to use.
NMAKEHLPC = $(_RULESDIR)\nmakehlp.c
# Get rid of our internal defines before calling rules.vc
!undef TCL_RULES_MAJOR
!undef TCL_RULES_MINOR
!undef OUR_RULES_MAJOR
!undef OUR_RULES_MINOR
!if exist("$(_RULESDIR)\rules.vc")
!message *** Using $(_RULESDIR)\rules.vc
!include "$(_RULESDIR)\rules.vc"
!else
!error *** Could not locate rules.vc in $(_RULESDIR)
!endif
!endif # _RULES_EXT_VC

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,98 @@
#------------------------------------------------------------- -*- makefile -*-
# targets.vc --
#
# Part of the nmake based build system for Tcl and its extensions.
# This file defines some standard targets for the convenience of extensions
# and can be optionally included by the extension makefile.
# See TIP 477 (https://core.tcl-lang.org/tips/doc/main/tip/477.md) for docs.
$(PROJECT): setup pkgindex $(PRJLIB)
!ifdef PRJ_STUBOBJS
$(PROJECT): $(PRJSTUBLIB)
$(PRJSTUBLIB): $(PRJ_STUBOBJS)
$(LIBCMD) $**
$(PRJ_STUBOBJS):
$(CCSTUBSCMD) %s
!endif # PRJ_STUBOBJS
!ifdef PRJ_MANIFEST
$(PROJECT): $(PRJLIB).manifest
$(PRJLIB).manifest: $(PRJ_MANIFEST)
@nmakehlp -s << $** >$@
@MACHINE@ $(MACHINE:IX86=X86)
<<
!endif
!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
!if $(STATIC_BUILD)
$(LIBCMD) $**
!else
$(DLLCMD) $**
$(_VC_MANIFEST_EMBED_DLL)
!endif
-@del $*.exp
!endif
!if "$(PRJ_HEADERS)" != "" && "$(PRJ_OBJS)" != ""
$(PRJ_OBJS): $(PRJ_HEADERS)
!endif
# If parent makefile has defined stub objects, add their installation
# to the default install
!if "$(PRJ_STUBOBJS)" != ""
default-install: default-install-stubs
!endif
# Unlike the other default targets, these cannot be in rules.vc because
# the executed command depends on existence of macro PRJ_HEADERS_PUBLIC
# that the parent makefile will not define until after including rules-ext.vc
!if "$(PRJ_HEADERS_PUBLIC)" != ""
default-install: default-install-headers
default-install-headers:
@echo Installing headers to '$(INCLUDE_INSTALL_DIR)'
@for %f in ($(PRJ_HEADERS_PUBLIC)) do @$(COPY) %f "$(INCLUDE_INSTALL_DIR)"
!endif
!if "$(DISABLE_STANDARD_TARGETS)" == ""
DISABLE_STANDARD_TARGETS = 0
!endif
!if "$(DISABLE_TARGET_setup)" == ""
DISABLE_TARGET_setup = 0
!endif
!if "$(DISABLE_TARGET_install)" == ""
DISABLE_TARGET_install = 0
!endif
!if "$(DISABLE_TARGET_clean)" == ""
DISABLE_TARGET_clean = 0
!endif
!if "$(DISABLE_TARGET_test)" == ""
DISABLE_TARGET_test = 0
!endif
!if "$(DISABLE_TARGET_shell)" == ""
DISABLE_TARGET_shell = 0
!endif
!if !$(DISABLE_STANDARD_TARGETS)
!if !$(DISABLE_TARGET_setup)
setup: default-setup
!endif
!if !$(DISABLE_TARGET_install)
install: default-install
!endif
!if !$(DISABLE_TARGET_clean)
clean: default-clean
realclean: hose
hose: default-hose
distclean: realclean default-distclean
!endif
!if !$(DISABLE_TARGET_test)
test: default-test
!endif
!if !$(DISABLE_TARGET_shell)
shell: default-shell
!endif
!endif # DISABLE_STANDARD_TARGETS