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 | |
| 19 | # Start building stuff. |
| 20 | # |
| 21 | make clean |
| 22 | make sqlite |
| 23 | strip sqlite |
| 24 | mv sqlite sqlite.bin |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 25 | rm -f sqlite.bin.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 26 | gzip sqlite.bin |
| 27 | |
| 28 | # Build the tclsqlite.so shared library for import into tclsh or wish |
| 29 | # under Linux |
| 30 | # |
| 31 | make target_source |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 32 | rm sqlite_source.zip |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 33 | cd tsrc |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 34 | zip ../sqlite_source.zip * |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 35 | rm shell.c |
| 36 | TCLDIR=/home/drh/tcltk/8.2linux |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 37 | TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 38 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1' |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 39 | gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 40 | strip tclsqlite.so |
| 41 | mv tclsqlite.so .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 42 | rm tclsqlite.c |
| 43 | gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so |
| 44 | strip sqlite.so |
| 45 | mv sqlite.so .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 46 | cd .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 47 | rm -f tclsqlite.so.gz sqlite.so.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 48 | gzip tclsqlite.so |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 49 | gzip sqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 50 | |
| 51 | # Build the tclsqlite.dll shared library that can be imported into tclsh |
| 52 | # or wish on windows. |
| 53 | # |
| 54 | make target_source |
| 55 | cd tsrc |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 56 | rm shell.c |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 57 | TCLDIR=/home/drh/tcltk/8.2win |
| 58 | TCLSTUBLIB=$TCLDIR/tclstub82.a |
| 59 | PATH=$PATH:/opt/mingw/bin |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 60 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1' |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 61 | CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR" |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 62 | rm shell.c |
| 63 | for i in *.c; do |
| 64 | CMD="$CC -c $i" |
| 65 | echo $CMD |
| 66 | $CMD |
| 67 | done |
| 68 | echo 'EXPORTS' >tclsqlite.def |
| 69 | echo 'Tclsqlite_Init' >>tclsqlite.def |
| 70 | echo 'Sqlite_Init' >>tclsqlite.def |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 71 | i386-mingw32msvc-dllwrap \ |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 72 | --def tclsqlite.def -v --export-all \ |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 73 | --driver-name i386-mingw32msvc-gcc \ |
| 74 | --dlltool-name i386-mingw32msvc-dlltool \ |
| 75 | --as i386-mingw32msvc-as \ |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 76 | --target i386-mingw32 \ |
| 77 | -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 78 | i386-mingw32msvc-strip tclsqlite.dll |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 79 | mv tclsqlite.dll .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 80 | rm tclsqlite.o |
| 81 | cat >sqlite.def <<\END_OF_FILE |
| 82 | EXPORTS |
| 83 | sqlite_open |
| 84 | sqlite_close |
| 85 | sqlite_exec |
| 86 | sqlite_last_insert_rowid |
| 87 | sqlite_error_string |
| 88 | sqlite_interrupt |
| 89 | sqlite_complete |
| 90 | sqlite_busy_handler |
| 91 | sqlite_busy_timeout |
| 92 | sqlite_get_table |
| 93 | sqlite_free_table |
| 94 | sqlite_mprintf |
| 95 | sqlite_vmprintf |
| 96 | sqlite_exec_printf |
| 97 | sqlite_exec_vprintf |
| 98 | sqlite_get_table_printf |
| 99 | sqlite_get_table_vprintf |
drh | fa86c41 | 2002-02-02 15:01:15 +0000 | [diff] [blame] | 100 | sqlite_freemem |
| 101 | sqlite_libversion |
| 102 | sqlite_libencoding |
drh | ef9f708 | 2002-04-26 09:47:20 +0000 | [diff] [blame] | 103 | sqlite_changes |
drh | 25197f4 | 2002-07-13 14:41:49 +0000 | [diff] [blame] | 104 | sqlite_create_function |
| 105 | sqlite_create_aggregate |
drh | 275ed72 | 2002-10-20 15:55:01 +0000 | [diff] [blame] | 106 | sqlite_function_type |
drh | 25197f4 | 2002-07-13 14:41:49 +0000 | [diff] [blame] | 107 | sqlite_user_data |
| 108 | sqlite_aggregate_context |
| 109 | sqlite_aggregate_count |
drh | ac729e2 | 2002-07-18 11:07:19 +0000 | [diff] [blame] | 110 | sqlite_set_result_string |
drh | 25197f4 | 2002-07-13 14:41:49 +0000 | [diff] [blame] | 111 | sqlite_set_result_int |
| 112 | sqlite_set_result_double |
| 113 | sqlite_set_result_error |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 114 | sqliteMalloc |
| 115 | sqliteFree |
| 116 | sqliteRealloc |
drh | fcb78a4 | 2003-01-18 20:11:05 +0000 | [diff] [blame] | 117 | sqlite_set_authorizer |
| 118 | sqlite_trace |
drh | be992ef | 2003-02-16 22:48:12 +0000 | [diff] [blame] | 119 | sqlite_compile |
| 120 | sqlite_step |
| 121 | sqlite_finalize |
rdc | b0c374f | 2004-02-20 22:53:38 +0000 | [diff] [blame] | 122 | sqlite_reset |
| 123 | sqlite_bind |
| 124 | sqlite_last_statement_changes |
drh | 6da834a | 2004-03-14 22:11:59 +0000 | [diff] [blame] | 125 | sqlite_encode_binary |
| 126 | sqlite_decode_binary |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 127 | END_OF_FILE |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 128 | i386-mingw32msvc-dllwrap \ |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 129 | --def sqlite.def -v --export-all \ |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 130 | --driver-name i386-mingw32msvc-gcc \ |
| 131 | --dlltool-name i386-mingw32msvc-dlltool \ |
| 132 | --as i386-mingw32msvc-as \ |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 133 | --target i386-mingw32 \ |
| 134 | -dllname sqlite.dll -lmsvcrt *.o |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 135 | i386-mingw32msvc-strip sqlite.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 136 | mv sqlite.dll sqlite.def .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 137 | cd .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 138 | rm -f tclsqlite.zip sqlitedll.zip |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 139 | zip tclsqlite.zip tclsqlite.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 140 | zip sqlitedll.zip sqlite.dll sqlite.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 141 | |
| 142 | # Build the sqlite.exe executable for windows. |
| 143 | # |
| 144 | make target_source |
| 145 | cd tsrc |
| 146 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 147 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 148 | i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 149 | mv sqlite.exe .. |
| 150 | cd .. |
| 151 | rm -f sqlite.zip |
| 152 | zip sqlite.zip sqlite.exe |
| 153 | |
| 154 | # Construct a tarball of the source tree |
| 155 | # |
| 156 | ORIGIN=`pwd` |
| 157 | cd $srcdir |
| 158 | cd .. |
drh | a8b38d2 | 2001-11-01 14:41:34 +0000 | [diff] [blame] | 159 | EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'` |
| 160 | tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 161 | cd $ORIGIN |
| 162 | vers=`cat $srcdir/VERSION` |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 163 | rm -f sqlite-$vers.tar.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 164 | ln sqlite.tar.gz sqlite-$vers.tar.gz |
| 165 | |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 166 | # |
| 167 | # Build RPMS (binary) and Source RPM |
| 168 | # |
| 169 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 170 | # Make sure we are properly setup to build RPMs |
| 171 | # |
| 172 | echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros |
| 173 | echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros |
| 174 | mkdir $HOME/rpm |
| 175 | mkdir $HOME/rpm/BUILD |
| 176 | mkdir $HOME/rpm/SOURCES |
| 177 | mkdir $HOME/rpm/RPMS |
| 178 | mkdir $HOME/rpm/SRPMS |
| 179 | mkdir $HOME/rpm/SPECS |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 180 | |
| 181 | # create the spec file from the template |
| 182 | sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec |
| 183 | |
| 184 | # copy the source tarball to the rpm directory |
| 185 | cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/. |
| 186 | |
| 187 | # build all the rpms |
| 188 | rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log |
| 189 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 190 | # copy the RPMs into the build directory. |
| 191 | ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm . |
| 192 | ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm . |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 193 | |
| 194 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 195 | # Build the website |
| 196 | # |
| 197 | cp $srcdir/../historical/* . |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 198 | rm -rf doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 199 | make doc |
| 200 | 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] | 201 | ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 202 | ln *.rpm doc |