blob: b6099c7fc23e4cab54e21b1532828acf7ae3ac40 [file] [log] [blame]
drh90ca9752001-09-28 17:47:14 +00001#!/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#
12srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
13
14# Get the makefile.
15#
drh76800322002-08-13 20:45:39 +000016cp $srcdir/Makefile.linux-gcc ./Makefile
drhe8a63422004-01-27 17:46:55 +000017chmod +x $srcdir/install-sh
drh90ca9752001-09-28 17:47:14 +000018
drh7b93ed32004-06-16 03:02:00 +000019# Get the current version number - needed to help build filenames
20#
21VERS=`cat $srcdir/VERSION`
22VERSW=`sed 's/\./_/g' $srcdir/VERSION`
23
24# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000025#
26make clean
drh7b93ed32004-06-16 03:02:00 +000027make sqlite3
28strip sqlite3
29mv sqlite3 sqlite3-$VERS.bin
30gzip sqlite3-$VERS.bin
31mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000032
33# Build the tclsqlite.so shared library for import into tclsh or wish
34# under Linux
35#
36make target_source
37cd tsrc
drh43d05782004-06-18 15:13:48 +000038zip ../doc/sqlite-source-$VERSW.zip *
drh90ca9752001-09-28 17:47:14 +000039rm shell.c
40TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000041TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000042OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000043gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000044strip tclsqlite.so
drh7b93ed32004-06-16 03:02:00 +000045mv tclsqlite.so tclsqlite-$VERS.so
46gzip tclsqlite-$VERS.so
47mv tclsqlite-$VERS.so.gz ../doc
drh1c928532002-01-31 15:54:21 +000048rm tclsqlite.c
49gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
50strip sqlite.so
drh7b93ed32004-06-16 03:02:00 +000051mv sqlite.so sqlite-$VERS.so
52gzip sqlite-$VERS.so
53mv sqlite-$VERS.so.gz ../doc
drh90ca9752001-09-28 17:47:14 +000054cd ..
drh90ca9752001-09-28 17:47:14 +000055
56# Build the tclsqlite.dll shared library that can be imported into tclsh
57# or wish on windows.
58#
59make target_source
60cd tsrc
drh66f95a62001-09-28 18:10:55 +000061rm shell.c
drh90ca9752001-09-28 17:47:14 +000062TCLDIR=/home/drh/tcltk/8.2win
63TCLSTUBLIB=$TCLDIR/tclstub82.a
64PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000065OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh1f66c572002-07-02 11:55:32 +000066CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
drh90ca9752001-09-28 17:47:14 +000067rm shell.c
68for i in *.c; do
69 CMD="$CC -c $i"
70 echo $CMD
71 $CMD
72done
drh8eebadf2004-06-22 14:41:35 +000073echo 'EXPORTS' >tclsqlite3.def
drhee4a1872004-07-01 11:25:35 +000074echo 'Tclsqlite3_Init' >>tclsqlite3.def
75echo 'Sqlite3_Init' >>tclsqlite3.def
drh1f66c572002-07-02 11:55:32 +000076i386-mingw32msvc-dllwrap \
drh8eebadf2004-06-22 14:41:35 +000077 --def tclsqlite3.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000078 --driver-name i386-mingw32msvc-gcc \
79 --dlltool-name i386-mingw32msvc-dlltool \
80 --as i386-mingw32msvc-as \
drh90ca9752001-09-28 17:47:14 +000081 --target i386-mingw32 \
drh8eebadf2004-06-22 14:41:35 +000082 -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB
drhee4a1872004-07-01 11:25:35 +000083i386-mingw32msvc-strip tclsqlite3.dll
drh1c928532002-01-31 15:54:21 +000084rm tclsqlite.o
drh8eebadf2004-06-22 14:41:35 +000085cat >sqlite3.def <<\END_OF_FILE
drh1c928532002-01-31 15:54:21 +000086EXPORTS
drh93db69e2004-06-01 01:22:37 +000087sqlite3_aggregate_context
88sqlite3_aggregate_count
89sqlite3_bind_blob
90sqlite3_bind_double
91sqlite3_bind_int
92sqlite3_bind_int64
93sqlite3_bind_null
94sqlite3_bind_text
95sqlite3_bind_text16
96sqlite3_busy_handler
97sqlite3_busy_timeout
98sqlite3_close
99sqlite3_column_blob
100sqlite3_column_bytes
101sqlite3_column_bytes16
102sqlite3_column_count
103sqlite3_column_decltype
104sqlite3_column_decltype16
105sqlite3_column_double
106sqlite3_column_int
107sqlite3_column_int64
108sqlite3_column_name
109sqlite3_column_name16
110sqlite3_column_text
111sqlite3_column_text16
112sqlite3_column_type
113sqlite3_complete
114sqlite3_complete16
115sqlite3_create_function
116sqlite3_create_function16
117sqlite3_errcode
118sqlite3_errmsg
119sqlite3_errmsg16
drh8eebadf2004-06-22 14:41:35 +0000120sqlite3_exec
drh93db69e2004-06-01 01:22:37 +0000121sqlite3_finalize
122sqlite3_free
123sqlite3_interrupt
124sqlite3_last_insert_rowid
125sqlite3_mprintf
126sqlite3_open
127sqlite3_open16
128sqlite3_prepare
129sqlite3_prepare16
130sqlite3_reset
131sqlite3_result_blob
132sqlite3_result_double
133sqlite3_result_error
134sqlite3_result_error16
135sqlite3_result_int
136sqlite3_result_int64
137sqlite3_result_null
138sqlite3_result_text
139sqlite3_result_text16
140sqlite3_result_value
141sqlite3_set_authorizer
142sqlite3_step
143sqlite3_user_data
144sqlite3_value_blob
145sqlite3_value_bytes
146sqlite3_value_bytes16
147sqlite3_value_double
148sqlite3_value_int
149sqlite3_value_int64
150sqlite3_value_text
151sqlite3_value_text16
152sqlite3_value_type
153sqlite3_vmprintf
drh1c928532002-01-31 15:54:21 +0000154END_OF_FILE
drh1f66c572002-07-02 11:55:32 +0000155i386-mingw32msvc-dllwrap \
drhee4a1872004-07-01 11:25:35 +0000156 --def sqlite3.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +0000157 --driver-name i386-mingw32msvc-gcc \
158 --dlltool-name i386-mingw32msvc-dlltool \
159 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +0000160 --target i386-mingw32 \
drh8eebadf2004-06-22 14:41:35 +0000161 -dllname sqlite3.dll -lmsvcrt *.o
162i386-mingw32msvc-strip sqlite3.dll
163zip ../doc/tclsqlite-$VERSW.zip tclsqlite3.dll
164zip ../doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +0000165cd ..
drh90ca9752001-09-28 17:47:14 +0000166
167# Build the sqlite.exe executable for windows.
168#
169make target_source
170cd tsrc
171rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000172OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh8eebadf2004-06-22 14:41:35 +0000173i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite3.exe
174zip ../doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +0000175cd ..
drh90ca9752001-09-28 17:47:14 +0000176
177# Construct a tarball of the source tree
178#
179ORIGIN=`pwd`
180cd $srcdir
181cd ..
drha8b38d22001-11-01 14:41:34 +0000182EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
drh7b93ed32004-06-16 03:02:00 +0000183tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000184cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000185
doughenry1d366502002-03-29 01:29:53 +0000186#
187# Build RPMS (binary) and Source RPM
188#
189
drh203c2112002-03-29 18:16:04 +0000190# Make sure we are properly setup to build RPMs
191#
192echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
193echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
194mkdir $HOME/rpm
195mkdir $HOME/rpm/BUILD
196mkdir $HOME/rpm/SOURCES
197mkdir $HOME/rpm/RPMS
198mkdir $HOME/rpm/SRPMS
199mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000200
201# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000202sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000203
204# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000205cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000206
207# build all the rpms
208rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
209
drh203c2112002-03-29 18:16:04 +0000210# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000211mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
212mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000213
drh90ca9752001-09-28 17:47:14 +0000214# Build the website
215#
drh7b93ed32004-06-16 03:02:00 +0000216cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000217make doc