make_release 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. #
  3. # Ceres Solver - A fast non-linear least squares minimizer
  4. # Copyright 2015 Google Inc. All rights reserved.
  5. # http://ceres-solver.org/
  6. #
  7. # Redistribution and use in source and binary forms, with or without
  8. # modification, are permitted provided that the following conditions are met:
  9. #
  10. # * Redistributions of source code must retain the above copyright notice,
  11. # this list of conditions and the following disclaimer.
  12. # * Redistributions in binary form must reproduce the above copyright notice,
  13. # this list of conditions and the following disclaimer in the documentation
  14. # and/or other materials provided with the distribution.
  15. # * Neither the name of Google Inc. nor the names of its contributors may be
  16. # used to endorse or promote products derived from this software without
  17. # specific prior written permission.
  18. #
  19. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. # POSSIBILITY OF SUCH DAMAGE.
  30. #
  31. # Author: mierle@gmail.com (Keir Mierle)
  32. #
  33. # Note: You will need Sphinx and Pygments installed for this to work.
  34. if [ -z $1 ] ; then
  35. echo 'usage: scripts/make_release <version>'
  36. echo ' must be run from toplevel Ceres source directory'
  37. exit 1
  38. fi
  39. TMP="/tmp/ceres-solver-$1"
  40. DOCS_TMP="/tmp/ceres-solver-docs-$1"
  41. VERSION=$(grep '#define CERES_VERSION_' include/ceres/version.h | \
  42. sed -e 's/#define CERES_VERSION_STRING.*$//' | \
  43. sed -e 's/\(^#define CERES_VERSION_[MR^S].[A-Z]*\) \([0-9]\)/\2/' | \
  44. tr '\n' '.' | \
  45. sed -e 's/..$//')
  46. GIT_COMMIT=$(git log -1 HEAD |grep commit)
  47. if [[ $1 != $VERSION ]] ; then
  48. echo "ERROR: Version from the command line $1 does not match CERES_VERSION"
  49. echo " in include/ceres/version.h, which is $VERSION. You may not be in the "
  50. echo " toplevel source dir."
  51. exit 1
  52. fi
  53. # Export repository.
  54. git checkout-index -f -a --prefix=$TMP/
  55. # Build the VERSION file.
  56. VERSIONFILE=$TMP/VERSION
  57. echo "version $VERSION" >> $VERSIONFILE
  58. echo "$GIT_COMMIT" >> $VERSIONFILE
  59. # Build the documentation.
  60. python $TMP/scripts/make_docs.py $TMP $DOCS_TMP
  61. cp -pr $DOCS_TMP/html $TMP/docs
  62. # Build the tarball.
  63. cd /tmp
  64. tar -cvzf "ceres-solver-$1.tar.gz" "ceres-solver-$1"
  65. # Don't leave a mess behind.
  66. rm -rf $TMP
  67. rm -rf $DOCS_TMP
  68. # Reminder to upload.
  69. cat <<EOF
  70. TODO:
  71. - Upload /tmp/ceres-solver-$1.tar.gz
  72. EOF