3 # This script is used to compile SQLite into a DLL.
5 # Two separate DLLs are generated. "sqlite3.dll" is the core
6 # library. "tclsqlite3.dll" contains the TCL bindings and is the
7 # library that is loaded into TCL in order to run SQLite.
10 PATH
=$PATH:/opt
/mingw
/bin
11 TCLDIR
=/home
/drh
/tcltk
/846/win
/846win
12 TCLSTUBLIB
=$TCLDIR/libtcl84stub.a
13 OPTS
='-DUSE_TCL_STUBS=1 -DTHREADSAFE=1 -DBUILD_sqlite=1 -DOS_WIN=1'
14 CC
="i386-mingw32msvc-gcc -O2 $OPTS -Itsrc -I$TCLDIR"
15 NM
="i386-mingw32msvc-nm"
16 CMD
="$CC -c sqlite3.c"
19 CMD
="$CC -c tclsqlite3.c"
22 echo 'EXPORTS' >tclsqlite3.def
23 $NM tclsqlite3.o |
grep ' T ' >temp1
24 grep '_Init$' temp1
>temp2
25 grep '_SafeInit$' temp1
>>temp2
26 grep ' T _sqlite3_' temp1
>>temp2
27 echo 'EXPORTS' >tclsqlite3.def
28 sed 's/^.* T _//' temp2 |
sort |
uniq >>tclsqlite3.def
29 i386-mingw32msvc-dllwrap \
30 --def tclsqlite3.def
-v --export-all \
31 --driver-name i386-mingw32msvc-gcc \
32 --dlltool-name i386-mingw32msvc-dlltool \
33 --as i386-mingw32msvc-as \
34 --target i386-mingw32 \
35 -dllname tclsqlite3.dll
-lmsvcrt tclsqlite3.o
$TCLSTUBLIB
36 $NM sqlite3.o |
grep ' T ' >temp1
37 echo 'EXPORTS' >sqlite3.def
38 grep ' _sqlite3_' temp1 |
sed 's/^.* _//' >>sqlite3.def
39 i386-mingw32msvc-dllwrap \
40 --def sqlite3.def
-v --export-all \
41 --driver-name i386-mingw32msvc-gcc \
42 --dlltool-name i386-mingw32msvc-dlltool \
43 --as i386-mingw32msvc-as \
44 --target i386-mingw32 \
45 -dllname sqlite3.dll
-lmsvcrt sqlite3.o