minor cleanups
[sqlcipher.git] / mkdll.sh
blob9e368d1d23bc5049ee932a8eb35423a49e247f17
1 #!/bin/sh
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.
9 make sqlite3.c
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 -DBUILD_sqlite=1 -DSQLITE_OS_WIN=1'
14 OPTS="$OPTS -DSQLITE_THREADSAFE=1"
15 OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1"
16 OPTS="$OPTS -DSQLITE_ENABLE_RTREE=1"
17 OPTS="$OPTS -DSQLITE_ENABLE_COLUMN_METADATA=1"
18 CC="i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR"
19 NM="i386-mingw32msvc-nm"
20 CMD="$CC -c sqlite3.c"
21 echo $CMD
22 $CMD
23 CMD="$CC -c tclsqlite3.c"
24 echo $CMD
25 $CMD
26 echo 'EXPORTS' >tclsqlite3.def
27 $NM tclsqlite3.o | grep ' T ' >temp1
28 grep '_Init$' temp1 >temp2
29 grep '_SafeInit$' temp1 >>temp2
30 grep ' T _sqlite3_' temp1 >>temp2
31 echo 'EXPORTS' >tclsqlite3.def
32 sed 's/^.* T _//' temp2 | sort | uniq >>tclsqlite3.def
33 i386-mingw32msvc-dllwrap \
34 --def tclsqlite3.def -v --export-all \
35 --driver-name i386-mingw32msvc-gcc \
36 --dlltool-name i386-mingw32msvc-dlltool \
37 --as i386-mingw32msvc-as \
38 --target i386-mingw32 \
39 -dllname tclsqlite3.dll -lmsvcrt tclsqlite3.o $TCLSTUBLIB
40 $NM sqlite3.o | grep ' T ' >temp1
41 echo 'EXPORTS' >sqlite3.def
42 grep ' _sqlite3_' temp1 | sed 's/^.* _//' >>sqlite3.def
43 i386-mingw32msvc-dllwrap \
44 --def sqlite3.def -v --export-all \
45 --driver-name i386-mingw32msvc-gcc \
46 --dlltool-name i386-mingw32msvc-dlltool \
47 --as i386-mingw32msvc-as \
48 --target i386-mingw32 \
49 -dllname sqlite3.dll -lmsvcrt sqlite3.o