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` |
| 25 | |
dan | 7dd8d0a | 2013-08-23 12:04:52 +0000 | [diff] [blame] | 26 | # Set global variable $ARTIFACT to the "3xxyyzz" string incorporated |
| 27 | # into artifact filenames. And $VERSION2 to the "3.x.y[.z]" form. |
| 28 | xx=`echo $VERSION|sed 's/3\.\([0-9]*\)\..*/\1/'` |
| 29 | yy=`echo $VERSION|sed 's/3\.[^.]*\.\([0-9]*\).*/\1/'` |
| 30 | zz=0 |
| 31 | set +e |
| 32 | zz=`echo $VERSION|sed 's/3\.[^.]*\.[^.]*\.\([0-9]*\).*/\1/'|grep -v '\.'` |
| 33 | set -e |
| 34 | ARTIFACT=`printf "3%.2d%.2d%.2d" $xx $yy $zz` |
| 35 | |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 36 | rm -rf $TMPSPACE |
| 37 | cp -R $TOP/autoconf $TMPSPACE |
| 38 | |
| 39 | cp sqlite3.c $TMPSPACE |
| 40 | cp sqlite3.h $TMPSPACE |
| 41 | cp sqlite3ext.h $TMPSPACE |
| 42 | cp $TOP/sqlite3.1 $TMPSPACE |
| 43 | cp $TOP/sqlite3.pc.in $TMPSPACE |
| 44 | cp $TOP/src/shell.c $TMPSPACE |
| 45 | |
| 46 | chmod 755 $TMPSPACE/install-sh |
| 47 | chmod 755 $TMPSPACE/missing |
| 48 | chmod 755 $TMPSPACE/depcomp |
| 49 | chmod 755 $TMPSPACE/config.sub |
| 50 | chmod 755 $TMPSPACE/config.guess |
| 51 | |
| 52 | cat $TMPSPACE/configure.ac | |
| 53 | sed "s/AC_INIT(sqlite, .*, http:\/\/www.sqlite.org)/AC_INIT(sqlite, $VERSION, http:\/\/www.sqlite.org)/" > $TMPSPACE/tmp |
| 54 | mv $TMPSPACE/tmp $TMPSPACE/configure.ac |
| 55 | |
| 56 | cd $TMPSPACE |
| 57 | aclocal |
| 58 | autoconf |
| 59 | automake |
| 60 | |
| 61 | mkdir -p tea/generic |
| 62 | echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c |
| 63 | echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c |
| 64 | echo "#else" >> tea/generic/tclsqlite3.c |
dan | edf5b16 | 2014-08-19 09:15:41 +0000 | [diff] [blame] | 65 | echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 66 | echo "#endif" >> tea/generic/tclsqlite3.c |
| 67 | cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c |
| 68 | |
| 69 | cat tea/configure.in | |
| 70 | sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp |
| 71 | mv tmp tea/configure.in |
| 72 | |
| 73 | cd tea |
| 74 | autoconf |
| 75 | rm -rf autom4te.cache |
| 76 | |
| 77 | cd ../ |
| 78 | ./configure && make dist |
dan | 7dd8d0a | 2013-08-23 12:04:52 +0000 | [diff] [blame] | 79 | tar -xzf sqlite-$VERSION.tar.gz |
| 80 | mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT |
| 81 | tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT |
| 82 | mv sqlite-autoconf-$ARTIFACT.tar.gz .. |
dan | 555c939 | 2013-05-27 18:37:33 +0000 | [diff] [blame] | 83 | |