• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# This script is used to compile SQLite and package everything up
4# so that it is ready to move to the SQLite website.
5#
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#
14cp $srcdir/Makefile.linux-gcc ./Makefile
15chmod +x $srcdir/install-sh
16
17# Get the current version number - needed to help build filenames
18#
19VERS=`cat $srcdir/VERSION`
20VERSW=`sed 's/\./_/g' $srcdir/VERSION`
21echo "VERSIONS: $VERS $VERSW"
22
23# Start by building an sqlite shell for linux.
24#
25make clean
26make sqlite3.c
27CFLAGS="-Os -DSQLITE_ENABLE_FTS3=0 -DSQLITE_ENABLE_RTREE=0"
28CFLAGS="$CFLAGS -DSQLITE_THREADSAFE=0"
29echo '***** '"COMPILING sqlite3-$VERS.bin..."
30gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl
31strip sqlite3
32mv sqlite3 sqlite3-$VERS.bin
33gzip sqlite3-$VERS.bin
34chmod 644 sqlite3-$VERS.bin.gz
35mv sqlite3-$VERS.bin.gz doc
36
37# Build the sqlite.so and tclsqlite.so shared libraries
38# under Linux
39#
40TCLDIR=/home/drh/tcltk/846/linux/846linux
41TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
42CFLAGS="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1"
43CFLAGS="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
44CFLAGS="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
45echo '***** BUILDING shared libraries for linux'
46gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread
47strip tclsqlite3.so
48chmod 644 tclsqlite3.so
49mv tclsqlite3.so tclsqlite-$VERS.so
50gzip tclsqlite-$VERS.so
51mv tclsqlite-$VERS.so.gz doc
52gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread
53strip sqlite3.so
54chmod 644 sqlite3.so
55mv sqlite3.so sqlite-$VERS.so
56gzip sqlite-$VERS.so
57mv sqlite-$VERS.so.gz doc
58
59
60# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
61#
62. $srcdir/mkdll.sh
63echo '***** PACKAGING shared libraries for windows'
64echo 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
68
69# Build the sqlite.exe executable for windows.
70#
71OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
72OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1"
73i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
74      -o sqlite3.exe
75zip doc/sqlite-$VERSW.zip sqlite3.exe
76
77# 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
91# Construct a tarball of the source tree
92#
93echo '***** BUILDING source archive'
94ORIGIN=`pwd`
95cd $srcdir
96chmod +x configure
97cd ..
98mv sqlite sqlite-$VERS
99EXCLUDE=`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"
101tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
102mv sqlite-$VERS sqlite
103cd $ORIGIN
104
105#
106# Build RPMS (binary) and Source RPM
107#
108
109# 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
119
120# create the spec file from the template
121sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
122
123# copy the source tarball to the rpm directory
124cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
125
126# build all the rpms
127rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
128
129# copy the RPMs into the build directory.
130mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
131mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
132
133# Build the website
134#
135#cp $srcdir/../historical/* doc
136#make doc
137#cd doc
138#chmod 644 *.gz
139