drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
drh | 22db44b | 2007-11-23 15:12:44 +0000 | [diff] [blame] | 3 | # This script is used to compile SQLite and package everything up |
| 4 | # so that it is ready to move to the SQLite website. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 5 | # |
| 6 | |
| 7 | # Set srcdir to the name of the directory that contains the publish.sh |
| 8 | # script. |
| 9 | # |
| 10 | srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'` |
| 11 | |
| 12 | # Get the makefile. |
| 13 | # |
drh | 7680032 | 2002-08-13 20:45:39 +0000 | [diff] [blame] | 14 | cp $srcdir/Makefile.linux-gcc ./Makefile |
drh | e8a6342 | 2004-01-27 17:46:55 +0000 | [diff] [blame] | 15 | chmod +x $srcdir/install-sh |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 16 | |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 17 | # Get the current version number - needed to help build filenames |
| 18 | # |
| 19 | VERS=`cat $srcdir/VERSION` |
| 20 | VERSW=`sed 's/\./_/g' $srcdir/VERSION` |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 21 | echo "VERSIONS: $VERS $VERSW" |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 22 | |
| 23 | # Start by building an sqlite shell for linux. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 24 | # |
| 25 | make clean |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 26 | make sqlite3.c |
drh | 58f1c8b | 2008-05-26 20:19:25 +0000 | [diff] [blame^] | 27 | CFLAGS="-Os -DSQLITE_ENABLE_FTS3=0 -DSQLITE_ENABLE_RTREE=0" |
| 28 | CFLAGS="$CFLAGS -DSQLITE_THREADSAFE=0" |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 29 | echo '***** '"COMPILING sqlite3-$VERS.bin..." |
drh | f042f51 | 2007-11-27 18:45:31 +0000 | [diff] [blame] | 30 | gcc $CFLAGS -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 31 | strip sqlite3 |
| 32 | mv sqlite3 sqlite3-$VERS.bin |
| 33 | gzip sqlite3-$VERS.bin |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 34 | chmod 644 sqlite3-$VERS.bin.gz |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 35 | mv sqlite3-$VERS.bin.gz doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 36 | |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 37 | # Build a source archive useful for windows. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 38 | # |
drh | 52d19f6 | 2007-05-08 18:30:36 +0000 | [diff] [blame] | 39 | make target_source |
| 40 | cd tsrc |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 41 | echo '***** BUILDING preprocessed source archives' |
drh | 414025d | 2008-01-31 16:36:40 +0000 | [diff] [blame] | 42 | rm fts[12]* icu* |
drh | 52d19f6 | 2007-05-08 18:30:36 +0000 | [diff] [blame] | 43 | rm -f ../doc/sqlite-source-$VERSW.zip |
| 44 | zip ../doc/sqlite-source-$VERSW.zip * |
| 45 | cd .. |
drh | 3bbbd7d | 2007-10-01 13:59:48 +0000 | [diff] [blame] | 46 | cp tsrc/sqlite3.h tsrc/sqlite3ext.h . |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 47 | pwd |
drh | 3bbbd7d | 2007-10-01 13:59:48 +0000 | [diff] [blame] | 48 | zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 49 | |
| 50 | # Build the sqlite.so and tclsqlite.so shared libraries |
| 51 | # under Linux |
| 52 | # |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 53 | TCLDIR=/home/drh/tcltk/846/linux/846linux |
| 54 | TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a |
drh | 58f1c8b | 2008-05-26 20:19:25 +0000 | [diff] [blame^] | 55 | CFLAGS="-Os -DSQLITE_ENABLE_FTS3=3 -DSQLITE_ENABLE_RTREE=1" |
| 56 | CFLAGS="$CFLAGS -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1" |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 57 | echo '***** BUILDING shared libraries for linux' |
drh | ea4ee79 | 2007-12-10 17:55:16 +0000 | [diff] [blame] | 58 | gcc $CFLAGS -shared tclsqlite3.c $TCLSTUBLIB -o tclsqlite3.so -lpthread |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 59 | strip tclsqlite3.so |
| 60 | chmod 644 tclsqlite3.so |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 61 | mv tclsqlite3.so tclsqlite-$VERS.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 62 | gzip tclsqlite-$VERS.so |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 63 | mv tclsqlite-$VERS.so.gz doc |
drh | ea4ee79 | 2007-12-10 17:55:16 +0000 | [diff] [blame] | 64 | gcc $CFLAGS -shared sqlite3.c -o sqlite3.so -lpthread |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 65 | strip sqlite3.so |
| 66 | chmod 644 sqlite3.so |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 67 | mv sqlite3.so sqlite-$VERS.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 68 | gzip sqlite-$VERS.so |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 69 | mv sqlite-$VERS.so.gz doc |
| 70 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 71 | |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 72 | # Build the tclsqlite3.dll and sqlite3.dll shared libraries. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 73 | # |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 74 | . $srcdir/mkdll.sh |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 75 | echo '***** PACKAGING shared libraries for windows' |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 76 | echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll |
| 77 | zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll |
| 78 | echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def |
| 79 | zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 80 | |
| 81 | # Build the sqlite.exe executable for windows. |
| 82 | # |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 83 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1 -DSQLITE_THREADSAFE=0' |
drh | 58f1c8b | 2008-05-26 20:19:25 +0000 | [diff] [blame^] | 84 | OPTS="$OPTS -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_RTREE=1" |
drh | 52d19f6 | 2007-05-08 18:30:36 +0000 | [diff] [blame] | 85 | i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \ |
drh | 611c8ca | 2007-04-02 15:04:34 +0000 | [diff] [blame] | 86 | -o sqlite3.exe |
| 87 | zip doc/sqlite-$VERSW.zip sqlite3.exe |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 88 | |
| 89 | # Construct a tarball of the source tree |
| 90 | # |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 91 | echo '***** BUILDING source archive' |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 92 | ORIGIN=`pwd` |
| 93 | cd $srcdir |
| 94 | cd .. |
drh | 39171f3 | 2005-02-15 16:15:09 +0000 | [diff] [blame] | 95 | mv sqlite sqlite-$VERS |
drh | e0d5e34 | 2007-11-27 17:38:14 +0000 | [diff] [blame] | 96 | EXCLUDE=`find sqlite-$VERS -print | egrep (CVS|www/|art/|doc/|contrib/) | sed 's,^, --exclude ,'` |
drh | 39171f3 | 2005-02-15 16:15:09 +0000 | [diff] [blame] | 97 | tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS |
| 98 | mv sqlite-$VERS sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 99 | cd $ORIGIN |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 100 | |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 101 | # |
| 102 | # Build RPMS (binary) and Source RPM |
| 103 | # |
| 104 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 105 | # Make sure we are properly setup to build RPMs |
| 106 | # |
| 107 | echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros |
| 108 | echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros |
| 109 | mkdir $HOME/rpm |
| 110 | mkdir $HOME/rpm/BUILD |
| 111 | mkdir $HOME/rpm/SOURCES |
| 112 | mkdir $HOME/rpm/RPMS |
| 113 | mkdir $HOME/rpm/SRPMS |
| 114 | mkdir $HOME/rpm/SPECS |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 115 | |
| 116 | # create the spec file from the template |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 117 | sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 118 | |
| 119 | # copy the source tarball to the rpm directory |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 120 | cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/. |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 121 | |
| 122 | # build all the rpms |
| 123 | rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log |
| 124 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 125 | # copy the RPMs into the build directory. |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 126 | mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc |
| 127 | mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 128 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 129 | # Build the website |
| 130 | # |
drh | 20753fb | 2004-07-22 18:53:17 +0000 | [diff] [blame] | 131 | #cp $srcdir/../historical/* doc |
drh | 22db44b | 2007-11-23 15:12:44 +0000 | [diff] [blame] | 132 | #make doc |
| 133 | #cd doc |
| 134 | #chmod 644 *.gz |