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