blob: dca30b7a91e8b939ba77b2605e5fe2bd325da174 [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"
drhe0d5e342007-11-27 17:38:14 +000057echo '***** BUILDING shared libraries for linux'
drhea4ee792007-12-10 17:55:16 +000058gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000059strip tclsqlite3.so
60chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000061mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000062gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000063mv tclsqlite-$VERS.so.gz doc
drhea4ee792007-12-10 17:55:16 +000064gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000065strip sqlite3.so
66chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000067mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000068gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000069mv sqlite-$VERS.so.gz doc
70
drh90ca9752001-09-28 17:47:14 +000071
drh4aec8b62004-08-28 16:19:00 +000072# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000073#
drh4aec8b62004-08-28 16:19:00 +000074. $srcdir/mkdll.sh
drhe0d5e342007-11-27 17:38:14 +000075echo '***** PACKAGING shared libraries for windows'
drh611c8ca2007-04-02 15:04:34 +000076echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
77zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
78echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
79zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000080
81# Build the sqlite.exe executable for windows.
82#
drhe0d5e342007-11-27 17:38:14 +000083OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
drh58f1c8b2008-05-26 20:19:25 +000084OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1"
drh52d19f62007-05-08 18:30:36 +000085i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000086 -o sqlite3.exe
87zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000088
89# Construct a tarball of the source tree
90#
drhe0d5e342007-11-27 17:38:14 +000091echo '***** BUILDING source archive'
drh90ca9752001-09-28 17:47:14 +000092ORIGIN=`pwd`
93cd $srcdir
94cd ..
drh39171f32005-02-15 16:15:09 +000095mv sqlite sqlite-$VERS
drhe0d5e342007-11-27 17:38:14 +000096EXCLUDE=`find sqlite-$VERS -print | egrep (CVS|www/|art/|doc/|contrib/) | sed 's,^, --exclude ,'`
drh39171f32005-02-15 16:15:09 +000097tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
98mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000099cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000100
doughenry1d366502002-03-29 01:29:53 +0000101#
102# Build RPMS (binary) and Source RPM
103#
104
drh203c2112002-03-29 18:16:04 +0000105# Make sure we are properly setup to build RPMs
106#
107echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
108echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
109mkdir $HOME/rpm
110mkdir $HOME/rpm/BUILD
111mkdir $HOME/rpm/SOURCES
112mkdir $HOME/rpm/RPMS
113mkdir $HOME/rpm/SRPMS
114mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000115
116# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000117sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000118
119# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000120cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000121
122# build all the rpms
123rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
124
drh203c2112002-03-29 18:16:04 +0000125# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000126mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
127mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000128
drh90ca9752001-09-28 17:47:14 +0000129# Build the website
130#
drh20753fb2004-07-22 18:53:17 +0000131#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000132#make doc
133#cd doc
134#chmod 644 *.gz