blob: 88b7df1c0ffc7a7791a1560522ef245b6ea207a8 [file] [log] [blame]
drh4b2266a2004-11-27 15:52:16 +00001# 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#
7set VERSION [lindex $argv 0]
8set LIBFILE .libs/libtclsqlite3[info sharedlibextension]
drhd5b6b382005-01-30 22:10:00 +00009if { ![info exists env(DESTDIR)] } { set env(DESTDIR) "" }
10set LIBDIR $env(DESTDIR)[lindex $auto_path 0]
drh4b2266a2004-11-27 15:52:16 +000011set LIBNAME [file tail $LIBFILE]
12set LIB $LIBDIR/sqlite3/$LIBNAME
13
14file delete -force $LIBDIR/sqlite3
15file mkdir $LIBDIR/sqlite3
16set fd [open $LIBDIR/sqlite3/pkgIndex.tcl w]
17puts $fd "package ifneeded sqlite3 $VERSION \[list load $LIB sqlite3\]"
18close $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#
23set in [open $LIBFILE]
24fconfigure $in -translation binary
25set out [open $LIB w]
26fconfigure $out -translation binary
27puts -nonewline $out [read $in]
28close $in
29close $out