ipopt-3.11.7.ebuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. AUTOTOOLS_IN_SOURCE_BUILD=yes
  5. FORTRAN_NEEDED="mumps"
  6. inherit eutils autotools-utils multilib toolchain-funcs fortran-2
  7. MYPN=Ipopt
  8. MYP=${MYPN}-${PV}
  9. DESCRIPTION="Interior-Point Optimizer for large-scale nonlinear optimization"
  10. HOMEPAGE="https://projects.coin-or.org/Ipopt/"
  11. SRC_URI="http://www.coin-or.org/download/source/${MYPN}/${MYP}.tgz"
  12. LICENSE="EPL-1.0 hsl? ( HSL )"
  13. SLOT="0/1"
  14. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  15. IUSE="doc examples hsl lapack mpi mumps static-libs test"
  16. RDEPEND="
  17. virtual/blas
  18. hsl? ( sci-libs/coinhsl )
  19. lapack? ( virtual/lapack )
  20. mumps? ( sci-libs/mumps[mpi=] )"
  21. DEPEND="${RDEPEND}
  22. virtual/pkgconfig
  23. doc? ( app-doc/doxygen[dot] )
  24. test? ( sci-libs/coinor-sample sci-libs/mumps )"
  25. S="${WORKDIR}/${MYPN}-${PV}/${MYPN}"
  26. src_prepare() {
  27. if use mumps && ! use mpi; then
  28. ln -s "${EPREFIX}"/usr/include/mpiseq/mpi.h \
  29. src/Algorithm/LinearSolvers/
  30. elif use mpi; then
  31. export CXX=mpicxx FC=mpif77 F77=mpif77 CC=mpicc
  32. fi
  33. sed -i \
  34. -e "s:lib/pkgconfig:$(get_libdir)/pkgconfig:g" \
  35. configure || die
  36. autotools-utils_src_prepare
  37. }
  38. src_configure() {
  39. # needed for the --with-coin-instdir
  40. dodir /usr
  41. local myeconfargs=(
  42. --enable-dependency-linking
  43. --with-blas-lib="$($(tc-getPKG_CONFIG) --libs blas)"
  44. --with-coin-instdir="${ED}"/usr
  45. $(use_with doc dot)
  46. )
  47. if use lapack; then
  48. myeconfargs+=( --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)" )
  49. else
  50. myeconfargs+=( --without-lapack )
  51. fi
  52. if use mumps; then
  53. myeconfargs+=(
  54. --with-mumps-incdir="${EPREFIX}"/usr/include
  55. --with-mumps-lib="-lmumps_common -ldmumps -lzmumps -lsmumps -lcmumps" )
  56. else
  57. myeconfargs+=( --without-mumps )
  58. fi
  59. if use hsl; then
  60. myeconfargs+=(
  61. --with-hsl-incdir="${EPREFIX}"/usr/include
  62. --with-hsl-lib="$($(tc-getPKG_CONFIG) --libs coinhsl)" )
  63. else
  64. myeconfargs+=( --without-hsl )
  65. fi
  66. autotools-utils_src_configure
  67. }
  68. src_compile() {
  69. autotools-utils_src_compile all $(use doc && echo doxydoc)
  70. }
  71. src_test() {
  72. autotools-utils_src_test test
  73. }
  74. src_install() {
  75. use doc && HTML_DOC=("${AUTOTOOLS_BUILD_DIR}/doxydocs/html/")
  76. autotools-utils_src_install
  77. # already installed
  78. rm "${ED}"/usr/share/coin/doc/${MYPN}/{README,AUTHORS,LICENSE} || die
  79. if use examples; then
  80. insinto /usr/share/doc/${PF}
  81. doins -r examples
  82. fi
  83. }