release.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. #
  3. # Use this script to easily make releases of Jansson. It configures
  4. # the source tree, and builds and signs all tarballs.
  5. die() {
  6. echo $1 >&2
  7. exit 1
  8. }
  9. confirm() {
  10. local answer
  11. read -p "$1 [yN]: " answer
  12. [ "$answer" = "Y" -o "$answer" = "y" ] || exit 0
  13. }
  14. set -e
  15. [ -f configure.ac ] || die "Must be run at project root directory"
  16. # Determine version
  17. v=$(grep AC_INIT configure.ac | sed -r 's/.*, \[(.+?)\],.*/\1/')
  18. [ -n "$v" ] || die "Unable to determine version"
  19. confirm "Version is $v, proceed?"
  20. # Sanity checks
  21. vi=$(grep version-info src/Makefile.am | sed 's/^[ \t]*//g' | cut -d" " -f2)
  22. confirm "Libtool version-info is $vi, proceed?"
  23. r=$(grep 'Released ' CHANGES | head -n 1)
  24. confirm "Last CHANGES entry says \"$r\", proceed??"
  25. dv=$(grep ^version doc/conf.py | sed -r "s/.*'(.*)'.*/\1/")
  26. if [ "$dv" != "$v" ]; then
  27. die "Documentation version ($dv) doesn't match library version"
  28. fi
  29. [ -f Makefile ] && make distclean || true
  30. rm -f jansson-$v.tar.*
  31. rm -rf jansson-$v-doc
  32. rm -f jansson-$v-doc.tar.*
  33. autoreconf -fi
  34. ./configure
  35. # Run tests and make gz source tarball
  36. : ${VALGRIND:=1}
  37. export VALGRIND
  38. make distcheck
  39. # Make bzip2 source tarball
  40. make dist-bzip2
  41. # Sign source tarballs
  42. for s in gz bz2; do
  43. gpg --detach-sign --armor jansson-$v.tar.$s
  44. done
  45. # Build documentation
  46. make html
  47. mv doc/_build/html jansson-$v-doc
  48. # Make and sign documentation tarballs
  49. for s in gz bz2; do
  50. [ $s = gz ] && compress=gzip
  51. [ $s = bz2 ] && compress=bzip2
  52. tar cf - jansson-$v-doc | $compress -9 -c > jansson-$v-doc.tar.$s
  53. gpg --detach-sign --armor jansson-$v-doc.tar.$s
  54. done
  55. echo "All done"