blob: 043c89a0397174e4892c4fa338cf35ed21565afe [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
drhe8a63422004-01-27 17:46:55 +000017chmod +x $srcdir/install-sh
drh90ca9752001-09-28 17:47:14 +000018
drh7b93ed32004-06-16 03:02:00 +000019# Get the current version number - needed to help build filenames
20#
21VERS=`cat $srcdir/VERSION`
22VERSW=`sed 's/\./_/g' $srcdir/VERSION`
23
24# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000025#
26make clean
drh7b93ed32004-06-16 03:02:00 +000027make sqlite3
28strip sqlite3
29mv sqlite3 sqlite3-$VERS.bin
30gzip sqlite3-$VERS.bin
31mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000032
drh4aec8b62004-08-28 16:19:00 +000033# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000034#
35make target_source
36cd tsrc
drh43d05782004-06-18 15:13:48 +000037zip ../doc/sqlite-source-$VERSW.zip *
drh4aec8b62004-08-28 16:19:00 +000038cd ..
39
40# Build the sqlite.so and tclsqlite.so shared libraries
41# under Linux
42#
43. $srcdir/mkso.sh
44cd tsrc
45mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000046gzip tclsqlite-$VERS.so
47mv tclsqlite-$VERS.so.gz ../doc
drh4aec8b62004-08-28 16:19:00 +000048mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000049gzip sqlite-$VERS.so
50mv sqlite-$VERS.so.gz ../doc
drh90ca9752001-09-28 17:47:14 +000051cd ..
drh90ca9752001-09-28 17:47:14 +000052
drh4aec8b62004-08-28 16:19:00 +000053# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000054#
drh4aec8b62004-08-28 16:19:00 +000055. $srcdir/mkdll.sh
drh90ca9752001-09-28 17:47:14 +000056cd tsrc
drh8685a942004-07-22 18:44:23 +000057echo zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
drh4aec8b62004-08-28 16:19:00 +000058zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
drh8685a942004-07-22 18:44:23 +000059echo zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh4aec8b62004-08-28 16:19:00 +000060zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000061cd ..
drh90ca9752001-09-28 17:47:14 +000062
63# Build the sqlite.exe executable for windows.
64#
65make target_source
66cd tsrc
67rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +000068OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh8eebadf2004-06-22 14:41:35 +000069i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite3.exe
70zip ../doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000071cd ..
drh90ca9752001-09-28 17:47:14 +000072
73# Construct a tarball of the source tree
74#
75ORIGIN=`pwd`
76cd $srcdir
77cd ..
drh39171f32005-02-15 16:15:09 +000078mv sqlite sqlite-$VERS
79EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'`
80tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
81mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000082cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +000083
doughenry1d366502002-03-29 01:29:53 +000084#
85# Build RPMS (binary) and Source RPM
86#
87
drh203c2112002-03-29 18:16:04 +000088# Make sure we are properly setup to build RPMs
89#
90echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
91echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
92mkdir $HOME/rpm
93mkdir $HOME/rpm/BUILD
94mkdir $HOME/rpm/SOURCES
95mkdir $HOME/rpm/RPMS
96mkdir $HOME/rpm/SRPMS
97mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +000098
99# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000100sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000101
102# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000103cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000104
105# build all the rpms
106rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
107
drh203c2112002-03-29 18:16:04 +0000108# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000109mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
110mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000111
drh90ca9752001-09-28 17:47:14 +0000112# Build the website
113#
drh20753fb2004-07-22 18:53:17 +0000114#cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000115make doc
drh5bd71932006-01-24 02:00:32 +0000116cd doc
117chmod 644 *.gz