]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the sqlite3_libversion() API (ticket #834). Fix the build scripts to
authordrh <drh@noemail.net>
Sat, 28 Aug 2004 16:19:00 +0000 (16:19 +0000)
committerdrh <drh@noemail.net>
Sat, 28 Aug 2004 16:19:00 +0000 (16:19 +0000)
correctly build the shared libraries with version 8.4 of Tcl. (CVS 1908)

FossilOrigin-Name: 6db26a19ea7ac77be41a7416dedaef1b9dfd9e16

Makefile.in
main.mk
manifest
manifest.uuid
mkdll.sh
mkso.sh [new file with mode: 0644]
publish.sh
sqlite3.def
src/main.c
www/capi3ref.tcl

index ddb6a5efd17335a8d4adad05b7c6444daad8c800..28850bdee9ea81a401c19c5afb48a4f9c71a96f0 100644 (file)
@@ -212,6 +212,7 @@ target_source:      $(SRC) $(VDBEHDR)
        cp $(SRC) $(VDBEHDR) tsrc
        rm tsrc/sqlite.h.in tsrc/parse.y
        cp parse.c opcodes.c tsrc
+       cp $(TOP)/sqlite3.def tsrc
 
 # Rules to build the LEMON compiler generator
 #
diff --git a/main.mk b/main.mk
index e9e01b9a96fad28627f55038782574dce31a3d30..7925949f805b05092a98a3734e235c4f31d342aa 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -187,6 +187,7 @@ target_source:      $(SRC) $(VDBEHDR) opcodes.c
        cp $(SRC) $(VDBEHDR) tsrc
        rm tsrc/sqlite.h.in tsrc/parse.y
        cp parse.c opcodes.c tsrc
+       cp $(TOP)/sqlite3.def tsrc
 
 # Rules to build the LEMON compiler generator
 #
index 144ce30b5e1fbdcedbd289c81527a5bc9fe69f68..404c3299dde408afe69db8736a74d54c2adfd440 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,6 +1,6 @@
-C Add\snew\sdefenses\sagainst\smisuse\sof\sthe\sC\sAPI.\s\sTicket\s#870.\s(CVS\s1906)
-D 2004-08-28T14:49:47
-F Makefile.in 4a5e570a9e2d35b09c31b3cf01b78cea764ade4b
+C Add\sthe\ssqlite3_libversion()\sAPI\s(ticket\s#834).\s\sFix\sthe\sbuild\sscripts\sto\ncorrectly\sbuild\sthe\sshared\slibraries\swith\sversion\s8.4\sof\sTcl.\s(CVS\s1908)
+D 2004-08-28T16:19:01
+F Makefile.in 65a7c43fcaf9a710d62f120b11b6e435eeb4a450
 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
 F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
 F VERSION 17f839d72355f3b8d4b1e4715cfcc7aa03443e2a
@@ -17,13 +17,14 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
 F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
 F ltmain.sh f6b283068efa69f06eb8aa1fe4bddfdbdeb35826
-F main.mk 430cb919fb25515058186674ea0ab7d27fa19c95
-F mkdll.sh 68d34a961a1fdfa15ef27fc4f4740be583112124
-F publish.sh fa3c5ad1a6ac59925f2b37e422db378a7bec621c
+F main.mk 2eb2826d6bd82d54e768902e5e1929e550409273
+F mkdll.sh 468d4f41d3ea98221371df4825cfbffbaac4d7e4
+F mkso.sh 7b67da1d63070875ba948e749aee9ef50ce36e3d
+F publish.sh 72bde067dda3fc2d33e92f20253b924e3b97da30
 F spec.template b2f6c4e488cbc3b993a57deba22cbc36203c4da3
 F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
 F sqlite.pc.in 30552343140c53304c2a658c080fbe810cd09ca2
-F sqlite3.def c139a6b17293d71759a7c301ad76707243ce5d54
+F sqlite3.def cf325d366f167029a971de7333f32b74bfe2e375
 F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
 F src/attach.c 0bd4f11da6999665da30625665a4096ba7898de6
 F src/auth.c 60db23b98bb94c8b0178180faaf49dc116674217
@@ -39,7 +40,7 @@ F src/hash.c a97721a55440b7bea31ffe471bb2f6b4123cddd5
 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
 F src/insert.c fc1ce65a0fe68f226143de9b43c3582164a92aff
 F src/legacy.c 2f3617c61bcdcd1d776154a9cfebf99facda8ad8
-F src/main.c c00e3f9e8c4fa9bc0fdad43ce366958db73ac9c6
+F src/main.c 63f77b83a518fda4d8405204b45ae016c5f35a2d
 F src/md5.c 7ae1c39044b95de2f62e066f47bb1deb880a1070
 F src/os.h d1780e0db95cad01f213d48da22ab490eb4fd345
 F src/os_common.h cd7eb025fdab7dc91e0e97bf6310f1648205857f
@@ -212,7 +213,7 @@ F www/arch2b.fig d22a2c9642d584b89d4088b1e51e2bb0f7c04bed
 F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
 F www/c_interface.tcl 2176519fc2bd2d2cf6fe74fd806fc2d8362de2c8
 F www/capi3.tcl 5c1cb163f4d2a54e2d0e22dcc399dd71245c8b89
-F www/capi3ref.tcl 740d222be4d66e8947b60a0627dd760a2e019e9f
+F www/capi3ref.tcl bead38516efb0227ffa6ac76beb3f7ea405bb389
 F www/changes.tcl 8c36aab96163bbb64f5f07a12606a242c0a820f2
 F www/common.tcl f786e6be86fb2627ceb30e770e9efa83b9c67a3a
 F www/conflict.tcl fb8a2ba83746c7fdfd9e52fa7f6aaf5c422b8246
@@ -243,7 +244,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25
 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P f5b0e5b0b2f17d179c23c7e4542dbbb452096056
-R 19adc0034f3d181b6cae6f1ebdba626d
+P 6ef1f662d71c75bdb7f61b2fff03f5b1b41e5586
+R 5b251c944f99c3bf147bc10eb4f70f96
 U drh
-Z 8b14a526a7800c9ee03abeba359d39e9
+Z 5c52cbb1dda1a18b82f5188a439efbf0
index 7e2b3ecb0d316d96b5837a9e42b0283144b38e6f..78ab67cc41db97a00595d9577783ab948f267fc7 100644 (file)
@@ -1 +1 @@
-6ef1f662d71c75bdb7f61b2fff03f5b1b41e5586
\ No newline at end of file
+6db26a19ea7ac77be41a7416dedaef1b9dfd9e16
\ No newline at end of file
index 07c4541c623a05e825b45e6873a6e024f5ac8ea1..bad8619f3e50aad25276a38b4f2ed4f553a15069 100644 (file)
--- a/mkdll.sh
+++ b/mkdll.sh
@@ -1,95 +1,36 @@
 #!/bin/sh
 #
-# This script is used to compile SQLite and all its documentation and
-# ship everything up to the SQLite website.  This script will only work
-# on the system "zadok" at the Hwaci offices.  But others might find
-# the script useful as an example.
+# This script is used to compile SQLite into a DLL.
 #
-
-# Build the tclsqlite.dll shared library that can be imported into tclsh
-# or wish on windows.
+# Two separate DLLs are generated.  "sqlite3.dll" is the core
+# library.  "tclsqlite3.dll" contains the TCL bindings and is the
+# library that is loaded into TCL in order to run SQLite.
 #
 make target_source
 cd tsrc
 PATH=$PATH:/opt/mingw/bin
+TCLDIR=/home/drh/tcltk/846/win/846win
+TCLSTUBLIB=$TCLDIR/libtcl84stub.a
 OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
-CC="i386-mingw32msvc-gcc -O2 $OPTS -I."
+CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
 rm shell.c
-rm tclsqlite.c
 for i in *.c; do
   CMD="$CC -c $i"
   echo $CMD
   $CMD
 done
-cat >sqlite3.def <<\END_OF_FILE
-EXPORTS
-sqlite3_aggregate_context
-sqlite3_aggregate_count
-sqlite3_bind_blob
-sqlite3_bind_double
-sqlite3_bind_int
-sqlite3_bind_int64
-sqlite3_bind_null
-sqlite3_bind_text
-sqlite3_bind_text16
-sqlite3_busy_handler
-sqlite3_busy_timeout
-sqlite3_close
-sqlite3_column_blob
-sqlite3_column_bytes
-sqlite3_column_bytes16
-sqlite3_column_count
-sqlite3_column_decltype
-sqlite3_column_decltype16
-sqlite3_column_double
-sqlite3_column_int
-sqlite3_column_int64
-sqlite3_column_name
-sqlite3_column_name16
-sqlite3_column_text
-sqlite3_column_text16
-sqlite3_column_type
-sqlite3_complete
-sqlite3_complete16
-sqlite3_create_function
-sqlite3_create_function16
-sqlite3_errcode
-sqlite3_errmsg
-sqlite3_errmsg16
-sqlite3_finalize
-sqlite3_free
-sqlite3_interrupt
-sqlite3_last_insert_rowid
-sqlite3_mprintf
-sqlite3_open
-sqlite3_open16
-sqlite3_prepare
-sqlite3_prepare16
-sqlite3_reset
-sqlite3_result_blob
-sqlite3_result_double
-sqlite3_result_error
-sqlite3_result_error16
-sqlite3_result_int
-sqlite3_result_int64
-sqlite3_result_null
-sqlite3_result_text
-sqlite3_result_text16
-sqlite3_result_value
-sqlite3_set_authorizer
-sqlite3_step
-sqlite3_user_data
-sqlite3_value_blob
-sqlite3_value_bytes
-sqlite3_value_bytes16
-sqlite3_value_double
-sqlite3_value_int
-sqlite3_value_int64
-sqlite3_value_text
-sqlite3_value_text16
-sqlite3_value_type
-sqlite3_vmprintf
-END_OF_FILE
+echo 'EXPORTS' >tclsqlite3.def
+echo 'Tclsqlite3_Init' >>tclsqlite3.def
+echo 'Sqlite3_Init' >>tclsqlite3.def
+i386-mingw32msvc-dllwrap \
+     --def tclsqlite3.def -v --export-all \
+     --driver-name i386-mingw32msvc-gcc \
+     --dlltool-name i386-mingw32msvc-dlltool \
+     --as i386-mingw32msvc-as \
+     --target i386-mingw32 \
+     -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB
+i386-mingw32msvc-strip tclsqlite3.dll
+rm tclsqlite.o
 i386-mingw32msvc-dllwrap \
      --def sqlite3.def -v --export-all \
      --driver-name i386-mingw32msvc-gcc \
@@ -98,7 +39,4 @@ i386-mingw32msvc-dllwrap \
      --target i386-mingw32 \
      -dllname sqlite3.dll -lmsvcrt *.o
 i386-mingw32msvc-strip sqlite3.dll
-mv sqlite3.dll sqlite3.def ..
 cd ..
-rm -f sqlite3dll.zip
-zip sqlite3dll.zip sqlite3.dll sqlite3.def
diff --git a/mkso.sh b/mkso.sh
new file mode 100644 (file)
index 0000000..9da593b
--- /dev/null
+++ b/mkso.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# This script is used to compile SQLite into a shared library on Linux.
+#
+# Two separate shared libraries are generated.  "sqlite3.so" is the core
+# library.  "tclsqlite3.so" contains the TCL bindings and is the
+# library that is loaded into TCL in order to run SQLite.
+#
+make target_source
+cd tsrc
+rm shell.c
+TCLDIR=/home/drh/tcltk/846/linux/846linux
+TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
+OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
+for i in *.c; do
+  CMD="cc -fPIC $OPTS -O2 -I. -I$TCLDIR -c $i"
+  echo $CMD
+  $CMD
+done
+echo gcc -shared *.o $TCLSTUBLIB -o tclsqlite3.so
+gcc -shared *.o $TCLSTUBLIB -o tclsqlite3.so
+strip tclsqlite3.so
+rm tclsqlite.c tclsqlite.o
+echo gcc -shared *.o -o sqlite3.so
+gcc -shared *.o -o sqlite3.so
+strip sqlite3.so
+cd ..
index 24c18a553d023e3f8d81e407ef4894d60ccd908d..7c45550bbaa15ae1b1797ab480da999a29735e1f 100644 (file)
@@ -14,7 +14,6 @@ srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
 # Get the makefile.
 #
 cp $srcdir/Makefile.linux-gcc ./Makefile
-cp $srcdir/sqlite3.def ./sqlite3.def
 chmod +x $srcdir/install-sh
 
 # Get the current version number - needed to help build filenames
@@ -31,71 +30,34 @@ mv sqlite3 sqlite3-$VERS.bin
 gzip sqlite3-$VERS.bin
 mv sqlite3-$VERS.bin.gz doc
 
-# Build the tclsqlite.so shared library for import into tclsh or wish
-# under Linux
+# Build a source archive useful for windows.
 #
 make target_source
 cd tsrc
 zip ../doc/sqlite-source-$VERSW.zip *
-rm shell.c
-TCLDIR=/home/drh/tcltk/8.2linux
-TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
-OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
-gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
-strip tclsqlite.so
-mv tclsqlite.so tclsqlite-$VERS.so
+cd ..
+
+# Build the sqlite.so and tclsqlite.so shared libraries
+# under Linux
+#
+. $srcdir/mkso.sh
+cd tsrc
+mv tclsqlite3.so tclsqlite-$VERS.so
 gzip tclsqlite-$VERS.so
 mv tclsqlite-$VERS.so.gz ../doc
-rm tclsqlite.c
-gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
-strip sqlite.so
-mv sqlite.so sqlite-$VERS.so
+mv sqlite3.so sqlite-$VERS.so
 gzip sqlite-$VERS.so
 mv sqlite-$VERS.so.gz ../doc
 cd ..
 
-# Build the tclsqlite.dll shared library that can be imported into tclsh
-# or wish on windows.
+# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
 #
-make target_source
+. $srcdir/mkdll.sh
 cd tsrc
-rm shell.c
-TCLDIR=/home/drh/tcltk/8.2win
-TCLSTUBLIB=$TCLDIR/tclstub82.a
-PATH=$PATH:/opt/mingw/bin
-OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
-CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
-rm shell.c
-for i in *.c; do
-  CMD="$CC -c $i"
-  echo $CMD
-  $CMD
-done
-echo 'EXPORTS' >tclsqlite3.def
-echo 'Tclsqlite3_Init' >>tclsqlite3.def
-echo 'Sqlite3_Init' >>tclsqlite3.def
-i386-mingw32msvc-dllwrap \
-     --def tclsqlite3.def -v --export-all \
-     --driver-name i386-mingw32msvc-gcc \
-     --dlltool-name i386-mingw32msvc-dlltool \
-     --as i386-mingw32msvc-as \
-     --target i386-mingw32 \
-     -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB
-i386-mingw32msvc-strip tclsqlite3.dll
-rm tclsqlite.o
-cp ../sqlite3.def .
-i386-mingw32msvc-dllwrap \
-     --def sqlite3.def -v --export-all \
-     --driver-name i386-mingw32msvc-gcc \
-     --dlltool-name i386-mingw32msvc-dlltool \
-     --as i386-mingw32msvc-as \
-     --target i386-mingw32 \
-     -dllname sqlite3.dll -lmsvcrt *.o
-i386-mingw32msvc-strip sqlite3.dll
-zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
 echo zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
-zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
+zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
 echo zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
+zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
 cd ..
 
 # Build the sqlite.exe executable for windows.
index ad90d95ee426739f0f9839482c1cb449efc2ebb8..3a17a9a87ac353b3ac335559a5f3d760de434995 100644 (file)
@@ -48,6 +48,7 @@ sqlite3_get_auxdata
 sqlite3_get_table
 sqlite3_interrupt
 sqlite3_last_insert_rowid
+sqlite3_libversion
 sqlite3_mprintf
 sqlite3_open
 sqlite3_open16
index 85ba6dc6bf380259a1693829fbe93c8eb2169dd0..fb891b5f4125647787175fa0817f26a9d29892e7 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.254 2004/08/28 14:49:47 drh Exp $
+** $Id: main.c,v 1.255 2004/08/28 16:19:01 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -372,6 +372,7 @@ int sqlite3ReadSchema(Parse *pParse){
 */
 const char rcsid3[] = "@(#) \044Id: SQLite version " SQLITE_VERSION " $";
 const char sqlite3_version[] = SQLITE_VERSION;
+const char *sqlite3_libversion(void){ return sqlite3_version; }
 
 /*
 ** This is the default collating function named "BINARY" which is always
index ed32f07fcdb5fd37aa6c2d1084493df165223a60..34ad945e211e433c3d75da01a9972c6921aa024a 100644 (file)
@@ -1,4 +1,4 @@
-set rcsid {$Id: capi3ref.tcl,v 1.9 2004/08/25 04:07:03 drh Exp $}
+set rcsid {$Id: capi3ref.tcl,v 1.10 2004/08/28 16:19:01 drh Exp $}
 source common.tcl
 header {C/C++ Interface For SQLite Version 3}
 puts {
@@ -47,6 +47,15 @@ Many SQLite functions return an integer result code from the set shown
 above in order to indicates success or failure.
 }
 
+api {} {
+  const char *sqlite3_libversion(void);
+} {
+  Return a pointer to a string which contains the version number of
+  the library.  The same string is available in the global
+  variable named "sqlite3_version".  This interface is provided since
+  windows is unable to access global variables in DLLs.
+}
+
 api {} {
   void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
 } {