blob: 4829277234b0de11ec024d6876dea49369c6ecb0 [file] [log] [blame]
dan555c9392013-05-27 18:37:33 +00001#!/bin/sh
2# This script is used to build the amalgamation autoconf package.
3# It assumes the following:
4#
5# 1. The files "sqlite3.c", "sqlite3.h" and "sqlite3ext.h"
6# are available in the current directory.
7#
8# 2. Variable $TOP is set to the full path of the root directory
9# of the SQLite source tree.
10#
11# 3. There is nothing of value in the ./mkpkg_tmp_dir directory.
12# This is important, as the script executes "rm -rf ./mkpkg_tmp_dir".
13#
14
15
16# Bail out of the script if any command returns a non-zero exit
17# status. Or if the script tries to use an unset variable. These
18# may fail for old /bin/sh interpreters.
19#
20set -e
21set -u
22
23TMPSPACE=./mkpkg_tmp_dir
24VERSION=`cat $TOP/VERSION`
25
dan7dd8d0a2013-08-23 12:04:52 +000026# Set global variable $ARTIFACT to the "3xxyyzz" string incorporated
27# into artifact filenames. And $VERSION2 to the "3.x.y[.z]" form.
28xx=`echo $VERSION|sed 's/3\.\([0-9]*\)\..*/\1/'`
29yy=`echo $VERSION|sed 's/3\.[^.]*\.\([0-9]*\).*/\1/'`
30zz=0
31set +e
32 zz=`echo $VERSION|sed 's/3\.[^.]*\.[^.]*\.\([0-9]*\).*/\1/'|grep -v '\.'`
33set -e
34ARTIFACT=`printf "3%.2d%.2d%.2d" $xx $yy $zz`
35
dan555c9392013-05-27 18:37:33 +000036rm -rf $TMPSPACE
37cp -R $TOP/autoconf $TMPSPACE
38
39cp sqlite3.c $TMPSPACE
40cp sqlite3.h $TMPSPACE
41cp sqlite3ext.h $TMPSPACE
42cp $TOP/sqlite3.1 $TMPSPACE
43cp $TOP/sqlite3.pc.in $TMPSPACE
44cp $TOP/src/shell.c $TMPSPACE
45
46chmod 755 $TMPSPACE/install-sh
47chmod 755 $TMPSPACE/missing
48chmod 755 $TMPSPACE/depcomp
49chmod 755 $TMPSPACE/config.sub
50chmod 755 $TMPSPACE/config.guess
51
52cat $TMPSPACE/configure.ac |
53sed "s/AC_INIT(sqlite, .*, http:\/\/www.sqlite.org)/AC_INIT(sqlite, $VERSION, http:\/\/www.sqlite.org)/" > $TMPSPACE/tmp
54mv $TMPSPACE/tmp $TMPSPACE/configure.ac
55
56cd $TMPSPACE
57aclocal
58autoconf
59automake
60
61mkdir -p tea/generic
62echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c
63echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c
64echo "#else" >> tea/generic/tclsqlite3.c
danedf5b162014-08-19 09:15:41 +000065echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c
dan555c9392013-05-27 18:37:33 +000066echo "#endif" >> tea/generic/tclsqlite3.c
67cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
68
69cat tea/configure.in |
70 sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp
71mv tmp tea/configure.in
72
73cd tea
74autoconf
75rm -rf autom4te.cache
76
77cd ../
78./configure && make dist
dan7dd8d0a2013-08-23 12:04:52 +000079tar -xzf sqlite-$VERSION.tar.gz
80mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT
81tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT
82mv sqlite-autoconf-$ARTIFACT.tar.gz ..
dan555c9392013-05-27 18:37:33 +000083