diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/ceres-solver.spec | 123 | ||||
-rw-r--r-- | scripts/make_docs.py | 81 | ||||
-rwxr-xr-x | scripts/make_release | 53 |
3 files changed, 235 insertions, 22 deletions
diff --git a/scripts/ceres-solver.spec b/scripts/ceres-solver.spec new file mode 100644 index 0000000..69b08e6 --- /dev/null +++ b/scripts/ceres-solver.spec @@ -0,0 +1,123 @@ +Name: ceres-solver +Version: 1.7.0 +# Release candidate versions are messy. Give them a release of +# e.g. "0.1.0%{?dist}" for RC1 (and remember to adjust the Source0 +# URL). Non-RC releases go back to incrementing integers starting at 1. +Release: "0.1.0%{?dist}" +Summary: A non-linear least squares minimizer + +Group: Development/Libraries +License: BSD +URL: http://code.google.com/p/ceres-solver/ +Source0: http://%{name}.googlecode.com/files/%{name}-%{version}rc1.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%if (0%{?rhel} == 06) +BuildRequires: cmake28 +%else +BuildRequires: cmake +%endif +BuildRequires: eigen3-devel +BuildRequires: suitesparse-devel +# Use atlas for BLAS and LAPACK +BuildRequires: atlas-devel +BuildRequires: gflags-devel +BuildRequires: glog-devel + +%description +Ceres Solver is a portable C++ library that allows for modeling and solving +large complicated nonlinear least squares problems. Features include: + + - A friendly API: build your objective function one term at a time + - Automatic differentiation + - Robust loss functions + - Local parameterizations + - Threaded Jacobian evaluators and linear solvers + - Levenberg-Marquardt and Dogleg (Powell & Subspace) solvers + - Dense QR and Cholesky factorization (using Eigen) for small problems + - Sparse Cholesky factorization (using SuiteSparse) for large sparse problems + - Specialized solvers for bundle adjustment problems in computer vision + - Iterative linear solvers for general sparse and bundle adjustment problems + - Runs on Linux, Windows, Mac OS X and Android. An iOS port is underway + +Notable use of Ceres Solver is for the image alignment in Google Maps and for +vehicle pose in Google Street View. + + +%package devel +Summary: A non-linear least squares minimizer +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + +%prep +%setup -q + +%build +mkdir build +pushd build + +# Disable the compilation flags that rpmbuild macros try to apply to all +# packages because it breaks the build since release 1.5.0rc1 +%define optflags "" +%if (0%{?rhel} == 06) +%{cmake28} .. \ +%else +%{cmake} .. \ +%endif + -DBLAS_LIB:FILEPATH=%{_libdir}/atlas/libatlas.so \ + -DLAPACK_LIB:FILEPATH=%{_libdir}/atlas/liblapack.so +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +pushd build +make install DESTDIR=$RPM_BUILD_ROOT +find $RPM_BUILD_ROOT -name '*.la' -delete + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%defattr(-,root,root,-) +%doc +%{_libdir}/*.so.* + +%files devel +%defattr(-,root,root,-) +%doc +%{_includedir}/* +%{_libdir}/*.so +%{_libdir}/*.a + + +%changelog +* Mon July 18 2013 Sameer Agarwal <sameeragarwal@google.com> - 1.7.0-0 +- Bump version + +* Mon Apr 29 2013 Sameer Agarwal <sameeragarwal@google.com> - 1.6.0-1 +- Bump version + +* Mon Apr 29 2013 Sameer Agarwal <sameeragarwal@google.com> - 1.6.0-0.2.0 +- Bump version + +* Mon Apr 29 2013 Sameer Agarwal <sameeragarwal@google.com> - 1.6.0-0.1.0 +- Bump version + +* Sun Feb 24 2013 Taylor Braun-Jones <taylor@braun-jones.org> - 1.5.0-0.1.0 +- Bump version. + +* Sun Oct 14 2012 Taylor Braun-Jones <taylor@braun-jones.org> - 1.4.0-0 +- Initial creation diff --git a/scripts/make_docs.py b/scripts/make_docs.py new file mode 100644 index 0000000..efbbf88 --- /dev/null +++ b/scripts/make_docs.py @@ -0,0 +1,81 @@ +#!/usr/bin/python +# +# Ceres Solver - A fast non-linear least squares minimizer +# Copyright 2013 Google Inc. All rights reserved. +# http://code.google.com/p/ceres-solver/ +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of Google Inc. nor the names of its contributors may be +# used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +# Author: sameeragarwal@google.com (Sameer Agarwal) +# +# Note: You will need Sphinx and Pygments installed for this to work. + +import glob +import os +import sys + +# Number of arguments +N = len(sys.argv) + +if N < 3: + print "make_docs.py src_root destination_root" + sys.exit(1) + +src_dir = sys.argv[1] + "/docs/source" +build_root = sys.argv[2] +cache_dir = build_root + "/doctrees" +html_dir = build_root + "/html" + +# Called from Command Line +if N == 3: + sphinx_exe = "sphinx-build" + +# Called from CMake (using the SPHINX_EXECUTABLE found) +elif N == 4: + sphinx_exe = sys.argv[3] + +# Run Sphinx to build the documentation. +os.system("%s -b html -d %s %s %s" %(sphinx_exe, cache_dir, src_dir, html_dir)) + +input_pattern = """config=TeX-AMS-MML_HTMLorMML"></script>""" +output_pattern = """config=TeX-AMS_HTML"> + MathJax.Hub.Config({ + "HTML-CSS": { + availableFonts: ["TeX"] + } + }); +</script>""" + +# By default MathJax uses does not use TeX fonts. This simple search +# and replace fixes that. +for name in glob.glob("%s/*.html" % html_dir): + print "Postprocessing: ", name + fptr = open(name) + out = fptr.read().replace(input_pattern, output_pattern) + fptr.close() + + fptr = open(name, "w") + fptr.write(out) + fptr.close() diff --git a/scripts/make_release b/scripts/make_release index 404aa75..d3ca820 100755 --- a/scripts/make_release +++ b/scripts/make_release @@ -30,8 +30,7 @@ # # Author: mierle@gmail.com (Keir Mierle) # -# Note: you will need a fairly complete latex installation, along with -# pygments, for this to work. +# Note: You will need Sphinx and Pygments installed for this to work. if [ -z $1 ] ; then echo 'usage: scripts/make_release <version>' @@ -41,9 +40,9 @@ fi TMP="/tmp/ceres-solver-$1" DOCS_TMP="/tmp/ceres-solver-docs-$1" -VERSION=$(grep 'SET(CERES_VERSION' CMakeLists.txt | \ - sed -e 's/SET(CERES_VERSION //' | \ - sed -e 's/)//') +VERSION=$(grep 'SET(CERES_VERSION_' CMakeLists.txt | \ + sed -e 's/\(.*\) \(.*\))/\2/' | \ + tr '\n' '.' | sed -e 's/.$//') ABI_VERSION=$(grep 'SET(CERES_ABI_VERSION' CMakeLists.txt | \ sed -e 's/SET(CERES_ABI_VERSION //' | \ sed -e 's/)//') @@ -52,6 +51,8 @@ VERSION_IN_HEADER=$(grep '#define CERES_VERSION' include/ceres/ceres.h | \ 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 @@ -79,9 +80,17 @@ if [[ $ABI_VERSION_IN_HEADER != $ABI_VERSION ]] ; then exit 1 fi -# Clone the repository and clean out the git extras. -git clone . $TMP -rm -rf "$TMP/.git" +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 + +# Export repository. +git checkout-index -f -a --prefix=$TMP/ # Build the VERSION file. VERSIONFILE=$TMP/VERSION @@ -90,26 +99,26 @@ echo "abi_version $VERSION" >> $VERSIONFILE echo "$GIT_COMMIT" >> $VERSIONFILE # Build the documentation. -cp -pr "$TMP/docs" $DOCS_TMP -cd $DOCS_TMP -curl http://minted.googlecode.com/files/minted.sty > minted.sty -pdflatex -shell-escape ceres-solver && \ - bibtex ceres-solver && \ - pdflatex -shell-escape ceres-solver && \ - pdflatex -shell-escape ceres-solver -cp $DOCS_TMP/ceres-solver.pdf "$TMP/docs/ceres-solver.pdf" -cp $DOCS_TMP/ceres-solver.pdf "/tmp/ceres-solver-$1.pdf" +python $TMP/scripts/make_docs.py $TMP $DOCS_TMP +cp -pr $DOCS_TMP/html $TMP/docs # Build the tarball. cd /tmp tar -cvzf "ceres-solver-$1.tar.gz" "ceres-solver-$1" # Don't leave a mess behind. -rm -rf $DOCS_TMP rm -rf $TMP +rm -rf $DOCS_TMP # Reminder to upload. -echo -echo "TODO: upload /tmp/ceres-solver-$1.tar.gz" -echo "TODO: upload /tmp/ceres-solver-$1.pdf" -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 |