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