blob: 727a99e91867eb4d025bc0409613b879351c5cea [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
drh58f1c8b2008-05-26 20:19:25 +000027CFLAGS="-Os -DSQLITE_ENABLE_FTS3=0 -DSQLITE_ENABLE_RTREE=0"
28CFLAGS="$CFLAGS -DSQLITE_THREADSAFE=0"
drhe0d5e342007-11-27 17:38:14 +000029echo '***** '"COMPILING sqlite3-$VERS.bin..."
drhf042f512007-11-27 18:45:31 +000030gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl
drh7b93ed32004-06-16 03:02:00 +000031strip sqlite3
32mv sqlite3 sqlite3-$VERS.bin
33gzip sqlite3-$VERS.bin
drh611c8ca2007-04-02 15:04:34 +000034chmod 644 sqlite3-$VERS.bin.gz
drh7b93ed32004-06-16 03:02:00 +000035mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000036
drh4aec8b62004-08-28 16:19:00 +000037# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000038#
drh52d19f62007-05-08 18:30:36 +000039make target_source
40cd tsrc
drhe0d5e342007-11-27 17:38:14 +000041echo '***** BUILDING preprocessed source archives'
drh414025d2008-01-31 16:36:40 +000042rm fts[12]* icu*
drh52d19f62007-05-08 18:30:36 +000043rm -f ../doc/sqlite-source-$VERSW.zip
44zip ../doc/sqlite-source-$VERSW.zip *
45cd ..
drh3bbbd7d2007-10-01 13:59:48 +000046cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
drh611c8ca2007-04-02 15:04:34 +000047pwd
drh3bbbd7d2007-10-01 13:59:48 +000048zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h
drh4aec8b62004-08-28 16:19:00 +000049
50# Build the sqlite.so and tclsqlite.so shared libraries
51# under Linux
52#
drh611c8ca2007-04-02 15:04:34 +000053TCLDIR=/home/drh/tcltk/846/linux/846linux
54TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drh58f1c8b2008-05-26 20:19:25 +000055CFLAGS="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1"
56CFLAGS="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
drh66f9de02008-08-05 21:42:37 +000057CFLAGS="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
drhe0d5e342007-11-27 17:38:14 +000058echo '***** BUILDING shared libraries for linux'
drhea4ee792007-12-10 17:55:16 +000059gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
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
drhea4ee792007-12-10 17:55:16 +000065gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
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'
drh58f1c8b2008-05-26 20:19:25 +000085OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=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
drh65ff59e2008-08-06 10:43:50 +000097EXCLUDE=`find sqlite-$VERS -print | egrep '(CVS|www/|art/|doc/|contrib/|_FOSSIL_|manifest)' | sed 's,^, --exclude ,'`
drh5b5c1722008-08-06 10:47:01 +000098echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
drh39171f32005-02-15 16:15:09 +000099tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
100mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +0000101cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000102
doughenry1d366502002-03-29 01:29:53 +0000103#
104# Build RPMS (binary) and Source RPM
105#
106
drh203c2112002-03-29 18:16:04 +0000107# Make sure we are properly setup to build RPMs
108#
109echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
110echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
111mkdir $HOME/rpm
112mkdir $HOME/rpm/BUILD
113mkdir $HOME/rpm/SOURCES
114mkdir $HOME/rpm/RPMS
115mkdir $HOME/rpm/SRPMS
116mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000117
118# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000119sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000120
121# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000122cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000123
124# build all the rpms
125rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
126
drh203c2112002-03-29 18:16:04 +0000127# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000128mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
129mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000130
drh90ca9752001-09-28 17:47:14 +0000131# Build the website
132#
drh20753fb2004-07-22 18:53:17 +0000133#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000134#make doc
135#cd doc
136#chmod 644 *.gz