Cleanup based on comments by William Rucklidge

Change-Id: If269ba8e388965a8ea32260fd6f17a133a19ab9b
diff --git a/docs/source/version_history.rst b/docs/source/version_history.rst
index 40e2bcb..a874923 100644
--- a/docs/source/version_history.rst
+++ b/docs/source/version_history.rst
@@ -102,6 +102,8 @@
 
 #. ``SCHUR_JACOBI`` can now be used without ``SuiteSparse``.
 
+#. A ``.spec`` file for producing RPMs. (Taylor Braun-Jones)
+
 Bug Fixes
 ---------
 #. Fix ``No previous prototype`` warnings. (Sergey Sharybin)
@@ -128,6 +130,9 @@
 
 #. Fixed a memory leak in ``cxsparse.cc``. (Alexander Mordvintsev).
 
+#. Fixed the install directory for libraries by correctly handling
+   ``LIB_SUFFIX``. (Taylor Braun-Jones)
+
 
 1.4.0
 =====
diff --git a/include/ceres/dynamic_autodiff_cost_function.h b/include/ceres/dynamic_autodiff_cost_function.h
index 861164a..e4549c5 100644
--- a/include/ceres/dynamic_autodiff_cost_function.h
+++ b/include/ceres/dynamic_autodiff_cost_function.h
@@ -78,7 +78,7 @@
 class DynamicAutoDiffCostFunction : public CostFunction {
  public:
   explicit DynamicAutoDiffCostFunction(CostFunctor* functor)
-  : functor_(functor) {}
+    : functor_(functor) {}
 
   virtual ~DynamicAutoDiffCostFunction() {}
 
diff --git a/include/ceres/problem.h b/include/ceres/problem.h
index bccb329..bab3bfe 100644
--- a/include/ceres/problem.h
+++ b/include/ceres/problem.h
@@ -345,7 +345,7 @@
     // problem.
     //
     // NOTE: This vector should contain the same pointers as the ones
-    // used to add parameter blocks to the Problem. These parmeter
+    // used to add parameter blocks to the Problem. These parameter
     // block should NOT point to new memory locations. Bad things will
     // happen otherwise.
     vector<double*> parameter_blocks;
@@ -390,7 +390,7 @@
   // the gradient vector (and the number of columns in the jacobian)
   // is the sum of the sizes of all the parameter blocks. If a
   // parameter block has a local parameterization, then it contributes
-  // "LocalSize" entries to the gradient vecto (and the number of
+  // "LocalSize" entries to the gradient vector (and the number of
   // columns in the jacobian).
   bool Evaluate(const EvaluateOptions& options,
                 double* cost,
diff --git a/internal/ceres/line_search_direction.cc b/internal/ceres/line_search_direction.cc
index 2f27a78..1fc4de5 100644
--- a/internal/ceres/line_search_direction.cc
+++ b/internal/ceres/line_search_direction.cc
@@ -81,7 +81,7 @@
 
     *search_direction =  -current.gradient + beta * previous.search_direction;
     const double directional_derivative =
-        current. gradient.dot(*search_direction);
+        current.gradient.dot(*search_direction);
     if (directional_derivative > -function_tolerance_) {
       LOG(WARNING) << "Restarting non-linear conjugate gradients: "
                    << directional_derivative;
diff --git a/internal/ceres/linear_solver.h b/internal/ceres/linear_solver.h
index a980514..5aeedcd 100644
--- a/internal/ceres/linear_solver.h
+++ b/internal/ceres/linear_solver.h
@@ -106,11 +106,11 @@
     //
     // For example if elimination_groups is a vector of size k, then
     // the linear solver is informed that it should eliminate the
-    // parameter blocks 0 - elimination_groups[0] - 1 first, and then
-    // elimination_groups[0] - elimination_groups[1] and so on. Within
-    // each elimination group, the linear solver is free to choose how
-    // the parameter blocks are ordered. Different linear solvers have
-    // differing requirements on elimination_groups.
+    // parameter blocks 0 ... elimination_groups[0] - 1 first, and
+    // then elimination_groups[0] ... elimination_groups[1] - 1 and so
+    // on. Within each elimination group, the linear solver is free to
+    // choose how the parameter blocks are ordered. Different linear
+    // solvers have differing requirements on elimination_groups.
     //
     // The most common use is for Schur type solvers, where there
     // should be at least two elimination groups and the first
diff --git a/internal/ceres/mutex.h b/internal/ceres/mutex.h
index 410748f..0c48ed3 100644
--- a/internal/ceres/mutex.h
+++ b/internal/ceres/mutex.h
@@ -275,7 +275,8 @@
 // "MutexLock(x) COMPILE_ASSERT(false)". To work around this, "Ceres" is
 // prefixed to the class names; this permits defining the classes.
 
-// CeresMutexLock(mu) acquires mu when constructed and releases it when destroyed.
+// CeresMutexLock(mu) acquires mu when constructed and releases it
+// when destroyed.
 class CeresMutexLock {
  public:
   explicit CeresMutexLock(Mutex *mu) : mu_(mu) { mu_->Lock(); }
diff --git a/internal/ceres/preconditioner.h b/internal/ceres/preconditioner.h
index 5bb077e..894a2e6 100644
--- a/internal/ceres/preconditioner.h
+++ b/internal/ceres/preconditioner.h
@@ -70,7 +70,7 @@
     // For example if elimination_groups is a vector of size k, then
     // the linear solver is informed that it should eliminate the
     // parameter blocks 0 ... elimination_groups[0] - 1 first, and
-    // then elimination_groups[0] ... elimination_groups[1] and so
+    // then elimination_groups[0] ... elimination_groups[1] - 1 and so
     // on. Within each elimination group, the linear solver is free to
     // choose how the parameter blocks are ordered. Different linear
     // solvers have differing requirements on elimination_groups.
diff --git a/internal/ceres/problem_impl.cc b/internal/ceres/problem_impl.cc
index bc378aa..1fb9e39 100644
--- a/internal/ceres/problem_impl.cc
+++ b/internal/ceres/problem_impl.cc
@@ -657,8 +657,8 @@
                                     gradient != NULL ? &(*gradient)[0] : NULL,
                                     tmp_jacobian.get());
 
-  // Make the parameter blocks that were temporarirly marked
-  // constant, variable again.
+  // Make the parameter blocks that were temporarily marked constant,
+  // variable again.
   for (int i = 0; i < variable_parameter_blocks.size(); ++i) {
     variable_parameter_blocks[i]->SetVarying();
   }
diff --git a/internal/ceres/problem_test.cc b/internal/ceres/problem_test.cc
index 130148d..888eb7c 100644
--- a/internal/ceres/problem_test.cc
+++ b/internal/ceres/problem_test.cc
@@ -769,7 +769,7 @@
 // Simple cost function used for testing Problem::Evaluate.
 //
 // r_i = i - (j + 1) * x_ij^2
-template <int kNumResiduals, int kNumParameterBlocks >
+template <int kNumResiduals, int kNumParameterBlocks>
 class QuadraticCostFunction : public CostFunction {
  public:
   QuadraticCostFunction() {
diff --git a/internal/ceres/solver.cc b/internal/ceres/solver.cc
index 6436d2d..45e6865 100644
--- a/internal/ceres/solver.cc
+++ b/internal/ceres/solver.cc
@@ -204,7 +204,7 @@
     StringAppendF(&report, "\n");
     StringAppendF(&report, "\n");
 
-    StringAppendF(&report,   "%45s    %21s\n", "Given",  "Used");
+    StringAppendF(&report, "%45s    %21s\n", "Given",  "Used");
     StringAppendF(&report, "Linear solver       %25s%25s\n",
                   LinearSolverTypeToString(linear_solver_type_given),
                   LinearSolverTypeToString(linear_solver_type_used));
@@ -299,15 +299,15 @@
     // LINE_SEARCH
     StringAppendF(&report, "\nMinimizer                 %19s\n", "LINE_SEARCH");
     if (line_search_direction_type == LBFGS) {
-      StringAppendF(&report,   "Line search direction     %19s(%d)\n",
+      StringAppendF(&report, "Line search direction     %19s(%d)\n",
                     LineSearchDirectionTypeToString(line_search_direction_type),
                     max_lbfgs_rank);
     } else {
-      StringAppendF(&report,   "Line search direction     %19s\n",
+      StringAppendF(&report, "Line search direction     %19s\n",
                     LineSearchDirectionTypeToString(
                         line_search_direction_type));
     }
-    StringAppendF(&report,   "Line search type          %19s\n",
+    StringAppendF(&report, "Line search type          %19s\n",
                   LineSearchTypeToString(line_search_type));
 
     StringAppendF(&report, "\n");
diff --git a/internal/ceres/visibility.cc b/internal/ceres/visibility.cc
index 8e80fd1..371bdfa 100644
--- a/internal/ceres/visibility.cc
+++ b/internal/ceres/visibility.cc
@@ -139,7 +139,8 @@
     const int count = it->second;
     // Static cast necessary for Windows.
     const double weight = static_cast<double>(count) /
-        (sqrt(static_cast<double>(visibility[camera1].size() * visibility[camera2].size())));
+        (sqrt(static_cast<double>(
+                  visibility[camera1].size() * visibility[camera2].size())));
     graph->AddEdge(camera1, camera2, weight);
   }
 
diff --git a/internal/ceres/visibility_based_preconditioner.h b/internal/ceres/visibility_based_preconditioner.h
index 8a09c78..dae4987 100644
--- a/internal/ceres/visibility_based_preconditioner.h
+++ b/internal/ceres/visibility_based_preconditioner.h
@@ -38,7 +38,8 @@
 // documented here can be found in
 //
 // Visibility Based Preconditioning for Bundle Adjustment
-// A. Kushal & S. Agarwal, submitted to CVPR 2012
+// A. Kushal & S. Agarwal, CVPR 2012.
+//
 // http://www.cs.washington.edu/homes/sagarwal/vbp.pdf
 //
 // The two preconditioners share enough code that its most efficient
diff --git a/scripts/make_docs.py b/scripts/make_docs.py
index 41879cb..8f7e718 100644
--- a/scripts/make_docs.py
+++ b/scripts/make_docs.py
@@ -32,9 +32,9 @@
 #
 # Note: You will need Sphinx and Pygments installed for this to work.
 
-import sys
-import os
 import glob
+import os
+import sys
 
 if len(sys.argv) < 3:
   print "make_docs.py src_root destination_root"
@@ -63,5 +63,8 @@
   print "Postprocessing: ", name
   fptr = open(name)
   out = fptr.read().replace(input_pattern, output_pattern)
-  open(name, "w").write(out)
-  fptr.close();
+  fptr.close()
+
+  fptr = open(name, "w")
+  fptr.write(out)
+  fptr.close()