Add RPM .spec file

Tested on RHEL6.1 (with epel repository for dependencies).

make_release checks that that the version string in the .spec file is in
sync with the rest of the project and reminds the user to bump the
release string if necessary and to build/upload the RPM package.

Change-Id: I5f454f2a7301d1e0e120cb3c0e13a68d03bca917
diff --git a/scripts/make_release b/scripts/make_release
index 1634f7c..36643e9 100755
--- a/scripts/make_release
+++ b/scripts/make_release
@@ -51,6 +51,8 @@
 ABI_VERSION_IN_HEADER=$(grep '#define CERES_ABI_VERSION' \
                               include/ceres/ceres.h | \
                         sed -e 's/#define CERES_ABI_VERSION //')
+VERSION_IN_SPEC=$(grep '^Version:' scripts/ceres-solver.spec | \
+                  sed -e 's/Version: *//')
 GIT_COMMIT=$(git log -1 HEAD |grep commit)
 
 if [[ $1 != $VERSION ]] ; then
@@ -78,6 +80,15 @@
   exit 1
 fi
 
+if [[ $VERSION_IN_SPEC != $VERSION ]] ; then
+  echo "ERROR: Version string from scripts/ceres-solver.spec, which is"
+  echo "       $VERSION_IN_SPEC, does not match the version"
+  echo "       from the toplevel CMakeLists.txt, which is $ABI_VERSION."
+  echo "       You may not be in the toplevel source directory, or the"
+  echo "       versions are out of sync."
+  exit 1
+fi
+
 # Clone the repository and clean out the git extras.
 git clone . $TMP
 rm -rf "$TMP/.git"
@@ -101,6 +112,14 @@
 rm -rf $DOCS_TMP
 
 # Reminder to upload.
-echo
-echo "TODO: upload /tmp/ceres-solver-$1.tar.gz"
-echo
+cat <<EOF 
+
+TODO:
+  - Upload /tmp/ceres-solver-$1.tar.gz
+
+  - Update the release string in scripts/ceres-solver.spec if this is a RC
+    release or the first release after a RC release.
+
+  - Build and upload RPM package.
+
+EOF