blob: 21f29797993e0169680d74224303e0d3e54dfa75 [file] [log] [blame]
drh90ca9752001-09-28 17:47:14 +00001#!/bin/sh
2#
drh22db44b2007-11-23 15:12:44 +00003# This script is used to compile SQLite and package everything up
4# so that it is ready to move to the SQLite website.
drh90ca9752001-09-28 17:47:14 +00005#
6
7# Set srcdir to the name of the directory that contains the publish.sh
8# script.
9#
10srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
11
12# Get the makefile.
13#
drh76800322002-08-13 20:45:39 +000014cp $srcdir/Makefile.linux-gcc ./Makefile
drhe8a63422004-01-27 17:46:55 +000015chmod +x $srcdir/install-sh
drh90ca9752001-09-28 17:47:14 +000016
drh7b93ed32004-06-16 03:02:00 +000017# Get the current version number - needed to help build filenames
18#
19VERS=`cat $srcdir/VERSION`
20VERSW=`sed 's/\./_/g' $srcdir/VERSION`
drh611c8ca2007-04-02 15:04:34 +000021echo "VERSIONS: $VERS $VERSW"
drh7b93ed32004-06-16 03:02:00 +000022
23# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000024#
25make clean
drh611c8ca2007-04-02 15:04:34 +000026make sqlite3.c
drhe0d5e342007-11-27 17:38:14 +000027make fts3amal.c
28cat fts3amal.c >>sqlite3.c
29CFLAGS="-Os -DSQLITE_ENABLE_FTS3=1 -DSQLITE_THREADSAFE=0"
30echo '***** '"COMPILING sqlite3-$VERS.bin..."
31gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl -lpthread
drh7b93ed32004-06-16 03:02:00 +000032strip sqlite3
33mv sqlite3 sqlite3-$VERS.bin
34gzip sqlite3-$VERS.bin
drh611c8ca2007-04-02 15:04:34 +000035chmod 644 sqlite3-$VERS.bin.gz
drh7b93ed32004-06-16 03:02:00 +000036mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000037
drh4aec8b62004-08-28 16:19:00 +000038# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000039#
drh52d19f62007-05-08 18:30:36 +000040make target_source
41cd tsrc
drhe0d5e342007-11-27 17:38:14 +000042echo '***** BUILDING preprocessed source archives'
43rm fts* icu*
drh52d19f62007-05-08 18:30:36 +000044rm -f ../doc/sqlite-source-$VERSW.zip
45zip ../doc/sqlite-source-$VERSW.zip *
46cd ..
drh3bbbd7d2007-10-01 13:59:48 +000047cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
drh611c8ca2007-04-02 15:04:34 +000048pwd
drh3bbbd7d2007-10-01 13:59:48 +000049zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h
drh4aec8b62004-08-28 16:19:00 +000050
51# Build the sqlite.so and tclsqlite.so shared libraries
52# under Linux
53#
drh611c8ca2007-04-02 15:04:34 +000054TCLDIR=/home/drh/tcltk/846/linux/846linux
55TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drhe0d5e342007-11-27 17:38:14 +000056CFLAGS="-Os -DSQLITE_ENABLE_FTS3=1"
57echo '***** BUILDING shared libraries for linux'
58gcc $CFLAGS -shared -Itsrc sqlite3.c tsrc/tclsqlite.c $TCLSTUBLIB \
59 -o tclsqlite3.so
drh611c8ca2007-04-02 15:04:34 +000060strip tclsqlite3.so
61chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000062mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000063gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000064mv tclsqlite-$VERS.so.gz doc
drhe0d5e342007-11-27 17:38:14 +000065gcc $CFLAGS -shared -Itsrc sqlite3.c -o sqlite3.so
drh611c8ca2007-04-02 15:04:34 +000066strip sqlite3.so
67chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000068mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000069gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000070mv sqlite-$VERS.so.gz doc
71
drh90ca9752001-09-28 17:47:14 +000072
drh4aec8b62004-08-28 16:19:00 +000073# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000074#
drh4aec8b62004-08-28 16:19:00 +000075. $srcdir/mkdll.sh
drhe0d5e342007-11-27 17:38:14 +000076echo '***** PACKAGING shared libraries for windows'
drh611c8ca2007-04-02 15:04:34 +000077echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
78zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
79echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
80zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000081
82# Build the sqlite.exe executable for windows.
83#
drhe0d5e342007-11-27 17:38:14 +000084OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
85OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1"
drh52d19f62007-05-08 18:30:36 +000086i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000087 -o sqlite3.exe
88zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000089
90# Construct a tarball of the source tree
91#
drhe0d5e342007-11-27 17:38:14 +000092echo '***** BUILDING source archive'
drh90ca9752001-09-28 17:47:14 +000093ORIGIN=`pwd`
94cd $srcdir
95cd ..
drh39171f32005-02-15 16:15:09 +000096mv sqlite sqlite-$VERS
drhe0d5e342007-11-27 17:38:14 +000097EXCLUDE=`find sqlite-$VERS -print | egrep (CVS|www/|art/|doc/|contrib/) | sed 's,^, --exclude ,'`
drh39171f32005-02-15 16:15:09 +000098tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
99mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +0000100cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000101
doughenry1d366502002-03-29 01:29:53 +0000102#
103# Build RPMS (binary) and Source RPM
104#
105
drh203c2112002-03-29 18:16:04 +0000106# Make sure we are properly setup to build RPMs
107#
108echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
109echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
110mkdir $HOME/rpm
111mkdir $HOME/rpm/BUILD
112mkdir $HOME/rpm/SOURCES
113mkdir $HOME/rpm/RPMS
114mkdir $HOME/rpm/SRPMS
115mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000116
117# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000118sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000119
120# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000121cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000122
123# build all the rpms
124rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
125
drh203c2112002-03-29 18:16:04 +0000126# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000127mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
128mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000129
drh90ca9752001-09-28 17:47:14 +0000130# Build the website
131#
drh20753fb2004-07-22 18:53:17 +0000132#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000133#make doc
134#cd doc
135#chmod 644 *.gz