blob: 6c4dea1efe1b45362a86e23c1604225476daa716 [file] [log] [blame]
# This script is used to compile SQLite and package everything up
# so that it is ready to move to the SQLite website.
# Set srcdir to the name of the directory that contains the
# script.
srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
# Get the makefile.
cp $srcdir/Makefile.linux-gcc ./Makefile
chmod +x $srcdir/install-sh
# Get the current version number - needed to help build filenames
VERS=`cat $srcdir/VERSION`
VERSW=`sed 's/\./_/g' $srcdir/VERSION`
# Start by building an sqlite shell for linux.
make clean
make sqlite3.c
echo '***** '"COMPILING sqlite3-$VERS.bin..."
gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl
strip sqlite3
mv sqlite3 sqlite3-$VERS.bin
gzip sqlite3-$VERS.bin
chmod 644 sqlite3-$VERS.bin.gz
mv sqlite3-$VERS.bin.gz doc
# Build the and shared libraries
# under Linux
echo '***** BUILDING shared libraries for linux'
gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o -lpthread
chmod 644
mv tclsqlite-$
gzip tclsqlite-$
mv tclsqlite-$ doc
gcc $CFLAGS -shared sqlite3.c -o -lpthread
chmod 644
mv sqlite-$
gzip sqlite-$
mv sqlite-$ doc
# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
. $srcdir/
echo '***** PACKAGING shared libraries for windows'
echo zip doc/tclsqlite-$ tclsqlite3.dll
zip doc/tclsqlite-$ tclsqlite3.dll
echo zip doc/sqlitedll-$ sqlite3.dll sqlite3.def
zip doc/sqlitedll-$ sqlite3.dll sqlite3.def
# Build the sqlite.exe executable for windows.
i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
-o sqlite3.exe
zip doc/sqlite-$ sqlite3.exe
# Build a source archive useful for windows.
make target_source
cd tsrc
echo '***** BUILDING preprocessed source archives'
rm fts[12]* icu*
rm -f ../doc/sqlite-source-$
zip ../doc/sqlite-source-$ *
cd ..
cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
cp tsrc/shell.c .
zip doc/sqlite-amalgamation-$ sqlite3.c sqlite3.h sqlite3ext.h shell.c sqlite3.def
# Construct a tarball of the source tree
echo '***** BUILDING source archive'
cd $srcdir
chmod +x configure
cd ..
mv sqlite sqlite-$VERS
EXCLUDE=`find sqlite-$VERS -print | egrep '(www/|art/|doc/|contrib/|_FOSSIL_)' | sed 's,^, --exclude ,'`
echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
mv sqlite-$VERS sqlite
# Build RPMS (binary) and Source RPM
# Make sure we are properly setup to build RPMs
echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
mkdir $HOME/rpm
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/SPECS
# create the spec file from the template
sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
# copy the source tarball to the rpm directory
cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
# build all the rpms
rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
# copy the RPMs into the build directory.
mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
# Build the website
#cp $srcdir/../historical/* doc
#make doc
#cd doc
#chmod 644 *.gz