blob: 5ce647f2bcc2de4af70d32595f5e4863f87fcd4b [file] [log] [blame]
drh90ca9752001-09-28 17:47:14 +00001#!/bin/sh
2#
drh22db44b2007-11-23 15:12:44 +00003# This script is used to compile SQLite and package everything up
4# so that it is ready to move to the SQLite website.
drh90ca9752001-09-28 17:47:14 +00005#
6
7# Set srcdir to the name of the directory that contains the publish.sh
8# script.
9#
10srcdir=`echo "$0" | sed 's%\(^.*\)/[^/][^/]*$%\1%'`
11
12# Get the makefile.
13#
drh76800322002-08-13 20:45:39 +000014cp $srcdir/Makefile.linux-gcc ./Makefile
drhe8a63422004-01-27 17:46:55 +000015chmod +x $srcdir/install-sh
drh90ca9752001-09-28 17:47:14 +000016
drh7b93ed32004-06-16 03:02:00 +000017# Get the current version number - needed to help build filenames
18#
19VERS=`cat $srcdir/VERSION`
20VERSW=`sed 's/\./_/g' $srcdir/VERSION`
drh611c8ca2007-04-02 15:04:34 +000021echo "VERSIONS: $VERS $VERSW"
drh7b93ed32004-06-16 03:02:00 +000022
23# Start by building an sqlite shell for linux.
drh90ca9752001-09-28 17:47:14 +000024#
25make clean
drh611c8ca2007-04-02 15:04:34 +000026make sqlite3.c
drh52d19f62007-05-08 18:30:36 +000027gcc -Os -Itsrc sqlite3.c tsrc/shell.c -o sqlite3 -ldl -lpthread
drh7b93ed32004-06-16 03:02:00 +000028strip sqlite3
29mv sqlite3 sqlite3-$VERS.bin
30gzip sqlite3-$VERS.bin
drh611c8ca2007-04-02 15:04:34 +000031chmod 644 sqlite3-$VERS.bin.gz
drh7b93ed32004-06-16 03:02:00 +000032mv sqlite3-$VERS.bin.gz doc
drh90ca9752001-09-28 17:47:14 +000033
drh4aec8b62004-08-28 16:19:00 +000034# Build a source archive useful for windows.
drh90ca9752001-09-28 17:47:14 +000035#
drh52d19f62007-05-08 18:30:36 +000036make target_source
37cd tsrc
38rm fts*
39rm -f ../doc/sqlite-source-$VERSW.zip
40zip ../doc/sqlite-source-$VERSW.zip *
41cd ..
drh611c8ca2007-04-02 15:04:34 +000042make sqlite3.c
drh3bbbd7d2007-10-01 13:59:48 +000043cp tsrc/sqlite3.h tsrc/sqlite3ext.h .
drh611c8ca2007-04-02 15:04:34 +000044pwd
drh3bbbd7d2007-10-01 13:59:48 +000045zip doc/sqlite-amalgamation-$VERSW.zip sqlite3.c sqlite3.h sqlite3ext.h
drh4aec8b62004-08-28 16:19:00 +000046
47# Build the sqlite.so and tclsqlite.so shared libraries
48# under Linux
49#
drh611c8ca2007-04-02 15:04:34 +000050make sqlite3.c
51TCLDIR=/home/drh/tcltk/846/linux/846linux
52TCLSTUBLIB=$TCLDIR/libtclstub8.4g.a
drh52d19f62007-05-08 18:30:36 +000053gcc -Os -shared -Itsrc sqlite3.c tsrc/tclsqlite.c $TCLSTUBLIB -o tclsqlite3.so
drh611c8ca2007-04-02 15:04:34 +000054strip tclsqlite3.so
55chmod 644 tclsqlite3.so
drh4aec8b62004-08-28 16:19:00 +000056mv tclsqlite3.so tclsqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000057gzip tclsqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000058mv tclsqlite-$VERS.so.gz doc
drh52d19f62007-05-08 18:30:36 +000059gcc -Os -shared -Itsrc sqlite3.c -o sqlite3.so
drh611c8ca2007-04-02 15:04:34 +000060strip sqlite3.so
61chmod 644 sqlite3.so
drh4aec8b62004-08-28 16:19:00 +000062mv sqlite3.so sqlite-$VERS.so
drh7b93ed32004-06-16 03:02:00 +000063gzip sqlite-$VERS.so
drh611c8ca2007-04-02 15:04:34 +000064mv sqlite-$VERS.so.gz doc
65
drh90ca9752001-09-28 17:47:14 +000066
drh4aec8b62004-08-28 16:19:00 +000067# Build the tclsqlite3.dll and sqlite3.dll shared libraries.
drh90ca9752001-09-28 17:47:14 +000068#
drh4aec8b62004-08-28 16:19:00 +000069. $srcdir/mkdll.sh
drh611c8ca2007-04-02 15:04:34 +000070echo zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
71zip doc/tclsqlite-$VERSW.zip tclsqlite3.dll
72echo zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
73zip doc/sqlitedll-$VERSW.zip sqlite3.dll sqlite3.def
drh90ca9752001-09-28 17:47:14 +000074
75# Build the sqlite.exe executable for windows.
76#
77make target_source
drha297b5c2002-01-15 18:39:43 +000078OPTS='-DSTATIC_BUILD=1 -DNDEBUG=1'
drh52d19f62007-05-08 18:30:36 +000079i386-mingw32msvc-gcc -Os $OPTS -Itsrc -I$TCLDIR sqlite3.c tsrc/shell.c \
drh611c8ca2007-04-02 15:04:34 +000080 -o sqlite3.exe
81zip doc/sqlite-$VERSW.zip sqlite3.exe
drh90ca9752001-09-28 17:47:14 +000082
83# Construct a tarball of the source tree
84#
85ORIGIN=`pwd`
86cd $srcdir
87cd ..
drh39171f32005-02-15 16:15:09 +000088mv sqlite sqlite-$VERS
89EXCLUDE=`find sqlite-$VERS -print | grep CVS | sed 's,^, --exclude ,'`
90tar czf $ORIGIN/doc/sqlite-$VERS.tar.gz $EXCLUDE sqlite-$VERS
91mv sqlite-$VERS sqlite
drh90ca9752001-09-28 17:47:14 +000092cd $ORIGIN
drh90ca9752001-09-28 17:47:14 +000093
doughenry1d366502002-03-29 01:29:53 +000094#
95# Build RPMS (binary) and Source RPM
96#
97
drh203c2112002-03-29 18:16:04 +000098# Make sure we are properly setup to build RPMs
99#
100echo "%HOME %{expand:%%(cd; pwd)}" > $HOME/.rpmmacros
101echo "%_topdir %{HOME}/rpm" >> $HOME/.rpmmacros
102mkdir $HOME/rpm
103mkdir $HOME/rpm/BUILD
104mkdir $HOME/rpm/SOURCES
105mkdir $HOME/rpm/RPMS
106mkdir $HOME/rpm/SRPMS
107mkdir $HOME/rpm/SPECS
doughenry1d366502002-03-29 01:29:53 +0000108
109# create the spec file from the template
drh7b93ed32004-06-16 03:02:00 +0000110sed s/SQLITE_VERSION/$VERS/g $srcdir/spec.template > $HOME/rpm/SPECS/sqlite.spec
doughenry1d366502002-03-29 01:29:53 +0000111
112# copy the source tarball to the rpm directory
drh7b93ed32004-06-16 03:02:00 +0000113cp doc/sqlite-$VERS.tar.gz $HOME/rpm/SOURCES/.
doughenry1d366502002-03-29 01:29:53 +0000114
115# build all the rpms
116rpm -ba $HOME/rpm/SPECS/sqlite.spec >& rpm-$vers.log
117
drh203c2112002-03-29 18:16:04 +0000118# copy the RPMs into the build directory.
drh7b93ed32004-06-16 03:02:00 +0000119mv $HOME/rpm/RPMS/i386/sqlite*-$vers*.rpm doc
120mv $HOME/rpm/SRPMS/sqlite-$vers*.rpm doc
doughenry1d366502002-03-29 01:29:53 +0000121
drh90ca9752001-09-28 17:47:14 +0000122# Build the website
123#
drh20753fb2004-07-22 18:53:17 +0000124#cp $srcdir/../historical/* doc
drh22db44b2007-11-23 15:12:44 +0000125#make doc
126#cd doc
127#chmod 644 *.gz