dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 1 | #!/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 | # |
| 20 | set -e |
| 21 | set -u |
| 22 | |
| 23 | TMPSPACE=./mkpkg_tmp_dir |
| 24 | VERSION=`cat $TOP/VERSION` |
drh | 07f7656 | 2016-02-09 22:39:39 +0000 | [diff] [blame] | 25 | HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid` |
drh | dd2b59b | 2016-02-10 13:36:17 +0000 | [diff] [blame] | 26 | DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'` |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 27 | |
drh | 07f7656 | 2016-02-09 22:39:39 +0000 | [diff] [blame] | 28 | # 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 | # |
| 32 | if test "$#" -ge 1 -a x$1 != x--snapshot |
| 33 | then |
| 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 |
drh | 8809d82 | 2016-02-09 22:54:39 +0000 | [diff] [blame] | 42 | TARBALLNAME=`printf "sqlite-autoconf-3%.2d%.2d%.2d" $xx $yy $zz` |
drh | 07f7656 | 2016-02-09 22:39:39 +0000 | [diff] [blame] | 43 | else |
drh | 8809d82 | 2016-02-09 22:54:39 +0000 | [diff] [blame] | 44 | TARBALLNAME=sqlite-snapshot-$DATETIME |
drh | 07f7656 | 2016-02-09 22:39:39 +0000 | [diff] [blame] | 45 | fi |
dan | 7dd8d0a | 2013-08-23 12:04:52 +0000 | [diff] [blame] | 46 | |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 47 | rm -rf $TMPSPACE |
drh | ac779bc | 2016-01-23 20:09:30 +0000 | [diff] [blame] | 48 | cp -R $TOP/autoconf $TMPSPACE |
| 49 | cp sqlite3.c $TMPSPACE |
| 50 | cp sqlite3.h $TMPSPACE |
| 51 | cp sqlite3ext.h $TMPSPACE |
| 52 | cp $TOP/sqlite3.1 $TMPSPACE |
| 53 | cp $TOP/sqlite3.pc.in $TMPSPACE |
drh | 0a38646 | 2017-10-12 14:13:20 +0000 | [diff] [blame] | 54 | cp shell.c $TMPSPACE |
drh | ac779bc | 2016-01-23 20:09:30 +0000 | [diff] [blame] | 55 | cp $TOP/src/sqlite3.rc $TMPSPACE |
mistachkin | 9aeb971 | 2016-02-26 23:13:16 +0000 | [diff] [blame] | 56 | cp $TOP/tool/Replace.cs $TMPSPACE |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 57 | |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 58 | cat $TMPSPACE/configure.ac | |
dan | 991c5d6 | 2015-12-15 19:32:12 +0000 | [diff] [blame] | 59 | sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 60 | mv $TMPSPACE/tmp $TMPSPACE/configure.ac |
| 61 | |
| 62 | cd $TMPSPACE |
dan | 991c5d6 | 2015-12-15 19:32:12 +0000 | [diff] [blame] | 63 | autoreconf -i |
| 64 | #libtoolize |
| 65 | #aclocal |
| 66 | #autoconf |
| 67 | #automake --add-missing |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 68 | |
| 69 | mkdir -p tea/generic |
| 70 | echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c |
| 71 | echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c |
| 72 | echo "#else" >> tea/generic/tclsqlite3.c |
dan | edf5b16 | 2014-08-19 09:15:41 +0000 | [diff] [blame] | 73 | echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 74 | echo "#endif" >> tea/generic/tclsqlite3.c |
| 75 | cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c |
| 76 | |
drh | b43be55 | 2015-01-15 15:47:06 +0000 | [diff] [blame] | 77 | cat tea/configure.ac | |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 78 | sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp |
drh | b43be55 | 2015-01-15 15:47:06 +0000 | [diff] [blame] | 79 | mv tmp tea/configure.ac |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 80 | |
| 81 | cd tea |
| 82 | autoconf |
| 83 | rm -rf autom4te.cache |
| 84 | |
| 85 | cd ../ |
| 86 | ./configure && make dist |
dan | 7dd8d0a | 2013-08-23 12:04:52 +0000 | [diff] [blame] | 87 | tar -xzf sqlite-$VERSION.tar.gz |
drh | 8809d82 | 2016-02-09 22:54:39 +0000 | [diff] [blame] | 88 | mv sqlite-$VERSION $TARBALLNAME |
| 89 | tar -czf $TARBALLNAME.tar.gz $TARBALLNAME |
| 90 | mv $TARBALLNAME.tar.gz .. |
drh | 07f7656 | 2016-02-09 22:39:39 +0000 | [diff] [blame] | 91 | cd .. |
drh | 8809d82 | 2016-02-09 22:54:39 +0000 | [diff] [blame] | 92 | ls -l $TARBALLNAME.tar.gz |