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 |
drh | 93db69e | 2004-06-01 01:22:37 +0000 | [diff] [blame] | 83 | sqlite3_aggregate_context |
| 84 | sqlite3_aggregate_count |
| 85 | sqlite3_bind_blob |
| 86 | sqlite3_bind_double |
| 87 | sqlite3_bind_int |
| 88 | sqlite3_bind_int64 |
| 89 | sqlite3_bind_null |
| 90 | sqlite3_bind_text |
| 91 | sqlite3_bind_text16 |
| 92 | sqlite3_busy_handler |
| 93 | sqlite3_busy_timeout |
| 94 | sqlite3_close |
| 95 | sqlite3_column_blob |
| 96 | sqlite3_column_bytes |
| 97 | sqlite3_column_bytes16 |
| 98 | sqlite3_column_count |
| 99 | sqlite3_column_decltype |
| 100 | sqlite3_column_decltype16 |
| 101 | sqlite3_column_double |
| 102 | sqlite3_column_int |
| 103 | sqlite3_column_int64 |
| 104 | sqlite3_column_name |
| 105 | sqlite3_column_name16 |
| 106 | sqlite3_column_text |
| 107 | sqlite3_column_text16 |
| 108 | sqlite3_column_type |
| 109 | sqlite3_complete |
| 110 | sqlite3_complete16 |
| 111 | sqlite3_create_function |
| 112 | sqlite3_create_function16 |
| 113 | sqlite3_errcode |
| 114 | sqlite3_errmsg |
| 115 | sqlite3_errmsg16 |
| 116 | sqlite3_finalize |
| 117 | sqlite3_free |
| 118 | sqlite3_interrupt |
| 119 | sqlite3_last_insert_rowid |
| 120 | sqlite3_mprintf |
| 121 | sqlite3_open |
| 122 | sqlite3_open16 |
| 123 | sqlite3_prepare |
| 124 | sqlite3_prepare16 |
| 125 | sqlite3_reset |
| 126 | sqlite3_result_blob |
| 127 | sqlite3_result_double |
| 128 | sqlite3_result_error |
| 129 | sqlite3_result_error16 |
| 130 | sqlite3_result_int |
| 131 | sqlite3_result_int64 |
| 132 | sqlite3_result_null |
| 133 | sqlite3_result_text |
| 134 | sqlite3_result_text16 |
| 135 | sqlite3_result_value |
| 136 | sqlite3_set_authorizer |
| 137 | sqlite3_step |
| 138 | sqlite3_user_data |
| 139 | sqlite3_value_blob |
| 140 | sqlite3_value_bytes |
| 141 | sqlite3_value_bytes16 |
| 142 | sqlite3_value_double |
| 143 | sqlite3_value_int |
| 144 | sqlite3_value_int64 |
| 145 | sqlite3_value_text |
| 146 | sqlite3_value_text16 |
| 147 | sqlite3_value_type |
| 148 | sqlite3_vmprintf |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 149 | END_OF_FILE |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 150 | i386-mingw32msvc-dllwrap \ |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 151 | --def sqlite.def -v --export-all \ |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 152 | --driver-name i386-mingw32msvc-gcc \ |
| 153 | --dlltool-name i386-mingw32msvc-dlltool \ |
| 154 | --as i386-mingw32msvc-as \ |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 155 | --target i386-mingw32 \ |
| 156 | -dllname sqlite.dll -lmsvcrt *.o |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 157 | i386-mingw32msvc-strip sqlite.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 158 | mv sqlite.dll sqlite.def .. |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 159 | cd .. |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 160 | rm -f tclsqlite.zip sqlitedll.zip |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 161 | zip tclsqlite.zip tclsqlite.dll |
drh | 1c92853 | 2002-01-31 15:54:21 +0000 | [diff] [blame] | 162 | zip sqlitedll.zip sqlite.dll sqlite.def |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 163 | |
| 164 | # Build the sqlite.exe executable for windows. |
| 165 | # |
| 166 | make target_source |
| 167 | cd tsrc |
| 168 | rm tclsqlite.c |
drh | a297b5c | 2002-01-15 18:39:43 +0000 | [diff] [blame] | 169 | OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1' |
drh | 1f66c57 | 2002-07-02 11:55:32 +0000 | [diff] [blame] | 170 | i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 171 | mv sqlite.exe .. |
| 172 | cd .. |
| 173 | rm -f sqlite.zip |
| 174 | zip sqlite.zip sqlite.exe |
| 175 | |
| 176 | # Construct a tarball of the source tree |
| 177 | # |
| 178 | ORIGIN=`pwd` |
| 179 | cd $srcdir |
| 180 | cd .. |
drh | a8b38d2 | 2001-11-01 14:41:34 +0000 | [diff] [blame] | 181 | EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'` |
| 182 | tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 183 | cd $ORIGIN |
| 184 | vers=`cat $srcdir/VERSION` |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 185 | rm -f sqlite-$vers.tar.gz |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 186 | ln sqlite.tar.gz sqlite-$vers.tar.gz |
| 187 | |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 188 | # |
| 189 | # Build RPMS (binary) and Source RPM |
| 190 | # |
| 191 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 192 | # Make sure we are properly setup to build RPMs |
| 193 | # |
| 194 | echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros |
| 195 | echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros |
| 196 | mkdir $HOME/rpm |
| 197 | mkdir $HOME/rpm/BUILD |
| 198 | mkdir $HOME/rpm/SOURCES |
| 199 | mkdir $HOME/rpm/RPMS |
| 200 | mkdir $HOME/rpm/SRPMS |
| 201 | mkdir $HOME/rpm/SPECS |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 202 | |
| 203 | # create the spec file from the template |
| 204 | sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec |
| 205 | |
| 206 | # copy the source tarball to the rpm directory |
| 207 | cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/. |
| 208 | |
| 209 | # build all the rpms |
| 210 | rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log |
| 211 | |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 212 | # copy the RPMs into the build directory. |
| 213 | ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm . |
| 214 | ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm . |
doughenry | 1d36650 | 2002-03-29 01:29:53 +0000 | [diff] [blame] | 215 | |
| 216 | |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 217 | # Build the website |
| 218 | # |
| 219 | cp $srcdir/../historical/* . |
drh | 9d31976 | 2001-10-09 12:44:43 +0000 | [diff] [blame] | 220 | rm -rf doc |
drh | 90ca975 | 2001-09-28 17:47:14 +0000 | [diff] [blame] | 221 | make doc |
| 222 | 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] | 223 | ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc |
drh | 203c211 | 2002-03-29 18:16:04 +0000 | [diff] [blame] | 224 | ln *.rpm doc |