blob: 6c4dea1efe1b45362a86e23c1604225476daa716 [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 the sqlite.so and tclsqlite.so shared libraries
38# under Linux
39#
drh611c8ca2007-04-02 15:04:34 +000040TCLDIR=/home/drh/tcltk/846/linux/846linux
41TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drh58f1c8b2008-05-26 20:19:25 +000042CFLAGS="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1"
43CFLAGS="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
drh66f9de02008-08-05 21:42:37 +000044CFLAGS="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
drhe0d5e342007-11-27 17:38:14 +000045echo '***** BUILDING shared libraries for linux'
drhea4ee792007-12-10 17:55:16 +000046gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000047strip tclsqlite3.so
48chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000049mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000050gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000051mv tclsqlite-$VERS.so.gz doc
drhea4ee792007-12-10 17:55:16 +000052gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
drh611c8ca2007-04-02 15:04:34 +000053strip sqlite3.so
54chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000055mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000056gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000057mv sqlite-$VERS.so.gz doc
58
drh90ca9752001-09-28 17:47:14 +000059
drh4aec8b62004-08-28 16:19:00 +000060# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000061#
drh4aec8b62004-08-28 16:19:00 +000062. $srcdir/mkdll.sh
drhe0d5e342007-11-27 17:38:14 +000063echo '***** PACKAGING shared libraries for windows'
drh611c8ca2007-04-02 15:04:34 +000064echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
65zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
66echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
67zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000068
69# Build the sqlite.exe executable for windows.
70#
drhe0d5e342007-11-27 17:38:14 +000071OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
drh58f1c8b2008-05-26 20:19:25 +000072OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1"
drh52d19f62007-05-08 18:30:36 +000073i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000074 -o sqlite3.exe
75zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000076
drh4b4580b2010-03-31 11:52:57 +000077# Build a source archive useful for windows.
78#
79make target_source
80cd tsrc
81echo '***** BUILDING preprocessed source archives'
82rm fts[12]* icu*
83rm -f ../doc/sqlite-source-$VERSW.zip
84zip ../doc/sqlite-source-$VERSW.zip *
85cd ..
86cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
87cp tsrc/shell.c .
88pwd
89zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h shell.c sqlite3.def
90
drh90ca9752001-09-28 17:47:14 +000091# Construct a tarball of the source tree
92#
drhe0d5e342007-11-27 17:38:14 +000093echo '***** BUILDING source archive'
drh90ca9752001-09-28 17:47:14 +000094ORIGIN=`pwd`
95cd $srcdir
drh4d11afe2009-09-11 17:59:55 +000096chmod +x configure
drh90ca9752001-09-28 17:47:14 +000097cd ..
drh39171f32005-02-15 16:15:09 +000098mv sqlite sqlite-$VERS
drh04616bb2009-08-14 16:15:17 +000099EXCLUDE=`find sqlite-$VERS -print | egrep '(www/|art/|doc/|contrib/|_FOSSIL_)' | sed 's,^, --exclude ,'`
100echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
drh39171f32005-02-15 16:15:09 +0000101tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
102mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +0000103cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000104
doughenry1d366502002-03-29 01:29:53 +0000105#
106# Build RPMS (binary) and Source RPM
107#
108
drh203c2112002-03-29 18:16:04 +0000109# Make sure we are properly setup to build RPMs
110#
111echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
112echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
113mkdir $HOME/rpm
114mkdir $HOME/rpm/BUILD
115mkdir $HOME/rpm/SOURCES
116mkdir $HOME/rpm/RPMS
117mkdir $HOME/rpm/SRPMS
118mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000119
120# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000121sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000122
123# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000124cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000125
126# build all the rpms
127rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
128
drh203c2112002-03-29 18:16:04 +0000129# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000130mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
131mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000132
drh90ca9752001-09-28 17:47:14 +0000133# Build the website
134#
drh20753fb2004-07-22 18:53:17 +0000135#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000136#make doc
137#cd doc
138#chmod 644 *.gz