mkautoconfamal.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. # 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. HASH=`sed 's/^\(..........\).*/\1/' $TOP/manifest.uuid`
  23. DATETIME=`grep '^D' $TOP/manifest | sed -e 's/[^0-9]//g' -e 's/\(............\).*/\1/'`
  24. # Verify that the version number in the TEA autoconf file is correct.
  25. # Fail with an error if not.
  26. #
  27. if grep $VERSION $TOP/autoconf/tea/configure.ac
  28. then echo "TEA version number ok"
  29. else echo "TEA version number mismatch. Should be $VERSION"; exit 1
  30. fi
  31. # If this script is given an argument of --snapshot, then generate a
  32. # snapshot tarball named for the current checkout SHA1 hash, rather than
  33. # the version number.
  34. #
  35. if test "$#" -ge 1 -a x$1 != x--snapshot
  36. then
  37. # Set global variable $ARTIFACT to the "3xxyyzz" string incorporated
  38. # into artifact filenames. And $VERSION2 to the "3.x.y[.z]" form.
  39. xx=`echo $VERSION|sed 's/3\.\([0-9]*\)\..*/\1/'`
  40. yy=`echo $VERSION|sed 's/3\.[^.]*\.\([0-9]*\).*/\1/'`
  41. zz=0
  42. set +e
  43. zz=`echo $VERSION|sed 's/3\.[^.]*\.[^.]*\.\([0-9]*\).*/\1/'|grep -v '\.'`
  44. set -e
  45. TARBALLNAME=`printf "sqlite-autoconf-3%.2d%.2d%.2d" $xx $yy $zz`
  46. else
  47. TARBALLNAME=sqlite-snapshot-$DATETIME
  48. fi
  49. rm -rf $TMPSPACE
  50. cp -R $TOP/autoconf $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. cat $TMPSPACE/configure.ac |
  61. sed "s/--SQLITE-VERSION--/$VERSION/" > $TMPSPACE/tmp
  62. mv $TMPSPACE/tmp $TMPSPACE/configure.ac
  63. cd $TMPSPACE
  64. autoreconf -i
  65. #libtoolize
  66. #aclocal
  67. #autoconf
  68. #automake --add-missing
  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
  73. echo "#include \"sqlite3.c\"" >> tea/generic/tclsqlite3.c
  74. echo "#endif" >> tea/generic/tclsqlite3.c
  75. cat $TOP/src/tclsqlite.c >> tea/generic/tclsqlite3.c
  76. cat tea/configure.ac |
  77. sed "s/AC_INIT(\[sqlite\], .*)/AC_INIT([sqlite], [$VERSION])/" > tmp
  78. mv tmp tea/configure.ac
  79. cd tea
  80. autoconf
  81. rm -rf autom4te.cache
  82. cd ../
  83. ./configure && make dist
  84. tar -xzf sqlite-$VERSION.tar.gz
  85. mv sqlite-$VERSION $TARBALLNAME
  86. tar -czf $TARBALLNAME.tar.gz $TARBALLNAME
  87. mv $TARBALLNAME.tar.gz ..
  88. cd ..
  89. ls -l $TARBALLNAME.tar.gz