sqlite
[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.
Brought by drakestapleton
sqlite / tool / mkautoconfamal.sh
| 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", "sqlite3ext.h", "shell.c", |
| 6 | # and "sqlite3rc.h" 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` |
| 25 | HASH=`cut -c1-10 $TOP/manifest.uuid` |
| 26 | DATETIME=`grep '^D' $TOP/manifest | tr -c -d '[0-9]' | cut -c1-12` |
| 27 | |
| 28 | # If this script is given an argument of --snapshot, then generate a |
| 29 | # snapshot tarball named for the current checkout SHA 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 |
| 42 | TARBALLNAME=`printf "sqlite-autoconf-3%.2d%.2d%.2d" $xx $yy $zz` |
| 43 | else |
| 44 | TARBALLNAME=sqlite-snapshot-$DATETIME |
| 45 | fi |
| 46 | |
| 47 | rm -rf $TMPSPACE |
| 48 | cp -R $TOP/autoconf $TMPSPACE |
| 49 | cp -R $TOP/autosetup $TMPSPACE |
| 50 | cp -p $TOP/configure $TMPSPACE |
| 51 | cp sqlite3.c $TMPSPACE |
| 52 | cp sqlite3.h $TMPSPACE |
| 53 | cp sqlite3ext.h $TMPSPACE |
| 54 | cp sqlite3rc.h $TMPSPACE |
| 55 | cp $TOP/sqlite3.1 $TMPSPACE |
| 56 | cp $TOP/sqlite3.pc.in $TMPSPACE |
| 57 | cp shell.c $TMPSPACE |
| 58 | cp $TOP/src/sqlite3.rc $TMPSPACE |
| 59 | cp $TOP/tool/Replace.cs $TMPSPACE |
| 60 | cp $TOP/VERSION $TMPSPACE |
| 61 | cp $TOP/main.mk $TMPSPACE |
| 62 | cp $TOP/make.bat $TMPSPACE |
| 63 | tree $TMPSPACE |
| 64 | cd $TMPSPACE |
| 65 | |
| 66 | #if true; then |
| 67 | # Clean up *~ files (emacs-generated backups). |
| 68 | # This bit is only for use during development of |
| 69 | # the autoconf bundle. |
| 70 | # find . -name '*~' -exec rm \{} \; |
| 71 | #fi |
| 72 | |
| 73 | mkdir -p tea/generic |
| 74 | cat <<EOF > tea/generic/tclsqlite3.c |
| 75 | #ifdef USE_SYSTEM_SQLITE |
| 76 | # include <sqlite3.h> |
| 77 | #else |
| 78 | # include "sqlite3.c" |
| 79 | #endif |
| 80 | EOF |
| 81 | cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c |
| 82 | |
| 83 | # Clean up some local remnants from the tarball. |
| 84 | rm -f tea/.env-* # autosetup environment overrides |
| 85 | find . -type f -name '*~' -exec rm -f \{} \; # backup files |
| 86 | find . -type f -name '#*#' -exec rm -f \{} \; # emacs lock files |
| 87 | find . -type f -name '*.o' -exec rm -f \{} \; |
| 88 | find . -type f -name '*.so' -exec rm -f \{} \; |
| 89 | |
| 90 | ./configure && ${MAKE-make} dist |
| 91 | tar xzf sqlite-$VERSION.tar.gz |
| 92 | mv sqlite-$VERSION $TARBALLNAME |
| 93 | tar czf $TARBALLNAME.tar.gz $TARBALLNAME |
| 94 | mv $TARBALLNAME.tar.gz .. |
| 95 | cd .. |
| 96 | ls -l $TARBALLNAME.tar.gz |