blob: 171565e28b47a090248f8c614c8b49ff4a5a3a2a [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
19# Start building stuff.
20#
21make clean
22make sqlite
23strip sqlite
24mv sqlite sqlite.bin
drh9d319762001-10-09 12:44:43 +000025rm -f sqlite.bin.gz
drh90ca9752001-09-28 17:47:14 +000026gzip sqlite.bin
27
28# Build the tclsqlite.so shared library for import into tclsh or wish
29# under Linux
30#
31make target_source
drh1c928532002-01-31 15:54:21 +000032rm sqlite_source.zip
drh90ca9752001-09-28 17:47:14 +000033cd tsrc
drh1c928532002-01-31 15:54:21 +000034zip ../sqlite_source.zip *
drh90ca9752001-09-28 17:47:14 +000035rm shell.c
36TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000037TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000038OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000039gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000040strip tclsqlite.so
41mv tclsqlite.so ..
drh1c928532002-01-31 15:54:21 +000042rm tclsqlite.c
43gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
44strip sqlite.so
45mv sqlite.so ..
drh90ca9752001-09-28 17:47:14 +000046cd ..
drh1c928532002-01-31 15:54:21 +000047rm -f tclsqlite.so.gz sqlite.so.gz
drh90ca9752001-09-28 17:47:14 +000048gzip tclsqlite.so
drh1c928532002-01-31 15:54:21 +000049gzip sqlite.so
drh90ca9752001-09-28 17:47:14 +000050
51# Build the tclsqlite.dll shared library that can be imported into tclsh
52# or wish on windows.
53#
54make target_source
55cd tsrc
drh66f95a62001-09-28 18:10:55 +000056rm shell.c
drh90ca9752001-09-28 17:47:14 +000057TCLDIR=/home/drh/tcltk/8.2win
58TCLSTUBLIB=$TCLDIR/tclstub82.a
59PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000060OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh1f66c572002-07-02 11:55:32 +000061CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
drh90ca9752001-09-28 17:47:14 +000062rm shell.c
63for i in *.c; do
64 CMD="$CC -c $i"
65 echo $CMD
66 $CMD
67done
68echo 'EXPORTS' >tclsqlite.def
69echo 'Tclsqlite_Init' >>tclsqlite.def
70echo 'Sqlite_Init' >>tclsqlite.def
drh1f66c572002-07-02 11:55:32 +000071i386-mingw32msvc-dllwrap \
drh90ca9752001-09-28 17:47:14 +000072 --def tclsqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000073 --driver-name i386-mingw32msvc-gcc \
74 --dlltool-name i386-mingw32msvc-dlltool \
75 --as i386-mingw32msvc-as \
drh90ca9752001-09-28 17:47:14 +000076 --target i386-mingw32 \
77 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
drh1f66c572002-07-02 11:55:32 +000078i386-mingw32msvc-strip tclsqlite.dll
drh90ca9752001-09-28 17:47:14 +000079mv tclsqlite.dll ..
drh1c928532002-01-31 15:54:21 +000080rm tclsqlite.o
81cat >sqlite.def <<\END_OF_FILE
82EXPORTS
drh93db69e2004-06-01 01:22:37 +000083sqlite3_aggregate_context
84sqlite3_aggregate_count
85sqlite3_bind_blob
86sqlite3_bind_double
87sqlite3_bind_int
88sqlite3_bind_int64
89sqlite3_bind_null
90sqlite3_bind_text
91sqlite3_bind_text16
92sqlite3_busy_handler
93sqlite3_busy_timeout
94sqlite3_close
95sqlite3_column_blob
96sqlite3_column_bytes
97sqlite3_column_bytes16
98sqlite3_column_count
99sqlite3_column_decltype
100sqlite3_column_decltype16
101sqlite3_column_double
102sqlite3_column_int
103sqlite3_column_int64
104sqlite3_column_name
105sqlite3_column_name16
106sqlite3_column_text
107sqlite3_column_text16
108sqlite3_column_type
109sqlite3_complete
110sqlite3_complete16
111sqlite3_create_function
112sqlite3_create_function16
113sqlite3_errcode
114sqlite3_errmsg
115sqlite3_errmsg16
116sqlite3_finalize
117sqlite3_free
118sqlite3_interrupt
119sqlite3_last_insert_rowid
120sqlite3_mprintf
121sqlite3_open
122sqlite3_open16
123sqlite3_prepare
124sqlite3_prepare16
125sqlite3_reset
126sqlite3_result_blob
127sqlite3_result_double
128sqlite3_result_error
129sqlite3_result_error16
130sqlite3_result_int
131sqlite3_result_int64
132sqlite3_result_null
133sqlite3_result_text
134sqlite3_result_text16
135sqlite3_result_value
136sqlite3_set_authorizer
137sqlite3_step
138sqlite3_user_data
139sqlite3_value_blob
140sqlite3_value_bytes
141sqlite3_value_bytes16
142sqlite3_value_double
143sqlite3_value_int
144sqlite3_value_int64
145sqlite3_value_text
146sqlite3_value_text16
147sqlite3_value_type
148sqlite3_vmprintf
drh1c928532002-01-31 15:54:21 +0000149END_OF_FILE
drh1f66c572002-07-02 11:55:32 +0000150i386-mingw32msvc-dllwrap \
drh1c928532002-01-31 15:54:21 +0000151 --def sqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +0000152 --driver-name i386-mingw32msvc-gcc \
153 --dlltool-name i386-mingw32msvc-dlltool \
154 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +0000155 --target i386-mingw32 \
156 -dllname sqlite.dll -lmsvcrt *.o
drh1f66c572002-07-02 11:55:32 +0000157i386-mingw32msvc-strip sqlite.dll
drh1c928532002-01-31 15:54:21 +0000158mv sqlite.dll sqlite.def ..
drh90ca9752001-09-28 17:47:14 +0000159cd ..
drh1c928532002-01-31 15:54:21 +0000160rm -f tclsqlite.zip sqlitedll.zip
drh90ca9752001-09-28 17:47:14 +0000161zip tclsqlite.zip tclsqlite.dll
drh1c928532002-01-31 15:54:21 +0000162zip sqlitedll.zip sqlite.dll sqlite.def
drh90ca9752001-09-28 17:47:14 +0000163
164# Build the sqlite.exe executable for windows.
165#
166make target_source
167cd tsrc
168rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000169OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh1f66c572002-07-02 11:55:32 +0000170i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
drh90ca9752001-09-28 17:47:14 +0000171mv sqlite.exe ..
172cd ..
173rm -f sqlite.zip
174zip sqlite.zip sqlite.exe
175
176# Construct a tarball of the source tree
177#
178ORIGIN=`pwd`
179cd $srcdir
180cd ..
drha8b38d22001-11-01 14:41:34 +0000181EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
182tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000183cd $ORIGIN
184vers=`cat $srcdir/VERSION`
drh9d319762001-10-09 12:44:43 +0000185rm -f sqlite-$vers.tar.gz
drh90ca9752001-09-28 17:47:14 +0000186ln sqlite.tar.gz sqlite-$vers.tar.gz
187
doughenry1d366502002-03-29 01:29:53 +0000188#
189# Build RPMS (binary) and Source RPM
190#
191
drh203c2112002-03-29 18:16:04 +0000192# Make sure we are properly setup to build RPMs
193#
194echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
195echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
196mkdir $HOME/rpm
197mkdir $HOME/rpm/BUILD
198mkdir $HOME/rpm/SOURCES
199mkdir $HOME/rpm/RPMS
200mkdir $HOME/rpm/SRPMS
201mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000202
203# create the spec file from the template
204sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
205
206# copy the source tarball to the rpm directory
207cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/.
208
209# build all the rpms
210rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
211
drh203c2112002-03-29 18:16:04 +0000212# copy the RPMs into the build directory.
213ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm .
214ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm .
doughenry1d366502002-03-29 01:29:53 +0000215
216
drh90ca9752001-09-28 17:47:14 +0000217# Build the website
218#
219cp $srcdir/../historical/* .
drh9d319762001-10-09 12:44:43 +0000220rm -rf doc
drh90ca9752001-09-28 17:47:14 +0000221make doc
222ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc
drh1c928532002-01-31 15:54:21 +0000223ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc
drh203c2112002-03-29 18:16:04 +0000224ln *.rpm doc