pari-2.5.1.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="4"
  4. inherit eutils flag-o-matic toolchain-funcs
  5. DESCRIPTION="A software package for computer-aided number theory"
  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"
  10. KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
  11. IUSE="doc data fltk gmp X"
  12. RDEPEND="sys-libs/readline
  13. fltk? ( x11-libs/fltk:1 )
  14. gmp? ( dev-libs/gmp )
  15. X? ( x11-libs/libX11 )
  16. doc? ( X? ( x11-misc/xdg-utils ) )
  17. data? ( sci-mathematics/pari-data )"
  18. DEPEND="${RDEPEND}
  19. doc? ( virtual/latex-base )"
  20. get_compile_dir() {
  21. pushd "${S}/config" > /dev/null
  22. local fastread=yes
  23. source ./get_archos
  24. popd > /dev/null
  25. echo "O${osname}-${arch}"
  26. }
  27. src_prepare() {
  28. epatch "${FILESDIR}/${PN}"-2.3.2-strip.patch
  29. epatch "${FILESDIR}/${PN}"-2.3.2-ppc-powerpc-arch-fix.patch
  30. # fix parallel make
  31. epatch "${FILESDIR}/${PN}"-2.5.0-doc-make.patch
  32. # sage error handling patch
  33. epatch "${FILESDIR}/${PN}"-2.5.0-mp.c.patch
  34. # OS X: add -install_name to the linker option
  35. epatch "${FILESDIR}/${PN}"-2.5.0-macos.patch
  36. # from debian, fies bug #423617
  37. epatch "${FILESDIR}/${PN}"-2.5.1-gcc47.patch
  38. # disable default building of docs during install
  39. sed -i \
  40. -e "s:install-doc install-examples:install-examples:" \
  41. config/Makefile.SH || die "Failed to fix makefile"
  42. # propagate ldflags
  43. sed -i \
  44. -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
  45. config/get_dlld || die "failed to fix LDFLAGS"
  46. # move doc dir to a gentoo doc dir and replace acroread by xdg-open
  47. sed -i \
  48. -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
  49. -e 's:"acroread":"xdg-open":' \
  50. doc/gphelp.in || die "Failed to fix doc dir"
  51. sed -i "s:/usr:${EPREFIX}/usr:g" config/get_X11 \
  52. || die "Failed to fix get_X11"
  53. # usersch3.tex is generated
  54. rm -f doc/usersch3.tex || die "failed to remove generated file"
  55. }
  56. src_configure() {
  57. tc-export CC
  58. # need to force optimization here, as it breaks without
  59. if is-flag -O0; then
  60. replace-flags -O0 -O2
  61. elif ! is-flag -O?; then
  62. append-flags -O2
  63. fi
  64. local myconfig
  65. if use gmp ; then
  66. myconfig="--with-gmp=${EPREFIX}/usr"
  67. else
  68. myconfig="--with-gmp=no"
  69. fi
  70. # sysdatadir installs a pari.cfg stuff which is informative only
  71. ./Configure \
  72. --prefix="${EPREFIX}"/usr \
  73. --datadir="${EPREFIX}"/usr/share/${PN} \
  74. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  75. --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
  76. --mandir="${EPREFIX}"/usr/share/man/man1 \
  77. --with-readline="${EPREFIX}"/usr \
  78. --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
  79. $myconfig \
  80. || die "./Configure failed"
  81. }
  82. src_compile() {
  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} \
  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. default
  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. local installdir=$(get_compile_dir)
  113. cd "${installdir}" || die "failed to change directory"
  114. emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
  115. fi
  116. }