1#!/bin/sh 2# 3# This script is used to compile SQLite into a DLL. 4# 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. 8# 9make sqlite3.c 10PATH=$PATH:/opt/mingw/bin 11TCLDIR=/home/drh/tcltk/846/win/846win 12TCLSTUBLIB=$TCLDIR/libtcl84stub.a 13OPTS='-DUSE_TCL_STUBS=1 -DBUILD_sqlite=1 -DSQLITE_OS_WIN=1' 14OPTS="$OPTS -DSQLITE_THREADSAFE=1" 15OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1" 16OPTS="$OPTS -DSQLITE_ENABLE_RTREE=1" 17OPTS="$OPTS -DSQLITE_ENABLE_COLUMN_METADATA=1" 18CC="i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR" 19NM="i386-mingw32msvc-nm" 20CMD="$CC -c sqlite3.c" 21echo $CMD 22$CMD 23CMD="$CC -c tclsqlite3.c" 24echo $CMD 25$CMD 26echo 'EXPORTS' >tclsqlite3.def 27$NM tclsqlite3.o | grep ' T ' >temp1 28grep '_Init$' temp1 >temp2 29grep '_SafeInit$' temp1 >>temp2 30grep ' T _sqlite3_' temp1 >>temp2 31echo 'EXPORTS' >tclsqlite3.def 32sed 's/^.* T _//' temp2 | sort | uniq >>tclsqlite3.def 33i386-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 41echo 'EXPORTS' >sqlite3.def 42grep ' _sqlite3_' temp1 | sed 's/^.* _//' >>sqlite3.def 43i386-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 50