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