ntl-5.5.2.ebuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=3
  4. inherit toolchain-funcs eutils multilib flag-o-matic
  5. DESCRIPTION="High-performance and portable Number Theory C++ library"
  6. HOMEPAGE="http://shoup.net/ntl/"
  7. SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
  11. IUSE="doc static-libs test"
  12. RDEPEND=">=dev-libs/gmp-4.3
  13. >=dev-libs/gf2x-0.9"
  14. DEPEND="${RDEPEND}
  15. dev-lang/perl"
  16. S="${WORKDIR}/${P}/src"
  17. src_prepare() {
  18. # fix parallel make
  19. sed -i -e "s/make/make ${MAKEOPTS}/g" WizardAux || die
  20. cd ..
  21. # enable compatibility with singular
  22. epatch "$FILESDIR/${P}-singular.patch"
  23. # implement a call back framework (submitted upstream)
  24. epatch "$FILESDIR/${P}-sage-tools.patch"
  25. # sanitize the makefile and allow the building of shared library
  26. epatch "$FILESDIR/${P}-shared.patch"
  27. replace-flags -O[3-9] -O2
  28. }
  29. src_configure() {
  30. perl DoConfig \
  31. PREFIX="${EPREFIX}"/usr \
  32. CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" \
  33. CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
  34. AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
  35. NTL_STD_CXX=on NTL_GMP_LIP=on NTL_GF2X_LIB=on \
  36. || die "DoConfig failed"
  37. }
  38. src_compile() {
  39. # split the targets to allow parallel make to run properly
  40. emake setup1 setup2 || die "emake setup failed"
  41. emake setup3 || die "emake setup failed"
  42. sh Wizard on || die "Tuning wizard failed"
  43. if use static-libs || use test; then
  44. emake ntl.a || die "emake static failed"
  45. fi
  46. local trg=so
  47. [[ ${CHOST} == *-darwin* ]] && trg=dylib
  48. emake shared${trg} || die "emake shared failed"
  49. }
  50. src_install() {
  51. if use static-libs; then
  52. newlib.a ntl.a libntl.a || die "installation of static library failed"
  53. fi
  54. dolib.so lib*$(get_libname) || die "installation of shared library failed"
  55. cd ..
  56. insinto /usr/include
  57. doins -r include/NTL || die "installation of the headers failed"
  58. dodoc README
  59. if use doc ; then
  60. dodoc doc/*.txt || die
  61. dohtml doc/* || die
  62. fi
  63. }