From 70701745b85fef7eeba2c978ae849fd48927699c Mon Sep 17 00:00:00 2001 From: Taylor Braun-Jones Date: Fri, 15 Feb 2013 19:09:48 -0500 Subject: [PATCH] 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 --- scripts/ceres-solver.spec | 112 ++++++++++++++++++++++++++++++++++++++ scripts/make_release | 25 ++++++++- 2 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 scripts/ceres-solver.spec diff --git a/scripts/ceres-solver.spec b/scripts/ceres-solver.spec new file mode 100644 index 000000000..f8c7a9d1f --- /dev/null +++ b/scripts/ceres-solver.spec @@ -0,0 +1,112 @@ +Name: ceres-solver +Version: 1.5.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} <= 6) +BuildRequires: cmake28 +%else +BuildRequires: cmake +%endif +BuildRequires: eigen3-devel +BuildRequires: suitesparse-devel +# Use atlas for BLAS and LAPACK +BuildRequires: atlas-devel +BuildRequires: protobuf-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} <= 6) +%{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 +* Sun Feb 24 2013 Taylor Braun-Jones - 1.5.0-0.1.0 +- Bump version. + +* Sun Oct 14 2012 Taylor Braun-Jones - 1.4.0-0 +- Initial creation diff --git a/scripts/make_release b/scripts/make_release index 1634f7c12..36643e9bd 100755 --- a/scripts/make_release +++ b/scripts/make_release @@ -51,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 @@ -78,6 +80,15 @@ if [[ $ABI_VERSION_IN_HEADER != $ABI_VERSION ]] ; then 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 $TMP rm -rf $DOCS_TMP # Reminder to upload. -echo -echo "TODO: upload /tmp/ceres-solver-$1.tar.gz" -echo +cat <