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 | # |
| 16 | cp $srcdir/Makefile.template ./Makefile |
| 17 | |
| 18 | # Start building stuff. |
| 19 | # |
| 20 | make clean |
| 21 | make sqlite |
| 22 | strip sqlite |
| 23 | mv sqlite sqlite.bin |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 24 | rm -f sqlite.bin.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 25 | gzip sqlite.bin |
| 26 | |
| 27 | # Build the tclsqlite.so shared library for import into tclsh or wish |
| 28 | # under Linux |
| 29 | # |
| 30 | make target_source |
| 31 | cd tsrc |
| 32 | rm shell.c |
| 33 | TCLDIR=/home/drh/tcltk/8.2linux |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 34 | TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame^] | 35 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1' |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 36 | gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 37 | strip tclsqlite.so |
| 38 | mv tclsqlite.so .. |
| 39 | cd .. |
drh | 4cbd68f | 2001-12-15 02:58:18 +0000 | [diff] [blame] | 40 | rm -f tclsqlite.so.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 41 | gzip tclsqlite.so |
| 42 | |
| 43 | # Build the tclsqlite.dll shared library that can be imported into tclsh |
| 44 | # or wish on windows. |
| 45 | # |
| 46 | make target_source |
| 47 | cd tsrc |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 48 | rm shell.c |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 49 | TCLDIR=/home/drh/tcltk/8.2win |
| 50 | TCLSTUBLIB=$TCLDIR/tclstub82.a |
| 51 | PATH=$PATH:/opt/mingw/bin |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame^] | 52 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1' |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 53 | CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR" |
| 54 | rm shell.c |
| 55 | for i in *.c; do |
| 56 | CMD="$CC -c $i" |
| 57 | echo $CMD |
| 58 | $CMD |
| 59 | done |
| 60 | echo 'EXPORTS' >tclsqlite.def |
| 61 | echo 'Tclsqlite_Init' >>tclsqlite.def |
| 62 | echo 'Sqlite_Init' >>tclsqlite.def |
| 63 | i386-mingw32-dllwrap \ |
| 64 | --def tclsqlite.def -v --export-all \ |
| 65 | --driver-name i386-mingw32-gcc \ |
| 66 | --dlltool-name i386-mingw32-dlltool \ |
| 67 | --as i386-mingw32-as \ |
| 68 | --target i386-mingw32 \ |
| 69 | -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB |
| 70 | i386-mingw32-strip tclsqlite.dll |
| 71 | mv tclsqlite.dll .. |
| 72 | cd .. |
| 73 | rm -f tclsqlite.zip |
| 74 | zip tclsqlite.zip tclsqlite.dll |
| 75 | |
| 76 | # Build the sqlite.exe executable for windows. |
| 77 | # |
| 78 | make target_source |
| 79 | cd tsrc |
| 80 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame^] | 81 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 82 | i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe |
| 83 | mv sqlite.exe .. |
| 84 | cd .. |
| 85 | rm -f sqlite.zip |
| 86 | zip sqlite.zip sqlite.exe |
| 87 | |
| 88 | # Construct a tarball of the source tree |
| 89 | # |
| 90 | ORIGIN=`pwd` |
| 91 | cd $srcdir |
| 92 | cd .. |
drh | a8b38d2 | 2001-11-01 14:41:34 +0000 | [diff] [blame] | 93 | EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'` |
| 94 | tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 95 | cd $ORIGIN |
| 96 | vers=`cat $srcdir/VERSION` |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 97 | rm -f sqlite-$vers.tar.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 98 | ln sqlite.tar.gz sqlite-$vers.tar.gz |
| 99 | |
| 100 | # Build the website |
| 101 | # |
| 102 | cp $srcdir/../historical/* . |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 103 | rm -rf doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 104 | make doc |
| 105 | ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc |