blob: d15e9bf7034ffbb5ea5ff546b3e56e2ee3eb65c1 [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
83sqlite_open
84sqlite_close
85sqlite_exec
86sqlite_last_insert_rowid
87sqlite_error_string
88sqlite_interrupt
89sqlite_complete
90sqlite_busy_handler
91sqlite_busy_timeout
92sqlite_get_table
93sqlite_free_table
94sqlite_mprintf
95sqlite_vmprintf
96sqlite_exec_printf
97sqlite_exec_vprintf
98sqlite_get_table_printf
99sqlite_get_table_vprintf
drhfa86c412002-02-02 15:01:15 +0000100sqlite_freemem
101sqlite_libversion
102sqlite_libencoding
drhef9f7082002-04-26 09:47:20 +0000103sqlite_changes
drh25197f42002-07-13 14:41:49 +0000104sqlite_create_function
105sqlite_create_aggregate
drh275ed722002-10-20 15:55:01 +0000106sqlite_function_type
drh25197f42002-07-13 14:41:49 +0000107sqlite_user_data
108sqlite_aggregate_context
109sqlite_aggregate_count
drhac729e22002-07-18 11:07:19 +0000110sqlite_set_result_string
drh25197f42002-07-13 14:41:49 +0000111sqlite_set_result_int
112sqlite_set_result_double
113sqlite_set_result_error
drh1c928532002-01-31 15:54:21 +0000114sqliteMalloc
115sqliteFree
116sqliteRealloc
drhfcb78a42003-01-18 20:11:05 +0000117sqlite_set_authorizer
118sqlite_trace
drhbe992ef2003-02-16 22:48:12 +0000119sqlite_compile
120sqlite_step
121sqlite_finalize
rdcb0c374f2004-02-20 22:53:38 +0000122sqlite_reset
123sqlite_bind
124sqlite_last_statement_changes
drh6da834a2004-03-14 22:11:59 +0000125sqlite_encode_binary
126sqlite_decode_binary
drh1c928532002-01-31 15:54:21 +0000127END_OF_FILE
drh1f66c572002-07-02 11:55:32 +0000128i386-mingw32msvc-dllwrap \
drh1c928532002-01-31 15:54:21 +0000129 --def sqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +0000130 --driver-name i386-mingw32msvc-gcc \
131 --dlltool-name i386-mingw32msvc-dlltool \
132 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +0000133 --target i386-mingw32 \
134 -dllname sqlite.dll -lmsvcrt *.o
drh1f66c572002-07-02 11:55:32 +0000135i386-mingw32msvc-strip sqlite.dll
drh1c928532002-01-31 15:54:21 +0000136mv sqlite.dll sqlite.def ..
drh90ca9752001-09-28 17:47:14 +0000137cd ..
drh1c928532002-01-31 15:54:21 +0000138rm -f tclsqlite.zip sqlitedll.zip
drh90ca9752001-09-28 17:47:14 +0000139zip tclsqlite.zip tclsqlite.dll
drh1c928532002-01-31 15:54:21 +0000140zip sqlitedll.zip sqlite.dll sqlite.def
drh90ca9752001-09-28 17:47:14 +0000141
142# Build the sqlite.exe executable for windows.
143#
144make target_source
145cd tsrc
146rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000147OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh1f66c572002-07-02 11:55:32 +0000148i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
drh90ca9752001-09-28 17:47:14 +0000149mv sqlite.exe ..
150cd ..
151rm -f sqlite.zip
152zip sqlite.zip sqlite.exe
153
154# Construct a tarball of the source tree
155#
156ORIGIN=`pwd`
157cd $srcdir
158cd ..
drha8b38d22001-11-01 14:41:34 +0000159EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
160tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000161cd $ORIGIN
162vers=`cat $srcdir/VERSION`
drh9d319762001-10-09 12:44:43 +0000163rm -f sqlite-$vers.tar.gz
drh90ca9752001-09-28 17:47:14 +0000164ln sqlite.tar.gz sqlite-$vers.tar.gz
165
doughenry1d366502002-03-29 01:29:53 +0000166#
167# Build RPMS (binary) and Source RPM
168#
169
drh203c2112002-03-29 18:16:04 +0000170# Make sure we are properly setup to build RPMs
171#
172echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
173echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
174mkdir $HOME/rpm
175mkdir $HOME/rpm/BUILD
176mkdir $HOME/rpm/SOURCES
177mkdir $HOME/rpm/RPMS
178mkdir $HOME/rpm/SRPMS
179mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000180
181# create the spec file from the template
182sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
183
184# copy the source tarball to the rpm directory
185cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/.
186
187# build all the rpms
188rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
189
drh203c2112002-03-29 18:16:04 +0000190# copy the RPMs into the build directory.
191ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm .
192ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm .
doughenry1d366502002-03-29 01:29:53 +0000193
194
drh90ca9752001-09-28 17:47:14 +0000195# Build the website
196#
197cp $srcdir/../historical/* .
drh9d319762001-10-09 12:44:43 +0000198rm -rf doc
drh90ca9752001-09-28 17:47:14 +0000199make doc
200ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc
drh1c928532002-01-31 15:54:21 +0000201ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc
drh203c2112002-03-29 18:16:04 +0000202ln *.rpm doc