blob: 29d343e678ffa718413e0602cb6be7201ff4c6a7 [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) "" }
vapieracf1a932007-05-03 20:06:11 +000010if { ![info exists env(TCLLIBDIR)] } { set env(TCLLIBDIR) [lindex $auto_path 0] }
11set LIBDIR $env(DESTDIR)$env(TCLLIBDIR)
12set LIBDIR_INSTALL $env(TCLLIBDIR)
drh4b2266a2004-11-27 15:52:16 +000013set LIBNAME [file tail $LIBFILE]
14set LIB $LIBDIR/sqlite3/$LIBNAME
vapieracf1a932007-05-03 20:06:11 +000015set LIB_INSTALL $LIBDIR_INSTALL/sqlite3/$LIBNAME
drh4b2266a2004-11-27 15:52:16 +000016
17file delete -force $LIBDIR/sqlite3
18file mkdir $LIBDIR/sqlite3
19set fd [open $LIBDIR/sqlite3/pkgIndex.tcl w]
vapieracf1a932007-05-03 20:06:11 +000020puts $fd "package ifneeded sqlite3 $VERSION \[list load $LIB_INSTALL sqlite3\]"
drh4b2266a2004-11-27 15:52:16 +000021close $fd
22
23# We cannot use [file copy] because that will just make a copy of
24# a symbolic link. We have to open and copy the file for ourselves.
25#
26set in [open $LIBFILE]
27fconfigure $in -translation binary
28set out [open $LIB w]
29fconfigure $out -translation binary
30puts -nonewline $out [read $in]
31close $in
32close $out