blob: 02448a0ed7c2e50daee6495cdc006b6ec1711584 [file] [log] [blame]
drh90ca9752001-09-28 17:47:14 +00001#!/bin/sh
2#
3# This script is used to compile SQLite and all its documentation and
4# ship everything up to the SQLite website. This script will only work
5# on the system "zadok" at the Hwaci offices. But others might find
6# the script useful as an example.
7#
8
9# Set srcdir to the name of the directory that contains the publish.sh
10# script.
11#
12srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
13
14# Get the makefile.
15#
16cp $srcdir/Makefile.template ./Makefile
17
18# Start building stuff.
19#
20make clean
21make sqlite
22strip sqlite
23mv sqlite sqlite.bin
drh9d319762001-10-09 12:44:43 +000024rm -f sqlite.bin.gz
drh90ca9752001-09-28 17:47:14 +000025gzip sqlite.bin
26
27# Build the tclsqlite.so shared library for import into tclsh or wish
28# under Linux
29#
30make target_source
drh1c928532002-01-31 15:54:21 +000031rm sqlite_source.zip
drh90ca9752001-09-28 17:47:14 +000032cd tsrc
drh1c928532002-01-31 15:54:21 +000033zip ../sqlite_source.zip *
drh90ca9752001-09-28 17:47:14 +000034rm shell.c
35TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000036TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000037OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000038gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000039strip tclsqlite.so
40mv tclsqlite.so ..
drh1c928532002-01-31 15:54:21 +000041rm tclsqlite.c
42gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
43strip sqlite.so
44mv sqlite.so ..
drh90ca9752001-09-28 17:47:14 +000045cd ..
drh1c928532002-01-31 15:54:21 +000046rm -f tclsqlite.so.gz sqlite.so.gz
drh90ca9752001-09-28 17:47:14 +000047gzip tclsqlite.so
drh1c928532002-01-31 15:54:21 +000048gzip sqlite.so
drh90ca9752001-09-28 17:47:14 +000049
50# Build the tclsqlite.dll shared library that can be imported into tclsh
51# or wish on windows.
52#
53make target_source
54cd tsrc
drh66f95a62001-09-28 18:10:55 +000055rm shell.c
drh90ca9752001-09-28 17:47:14 +000056TCLDIR=/home/drh/tcltk/8.2win
57TCLSTUBLIB=$TCLDIR/tclstub82.a
58PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000059OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh90ca9752001-09-28 17:47:14 +000060CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR"
61rm shell.c
62for i in *.c; do
63 CMD="$CC -c $i"
64 echo $CMD
65 $CMD
66done
67echo 'EXPORTS' >tclsqlite.def
68echo 'Tclsqlite_Init' >>tclsqlite.def
69echo 'Sqlite_Init' >>tclsqlite.def
70i386-mingw32-dllwrap \
71 --def tclsqlite.def -v --export-all \
72 --driver-name i386-mingw32-gcc \
73 --dlltool-name i386-mingw32-dlltool \
74 --as i386-mingw32-as \
75 --target i386-mingw32 \
76 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
77i386-mingw32-strip tclsqlite.dll
78mv tclsqlite.dll ..
drh1c928532002-01-31 15:54:21 +000079rm tclsqlite.o
80cat >sqlite.def <<\END_OF_FILE
81EXPORTS
82sqlite_open
83sqlite_close
84sqlite_exec
85sqlite_last_insert_rowid
86sqlite_error_string
87sqlite_interrupt
88sqlite_complete
89sqlite_busy_handler
90sqlite_busy_timeout
91sqlite_get_table
92sqlite_free_table
93sqlite_mprintf
94sqlite_vmprintf
95sqlite_exec_printf
96sqlite_exec_vprintf
97sqlite_get_table_printf
98sqlite_get_table_vprintf
99sqliteMalloc
100sqliteFree
101sqliteRealloc
102END_OF_FILE
103i386-mingw32-dllwrap \
104 --def sqlite.def -v --export-all \
105 --driver-name i386-mingw32-gcc \
106 --dlltool-name i386-mingw32-dlltool \
107 --as i386-mingw32-as \
108 --target i386-mingw32 \
109 -dllname sqlite.dll -lmsvcrt *.o
110i386-mingw32-strip sqlite.dll
111mv sqlite.dll sqlite.def ..
drh90ca9752001-09-28 17:47:14 +0000112cd ..
drh1c928532002-01-31 15:54:21 +0000113rm -f tclsqlite.zip sqlitedll.zip
drh90ca9752001-09-28 17:47:14 +0000114zip tclsqlite.zip tclsqlite.dll
drh1c928532002-01-31 15:54:21 +0000115zip sqlitedll.zip sqlite.dll sqlite.def
drh90ca9752001-09-28 17:47:14 +0000116
117# Build the sqlite.exe executable for windows.
118#
119make target_source
120cd tsrc
121rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000122OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh90ca9752001-09-28 17:47:14 +0000123i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
124mv sqlite.exe ..
125cd ..
126rm -f sqlite.zip
127zip sqlite.zip sqlite.exe
128
129# Construct a tarball of the source tree
130#
131ORIGIN=`pwd`
132cd $srcdir
133cd ..
drha8b38d22001-11-01 14:41:34 +0000134EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
135tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000136cd $ORIGIN
137vers=`cat $srcdir/VERSION`
drh9d319762001-10-09 12:44:43 +0000138rm -f sqlite-$vers.tar.gz
drh90ca9752001-09-28 17:47:14 +0000139ln sqlite.tar.gz sqlite-$vers.tar.gz
140
141# Build the website
142#
143cp $srcdir/../historical/* .
drh9d319762001-10-09 12:44:43 +0000144rm -rf doc
drh90ca9752001-09-28 17:47:14 +0000145make doc
146ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc
drh1c928532002-01-31 15:54:21 +0000147ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc