drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame^] | 1 | # This script attempts to install SQLite3 so that it can be used |
| 2 | # by TCL. Invoke this script with single argument which is the |
| 3 | # version number of SQLite. Example: |
| 4 | # |
| 5 | # tclsh tclinstaller.tcl 3.0 |
| 6 | # |
| 7 | set VERSION [lindex $argv 0] |
| 8 | set LIBFILE .libs/libtclsqlite3[info sharedlibextension] |
| 9 | set LIBDIR [lindex $auto_path 0] |
| 10 | set LIBNAME [file tail $LIBFILE] |
| 11 | set LIB $LIBDIR/sqlite3/$LIBNAME |
| 12 | |
| 13 | file delete -force $LIBDIR/sqlite3 |
| 14 | file mkdir $LIBDIR/sqlite3 |
| 15 | set fd [open $LIBDIR/sqlite3/pkgIndex.tcl w] |
| 16 | puts $fd "package ifneeded sqlite3 $VERSION \[list load $LIB sqlite3\]" |
| 17 | close $fd |
| 18 | |
| 19 | # We cannot use [file copy] because that will just make a copy of |
| 20 | # a symbolic link. We have to open and copy the file for ourselves. |
| 21 | # |
| 22 | set in [open $LIBFILE] |
| 23 | fconfigure $in -translation binary |
| 24 | set out [open $LIB w] |
| 25 | fconfigure $out -translation binary |
| 26 | puts -nonewline $out [read $in] |
| 27 | close $in |
| 28 | close $out |