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] |
drh | d5b6b38 | 2005-01-30 22:10:00 +0000 | [diff] [blame] | 9 | if { ![info exists env(DESTDIR)] } { set env(DESTDIR) "" } |
| 10 | set LIBDIR $env(DESTDIR)[lindex $auto_path 0] |
drh | 4b2266a | 2004-11-27 15:52:16 +0000 | [diff] [blame] | 11 | set LIBNAME [file tail $LIBFILE] |
| 12 | set LIB $LIBDIR/sqlite3/$LIBNAME |
| 13 | |
| 14 | file delete -force $LIBDIR/sqlite3 |
| 15 | file mkdir $LIBDIR/sqlite3 |
| 16 | set fd [open $LIBDIR/sqlite3/pkgIndex.tcl w] |
| 17 | puts $fd "package ifneeded sqlite3 $VERSION \[list load $LIB sqlite3\]" |
| 18 | close $fd |
| 19 | |
| 20 | # We cannot use [file copy] because that will just make a copy of |
| 21 | # a symbolic link. We have to open and copy the file for ourselves. |
| 22 | # |
| 23 | set in [open $LIBFILE] |
| 24 | fconfigure $in -translation binary |
| 25 | set out [open $LIB w] |
| 26 | fconfigure $out -translation binary |
| 27 | puts -nonewline $out [read $in] |
| 28 | close $in |
| 29 | close $out |