drh | 014ac19 | 2004-06-01 01:45:11 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 3 | # This script is used to compile SQLite into a DLL. |
drh | 014ac19 | 2004-06-01 01:45:11 +0000 | [diff] [blame] | 4 | # |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 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. |
drh | 014ac19 | 2004-06-01 01:45:11 +0000 | [diff] [blame] | 8 | # |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 9 | make sqlite3.c |
drh | 014ac19 | 2004-06-01 01:45:11 +0000 | [diff] [blame] | 10 | PATH=$PATH:/opt/mingw/bin |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 11 | TCLDIR=/home/drh/tcltk/846/win/846win |
| 12 | TCLSTUBLIB=$TCLDIR/libtcl84stub.a |
drh | 66f9de0 | 2008-08-05 21:42:37 +0000 | [diff] [blame] | 13 | OPTS='-DUSE_TCL_STUBS=1 -DBUILD_sqlite=1 -DSQLITE_OS_WIN=1' |
| 14 | OPTS="$OPTS -DSQLITE_THREADSAFE=1" |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 15 | OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1" |
shane | e5447f5 | 2008-10-12 02:03:37 +0000 | [diff] [blame] | 16 | OPTS="$OPTS -DSQLITE_ENABLE_RTREE=1" |
drh | 66f9de0 | 2008-08-05 21:42:37 +0000 | [diff] [blame] | 17 | OPTS="$OPTS -DSQLITE_ENABLE_COLUMN_METADATA=1" |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 18 | CC="i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR" |
drh | 3957781 | 2006-09-01 17:06:20 +0000 | [diff] [blame] | 19 | NM="i386-mingw32msvc-nm" |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 20 | CMD="$CC -c sqlite3.c" |
| 21 | echo $CMD |
| 22 | $CMD |
drh | 74792b2 | 2007-06-18 17:44:16 +0000 | [diff] [blame] | 23 | CMD="$CC -c tclsqlite3.c" |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 24 | echo $CMD |
| 25 | $CMD |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 26 | echo 'EXPORTS' >tclsqlite3.def |
drh | 74792b2 | 2007-06-18 17:44:16 +0000 | [diff] [blame] | 27 | $NM tclsqlite3.o | grep ' T ' >temp1 |
drh | 37b9056 | 2006-09-02 13:22:28 +0000 | [diff] [blame] | 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 |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 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 \ |
drh | 74792b2 | 2007-06-18 17:44:16 +0000 | [diff] [blame] | 39 | -dllname tclsqlite3.dll -lmsvcrt tclsqlite3.o $TCLSTUBLIB |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 40 | $NM sqlite3.o | grep ' T ' >temp1 |
drh | 37b9056 | 2006-09-02 13:22:28 +0000 | [diff] [blame] | 41 | echo 'EXPORTS' >sqlite3.def |
| 42 | grep ' _sqlite3_' temp1 | sed 's/^.* _//' >>sqlite3.def |
drh | 014ac19 | 2004-06-01 01:45:11 +0000 | [diff] [blame] | 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 \ |
drh | 74792b2 | 2007-06-18 17:44:16 +0000 | [diff] [blame] | 49 | -dllname sqlite3.dll -lmsvcrt sqlite3.o |