blob: 138f3d901aac147b575264abf09a224d61d056b0 [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 +000027CFLAGS="-Os -DSQLITE_ENABLE_FTS3=1 -DSQLITE_THREADSAFE=0"
28echo '***** '"COMPILING sqlite3-$VERS.bin..."
drhf042f512007-11-27 18:45:31 +000029gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl
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
drhe0d5e342007-11-27 17:38:14 +000040echo '***** BUILDING preprocessed source archives'
drh414025d2008-01-31 16:36:40 +000041rm fts[12]* icu*
drh52d19f62007-05-08 18:30:36 +000042rm -f ../doc/sqlite-source-$VERSW.zip
43zip ../doc/sqlite-source-$VERSW.zip *
44cd ..
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 +000052TCLDIR=/home/drh/tcltk/846/linux/846linux
53TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drh414025d2008-01-31 16:36:40 +000054CFLAGS="-Os -DSQLITE_ENABLE_FTS3=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
drhe0d5e342007-11-27 17:38:14 +000055echo '***** BUILDING shared libraries for linux'
drhea4ee792007-12-10 17:55:16 +000056gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000057strip tclsqlite3.so
58chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000059mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000060gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000061mv tclsqlite-$VERS.so.gz doc
drhea4ee792007-12-10 17:55:16 +000062gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000063strip sqlite3.so
64chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000065mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000066gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000067mv sqlite-$VERS.so.gz doc
68
drh90ca9752001-09-28 17:47:14 +000069
drh4aec8b62004-08-28 16:19:00 +000070# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000071#
drh4aec8b62004-08-28 16:19:00 +000072. $srcdir/mkdll.sh
drhe0d5e342007-11-27 17:38:14 +000073echo '***** PACKAGING shared libraries for windows'
drh611c8ca2007-04-02 15:04:34 +000074echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
75zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
76echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
77zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000078
79# Build the sqlite.exe executable for windows.
80#
drhe0d5e342007-11-27 17:38:14 +000081OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
82OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1"
drh52d19f62007-05-08 18:30:36 +000083i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000084 -o sqlite3.exe
85zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000086
87# Construct a tarball of the source tree
88#
drhe0d5e342007-11-27 17:38:14 +000089echo '***** BUILDING source archive'
drh90ca9752001-09-28 17:47:14 +000090ORIGIN=`pwd`
91cd $srcdir
92cd ..
drh39171f32005-02-15 16:15:09 +000093mv sqlite sqlite-$VERS
drhe0d5e342007-11-27 17:38:14 +000094EXCLUDE=`find sqlite-$VERS -print | egrep (CVS|www/|art/|doc/|contrib/) | sed 's,^, --exclude ,'`
drh39171f32005-02-15 16:15:09 +000095tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
96mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000097cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +000098
doughenry1d366502002-03-29 01:29:53 +000099#
100# Build RPMS (binary) and Source RPM
101#
102
drh203c2112002-03-29 18:16:04 +0000103# Make sure we are properly setup to build RPMs
104#
105echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
106echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
107mkdir $HOME/rpm
108mkdir $HOME/rpm/BUILD
109mkdir $HOME/rpm/SOURCES
110mkdir $HOME/rpm/RPMS
111mkdir $HOME/rpm/SRPMS
112mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000113
114# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000115sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000116
117# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000118cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000119
120# build all the rpms
121rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
122
drh203c2112002-03-29 18:16:04 +0000123# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000124mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
125mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000126
drh90ca9752001-09-28 17:47:14 +0000127# Build the website
128#
drh20753fb2004-07-22 18:53:17 +0000129#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000130#make doc
131#cd doc
132#chmod 644 *.gz