2004-06-01 05:45:11 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2004-08-28 20:19:00 +04:00
|
|
|
# This script is used to compile SQLite into a DLL.
|
2004-06-01 05:45:11 +04:00
|
|
|
#
|
2004-08-28 20:19:00 +04:00
|
|
|
# Two separate DLLs are generated. "sqlite3.dll" is the core
|
|
|
|
# library. "tclsqlite3.dll" contains the TCL bindings and is the
|
|
|
|
# library that is loaded into TCL in order to run SQLite.
|
2004-06-01 05:45:11 +04:00
|
|
|
#
|
2007-04-02 19:04:34 +04:00
|
|
|
make sqlite3.c
|
2004-06-01 05:45:11 +04:00
|
|
|
PATH=$PATH:/opt/mingw/bin
|
2004-08-28 20:19:00 +04:00
|
|
|
TCLDIR=/home/drh/tcltk/846/win/846win
|
|
|
|
TCLSTUBLIB=$TCLDIR/libtcl84stub.a
|
2007-04-02 19:04:34 +04:00
|
|
|
OPTS='-DUSE_TCL_STUBS=1 -DTHREADSAFE=1 -DBUILD_sqlite=1 -DOS_WIN=1'
|
|
|
|
CC="i386-mingw32msvc-gcc -O2 $OPTS -Itsrc -I$TCLDIR"
|
2006-09-01 21:06:20 +04:00
|
|
|
NM="i386-mingw32msvc-nm"
|
2007-04-02 19:04:34 +04:00
|
|
|
CMD="$CC -c sqlite3.c"
|
|
|
|
echo $CMD
|
|
|
|
$CMD
|
|
|
|
CMD="$CC -c tsrc/tclsqlite.c -o tclsqlite.o"
|
|
|
|
echo $CMD
|
|
|
|
$CMD
|
2004-08-28 20:19:00 +04:00
|
|
|
echo 'EXPORTS' >tclsqlite3.def
|
2007-04-02 19:04:34 +04:00
|
|
|
$NM sqlite3.o tclsqlite.o | grep ' T ' >temp1
|
2006-09-02 17:22:28 +04:00
|
|
|
grep '_Init$' temp1 >temp2
|
|
|
|
grep '_SafeInit$' temp1 >>temp2
|
|
|
|
grep ' T _sqlite3_' temp1 >>temp2
|
|
|
|
echo 'EXPORTS' >tclsqlite3.def
|
|
|
|
sed 's/^.* T _//' temp2 | sort | uniq >>tclsqlite3.def
|
2004-08-28 20:19:00 +04:00
|
|
|
i386-mingw32msvc-dllwrap \
|
|
|
|
--def tclsqlite3.def -v --export-all \
|
|
|
|
--driver-name i386-mingw32msvc-gcc \
|
|
|
|
--dlltool-name i386-mingw32msvc-dlltool \
|
|
|
|
--as i386-mingw32msvc-as \
|
|
|
|
--target i386-mingw32 \
|
2007-04-02 19:04:34 +04:00
|
|
|
-dllname tclsqlite3.dll -lmsvcrt tclsqlite.o sqlite3.o $TCLSTUBLIB
|
|
|
|
$NM sqlite3.o | grep ' T ' >temp1
|
2006-09-02 17:22:28 +04:00
|
|
|
echo 'EXPORTS' >sqlite3.def
|
|
|
|
grep ' _sqlite3_' temp1 | sed 's/^.* _//' >>sqlite3.def
|
2004-06-01 05:45:11 +04:00
|
|
|
i386-mingw32msvc-dllwrap \
|
|
|
|
--def sqlite3.def -v --export-all \
|
|
|
|
--driver-name i386-mingw32msvc-gcc \
|
|
|
|
--dlltool-name i386-mingw32msvc-dlltool \
|
|
|
|
--as i386-mingw32msvc-as \
|
|
|
|
--target i386-mingw32 \
|
2007-04-02 19:04:34 +04:00
|
|
|
-dllname sqlite3.dll -lmsvcrt sqlite3.o
|