pari-2.7.1.ebuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils flag-o-matic toolchain-funcs multilib
  5. DESCRIPTION="Computer-aided number theory C library and tools"
  6. HOMEPAGE="http://pari.math.u-bordeaux.fr/"
  7. SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0/4"
  10. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
  11. IUSE="data doc fltk gmp qt4 X"
  12. RDEPEND="
  13. sys-libs/readline:0=
  14. data? ( sci-mathematics/pari-data )
  15. doc? ( X? ( x11-misc/xdg-utils ) )
  16. fltk? ( x11-libs/fltk:1= )
  17. gmp? ( dev-libs/gmp:0= )
  18. qt4? ( dev-qt/qtgui:4= )
  19. X? ( x11-libs/libX11:0= )"
  20. DEPEND="${RDEPEND}
  21. doc? ( virtual/latex-base )"
  22. get_compile_dir() {
  23. pushd "${S}/config" > /dev/null
  24. local fastread=yes
  25. source ./get_archos
  26. popd > /dev/null
  27. echo "O${osname}-${arch}"
  28. }
  29. src_prepare() {
  30. epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
  31. epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
  32. # fix parallel make
  33. epatch "${FILESDIR}"/${PN}-2.7.0-doc-make.patch
  34. # fix automagic
  35. epatch "${FILESDIR}"/${PN}-2.7.0-no-automagic.patch
  36. # sage-on-gentoo trac 15654: PARI discriminant speed depends on stack size
  37. epatch "${FILESDIR}"/${PN}-2.7.0-slow-discriminant.patch
  38. # fix building docs with perl-5.22
  39. epatch "${FILESDIR}"/${PN}-2.7.1-perl-5.22-doc.patch
  40. # disable default building of docs during install
  41. sed -i \
  42. -e "s:install-doc install-examples:install-examples:" \
  43. config/Makefile.SH || die "Failed to fix makefile"
  44. # propagate ldflags
  45. sed -i \
  46. -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
  47. config/get_dlld || die "failed to fix LDFLAGS"
  48. # move doc dir to a gentoo doc dir and replace acroread by xdg-open
  49. sed -i \
  50. -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
  51. -e 's:"acroread":"xdg-open":' \
  52. doc/gphelp.in || die "Failed to fix doc dir"
  53. # usersch3.tex is generated
  54. rm doc/usersch3.tex || die "failed to remove generated file"
  55. }
  56. src_configure() {
  57. tc-export CC
  58. export CPLUSPLUS=$(tc-getCXX)
  59. # need to force optimization here, as it breaks without
  60. if is-flag -O0; then
  61. replace-flags -O0 -O2
  62. elif ! is-flag -O?; then
  63. append-flags -O2
  64. fi
  65. # sysdatadir installs a pari.cfg stuff which is informative only
  66. ./Configure \
  67. --prefix="${EPREFIX}"/usr \
  68. --datadir="${EPREFIX}"/usr/share/${PN} \
  69. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  70. --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
  71. --mandir="${EPREFIX}"/usr/share/man/man1 \
  72. --with-readline="${EPREFIX}"/usr \
  73. --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
  74. $(use_with fltk) \
  75. $(use_with gmp) \
  76. $(use_with qt4 qt) \
  77. || die "./Configure failed"
  78. }
  79. src_compile() {
  80. use hppa && \
  81. mymake=DLLD\="${EPREFIX}"/usr/bin/gcc\ DLLDFLAGS\=-shared\ -Wl,-soname=\$\(LIBPARI_SONAME\)\ -lm
  82. mycxxmake=LD\=$(tc-getCXX)
  83. local installdir=$(get_compile_dir)
  84. cd "${installdir}" || die "failed to change directory"
  85. # upstream set -fno-strict-aliasing.
  86. # aliasing is a known issue on amd64, work on x86 by sheer luck
  87. emake ${mymake} \
  88. CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
  89. emake ${mymake} ${mycxxmake} \
  90. CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
  91. if use doc; then
  92. cd "${S}" || die "failed to change directory"
  93. # To prevent sandbox violations by metafont
  94. VARTEXFONTS="${T}"/fonts emake docpdf
  95. fi
  96. }
  97. src_test() {
  98. emake dobench
  99. }
  100. src_install() {
  101. emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
  102. dodoc MACHINES COMPAT
  103. if use doc; then
  104. # install gphelp and the pdf documentations manually.
  105. # the install-doc target is overkill.
  106. dodoc doc/*.pdf
  107. dobin doc/gphelp
  108. insinto /usr/share/doc/${PF}
  109. # gphelp looks for some of the tex sources...
  110. doins doc/*.tex doc/translations
  111. # Install the examples - for real.
  112. emake EXDIR="${ED}/usr/share/doc/${PF}/examples" \
  113. -C $(get_compile_dir) install-examples
  114. fi
  115. }