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