blob: eacd9fa515b4d46b85d0cf7af4873c3228fe7d7d [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#
mistachkin7cff0e32020-06-19 15:33:23 +00005# 1. The files "sqlite3.c", "sqlite3.h", "sqlite3ext.h", "shell.c",
6# and "sqlite3rc.h" are available in the current directory.
dan555c9392013-05-27 18:37:33 +00007#
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`
drh07f76562016-02-09 22:39:39 +000025HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid`
drhdd2b59b2016-02-10 13:36:17 +000026DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'`
dan555c9392013-05-27 18:37:33 +000027
drh07f76562016-02-09 22:39:39 +000028# If this script is given an argument of --snapshot, then generate a
29# snapshot tarball named for the current checkout SHA1 hash, rather than
30# the version number.
31#
32if test "$#" -ge 1 -a x$1 != x--snapshot
33then
34 # Set global variable $ARTIFACT to the "3xxyyzz" string incorporated
35 # into artifact filenames. And $VERSION2 to the "3.x.y[.z]" form.
36 xx=`echo $VERSION|sed 's/3\.\([0-9]*\)\..*/\1/'`
37 yy=`echo $VERSION|sed 's/3\.[^.]*\.\([0-9]*\).*/\1/'`
38 zz=0
39 set +e
40 zz=`echo $VERSION|sed 's/3\.[^.]*\.[^.]*\.\([0-9]*\).*/\1/'|grep -v '\.'`
41 set -e
drh8809d822016-02-09 22:54:39 +000042 TARBALLNAME=`printf "sqlite-autoconf-3%.2d%.2d%.2d" $xx $yy $zz`
drh07f76562016-02-09 22:39:39 +000043else
drh8809d822016-02-09 22:54:39 +000044 TARBALLNAME=sqlite-snapshot-$DATETIME
drh07f76562016-02-09 22:39:39 +000045fi
dan7dd8d0a2013-08-23 12:04:52 +000046
dan555c9392013-05-27 18:37:33 +000047rm -rf $TMPSPACE
drhac779bc2016-01-23 20:09:30 +000048cp -R $TOP/autoconf $TMPSPACE
49cp sqlite3.c $TMPSPACE
50cp sqlite3.h $TMPSPACE
51cp sqlite3ext.h $TMPSPACE
mistachkin7cff0e32020-06-19 15:33:23 +000052cp sqlite3rc.h $TMPSPACE
drhac779bc2016-01-23 20:09:30 +000053cp $TOP/sqlite3.1 $TMPSPACE
54cp $TOP/sqlite3.pc.in $TMPSPACE
drh0a386462017-10-12 14:13:20 +000055cp shell.c $TMPSPACE
drhac779bc2016-01-23 20:09:30 +000056cp $TOP/src/sqlite3.rc $TMPSPACE
mistachkin9aeb9712016-02-26 23:13:16 +000057cp $TOP/tool/Replace.cs $TMPSPACE
dan555c9392013-05-27 18:37:33 +000058
dan555c9392013-05-27 18:37:33 +000059cat $TMPSPACE/configure.ac |
dan991c5d62015-12-15 19:32:12 +000060sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp
dan555c9392013-05-27 18:37:33 +000061mv $TMPSPACE/tmp $TMPSPACE/configure.ac
62
63cd $TMPSPACE
dan991c5d62015-12-15 19:32:12 +000064autoreconf -i
65#libtoolize
66#aclocal
67#autoconf
68#automake --add-missing
dan555c9392013-05-27 18:37:33 +000069
70mkdir -p tea/generic
71echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c
72echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c
73echo "#else" >> tea/generic/tclsqlite3.c
danedf5b162014-08-19 09:15:41 +000074echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c
dan555c9392013-05-27 18:37:33 +000075echo "#endif" >> tea/generic/tclsqlite3.c
mistachkin96e3c392020-06-19 15:35:07 +000076cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
dan555c9392013-05-27 18:37:33 +000077
drhb43be552015-01-15 15:47:06 +000078cat tea/configure.ac |
dan555c9392013-05-27 18:37:33 +000079 sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp
drhb43be552015-01-15 15:47:06 +000080mv tmp tea/configure.ac
dan555c9392013-05-27 18:37:33 +000081
82cd tea
83autoconf
84rm -rf autom4te.cache
85
86cd ../
87./configure && make dist
dan7dd8d0a2013-08-23 12:04:52 +000088tar -xzf sqlite-$VERSION.tar.gz
drh8809d822016-02-09 22:54:39 +000089mv sqlite-$VERSION $TARBALLNAME
90tar -czf $TARBALLNAME.tar.gz $TARBALLNAME
91mv $TARBALLNAME.tar.gz ..
drh07f76562016-02-09 22:39:39 +000092cd ..
drh8809d822016-02-09 22:54:39 +000093ls -l $TARBALLNAME.tar.gz