blob: 083a25d10c4ebb45e8f0d4c4692d2b9abfaa9ed5 [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
24gzip sqlite.bin
25
26# Build the tclsqlite.so shared library for import into tclsh or wish
27# under Linux
28#
29make target_source
30cd tsrc
31rm shell.c
32TCLDIR=/home/drh/tcltk/8.2linux
33OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DOS_UNIX=1 -DOS_WIN=0'
34gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c -o tclsqlite.so
35strip tclsqlite.so
36mv tclsqlite.so ..
37cd ..
38gzip tclsqlite.so
39
40# Build the tclsqlite.dll shared library that can be imported into tclsh
41# or wish on windows.
42#
43make target_source
44cd tsrc
45TCLDIR=/home/drh/tcltk/8.2win
46TCLSTUBLIB=$TCLDIR/tclstub82.a
47PATH=$PATH:/opt/mingw/bin
48OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DOS_UNIX=0 -DOS_WIN=1'
49CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR"
50rm shell.c
51for i in *.c; do
52 CMD="$CC -c $i"
53 echo $CMD
54 $CMD
55done
56echo 'EXPORTS' >tclsqlite.def
57echo 'Tclsqlite_Init' >>tclsqlite.def
58echo 'Sqlite_Init' >>tclsqlite.def
59i386-mingw32-dllwrap \
60 --def tclsqlite.def -v --export-all \
61 --driver-name i386-mingw32-gcc \
62 --dlltool-name i386-mingw32-dlltool \
63 --as i386-mingw32-as \
64 --target i386-mingw32 \
65 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
66i386-mingw32-strip tclsqlite.dll
67mv tclsqlite.dll ..
68cd ..
69rm -f tclsqlite.zip
70zip tclsqlite.zip tclsqlite.dll
71
72# Build the sqlite.exe executable for windows.
73#
74make target_source
75cd tsrc
76rm tclsqlite.c
77OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DOS_UNIX=0 -DOS_WIN=1'
78i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
79mv sqlite.exe ..
80cd ..
81rm -f sqlite.zip
82zip sqlite.zip sqlite.exe
83
84# Construct a tarball of the source tree
85#
86ORIGIN=`pwd`
87cd $srcdir
88cd ..
89tar czf $ORIGIN/sqlite.tar.gz sqlite
90cd $ORIGIN
91vers=`cat $srcdir/VERSION`
92ln sqlite.tar.gz sqlite-$vers.tar.gz
93
94# Build the website
95#
96cp $srcdir/../historical/* .
97make doc
98ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc