3 # This script is used to compile SQLite and package everything up
4 # so that it is ready to move to the SQLite website.
7 # Set srcdir to the name of the directory that contains the publish.sh
10 srcdir
=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
14 cp $srcdir/Makefile.linux-gcc .
/Makefile
15 chmod +x
$srcdir/install-sh
17 # Get the current version number - needed to help build filenames
19 VERS
=`cat $srcdir/VERSION`
20 VERSW
=`sed 's/\./_/g' $srcdir/VERSION`
21 echo "VERSIONS: $VERS $VERSW"
23 # Start by building an sqlite shell for linux.
27 CFLAGS
="-Os -DSQLITE_ENABLE_FTS3=0 -DSQLITE_ENABLE_RTREE=0"
28 CFLAGS
="$CFLAGS -DSQLITE_THREADSAFE=0"
29 echo '***** '"COMPILING sqlite3-$VERS.bin..."
30 gcc
$CFLAGS -Itsrc sqlite3.c tsrc
/shell.c
-o sqlite3
-ldl
32 mv sqlite3 sqlite3-
$VERS.bin
33 gzip sqlite3-
$VERS.bin
34 chmod 644 sqlite3-
$VERS.bin.gz
35 mv sqlite3-
$VERS.bin.gz doc
37 # Build the sqlite.so and tclsqlite.so shared libraries
40 TCLDIR
=/home
/drh
/tcltk
/846/linux
/846linux
41 TCLSTUBLIB
=$TCLDIR/libtclstub8.4g.a
42 CFLAGS
="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1"
43 CFLAGS
="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1"
44 CFLAGS
="$CFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1"
45 echo '***** BUILDING shared libraries for linux'
46 gcc
$CFLAGS -shared tclsqlite3.c
$TCLSTUBLIB -o tclsqlite3.so
-lpthread
48 chmod 644 tclsqlite3.so
49 mv tclsqlite3.so tclsqlite-
$VERS.so
50 gzip tclsqlite-
$VERS.so
51 mv tclsqlite-
$VERS.so.gz doc
52 gcc
$CFLAGS -shared sqlite3.c
-o sqlite3.so
-lpthread
55 mv sqlite3.so sqlite-
$VERS.so
57 mv sqlite-
$VERS.so.gz doc
60 # Build the tclsqlite3.dll and sqlite3.dll shared libraries.
63 echo '***** PACKAGING shared libraries for windows'
64 echo zip doc
/tclsqlite-
$VERSW.
zip tclsqlite3.dll
65 zip doc
/tclsqlite-
$VERSW.
zip tclsqlite3.dll
66 echo zip doc
/sqlitedll-
$VERSW.
zip sqlite3.dll sqlite3.def
67 zip doc
/sqlitedll-
$VERSW.
zip sqlite3.dll sqlite3.def
69 # Build the sqlite.exe executable for windows.
71 OPTS
='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0'
72 OPTS
="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1"
73 i386-mingw32msvc-gcc
-Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc
/shell.c \
75 zip doc
/sqlite-
$VERSW.
zip sqlite3.exe
77 # Build a source archive useful for windows.
81 echo '***** BUILDING preprocessed source archives'
83 rm -f ..
/doc
/sqlite-source-
$VERSW.
zip
84 zip ..
/doc
/sqlite-source-
$VERSW.
zip *
86 cp tsrc
/sqlite3.h tsrc
/sqlite3ext.h .
89 zip doc
/sqlite-amalgamation-
$VERSW.
zip sqlite3.c sqlite3.h sqlite3ext.h shell.c sqlite3.def
91 # Construct a tarball of the source tree
93 echo '***** BUILDING source archive'
98 mv sqlite sqlite-
$VERS
99 EXCLUDE
=`find sqlite-$VERS -print | egrep '(www/|art/|doc/|contrib/|_FOSSIL_)' | sed 's,^, --exclude ,'`
100 echo "tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS"
101 tar czf
$ORIGIN/doc
/sqlite-
$VERS.
tar.gz
$EXCLUDE sqlite-
$VERS
102 mv sqlite-
$VERS sqlite
106 # Build RPMS (binary) and Source RPM
109 # Make sure we are properly setup to build RPMs
111 echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
112 echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
114 mkdir
$HOME/rpm
/BUILD
115 mkdir
$HOME/rpm
/SOURCES
117 mkdir
$HOME/rpm
/SRPMS
118 mkdir
$HOME/rpm
/SPECS
120 # create the spec file from the template
121 sed s
/SQLITE_VERSION
/$VERS/g
$srcdir/spec.template
> $HOME/rpm
/SPECS
/sqlite.spec
123 # copy the source tarball to the rpm directory
124 cp doc
/sqlite-
$VERS.
tar.gz
$HOME/rpm
/SOURCES
/.
127 rpm
-ba $HOME/rpm
/SPECS
/sqlite.spec
>& rpm-
$vers.log
129 # copy the RPMs into the build directory.
130 mv $HOME/rpm
/RPMS
/i386
/sqlite
*-$vers*.rpm doc
131 mv $HOME/rpm
/SRPMS
/sqlite-
$vers*.rpm doc
135 #cp $srcdir/../historical/* doc