taucs-2.2.ebuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit eutils fortran-2 toolchain-funcs
  5. DESCRIPTION="C library of sparse linear solvers"
  6. HOMEPAGE="http://www.tau.ac.il/~stoledo/taucs/"
  7. SRC_URI="http://www.tau.ac.il/~stoledo/${PN}/${PV}/${PN}.tgz -> ${P}.tgz"
  8. SLOT="0"
  9. LICENSE="LGPL-2.1"
  10. IUSE="cilk doc static-libs"
  11. KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
  12. RDEPEND="
  13. virtual/blas
  14. virtual/lapack
  15. || ( sci-libs/metis sci-libs/parmetis )
  16. cilk? ( dev-lang/cilk )"
  17. DEPEND="${RDEPEND}
  18. virtual/pkgconfig"
  19. S="${WORKDIR}"
  20. src_prepare() {
  21. # test with cilk has memory leaks
  22. epatch "${FILESDIR}"/${P}-no-test-cilk.patch
  23. }
  24. src_configure() {
  25. cat > config/linux_shared.mk <<-EOF
  26. FC=$(tc-getFC)
  27. CC=$(tc-getCC)
  28. LD=$(tc-getFC)
  29. CFLAGS=${CFLAGS} -fPIC
  30. FFLAGS=${FFLAGS} -fPIC
  31. LDFLAGS=${LDFLAGS} -fPIC
  32. LIBBLAS=$($(tc-getPKG_CONFIG) --libs blas)
  33. LIBLAPACK=$($(tc-getPKG_CONFIG) --libs lapack)
  34. LIBF77=
  35. EOF
  36. echo "LIBMETIS=$($(tc-getPKG_CONFIG) --libs metis)" >> config/linux_shared.mk
  37. # no cat <<EOF because -o has a trailing space
  38. if use cilk; then
  39. echo "CILKC=cilkc" >> config/linux_shared.mk
  40. echo "CILKFLAGS=-O2 -I${EPREFIX}/usr/include/cilk -fPIC" >> config/linux_shared.mk
  41. echo "CILKOUTFLG=-o " >> config/linux_shared.mk
  42. fi
  43. sed -e 's/ -fPIC//g' \
  44. config/linux_shared.mk \
  45. > config/linux_static.mk || die
  46. }
  47. src_compile() {
  48. # not autotools configure
  49. if use static-libs; then
  50. ./configure variant=_static || die
  51. emake
  52. fi
  53. ./configure variant=_shared || die
  54. emake
  55. cd lib/linux_shared
  56. $(tc-getFC) ${LDFLAGS} -shared -Wl,-soname=libtaucs.so.1 \
  57. -Wl,--whole-archive libtaucs.a -Wl,--no-whole-archive \
  58. $($(tc-getPKG_CONFIG) --libs blas lapack metis) \
  59. -o libtaucs.so.1.0.0 \
  60. || die "shared lib linking failed"
  61. }
  62. src_test() {
  63. LD_LIBRARY_PATH=lib/linux_shared \
  64. ./testscript variant=_shared || die "compile test failed"
  65. if grep -q FAILED testscript.log; then
  66. eerror "Test failed. See ${S}/testscript.log"
  67. die "test failed"
  68. fi
  69. }
  70. src_install() {
  71. use static-libs && dolib.a lib/linux_static/libtaucs.a
  72. ln -s libtaucs.so.1.0.0 lib/linux_shared/libtaucs.so.1
  73. ln -s libtaucs.so.1 lib/linux_shared/libtaucs.so
  74. dolib.so lib/linux_shared/libtaucs.so*
  75. insinto /usr/include
  76. doins build/*/*.h src/*.h
  77. use doc && dodoc doc/*.pdf
  78. }