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