]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the tclextension-list makefile target. The the makefile running on Mac.
authordrh <>
Thu, 1 Aug 2024 23:00:37 +0000 (23:00 +0000)
committerdrh <>
Thu, 1 Aug 2024 23:00:37 +0000 (23:00 +0000)
FossilOrigin-Name: 2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326

Makefile.in
manifest
manifest.uuid
src/tclsqlite.c
tool/buildtclext.tcl

index bae560b4dce094576916304a8600270f25188215..61fcf6e7d6dbcbcfda979942aa2f66ebb613ae4e 100644 (file)
@@ -1556,15 +1556,30 @@ install:        sqlite3$(TEXE) lib_install sqlite3.h sqlite3.pc ${HAVE_TCL:1=tcl_instal
        $(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
        $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(pkgconfigdir)
 
-pkgIndex.tcl:  tclsqlite3.c
+# Build the SQLite TCL extension in a way that make it compatible
+# with whatever version of TCL is running as $TCLSH_CMD, possibly defined
+# by --with-tclsh=
+#
+tclextension:  tclsqlite3.c
        $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --build-only
 
-tclextension-install:  pkgIndex.tcl
+# Install the SQLite TCL extension in a way that is appropriate for $TCLSH_CMD
+# to find it.
+#
+tclextension-install:  tclextension
        $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --install-only
 
+# Install the SQLite TCL extension that is used by $TCLSH_CMD
+#
 tclextension-uninstall: 
        $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --uninstall
 
+# List all installed the SQLite TCL extension that is are accessible
+# by $TCLSH_CMD, included prior versions.
+#
+tclextension-list: 
+       $(TCLSH_CMD) $(TOP)/tool/buildtclext.tcl --info
+
 clean:
        rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la
        rm -f sqlite3.h opcodes.*
index e6c0cd9da506793e7a53cb037a499153dcc2f1c7..15bb5252ff6c0ff5fa427bcb7e55559d3c0b8d2a 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C New\smakefile\stargets:\stclextension-install\sand\stclextension-uninstall.\s\sSeem\nto\swork\son\sLinux.
-D 2024-08-01T20:26:22.352
+C Add\sthe\stclextension-list\smakefile\starget.\s\sThe\sthe\smakefile\srunning\son\sMac.
+D 2024-08-01T23:00:37.841
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
-F Makefile.in 1e1686272e573f924567483d123abc2a1397cf59c0ec823916a1368b46e13382
+F Makefile.in 4fc6dc2def18b4a2e8fb4c4cad04699e829b3fcefa85974ec71a4a9110a0ea88
 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6
 F Makefile.msc 993f8addade63bcac7192416e7161ceee60edcee2376299ea48b2a74c66ac2d5
 F README.md 6358805260a03ebead84e168bbf3740ddf3f683b477e478567186aa7afb490d3
@@ -768,7 +768,7 @@ F src/sqliteInt.h b77218c425891c7c90506c77fd2eb13bae03628d065b44fffeb37401cd955a
 F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728
 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b
 F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1
-F src/tclsqlite.c 8e86ab2595c2ff7bb155331fb173e560180235bceaacce7931a718b1c2e6dfb4
+F src/tclsqlite.c 9bd7443f5db3250dbb073aa6f046a52f939832ac0193c710d6fffb6ca68674be
 F src/tclsqlite.h c6af51f31a2b2172d674608763a4b98fdf5cd587e4025053e546fb8077757262
 F src/test1.c 51159784f29d3dfd4b50fd6ed9c43c8f7f36925c501a3ad3083528e5e5544bd7
 F src/test2.c 7ebc518e6735939d8979273a6f7b1d9b5702babf059f6ad62499f7f60a9eb9a3
@@ -2093,7 +2093,7 @@ F tool/GetTclKit.bat d84033c6a93dfe735d247f48ba00292a1cc284dcf69963e5e672444e045
 F tool/Replace.cs 02c67258801c2fb5f63231e0ac0f220b4b36ba91
 F tool/build-all-msvc.bat c817b716e0edeecaf265a6775b63e5f45c34a6544f1d4114a222701ed5ac79ab x
 F tool/build-shell.sh f193b5e3eb4afcb4abbf96bf1475be6cfb74763ee2e50c82bc7ca105e8a136c5
-F tool/buildtclext.tcl b360c5133169d555b2b2d6aeac8aece43a34babc672dd6c05fd41ebc850cc14f
+F tool/buildtclext.tcl 23a986cfcb0338e02ad277cebd94d92b37a9cd848fe168f088fa80ca973b4d79
 F tool/cg_anno.tcl c1f875f5a4c9caca3d59937b16aff716f8b1883935f1b4c9ae23124705bc8099 x
 F tool/checkSpacing.c 810e51703529a204fc4e1eb060e9ab663e3c06d2
 F tool/cktclsh.sh 6075eef9c6b9ba4b38fef2ca2a66d25f2311bd3c610498d18a9b01f861629cca
@@ -2202,8 +2202,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 58babd2aa4b5c9c70e1169cdf09f05eb95d7b13f50bb2ec0e487182288172678
-R 38f4741323b0ec90afecf9f175b90c98
+P 534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c
+R 2909fb7ee21646cc58011e08d136b308
 U drh
-Z a4ed4e2858217ff286bef81105749295
+Z d8a3255efb288995807535829d58616f
 # Remove this line to create a well-formed Fossil manifest.
index 49f1f98f351f9243999725f1dc7bd488a4dcc4f5..01a9c859f100a104b1870419eb1014cf9cc05e19 100644 (file)
@@ -1 +1 @@
-534f8344abbda78e841edafe84c27ea8b1dfdecb9ab51271772a7f7264ef5b8c
+2f667cc8e54167342e17e63e1a017388365ebf4cd379f9c16c12e4603b34a326
index 906f429ab956c049c64c31d074dd989f4ea4ad34..51049b4d211886ff35e90365467291fef2e38ddc 100644 (file)
@@ -369,12 +369,19 @@ static int SQLITE_TCLAPI incrblobOutput(
   return nWrite;
 }
 
+/* The datatype of Tcl_DriverWideSeekProc changes between tcl8.6 and tcl9.0 */
+#if TCL_MAJOR_VERSION==9
+# define WideSeekProcType long lone
+#else
+# define WideSeekProcType Tcl_WideInt
+#endif
+
 /*
 ** Seek an incremental blob channel.
 */
-static long long SQLITE_TCLAPI incrblobWideSeek(
+static WideSeekProcType SQLITE_TCLAPI incrblobWideSeek(
   ClientData instanceData,
-  long long offset,
+  WideSeekProcType offset,
   int seekMode,
   int *errorCodePtr
 ){
index f2510da98e7a8bde2416bf4f24d5fdfb738f8a93..26067ecd870e758e646f3531d625024a8da7cc80 100644 (file)
@@ -1,29 +1,38 @@
+#!/usr/bin/tclsh
 #
-# Run this TCL script to build and optionally install the TCL interface
-# library for SQLite.  Run the script with the specific "tclsh" for which
-# the installation should occur.
-#
-# Must do "make tclsqlite3.c" first.
-#
-# Options:
-#
-#    --build-only              Only build the extension, don't install it
-#    --install-only            Install an extension previously build
-#    --uninstall               Uninstall the extension
-#
-set installonly 0
-set buildonly 0
+set help \
+{Run this TCL script to build and install the TCL interface library for
+SQLite.  Run the script with the specific "tclsh" for which the installation
+should occur.
+
+There must be a valid "tclsqlite3.c" file in the working directory prior
+to running this script.  Use "make tclsqlite3.c" to generate that file.
+
+Options:
+
+   --build-only         Only build the extension, don't install it
+   --info               Show info on existing SQLite TCL extension installs
+   --install-only       Install an extension previously build
+   --uninstall          Uninstall the extension}
+
+
+set build 1
+set install 1
 set uninstall 0
+set infoonly 0
 for {set ii 0} {$ii<[llength $argv]} {incr ii} {
   set a0 [lindex $argv $ii]
   if {$a0=="--install-only"} {
-    set installonly 1
+    set build 0
   } elseif {$a0=="--build-only"} {
-    set buildonly 1
+    set install 0
   } elseif {$a0=="--uninstall"} {
     set uninstall 1
+  } elseif {$a0=="--info"} {
+    set infoonly 1
   } else {
-    puts stderr "Unknown option: \"$a0\""
+    puts stderr "Unknown option: \"$a0\"\n"
+    puts stderr $help
     exit 1
   }
 }
@@ -94,7 +103,7 @@ if {$inc!=""} {
 }
 set cmd {}
 regexp {TCL_SHLIB_LD='([^']+)'} $tclConfig all cmd
-set LDFLAGS $INC
+set LDFLAGS "$INC -DUSE_TCL_STUBS"
 set CMD [subst $cmd]
 if {$TCLMAJOR>8} {
   set OUT libtcl9sqlite$VERSION.$SUFFIX
@@ -102,6 +111,24 @@ if {$TCLMAJOR>8} {
   set OUT libsqlite$VERSION.$SUFFIX
 }
 
+# Show information about prior installs
+#
+if {$infoonly} {
+  set cnt 0
+  foreach dir $auto_path {
+    foreach subdir [glob -nocomplain -types d $dir/sqlite3*] {
+      if {[file exists $subdir/pkgIndex.tcl]} {
+        puts $subdir
+        incr cnt
+      }
+    }
+  }
+  if {$cnt==0} {
+    puts "no current installations of the SQLite TCL extension"
+  }
+  exit
+}
+
 # Uninstall the extension
 #
 if {$uninstall} {
@@ -123,24 +150,40 @@ if {$uninstall} {
   exit
 }
 
-# Figure out where the extension will be installed.
-#
-set DEST {}
-foreach dir $auto_path {
-  if {[file writable $dir]} {
-    set DEST $dir
-    break
+if {$install} {
+  # Figure out where the extension will be installed.  Put the extension
+  # in the first writable directory on $auto_path.
+  #
+  set DEST {}
+  foreach dir $auto_path {
+    if {[file writable $dir]} {
+      set DEST $dir
+      break
+    } elseif {[glob -nocomplain $dir/sqlite3*/pkgIndex.tcl]!=""} {
+      set conflict [lindex [glob $dir/sqlite3*/pkgIndex.tcl] 0]
+      puts "Unable to install. There is already a conflicting version"
+      puts "of the SQLite TCL Extension that cannot be overwritten at\n"
+      puts "   [file dirname $conflict]\n"
+      puts "Consider running using sudo to work around this problem."
+      exit 1
+    }
+  }
+  if {$DEST==""} {
+    puts "None of the directories on \$auto_path are writable by this process,"
+    puts "so the installation cannot take place.  Consider running using sudo"
+    puts "to work around this problem.\n"
+    puts "These are the (unwritable) \$auto_path directories:\n"
+    foreach dir $auto_path {
+      puts "  *  $dir"
+    }
+    exit 1
   }
-}
-if {$DEST==""} {
-  puts "None of the directories on $auto_path are writable by this process,"
-  puts "so the installation cannot take place.  Consider running using sudo"
-  puts "to work around this."
 }
 
-if {!$installonly} {
+if {$build} {
   # Generate the pkgIndex.tcl file
   #
+  puts "generating pkgConfig.tcl..."
   set fd [open pkgIndex.tcl w]
   puts $fd [subst -nocommands {# -*- tcl -*-
 # Tcl package index file, version ???
@@ -157,9 +200,9 @@ package ifneeded sqlite3 $VERSION \\
   exec {*}$cmd
 }
 
-# Install the extension
-#
-if {$DEST!="" && !$buildonly} {
+
+if {$install} {
+  # Install the extension
   set DEST2 $DEST/sqlite$VERSION
   file mkdir $DEST2
   puts "installing $DEST2/pkgIndex.tcl"