Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Ceres Solver - A fast non-linear least squares minimizer |
| 4 | # Copyright 2012 Google Inc. All rights reserved. |
| 5 | # http://code.google.com/p/ceres-solver/ |
| 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 | # |
Sameer Agarwal | fa21df8 | 2013-02-18 08:48:52 -0800 | [diff] [blame] | 33 | # Note: You will need Sphinx and Pygments installed for this to work. |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 34 | |
| 35 | if [ -z $1 ] ; then |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 36 | echo 'usage: scripts/make_release <version>' |
| 37 | echo ' must be run from toplevel Ceres source directory' |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 38 | exit 1 |
| 39 | fi |
| 40 | |
| 41 | TMP="/tmp/ceres-solver-$1" |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 42 | DOCS_TMP="/tmp/ceres-solver-docs-$1" |
Pablo Speciale | c51b11c | 2013-03-12 00:56:56 -0700 | [diff] [blame] | 43 | VERSION=$(grep 'SET(CERES_VERSION_' CMakeLists.txt | \ |
| 44 | sed -e 's/\(.*\) \(.*\))/\2/' | \ |
| 45 | tr '\n' '.' | sed -e 's/.$//') |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 46 | ABI_VERSION=$(grep 'SET(CERES_ABI_VERSION' CMakeLists.txt | \ |
| 47 | sed -e 's/SET(CERES_ABI_VERSION //' | \ |
| 48 | sed -e 's/)//') |
Keir Mierle | 7e73d10 | 2012-09-11 18:04:09 -0700 | [diff] [blame] | 49 | VERSION_IN_HEADER=$(grep '#define CERES_VERSION' include/ceres/ceres.h | \ |
| 50 | sed -e 's/#define CERES_VERSION //') |
| 51 | ABI_VERSION_IN_HEADER=$(grep '#define CERES_ABI_VERSION' \ |
| 52 | include/ceres/ceres.h | \ |
| 53 | sed -e 's/#define CERES_ABI_VERSION //') |
Taylor Braun-Jones | 7070174 | 2013-02-15 19:09:48 -0500 | [diff] [blame] | 54 | VERSION_IN_SPEC=$(grep '^Version:' scripts/ceres-solver.spec | \ |
| 55 | sed -e 's/Version: *//') |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 56 | GIT_COMMIT=$(git log -1 HEAD |grep commit) |
| 57 | |
| 58 | if [[ $1 != $VERSION ]] ; then |
Keir Mierle | 7e73d10 | 2012-09-11 18:04:09 -0700 | [diff] [blame] | 59 | echo "ERROR: Version from the command line $1 does not match CERES_VERSION" |
| 60 | echo " in CMakeLists.txt, which is $VERSION. You may not be in the " |
| 61 | echo " toplevel source dir." |
| 62 | exit 1 |
| 63 | fi |
| 64 | |
| 65 | if [[ $VERSION_IN_HEADER != $VERSION ]] ; then |
| 66 | echo "ERROR: CERES_VERSION version from include/ceres/ceres.h, which is" |
| 67 | echo " $VERSION_IN_HEADER, does not match the ABI version" |
| 68 | echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION." |
| 69 | echo " You may not be in the toplevel source directory, or the" |
| 70 | echo " versions are out of sync." |
| 71 | exit 1 |
| 72 | fi |
| 73 | |
| 74 | if [[ $ABI_VERSION_IN_HEADER != $ABI_VERSION ]] ; then |
| 75 | echo "ERROR: CERES_ABI_VERSION from include/ceres/ceres.h, which is" |
| 76 | echo " $ABI_VERSION_IN_HEADER, does not match the ABI version" |
| 77 | echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION." |
| 78 | echo " You may not be in the toplevel source directory, or the" |
| 79 | echo " versions are out of sync." |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 80 | exit 1 |
| 81 | fi |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 82 | |
Taylor Braun-Jones | 7070174 | 2013-02-15 19:09:48 -0500 | [diff] [blame] | 83 | if [[ $VERSION_IN_SPEC != $VERSION ]] ; then |
| 84 | echo "ERROR: Version string from scripts/ceres-solver.spec, which is" |
| 85 | echo " $VERSION_IN_SPEC, does not match the version" |
| 86 | echo " from the toplevel CMakeLists.txt, which is $ABI_VERSION." |
| 87 | echo " You may not be in the toplevel source directory, or the" |
| 88 | echo " versions are out of sync." |
| 89 | exit 1 |
| 90 | fi |
| 91 | |
Pablo Speciale | c51b11c | 2013-03-12 00:56:56 -0700 | [diff] [blame] | 92 | # Export repository. |
| 93 | git checkout-index -f -a --prefix=$TMP/ |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 94 | |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 95 | # Build the VERSION file. |
| 96 | VERSIONFILE=$TMP/VERSION |
| 97 | echo "version $VERSION" >> $VERSIONFILE |
| 98 | echo "abi_version $VERSION" >> $VERSIONFILE |
| 99 | echo "$GIT_COMMIT" >> $VERSIONFILE |
| 100 | |
| 101 | # Build the documentation. |
Sameer Agarwal | fa21df8 | 2013-02-18 08:48:52 -0800 | [diff] [blame] | 102 | python $TMP/scripts/make_docs.py $TMP $DOCS_TMP |
| 103 | cp -pr $DOCS_TMP/html $TMP/docs |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 104 | |
| 105 | # Build the tarball. |
| 106 | cd /tmp |
| 107 | tar -cvzf "ceres-solver-$1.tar.gz" "ceres-solver-$1" |
| 108 | |
| 109 | # Don't leave a mess behind. |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 110 | rm -rf $TMP |
Sameer Agarwal | 2160c5b | 2013-02-24 14:15:45 -0800 | [diff] [blame] | 111 | rm -rf $DOCS_TMP |
Keir Mierle | 003dc6a | 2012-06-18 01:51:09 -0700 | [diff] [blame] | 112 | |
Keir Mierle | f4b9911 | 2012-07-19 10:31:16 -0700 | [diff] [blame] | 113 | # Reminder to upload. |
Taylor Braun-Jones | 7070174 | 2013-02-15 19:09:48 -0500 | [diff] [blame] | 114 | cat <<EOF |
| 115 | |
| 116 | TODO: |
| 117 | - Upload /tmp/ceres-solver-$1.tar.gz |
| 118 | |
| 119 | - Update the release string in scripts/ceres-solver.spec if this is a RC |
| 120 | release or the first release after a RC release. |
| 121 | |
| 122 | - Build and upload RPM package. |
| 123 | |
| 124 | EOF |