blob: b0bb8883276e03e2ec859084df60caddf043958b [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
31cd tsrc
32rm shell.c
33TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000034TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000035OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000036gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000037strip tclsqlite.so
38mv tclsqlite.so ..
39cd ..
drh4cbd68f2001-12-15 02:58:18 +000040rm -f tclsqlite.so.gz
drh90ca9752001-09-28 17:47:14 +000041gzip tclsqlite.so
42
43# Build the tclsqlite.dll shared library that can be imported into tclsh
44# or wish on windows.
45#
46make target_source
47cd tsrc
drh66f95a62001-09-28 18:10:55 +000048rm shell.c
drh90ca9752001-09-28 17:47:14 +000049TCLDIR=/home/drh/tcltk/8.2win
50TCLSTUBLIB=$TCLDIR/tclstub82.a
51PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000052OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh90ca9752001-09-28 17:47:14 +000053CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR"
54rm shell.c
55for i in *.c; do
56 CMD="$CC -c $i"
57 echo $CMD
58 $CMD
59done
60echo 'EXPORTS' >tclsqlite.def
61echo 'Tclsqlite_Init' >>tclsqlite.def
62echo 'Sqlite_Init' >>tclsqlite.def
63i386-mingw32-dllwrap \
64 --def tclsqlite.def -v --export-all \
65 --driver-name i386-mingw32-gcc \
66 --dlltool-name i386-mingw32-dlltool \
67 --as i386-mingw32-as \
68 --target i386-mingw32 \
69 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
70i386-mingw32-strip tclsqlite.dll
71mv tclsqlite.dll ..
72cd ..
73rm -f tclsqlite.zip
74zip tclsqlite.zip tclsqlite.dll
75
76# Build the sqlite.exe executable for windows.
77#
78make target_source
79cd tsrc
80rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +000081OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh90ca9752001-09-28 17:47:14 +000082i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
83mv sqlite.exe ..
84cd ..
85rm -f sqlite.zip
86zip sqlite.zip sqlite.exe
87
88# Construct a tarball of the source tree
89#
90ORIGIN=`pwd`
91cd $srcdir
92cd ..
drha8b38d22001-11-01 14:41:34 +000093EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
94tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +000095cd $ORIGIN
96vers=`cat $srcdir/VERSION`
drh9d319762001-10-09 12:44:43 +000097rm -f sqlite-$vers.tar.gz
drh90ca9752001-09-28 17:47:14 +000098ln sqlite.tar.gz sqlite-$vers.tar.gz
99
100# Build the website
101#
102cp $srcdir/../historical/* .
drh9d319762001-10-09 12:44:43 +0000103rm -rf doc
drh90ca9752001-09-28 17:47:14 +0000104make doc
105ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc