blob: e69288046c61e88c2f6a5ed059d62867e405f136 [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#
16cp $srcdir/Makefile.template ./Makefile
17
18# Start building stuff.
19#
20make clean
21make sqlite
22strip sqlite
23mv sqlite sqlite.bin
drh9d319762001-10-09 12:44:43 +000024rm -f sqlite.bin.gz
drh90ca9752001-09-28 17:47:14 +000025gzip sqlite.bin
26
27# Build the tclsqlite.so shared library for import into tclsh or wish
28# under Linux
29#
30make target_source
drh1c928532002-01-31 15:54:21 +000031rm sqlite_source.zip
drh90ca9752001-09-28 17:47:14 +000032cd tsrc
drh1c928532002-01-31 15:54:21 +000033zip ../sqlite_source.zip *
drh90ca9752001-09-28 17:47:14 +000034rm shell.c
35TCLDIR=/home/drh/tcltk/8.2linux
drh66f95a62001-09-28 18:10:55 +000036TCLSTUBLIB=$TCLDIR/libtclstub8.2g.a
drha297b5c2002-01-15 18:39:43 +000037OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1'
drh66f95a62001-09-28 18:10:55 +000038gcc -fPIC $OPTS -O2 -I. -I$TCLDIR -shared *.c $TCLSTUBLIB -o tclsqlite.so
drh90ca9752001-09-28 17:47:14 +000039strip tclsqlite.so
40mv tclsqlite.so ..
drh1c928532002-01-31 15:54:21 +000041rm tclsqlite.c
42gcc -fPIC -DNDEBUG=1 -O2 -I. -shared *.c -o sqlite.so
43strip sqlite.so
44mv sqlite.so ..
drh90ca9752001-09-28 17:47:14 +000045cd ..
drh1c928532002-01-31 15:54:21 +000046rm -f tclsqlite.so.gz sqlite.so.gz
drh90ca9752001-09-28 17:47:14 +000047gzip tclsqlite.so
drh1c928532002-01-31 15:54:21 +000048gzip sqlite.so
drh90ca9752001-09-28 17:47:14 +000049
50# Build the tclsqlite.dll shared library that can be imported into tclsh
51# or wish on windows.
52#
53make target_source
54cd tsrc
drh66f95a62001-09-28 18:10:55 +000055rm shell.c
drh90ca9752001-09-28 17:47:14 +000056TCLDIR=/home/drh/tcltk/8.2win
57TCLSTUBLIB=$TCLDIR/tclstub82.a
58PATH=$PATH:/opt/mingw/bin
drha297b5c2002-01-15 18:39:43 +000059OPTS='-DUSE_TCL_STUBS=1 -DNDEBUG=1 -DTHREADSAFE=1'
drh1f66c572002-07-02 11:55:32 +000060CC="i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR"
drh90ca9752001-09-28 17:47:14 +000061rm shell.c
62for i in *.c; do
63 CMD="$CC -c $i"
64 echo $CMD
65 $CMD
66done
67echo 'EXPORTS' >tclsqlite.def
68echo 'Tclsqlite_Init' >>tclsqlite.def
69echo 'Sqlite_Init' >>tclsqlite.def
drh1f66c572002-07-02 11:55:32 +000070i386-mingw32msvc-dllwrap \
drh90ca9752001-09-28 17:47:14 +000071 --def tclsqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +000072 --driver-name i386-mingw32msvc-gcc \
73 --dlltool-name i386-mingw32msvc-dlltool \
74 --as i386-mingw32msvc-as \
drh90ca9752001-09-28 17:47:14 +000075 --target i386-mingw32 \
76 -dllname tclsqlite.dll -lmsvcrt *.o $TCLSTUBLIB
drh1f66c572002-07-02 11:55:32 +000077i386-mingw32msvc-strip tclsqlite.dll
drh90ca9752001-09-28 17:47:14 +000078mv tclsqlite.dll ..
drh1c928532002-01-31 15:54:21 +000079rm tclsqlite.o
80cat >sqlite.def <<\END_OF_FILE
81EXPORTS
82sqlite_open
83sqlite_close
84sqlite_exec
85sqlite_last_insert_rowid
86sqlite_error_string
87sqlite_interrupt
88sqlite_complete
89sqlite_busy_handler
90sqlite_busy_timeout
91sqlite_get_table
92sqlite_free_table
93sqlite_mprintf
94sqlite_vmprintf
95sqlite_exec_printf
96sqlite_exec_vprintf
97sqlite_get_table_printf
98sqlite_get_table_vprintf
drhfa86c412002-02-02 15:01:15 +000099sqlite_freemem
100sqlite_libversion
101sqlite_libencoding
drhef9f7082002-04-26 09:47:20 +0000102sqlite_changes
drh1c928532002-01-31 15:54:21 +0000103sqliteMalloc
104sqliteFree
105sqliteRealloc
106END_OF_FILE
drh1f66c572002-07-02 11:55:32 +0000107i386-mingw32msvc-dllwrap \
drh1c928532002-01-31 15:54:21 +0000108 --def sqlite.def -v --export-all \
drh1f66c572002-07-02 11:55:32 +0000109 --driver-name i386-mingw32msvc-gcc \
110 --dlltool-name i386-mingw32msvc-dlltool \
111 --as i386-mingw32msvc-as \
drh1c928532002-01-31 15:54:21 +0000112 --target i386-mingw32 \
113 -dllname sqlite.dll -lmsvcrt *.o
drh1f66c572002-07-02 11:55:32 +0000114i386-mingw32msvc-strip sqlite.dll
drh1c928532002-01-31 15:54:21 +0000115mv sqlite.dll sqlite.def ..
drh90ca9752001-09-28 17:47:14 +0000116cd ..
drh1c928532002-01-31 15:54:21 +0000117rm -f tclsqlite.zip sqlitedll.zip
drh90ca9752001-09-28 17:47:14 +0000118zip tclsqlite.zip tclsqlite.dll
drh1c928532002-01-31 15:54:21 +0000119zip sqlitedll.zip sqlite.dll sqlite.def
drh90ca9752001-09-28 17:47:14 +0000120
121# Build the sqlite.exe executable for windows.
122#
123make target_source
124cd tsrc
125rm tclsqlite.c
drha297b5c2002-01-15 18:39:43 +0000126OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh1f66c572002-07-02 11:55:32 +0000127i386-mingw32msvc-gcc -O2 $OPTS -I. -I$TCLDIR *.c -o sqlite.exe
drh90ca9752001-09-28 17:47:14 +0000128mv sqlite.exe ..
129cd ..
130rm -f sqlite.zip
131zip sqlite.zip sqlite.exe
132
133# Construct a tarball of the source tree
134#
135ORIGIN=`pwd`
136cd $srcdir
137cd ..
drha8b38d22001-11-01 14:41:34 +0000138EXCLUDE=`find sqlite -print | grep CVS | sed 's,sqlite/, --exclude sqlite/,'`
139tar czf $ORIGIN/sqlite.tar.gz $EXCLUDE sqlite
drh90ca9752001-09-28 17:47:14 +0000140cd $ORIGIN
141vers=`cat $srcdir/VERSION`
drh9d319762001-10-09 12:44:43 +0000142rm -f sqlite-$vers.tar.gz
drh90ca9752001-09-28 17:47:14 +0000143ln sqlite.tar.gz sqlite-$vers.tar.gz
144
doughenry1d366502002-03-29 01:29:53 +0000145#
146# Build RPMS (binary) and Source RPM
147#
148
drh203c2112002-03-29 18:16:04 +0000149# Make sure we are properly setup to build RPMs
150#
151echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
152echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
153mkdir $HOME/rpm
154mkdir $HOME/rpm/BUILD
155mkdir $HOME/rpm/SOURCES
156mkdir $HOME/rpm/RPMS
157mkdir $HOME/rpm/SRPMS
158mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000159
160# create the spec file from the template
161sed s/SQLITE_VERSION/$vers/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
162
163# copy the source tarball to the rpm directory
164cp sqlite-$vers.tar.gz $HOME/rpm/SOURCES/.
165
166# build all the rpms
167rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
168
drh203c2112002-03-29 18:16:04 +0000169# copy the RPMs into the build directory.
170ln $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm .
171ln $HOME/rpm/SRPMS/sqlite-$vers*.rpm .
doughenry1d366502002-03-29 01:29:53 +0000172
173
drh90ca9752001-09-28 17:47:14 +0000174# Build the website
175#
176cp $srcdir/../historical/* .
drh9d319762001-10-09 12:44:43 +0000177rm -rf doc
drh90ca9752001-09-28 17:47:14 +0000178make doc
179ln sqlite.bin.gz sqlite.zip sqlite*.tar.gz tclsqlite.so.gz tclsqlite.zip doc
drh1c928532002-01-31 15:54:21 +0000180ln sqlitedll.zip sqlite.so.gz sqlite_source.zip doc
drh203c2112002-03-29 18:16:04 +0000181ln *.rpm doc