blob: 9e368d1d23bc5049ee932a8eb35423a49e247f17 [file] [log] [blame]
drh014ac192004-06-01 01:45:11 +00001#!/bin/sh
2#
drh4aec8b62004-08-28 16:19:00 +00003# This script is used to compile SQLite into a DLL.
drh014ac192004-06-01 01:45:11 +00004#
drh4aec8b62004-08-28 16:19:00 +00005# 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.
drh014ac192004-06-01 01:45:11 +00008#
drh611c8ca2007-04-02 15:04:34 +00009make sqlite3.c
drh014ac192004-06-01 01:45:11 +000010PATH=$PATH:/opt/mingw/bin
drh4aec8b62004-08-28 16:19:00 +000011TCLDIR=/home/drh/tcltk/846/win/846win
12TCLSTUBLIB=$TCLDIR/libtcl84stub.a
drh66f9de02008-08-05 21:42:37 +000013OPTS='-DUSE_TCL_STUBS=1 -DBUILD_sqlite=1 -DSQLITE_OS_WIN=1'
14OPTS="$OPTS -DSQLITE_THREADSAFE=1"
drhe0d5e342007-11-27 17:38:14 +000015OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1"
shanee5447f52008-10-12 02:03:37 +000016OPTS="$OPTS -DSQLITE_ENABLE_RTREE=1"
drh66f9de02008-08-05 21:42:37 +000017OPTS="$OPTS -DSQLITE_ENABLE_COLUMN_METADATA=1"
drhe0d5e342007-11-27 17:38:14 +000018CC="i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR"
drh39577812006-09-01 17:06:20 +000019NM="i386-mingw32msvc-nm"
drh611c8ca2007-04-02 15:04:34 +000020CMD="$CC -c sqlite3.c"
21echo $CMD
22$CMD
drh74792b22007-06-18 17:44:16 +000023CMD="$CC -c tclsqlite3.c"
drh611c8ca2007-04-02 15:04:34 +000024echo $CMD
25$CMD
drh4aec8b62004-08-28 16:19:00 +000026echo 'EXPORTS' >tclsqlite3.def
drh74792b22007-06-18 17:44:16 +000027$NM tclsqlite3.o | grep ' T ' >temp1
drh37b90562006-09-02 13:22:28 +000028grep '_Init$' temp1 >temp2
29grep '_SafeInit$' temp1 >>temp2
30grep ' T _sqlite3_' temp1 >>temp2
31echo 'EXPORTS' >tclsqlite3.def
32sed 's/^.* T _//' temp2 | sort | uniq >>tclsqlite3.def
drh4aec8b62004-08-28 16:19:00 +000033i386-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 \
drh74792b22007-06-18 17:44:16 +000039 -dllname tclsqlite3.dll -lmsvcrt tclsqlite3.o $TCLSTUBLIB
drh611c8ca2007-04-02 15:04:34 +000040$NM sqlite3.o | grep ' T ' >temp1
drh37b90562006-09-02 13:22:28 +000041echo 'EXPORTS' >sqlite3.def
42grep ' _sqlite3_' temp1 | sed 's/^.* _//' >>sqlite3.def
drh014ac192004-06-01 01:45:11 +000043i386-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 \
drh74792b22007-06-18 17:44:16 +000049 -dllname sqlite3.dll -lmsvcrt sqlite3.o