blob: d9cdcaecbc81a10128d8b0239ed2c8642285e1a4 [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`
drh611c8ca2007-04-02 15:04:34 +000023echo "VERSIONS: $VERS $VERSW"
drh7b93ed32004-06-16 03:02:00 +000024
25# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000026#
27make clean
drh611c8ca2007-04-02 15:04:34 +000028make sqlite3.c
29gcc -O2 -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl -lpthread
drh7b93ed32004-06-16 03:02:00 +000030strip sqlite3
31mv sqlite3 sqlite3-$VERS.bin
32gzip sqlite3-$VERS.bin
drh611c8ca2007-04-02 15:04:34 +000033chmod 644 sqlite3-$VERS.bin.gz
drh7b93ed32004-06-16 03:02:00 +000034mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000035
drh4aec8b62004-08-28 16:19:00 +000036# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000037#
drh611c8ca2007-04-02 15:04:34 +000038make sqlite3.c
39cp tsrc/sqlite3.h .
40pwd
41zip doc/sqlite-source-$VERSW.zip sqlite3.c sqlite3.h
drh4aec8b62004-08-28 16:19:00 +000042
43# Build the sqlite.so and tclsqlite.so shared libraries
44# under Linux
45#
drh611c8ca2007-04-02 15:04:34 +000046make sqlite3.c
47TCLDIR=/home/drh/tcltk/846/linux/846linux
48TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
49gcc -O2 -shared -Itsrc sqlite3.c tsrc/tclsqlite.c $TCLSTUBLIB -o tclsqlite3.so
50strip tclsqlite3.so
51chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000052mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000053gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000054mv tclsqlite-$VERS.so.gz doc
55gcc -O2 -shared -Itsrc sqlite3.c -o sqlite3.so
56strip sqlite3.so
57chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000058mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000059gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000060mv sqlite-$VERS.so.gz doc
61
drh90ca9752001-09-28 17:47:14 +000062
drh4aec8b62004-08-28 16:19:00 +000063# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000064#
drh4aec8b62004-08-28 16:19:00 +000065. $srcdir/mkdll.sh
drh611c8ca2007-04-02 15:04:34 +000066echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
67zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
68echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
69zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000070
71# Build the sqlite.exe executable for windows.
72#
73make target_source
drha297b5c2002-01-15 18:39:43 +000074OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh611c8ca2007-04-02 15:04:34 +000075i386-mingw32msvc-gcc -O2 $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
76 -o sqlite3.exe
77zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000078
79# Construct a tarball of the source tree
80#
81ORIGIN=`pwd`
82cd $srcdir
83cd ..
drh39171f32005-02-15 16:15:09 +000084mv sqlite sqlite-$VERS
85EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'`
86tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
87mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000088cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +000089
doughenry1d366502002-03-29 01:29:53 +000090#
91# Build RPMS (binary) and Source RPM
92#
93
drh203c2112002-03-29 18:16:04 +000094# Make sure we are properly setup to build RPMs
95#
96echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
97echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
98mkdir $HOME/rpm
99mkdir $HOME/rpm/BUILD
100mkdir $HOME/rpm/SOURCES
101mkdir $HOME/rpm/RPMS
102mkdir $HOME/rpm/SRPMS
103mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000104
105# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000106sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000107
108# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000109cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000110
111# build all the rpms
112rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
113
drh203c2112002-03-29 18:16:04 +0000114# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000115mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
116mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000117
drh90ca9752001-09-28 17:47:14 +0000118# Build the website
119#
drh20753fb2004-07-22 18:53:17 +0000120#cp $srcdir/../historical/* doc
drh90ca9752001-09-28 17:47:14 +0000121make doc
drh5bd71932006-01-24 02:00:32 +0000122cd doc
123chmod 644 *.gz