mkautoconfamal.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. # Bail out of the script if any command returns a non-zero exit
  15. # status. Or if the script tries to use an unset variable. These
  16. # may fail for old /bin/sh interpreters.
  17. #
  18. set -e
  19. set -u
  20. TMPSPACE=./mkpkg_tmp_dir
  21. VERSION=`cat $TOP/VERSION`
  22. # Set global variable $ARTIFACT to the "3xxyyzz" string incorporated
  23. # into artifact filenames. And $VERSION2 to the "3.x.y[.z]" form.
  24. xx=`echo $VERSION|sed 's/3\.\([0-9]*\)\..*/\1/'`
  25. yy=`echo $VERSION|sed 's/3\.[^.]*\.\([0-9]*\).*/\1/'`
  26. zz=0
  27. set +e
  28. zz=`echo $VERSION|sed 's/3\.[^.]*\.[^.]*\.\([0-9]*\).*/\1/'|grep -v '\.'`
  29. set -e
  30. ARTIFACT=`printf "3%.2d%.2d%.2d" $xx $yy $zz`
  31. rm -rf $TMPSPACE
  32. cp -R $TOP/autoconf $TMPSPACE
  33. cp sqlite3.c $TMPSPACE
  34. cp sqlite3.h $TMPSPACE
  35. cp sqlite3ext.h $TMPSPACE
  36. cp $TOP/sqlite3.1 $TMPSPACE
  37. cp $TOP/sqlite3.pc.in $TMPSPACE
  38. cp $TOP/src/shell.c $TMPSPACE
  39. chmod 755 $TMPSPACE/install-sh
  40. chmod 755 $TMPSPACE/missing
  41. chmod 755 $TMPSPACE/depcomp
  42. chmod 755 $TMPSPACE/config.sub
  43. chmod 755 $TMPSPACE/config.guess
  44. cat $TMPSPACE/configure.ac |
  45. sed "s/AC_INIT(sqlite, .*, http:\/\/www.sqlite.org)/AC_INIT(sqlite, $VERSION, http:\/\/www.sqlite.org)/" > $TMPSPACE/tmp
  46. mv $TMPSPACE/tmp $TMPSPACE/configure.ac
  47. cd $TMPSPACE
  48. aclocal
  49. autoconf
  50. automake
  51. mkdir -p tea/generic
  52. echo "#ifdef USE_SYSTEM_SQLITE" > tea/generic/tclsqlite3.c
  53. echo "# include <sqlite3.h>" >> tea/generic/tclsqlite3.c
  54. echo "#else" >> tea/generic/tclsqlite3.c
  55. echo "#include \"../../sqlite3.c\"" >> tea/generic/tclsqlite3.c
  56. echo "#endif" >> tea/generic/tclsqlite3.c
  57. cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
  58. cat tea/configure.in |
  59. sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp
  60. mv tmp tea/configure.in
  61. cd tea
  62. autoconf
  63. rm -rf autom4te.cache
  64. cd ../
  65. ./configure && make dist
  66. tar -xzf sqlite-$VERSION.tar.gz
  67. mv sqlite-$VERSION sqlite-autoconf-$ARTIFACT
  68. tar -czf sqlite-autoconf-$ARTIFACT.tar.gz sqlite-autoconf-$ARTIFACT
  69. mv sqlite-autoconf-$ARTIFACT.tar.gz ..