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 |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 31 | rm sqlite_source.zip |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 32 | cd tsrc |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 33 | zip ../sqlite_source.zip * |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 34 | rm shell.c |
| 35 | TCLDIR=/home/drh/tcltk/8.2linux |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 36 | TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 37 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1' |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 38 | gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 39 | strip tclsqlite.so |
| 40 | mv tclsqlite.so .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 41 | rm tclsqlite.c |
| 42 | gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so |
| 43 | strip sqlite.so |
| 44 | mv sqlite.so .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 45 | cd .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 46 | rm -f tclsqlite.so.gz sqlite.so.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 47 | gzip tclsqlite.so |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 48 | gzip sqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 49 | |
| 50 | # Build the tclsqlite.dll shared library that can be imported into tclsh |
| 51 | # or wish on windows. |
| 52 | # |
| 53 | make target_source |
| 54 | cd tsrc |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 55 | rm shell.c |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 56 | TCLDIR=/home/drh/tcltk/8.2win |
| 57 | TCLSTUBLIB=$TCLDIR/tclstub82.a |
| 58 | PATH=$PATH:/opt/mingw/bin |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 59 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1' |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 60 | CC="i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR" |
| 61 | rm shell.c |
| 62 | for i in *.c; do |
| 63 | CMD="$CC -c $i" |
| 64 | echo $CMD |
| 65 | $CMD |
| 66 | done |
| 67 | echo 'EXPORTS' >tclsqlite.def |
| 68 | echo 'Tclsqlite_Init' >>tclsqlite.def |
| 69 | echo 'Sqlite_Init' >>tclsqlite.def |
| 70 | i386-mingw32-dllwrap \ |
| 71 | --def tclsqlite.def -v --export-all \ |
| 72 | --driver-name i386-mingw32-gcc \ |
| 73 | --dlltool-name i386-mingw32-dlltool \ |
| 74 | --as i386-mingw32-as \ |
| 75 | --target i386-mingw32 \ |
| 76 | -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB |
| 77 | i386-mingw32-strip tclsqlite.dll |
| 78 | mv tclsqlite.dll .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 79 | rm tclsqlite.o |
| 80 | cat >sqlite.def <<\END_OF_FILE |
| 81 | EXPORTS |
| 82 | sqlite_open |
| 83 | sqlite_close |
| 84 | sqlite_exec |
| 85 | sqlite_last_insert_rowid |
| 86 | sqlite_error_string |
| 87 | sqlite_interrupt |
| 88 | sqlite_complete |
| 89 | sqlite_busy_handler |
| 90 | sqlite_busy_timeout |
| 91 | sqlite_get_table |
| 92 | sqlite_free_table |
| 93 | sqlite_mprintf |
| 94 | sqlite_vmprintf |
| 95 | sqlite_exec_printf |
| 96 | sqlite_exec_vprintf |
| 97 | sqlite_get_table_printf |
| 98 | sqlite_get_table_vprintf |
| 99 | sqliteMalloc |
| 100 | sqliteFree |
| 101 | sqliteRealloc |
| 102 | END_OF_FILE |
| 103 | i386-mingw32-dllwrap \ |
| 104 | --def sqlite.def -v --export-all \ |
| 105 | --driver-name i386-mingw32-gcc \ |
| 106 | --dlltool-name i386-mingw32-dlltool \ |
| 107 | --as i386-mingw32-as \ |
| 108 | --target i386-mingw32 \ |
| 109 | -dllname sqlite.dll -lmsvcrt *.o |
| 110 | i386-mingw32-strip sqlite.dll |
| 111 | mv sqlite.dll sqlite.def .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 112 | cd .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 113 | rm -f tclsqlite.zip sqlitedll.zip |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 114 | zip tclsqlite.zip tclsqlite.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 115 | zip sqlitedll.zip sqlite.dll sqlite.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 116 | |
| 117 | # Build the sqlite.exe executable for windows. |
| 118 | # |
| 119 | make target_source |
| 120 | cd tsrc |
| 121 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 122 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 123 | i386-mingw32-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe |
| 124 | mv sqlite.exe .. |
| 125 | cd .. |
| 126 | rm -f sqlite.zip |
| 127 | zip sqlite.zip sqlite.exe |
| 128 | |
| 129 | # Construct a tarball of the source tree |
| 130 | # |
| 131 | ORIGIN=`pwd` |
| 132 | cd $srcdir |
| 133 | cd .. |
drh | a8b38d2 | 2001-11-01 14:41:34 +0000 | [diff] [blame] | 134 | EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'` |
| 135 | tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 136 | cd $ORIGIN |
| 137 | vers=`cat $srcdir/VERSION` |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 138 | rm -f sqlite-$vers.tar.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 139 | ln sqlite.tar.gz sqlite-$vers.tar.gz |
| 140 | |
| 141 | # Build the website |
| 142 | # |
| 143 | cp $srcdir/../historical/* . |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 144 | rm -rf doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 145 | make doc |
| 146 | ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame^] | 147 | ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc |