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` |
| 23 | |
| 24 | # Start by building an sqlite shell for linux. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 25 | # |
| 26 | make clean |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 27 | make sqlite3 |
| 28 | strip sqlite3 |
| 29 | mv sqlite3 sqlite3-$VERS.bin |
| 30 | gzip sqlite3-$VERS.bin |
| 31 | mv sqlite3-$VERS.bin.gz doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 32 | |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 33 | # Build a source archive useful for windows. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 34 | # |
| 35 | make target_source |
| 36 | cd tsrc |
drh | 43d0578 | 2004-06-18 15:13:48 +0000 | [diff] [blame] | 37 | zip ../doc/sqlite-source-$VERSW.zip * |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 38 | cd .. |
| 39 | |
| 40 | # Build the sqlite.so and tclsqlite.so shared libraries |
| 41 | # under Linux |
| 42 | # |
| 43 | . $srcdir/mkso.sh |
| 44 | cd tsrc |
| 45 | mv tclsqlite3.so tclsqlite-$VERS.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 46 | gzip tclsqlite-$VERS.so |
| 47 | mv tclsqlite-$VERS.so.gz ../doc |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 48 | mv sqlite3.so sqlite-$VERS.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 49 | gzip sqlite-$VERS.so |
| 50 | mv sqlite-$VERS.so.gz ../doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 51 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 52 | |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 53 | # Build the tclsqlite3.dll and sqlite3.dll shared libraries. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 54 | # |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 55 | . $srcdir/mkdll.sh |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 56 | cd tsrc |
drh | 8685a94 | 2004-07-22 18:44:23 +0000 | [diff] [blame] | 57 | echo zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 58 | zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll |
drh | 8685a94 | 2004-07-22 18:44:23 +0000 | [diff] [blame] | 59 | echo zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def |
drh | 4aec8b6 | 2004-08-28 16:19:00 +0000 | [diff] [blame] | 60 | zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 61 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 62 | |
| 63 | # Build the sqlite.exe executable for windows. |
| 64 | # |
| 65 | make target_source |
| 66 | cd tsrc |
| 67 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 68 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 69 | i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite3.exe |
| 70 | zip ../doc/sqlite-$VERSW.zip sqlite3.exe |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 71 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 72 | |
| 73 | # Construct a tarball of the source tree |
| 74 | # |
| 75 | ORIGIN=`pwd` |
| 76 | cd $srcdir |
| 77 | cd .. |
drh | 39171f3 | 2005-02-15 16:15:09 +0000 | [diff] [blame] | 78 | mv sqlite sqlite-$VERS |
| 79 | EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'` |
| 80 | tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS |
| 81 | mv sqlite-$VERS sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 82 | cd $ORIGIN |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 83 | |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 84 | # |
| 85 | # Build RPMS (binary) and Source RPM |
| 86 | # |
| 87 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 88 | # Make sure we are properly setup to build RPMs |
| 89 | # |
| 90 | echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros |
| 91 | echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros |
| 92 | mkdir $HOME/rpm |
| 93 | mkdir $HOME/rpm/BUILD |
| 94 | mkdir $HOME/rpm/SOURCES |
| 95 | mkdir $HOME/rpm/RPMS |
| 96 | mkdir $HOME/rpm/SRPMS |
| 97 | mkdir $HOME/rpm/SPECS |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 98 | |
| 99 | # create the spec file from the template |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 100 | 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] | 101 | |
| 102 | # copy the source tarball to the rpm directory |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 103 | cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/. |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 104 | |
| 105 | # build all the rpms |
| 106 | rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log |
| 107 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 108 | # copy the RPMs into the build directory. |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 109 | mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc |
| 110 | mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 111 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 112 | # Build the website |
| 113 | # |
drh | 20753fb | 2004-07-22 18:53:17 +0000 | [diff] [blame] | 114 | #cp $srcdir/../historical/* doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 115 | make doc |