blob: 2f5eac16ddd41d5a1d19562f72664dd872b35e0a [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
drh1c928532002-01-31 15:54:21 +000037rm sqlite_source.zip
drh90ca9752001-09-28 17:47:14 +000038cd tsrc
drh1c928532002-01-31 15:54:21 +000039zip ../sqlite_source.zip *
drh90ca9752001-09-28 17:47:14 +000040rm shell.c
41TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000042TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000043OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000044gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000045strip tclsqlite.so
drh7b93ed32004-06-16 03:02:00 +000046mv tclsqlite.so tclsqlite-$VERS.so
47gzip tclsqlite-$VERS.so
48mv tclsqlite-$VERS.so.gz ../doc
drh1c928532002-01-31 15:54:21 +000049rm tclsqlite.c
50gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
51strip sqlite.so
drh7b93ed32004-06-16 03:02:00 +000052mv sqlite.so sqlite-$VERS.so
53gzip sqlite-$VERS.so
54mv sqlite-$VERS.so.gz ../doc
drh90ca9752001-09-28 17:47:14 +000055cd ..
drh90ca9752001-09-28 17:47:14 +000056
57# Build the tclsqlite.dll shared library that can be imported into tclsh
58# or wish on windows.
59#
60make target_source
61cd tsrc
drh66f95a62001-09-28 18:10:55 +000062rm shell.c
drh90ca9752001-09-28 17:47:14 +000063TCLDIR=/home/drh/tcltk/8.2win
64TCLSTUBLIB=$TCLDIR/tclstub82.a
65PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000066OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh1f66c572002-07-02 11:55:32 +000067CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
drh90ca9752001-09-28 17:47:14 +000068rm shell.c
69for i in *.c; do
70 CMD="$CC -c $i"
71 echo $CMD
72 $CMD
73done
74echo 'EXPORTS' >tclsqlite.def
75echo 'Tclsqlite_Init' >>tclsqlite.def
76echo 'Sqlite_Init' >>tclsqlite.def
drh1f66c572002-07-02 11:55:32 +000077i386-mingw32msvc-dllwrap \
drh90ca9752001-09-28 17:47:14 +000078 --def tclsqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000079 --driver-name i386-mingw32msvc-gcc \
80 --dlltool-name i386-mingw32msvc-dlltool \
81 --as i386-mingw32msvc-as \
drh90ca9752001-09-28 17:47:14 +000082 --target i386-mingw32 \
83 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
drh1f66c572002-07-02 11:55:32 +000084i386-mingw32msvc-strip tclsqlite.dll
drh90ca9752001-09-28 17:47:14 +000085mv tclsqlite.dll ..
drh1c928532002-01-31 15:54:21 +000086rm tclsqlite.o
87cat >sqlite.def <<\END_OF_FILE
88EXPORTS
drh93db69e2004-06-01 01:22:37 +000089sqlite3_aggregate_context
90sqlite3_aggregate_count
91sqlite3_bind_blob
92sqlite3_bind_double
93sqlite3_bind_int
94sqlite3_bind_int64
95sqlite3_bind_null
96sqlite3_bind_text
97sqlite3_bind_text16
98sqlite3_busy_handler
99sqlite3_busy_timeout
100sqlite3_close
101sqlite3_column_blob
102sqlite3_column_bytes
103sqlite3_column_bytes16
104sqlite3_column_count
105sqlite3_column_decltype
106sqlite3_column_decltype16
107sqlite3_column_double
108sqlite3_column_int
109sqlite3_column_int64
110sqlite3_column_name
111sqlite3_column_name16
112sqlite3_column_text
113sqlite3_column_text16
114sqlite3_column_type
115sqlite3_complete
116sqlite3_complete16
117sqlite3_create_function
118sqlite3_create_function16
119sqlite3_errcode
120sqlite3_errmsg
121sqlite3_errmsg16
122sqlite3_finalize
123sqlite3_free
124sqlite3_interrupt
125sqlite3_last_insert_rowid
126sqlite3_mprintf
127sqlite3_open
128sqlite3_open16
129sqlite3_prepare
130sqlite3_prepare16
131sqlite3_reset
132sqlite3_result_blob
133sqlite3_result_double
134sqlite3_result_error
135sqlite3_result_error16
136sqlite3_result_int
137sqlite3_result_int64
138sqlite3_result_null
139sqlite3_result_text
140sqlite3_result_text16
141sqlite3_result_value
142sqlite3_set_authorizer
143sqlite3_step
144sqlite3_user_data
145sqlite3_value_blob
146sqlite3_value_bytes
147sqlite3_value_bytes16
148sqlite3_value_double
149sqlite3_value_int
150sqlite3_value_int64
151sqlite3_value_text
152sqlite3_value_text16
153sqlite3_value_type
154sqlite3_vmprintf
drh1c928532002-01-31 15:54:21 +0000155END_OF_FILE
drh1f66c572002-07-02 11:55:32 +0000156i386-mingw32msvc-dllwrap \
drh1c928532002-01-31 15:54:21 +0000157 --def sqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +0000158 --driver-name i386-mingw32msvc-gcc \
159 --dlltool-name i386-mingw32msvc-dlltool \
160 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +0000161 --target i386-mingw32 \
162 -dllname sqlite.dll -lmsvcrt *.o
drh1f66c572002-07-02 11:55:32 +0000163i386-mingw32msvc-strip sqlite.dll
drh7b93ed32004-06-16 03:02:00 +0000164zip ../doc/tclsqlite-$VERSW.zip tclsqlite.dll
165zip ../doc/sqlitedll-$VERSW.zip sqlite.dll sqlite.def
drh90ca9752001-09-28 17:47:14 +0000166cd ..
drh90ca9752001-09-28 17:47:14 +0000167
168# Build the sqlite.exe executable for windows.
169#
170make target_source
171cd tsrc
172rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000173OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh1f66c572002-07-02 11:55:32 +0000174i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
drh7b93ed32004-06-16 03:02:00 +0000175zip ../doc/sqlite-$VERSW.zip sqlite.exe
drh90ca9752001-09-28 17:47:14 +0000176cd ..
drh90ca9752001-09-28 17:47:14 +0000177
178# Construct a tarball of the source tree
179#
180ORIGIN=`pwd`
181cd $srcdir
182cd ..
drha8b38d22001-11-01 14:41:34 +0000183EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
drh7b93ed32004-06-16 03:02:00 +0000184tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000185cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +0000186
doughenry1d366502002-03-29 01:29:53 +0000187#
188# Build RPMS (binary) and Source RPM
189#
190
drh203c2112002-03-29 18:16:04 +0000191# Make sure we are properly setup to build RPMs
192#
193echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
194echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
195mkdir $HOME/rpm
196mkdir $HOME/rpm/BUILD
197mkdir $HOME/rpm/SOURCES
198mkdir $HOME/rpm/RPMS
199mkdir $HOME/rpm/SRPMS
200mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000201
202# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000203sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000204
205# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000206cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000207
208# build all the rpms
209rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
210
drh203c2112002-03-29 18:16:04 +0000211# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000212mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
213mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000214
drh90ca9752001-09-28 17:47:14 +0000215# Build the website
216#
drh7b93ed32004-06-16 03:02:00 +0000217cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000218make doc