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 | |
| 33 | # Build the tclsqlite.so shared library for import into tclsh or wish |
| 34 | # under Linux |
| 35 | # |
| 36 | make target_source |
| 37 | cd tsrc |
drh | 43d0578 | 2004-06-18 15:13:48 +0000 | [diff] [blame] | 38 | zip ../doc/sqlite-source-$VERSW.zip * |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 39 | rm shell.c |
| 40 | TCLDIR=/home/drh/tcltk/8.2linux |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 41 | TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 42 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1' |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 43 | gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 44 | strip tclsqlite.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 45 | mv tclsqlite.so tclsqlite-$VERS.so |
| 46 | gzip tclsqlite-$VERS.so |
| 47 | mv tclsqlite-$VERS.so.gz ../doc |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 48 | rm tclsqlite.c |
| 49 | gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so |
| 50 | strip sqlite.so |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 51 | mv sqlite.so sqlite-$VERS.so |
| 52 | gzip sqlite-$VERS.so |
| 53 | mv sqlite-$VERS.so.gz ../doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 54 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 55 | |
| 56 | # Build the tclsqlite.dll shared library that can be imported into tclsh |
| 57 | # or wish on windows. |
| 58 | # |
| 59 | make target_source |
| 60 | cd tsrc |
drh | 66f95a6 | 2001-09-28 18:10:55 +0000 | [diff] [blame] | 61 | rm shell.c |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 62 | TCLDIR=/home/drh/tcltk/8.2win |
| 63 | TCLSTUBLIB=$TCLDIR/tclstub82.a |
| 64 | PATH=$PATH:/opt/mingw/bin |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 65 | OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1' |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 66 | CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR" |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 67 | rm shell.c |
| 68 | for i in *.c; do |
| 69 | CMD="$CC -c $i" |
| 70 | echo $CMD |
| 71 | $CMD |
| 72 | done |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 73 | echo 'EXPORTS' >tclsqlite3.def |
drh | ee4a187 | 2004-07-01 11:25:35 +0000 | [diff] [blame] | 74 | echo 'Tclsqlite3_Init' >>tclsqlite3.def |
| 75 | echo 'Sqlite3_Init' >>tclsqlite3.def |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 76 | i386-mingw32msvc-dllwrap \ |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 77 | --def tclsqlite3.def -v --export-all \ |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 78 | --driver-name i386-mingw32msvc-gcc \ |
| 79 | --dlltool-name i386-mingw32msvc-dlltool \ |
| 80 | --as i386-mingw32msvc-as \ |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 81 | --target i386-mingw32 \ |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 82 | -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB |
drh | ee4a187 | 2004-07-01 11:25:35 +0000 | [diff] [blame] | 83 | i386-mingw32msvc-strip tclsqlite3.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 84 | rm tclsqlite.o |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 85 | cat >sqlite3.def <<\END_OF_FILE |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 86 | EXPORTS |
drh | 93db69e | 2004-06-01 01:22:37 +0000 | [diff] [blame] | 87 | sqlite3_aggregate_context |
| 88 | sqlite3_aggregate_count |
| 89 | sqlite3_bind_blob |
| 90 | sqlite3_bind_double |
| 91 | sqlite3_bind_int |
| 92 | sqlite3_bind_int64 |
| 93 | sqlite3_bind_null |
| 94 | sqlite3_bind_text |
| 95 | sqlite3_bind_text16 |
| 96 | sqlite3_busy_handler |
| 97 | sqlite3_busy_timeout |
| 98 | sqlite3_close |
| 99 | sqlite3_column_blob |
| 100 | sqlite3_column_bytes |
| 101 | sqlite3_column_bytes16 |
| 102 | sqlite3_column_count |
| 103 | sqlite3_column_decltype |
| 104 | sqlite3_column_decltype16 |
| 105 | sqlite3_column_double |
| 106 | sqlite3_column_int |
| 107 | sqlite3_column_int64 |
| 108 | sqlite3_column_name |
| 109 | sqlite3_column_name16 |
| 110 | sqlite3_column_text |
| 111 | sqlite3_column_text16 |
| 112 | sqlite3_column_type |
| 113 | sqlite3_complete |
| 114 | sqlite3_complete16 |
| 115 | sqlite3_create_function |
| 116 | sqlite3_create_function16 |
| 117 | sqlite3_errcode |
| 118 | sqlite3_errmsg |
| 119 | sqlite3_errmsg16 |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 120 | sqlite3_exec |
drh | 93db69e | 2004-06-01 01:22:37 +0000 | [diff] [blame] | 121 | sqlite3_finalize |
| 122 | sqlite3_free |
| 123 | sqlite3_interrupt |
| 124 | sqlite3_last_insert_rowid |
| 125 | sqlite3_mprintf |
| 126 | sqlite3_open |
| 127 | sqlite3_open16 |
| 128 | sqlite3_prepare |
| 129 | sqlite3_prepare16 |
| 130 | sqlite3_reset |
| 131 | sqlite3_result_blob |
| 132 | sqlite3_result_double |
| 133 | sqlite3_result_error |
| 134 | sqlite3_result_error16 |
| 135 | sqlite3_result_int |
| 136 | sqlite3_result_int64 |
| 137 | sqlite3_result_null |
| 138 | sqlite3_result_text |
| 139 | sqlite3_result_text16 |
| 140 | sqlite3_result_value |
| 141 | sqlite3_set_authorizer |
| 142 | sqlite3_step |
| 143 | sqlite3_user_data |
| 144 | sqlite3_value_blob |
| 145 | sqlite3_value_bytes |
| 146 | sqlite3_value_bytes16 |
| 147 | sqlite3_value_double |
| 148 | sqlite3_value_int |
| 149 | sqlite3_value_int64 |
| 150 | sqlite3_value_text |
| 151 | sqlite3_value_text16 |
| 152 | sqlite3_value_type |
| 153 | sqlite3_vmprintf |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 154 | END_OF_FILE |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 155 | i386-mingw32msvc-dllwrap \ |
drh | ee4a187 | 2004-07-01 11:25:35 +0000 | [diff] [blame] | 156 | --def sqlite3.def -v --export-all \ |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 157 | --driver-name i386-mingw32msvc-gcc \ |
| 158 | --dlltool-name i386-mingw32msvc-dlltool \ |
| 159 | --as i386-mingw32msvc-as \ |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 160 | --target i386-mingw32 \ |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 161 | -dllname sqlite3.dll -lmsvcrt *.o |
| 162 | i386-mingw32msvc-strip sqlite3.dll |
| 163 | zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll |
| 164 | zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 165 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 166 | |
| 167 | # Build the sqlite.exe executable for windows. |
| 168 | # |
| 169 | make target_source |
| 170 | cd tsrc |
| 171 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 172 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 8eebadf | 2004-06-22 14:41:35 +0000 | [diff] [blame] | 173 | i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite3.exe |
| 174 | zip ../doc/sqlite-$VERSW.zip sqlite3.exe |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 175 | cd .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 176 | |
| 177 | # Construct a tarball of the source tree |
| 178 | # |
| 179 | ORIGIN=`pwd` |
| 180 | cd $srcdir |
| 181 | cd .. |
drh | a8b38d2 | 2001-11-01 14:41:34 +0000 | [diff] [blame] | 182 | EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'` |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 183 | tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 184 | cd $ORIGIN |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 185 | |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 186 | # |
| 187 | # Build RPMS (binary) and Source RPM |
| 188 | # |
| 189 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 190 | # Make sure we are properly setup to build RPMs |
| 191 | # |
| 192 | echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros |
| 193 | echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros |
| 194 | mkdir $HOME/rpm |
| 195 | mkdir $HOME/rpm/BUILD |
| 196 | mkdir $HOME/rpm/SOURCES |
| 197 | mkdir $HOME/rpm/RPMS |
| 198 | mkdir $HOME/rpm/SRPMS |
| 199 | mkdir $HOME/rpm/SPECS |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 200 | |
| 201 | # create the spec file from the template |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 202 | 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] | 203 | |
| 204 | # copy the source tarball to the rpm directory |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 205 | cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/. |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 206 | |
| 207 | # build all the rpms |
| 208 | rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log |
| 209 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 210 | # copy the RPMs into the build directory. |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 211 | mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc |
| 212 | mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 213 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 214 | # Build the website |
| 215 | # |
drh | 7b93ed3 | 2004-06-16 03:02:00 +0000 | [diff] [blame] | 216 | cp $srcdir/../historical/* doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 217 | make doc |