ceres-solver-1.9.0.ebuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python2_7 )
  5. inherit cmake-utils eutils multilib python-any-r1 toolchain-funcs
  6. DESCRIPTION="Nonlinear least-squares minimizer"
  7. HOMEPAGE="http://ceres-solver.org/"
  8. SRC_URI="${HOMEPAGE}/${P}.tar.gz"
  9. LICENSE="BSD"
  10. SLOT="0/1"
  11. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  12. IUSE="cxsparse doc examples gflags lapack openmp protobuf +schur sparse static-libs test"
  13. REQUIRED_USE="test? ( gflags ) sparse? ( lapack )"
  14. RDEPEND="
  15. dev-cpp/glog[gflags?]
  16. cxsparse? ( sci-libs/cxsparse:0= )
  17. lapack? ( virtual/lapack )
  18. protobuf? ( dev-libs/protobuf )
  19. sparse? (
  20. sci-libs/amd:0=
  21. sci-libs/camd:0=
  22. sci-libs/ccolamd:0=
  23. sci-libs/cholmod:0=
  24. sci-libs/colamd:0=
  25. sci-libs/spqr:0= )"
  26. DEPEND="${RDEPEND}
  27. dev-cpp/eigen:3
  28. doc? ( dev-python/sphinx dev-python/sphinx_rtd_theme )
  29. lapack? ( virtual/pkgconfig )"
  30. PATCHES=( "${FILESDIR}"/${P}-underlink.patch )
  31. pkg_setup() {
  32. # XXX: this looks like it should be used with BUILD_TYPE!=binary
  33. if use openmp; then
  34. if [[ $(tc-getCXX) == *g++* ]] && ! tc-has-openmp; then
  35. ewarn "OpenMP is not available in your current selected gcc"
  36. die "need openmp capable gcc"
  37. fi
  38. fi
  39. use doc && python-any-r1_pkg_setup
  40. }
  41. src_prepare() {
  42. # search paths work for prefix
  43. sed -i \
  44. -e "s:/usr:${EPREFIX}/usr:g" \
  45. cmake/*.cmake || die
  46. # remove Werror
  47. sed -i \
  48. -e 's/-Werror//g' \
  49. CMakeLists.txt || die
  50. # respect gentoo doc install directory
  51. sed -i \
  52. -e "s:share/doc/ceres:share/doc/${PF}:" \
  53. docs/source/CMakeLists.txt || die
  54. cmake-utils_src_prepare
  55. }
  56. src_configure() {
  57. local mycmakeargs=(
  58. -DBUILD_SHARED_LIBS=ON
  59. -DBUILD_EXAMPLES=OFF
  60. $(cmake-utils_use_enable test TESTING)
  61. $(cmake-utils_use doc BUILD_DOCUMENTATION)
  62. $(cmake-utils_use gflags GFLAGS)
  63. $(cmake-utils_use lapack LAPACK)
  64. $(cmake-utils_use openmp OPENMP)
  65. $(cmake-utils_use protobuf PROTOBUF)
  66. $(cmake-utils_use schur SCHUR_SPECIALIZATIONS)
  67. $(cmake-utils_use cxsparse CXSPARSE)
  68. $(cmake-utils_use sparse SUITESPARSE)
  69. )
  70. cmake-utils_src_configure
  71. }
  72. src_install() {
  73. cmake-utils_src_install
  74. dodoc README VERSION
  75. if use examples; then
  76. insinto /usr/share/doc/${PF}
  77. docompress -x /usr/share/doc/${PF}/examples
  78. doins -r examples data
  79. fi
  80. }