blob: 24c18a553d023e3f8d81e407ef4894d60ccd908d [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#
drh76800322002-08-13 20:45:39 +000016cp $srcdir/Makefile.linux-gcc ./Makefile
drh75f6a032004-07-15 14:15:00 +000017cp $srcdir/sqlite3.def ./sqlite3.def
drhe8a63422004-01-27 17:46:55 +000018chmod +x $srcdir/install-sh
drh90ca9752001-09-28 17:47:14 +000019
drh7b93ed32004-06-16 03:02:00 +000020# Get the current version number - needed to help build filenames
21#
22VERS=`cat $srcdir/VERSION`
23VERSW=`sed 's/\./_/g' $srcdir/VERSION`
24
25# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000026#
27make clean
drh7b93ed32004-06-16 03:02:00 +000028make sqlite3
29strip sqlite3
30mv sqlite3 sqlite3-$VERS.bin
31gzip sqlite3-$VERS.bin
32mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000033
34# Build the tclsqlite.so shared library for import into tclsh or wish
35# under Linux
36#
37make target_source
38cd tsrc
drh43d05782004-06-18 15:13:48 +000039zip ../doc/sqlite-source-$VERSW.zip *
drh90ca9752001-09-28 17:47:14 +000040rm shell.c
41TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000042TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000043OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000044gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000045strip tclsqlite.so
drh7b93ed32004-06-16 03:02:00 +000046mv tclsqlite.so tclsqlite-$VERS.so
47gzip tclsqlite-$VERS.so
48mv tclsqlite-$VERS.so.gz ../doc
drh1c928532002-01-31 15:54:21 +000049rm tclsqlite.c
50gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
51strip sqlite.so
drh7b93ed32004-06-16 03:02:00 +000052mv sqlite.so sqlite-$VERS.so
53gzip sqlite-$VERS.so
54mv sqlite-$VERS.so.gz ../doc
drh90ca9752001-09-28 17:47:14 +000055cd ..
drh90ca9752001-09-28 17:47:14 +000056
57# Build the tclsqlite.dll shared library that can be imported into tclsh
58# or wish on windows.
59#
60make target_source
61cd tsrc
drh66f95a62001-09-28 18:10:55 +000062rm shell.c
drh90ca9752001-09-28 17:47:14 +000063TCLDIR=/home/drh/tcltk/8.2win
64TCLSTUBLIB=$TCLDIR/tclstub82.a
65PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000066OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh1f66c572002-07-02 11:55:32 +000067CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
drh90ca9752001-09-28 17:47:14 +000068rm shell.c
69for i in *.c; do
70 CMD="$CC -c $i"
71 echo $CMD
72 $CMD
73done
drh8eebadf2004-06-22 14:41:35 +000074echo 'EXPORTS' >tclsqlite3.def
drhee4a1872004-07-01 11:25:35 +000075echo 'Tclsqlite3_Init' >>tclsqlite3.def
76echo 'Sqlite3_Init' >>tclsqlite3.def
drh1f66c572002-07-02 11:55:32 +000077i386-mingw32msvc-dllwrap \
drh8eebadf2004-06-22 14:41:35 +000078 --def tclsqlite3.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000079 --driver-name i386-mingw32msvc-gcc \
80 --dlltool-name i386-mingw32msvc-dlltool \
81 --as i386-mingw32msvc-as \
drh90ca9752001-09-28 17:47:14 +000082 --target i386-mingw32 \
drh8eebadf2004-06-22 14:41:35 +000083 -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB
drhee4a1872004-07-01 11:25:35 +000084i386-mingw32msvc-strip tclsqlite3.dll
drh1c928532002-01-31 15:54:21 +000085rm tclsqlite.o
drh75f6a032004-07-15 14:15:00 +000086cp ../sqlite3.def .
drh1f66c572002-07-02 11:55:32 +000087i386-mingw32msvc-dllwrap \
drhee4a1872004-07-01 11:25:35 +000088 --def sqlite3.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000089 --driver-name i386-mingw32msvc-gcc \
90 --dlltool-name i386-mingw32msvc-dlltool \
91 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +000092 --target i386-mingw32 \
drh8eebadf2004-06-22 14:41:35 +000093 -dllname sqlite3.dll -lmsvcrt *.o
94i386-mingw32msvc-strip sqlite3.dll
95zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
drh8685a942004-07-22 18:44:23 +000096echo zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
drh8eebadf2004-06-22 14:41:35 +000097zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh8685a942004-07-22 18:44:23 +000098echo zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000099cd ..
drh90ca9752001-09-28 17:47:14 +0000100
101# Build the sqlite.exe executable for windows.
102#
103make target_source
104cd tsrc
105rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000106OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh8eebadf2004-06-22 14:41:35 +0000107i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite3.exe
108zip ../doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +0000109cd ..
drh90ca9752001-09-28 17:47:14 +0000110
111# Construct a tarball of the source tree
112#
113ORIGIN=`pwd`
114cd $srcdir
115cd ..
drh8685a942004-07-22 18:44:23 +0000116EXCLUDE=`find sqlite -print | grep CVS | sed 's,^, --exclude ,'`
drh7b93ed32004-06-16 03:02:00 +0000117tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000118cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000119
doughenry1d366502002-03-29 01:29:53 +0000120#
121# Build RPMS (binary) and Source RPM
122#
123
drh203c2112002-03-29 18:16:04 +0000124# Make sure we are properly setup to build RPMs
125#
126echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
127echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
128mkdir $HOME/rpm
129mkdir $HOME/rpm/BUILD
130mkdir $HOME/rpm/SOURCES
131mkdir $HOME/rpm/RPMS
132mkdir $HOME/rpm/SRPMS
133mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000134
135# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000136sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000137
138# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000139cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000140
141# build all the rpms
142rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
143
drh203c2112002-03-29 18:16:04 +0000144# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000145mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
146mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000147
drh90ca9752001-09-28 17:47:14 +0000148# Build the website
149#
drh20753fb2004-07-22 18:53:17 +0000150#cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000151make doc