blob: c65d15bd1f68a1b824a748c9fbc85aa9843bffba [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`
drh611c8ca2007-04-02 15:04:34 +000023echo "VERSIONS: $VERS $VERSW"
drh7b93ed32004-06-16 03:02:00 +000024
25# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000026#
27make clean
drh611c8ca2007-04-02 15:04:34 +000028make sqlite3.c
drh52d19f62007-05-08 18:30:36 +000029gcc -Os -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl -lpthread
drh7b93ed32004-06-16 03:02:00 +000030strip sqlite3
31mv sqlite3 sqlite3-$VERS.bin
32gzip sqlite3-$VERS.bin
drh611c8ca2007-04-02 15:04:34 +000033chmod 644 sqlite3-$VERS.bin.gz
drh7b93ed32004-06-16 03:02:00 +000034mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000035
drh4aec8b62004-08-28 16:19:00 +000036# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000037#
drh52d19f62007-05-08 18:30:36 +000038make target_source
39cd tsrc
40rm fts*
41rm -f ../doc/sqlite-source-$VERSW.zip
42zip ../doc/sqlite-source-$VERSW.zip *
43cd ..
drh611c8ca2007-04-02 15:04:34 +000044make sqlite3.c
drh3bbbd7d2007-10-01 13:59:48 +000045cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
drh611c8ca2007-04-02 15:04:34 +000046pwd
drh3bbbd7d2007-10-01 13:59:48 +000047zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h
drh4aec8b62004-08-28 16:19:00 +000048
49# Build the sqlite.so and tclsqlite.so shared libraries
50# under Linux
51#
drh611c8ca2007-04-02 15:04:34 +000052make sqlite3.c
53TCLDIR=/home/drh/tcltk/846/linux/846linux
54TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drh52d19f62007-05-08 18:30:36 +000055gcc -Os -shared -Itsrc sqlite3.c tsrc/tclsqlite.c $TCLSTUBLIB -o tclsqlite3.so
drh611c8ca2007-04-02 15:04:34 +000056strip tclsqlite3.so
57chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000058mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000059gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000060mv tclsqlite-$VERS.so.gz doc
drh52d19f62007-05-08 18:30:36 +000061gcc -Os -shared -Itsrc sqlite3.c -o sqlite3.so
drh611c8ca2007-04-02 15:04:34 +000062strip sqlite3.so
63chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000064mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000065gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000066mv sqlite-$VERS.so.gz doc
67
drh90ca9752001-09-28 17:47:14 +000068
drh4aec8b62004-08-28 16:19:00 +000069# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000070#
drh4aec8b62004-08-28 16:19:00 +000071. $srcdir/mkdll.sh
drh611c8ca2007-04-02 15:04:34 +000072echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
73zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
74echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
75zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000076
77# Build the sqlite.exe executable for windows.
78#
79make target_source
drha297b5c2002-01-15 18:39:43 +000080OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh52d19f62007-05-08 18:30:36 +000081i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000082 -o sqlite3.exe
83zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000084
85# Construct a tarball of the source tree
86#
87ORIGIN=`pwd`
88cd $srcdir
89cd ..
drh39171f32005-02-15 16:15:09 +000090mv sqlite sqlite-$VERS
91EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'`
92tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
93mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000094cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +000095
doughenry1d366502002-03-29 01:29:53 +000096#
97# Build RPMS (binary) and Source RPM
98#
99
drh203c2112002-03-29 18:16:04 +0000100# Make sure we are properly setup to build RPMs
101#
102echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
103echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
104mkdir $HOME/rpm
105mkdir $HOME/rpm/BUILD
106mkdir $HOME/rpm/SOURCES
107mkdir $HOME/rpm/RPMS
108mkdir $HOME/rpm/SRPMS
109mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000110
111# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000112sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000113
114# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000115cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000116
117# build all the rpms
118rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
119
drh203c2112002-03-29 18:16:04 +0000120# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000121mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
122mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000123
drh90ca9752001-09-28 17:47:14 +0000124# Build the website
125#
drh20753fb2004-07-22 18:53:17 +0000126#cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000127make doc
drh5bd71932006-01-24 02:00:32 +0000128cd doc
129chmod 644 *.gz