pari-2.5.0-r3.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. # disable default building of docs during install
  37. sed -i \
  38. -e "s:install-doc install-examples:install-examples:" \
  39. config/Makefile.SH || die "Failed to fix makefile"
  40. # propagate ldflags
  41. sed -i \
  42. -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
  43. config/get_dlld || die "failed to fix LDFLAGS"
  44. # move doc dir to a gentoo doc dir and replace acroread by xdg-open
  45. sed -i \
  46. -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
  47. -e 's:"acroread":"xdg-open":' \
  48. doc/gphelp.in || die "Failed to fix doc dir"
  49. sed -i "s:/usr:${EPREFIX}/usr:g" config/get_X11 \
  50. || die "Failed to fix get_X11"
  51. # usersch3.tex is generated
  52. rm -f doc/usersch3.tex || die "failed to remove generated file"
  53. }
  54. src_configure() {
  55. tc-export CC
  56. # need to force optimization here, as it breaks without
  57. if is-flag -O0; then
  58. replace-flags -O0 -O2
  59. elif ! is-flag -O?; then
  60. append-flags -O2
  61. fi
  62. local myconfig
  63. if use gmp ; then
  64. myconfig="--with-gmp=${EPREFIX}/usr"
  65. else
  66. myconfig="--with-gmp=no"
  67. fi
  68. # sysdatadir installs a pari.cfg stuff which is informative only
  69. ./Configure \
  70. --prefix="${EPREFIX}"/usr \
  71. --datadir="${EPREFIX}"/usr/share/${PN} \
  72. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  73. --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
  74. --mandir="${EPREFIX}"/usr/share/man/man1 \
  75. --with-readline="${EPREFIX}"/usr \
  76. --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
  77. $myconfig \
  78. || die "./Configure failed"
  79. }
  80. src_compile() {
  81. local installdir=$(get_compile_dir)
  82. cd "${installdir}" || die "failed to change directory"
  83. # upstream set -fno-strict-aliasing.
  84. # aliasing is a known issue on amd64, work on x86 by sheer luck
  85. emake ${mymake} \
  86. CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
  87. emake ${mymake} \
  88. CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
  89. if use doc; then
  90. cd "${S}" || die "failed to change directory"
  91. # To prevent sandbox violations by metafont
  92. VARTEXFONTS="${T}"/fonts emake docpdf
  93. fi
  94. }
  95. src_test() {
  96. emake dobench
  97. }
  98. src_install() {
  99. default
  100. dodoc MACHINES COMPAT
  101. if use doc; then
  102. # install gphelp and the pdf documentations manually.
  103. # the install-doc target is overkill.
  104. dodoc doc/*.pdf
  105. dobin doc/gphelp
  106. insinto /usr/share/doc/${PF}
  107. # gphelp looks for some of the tex sources...
  108. doins doc/*.tex doc/translations
  109. # Install the examples - for real.
  110. local installdir=$(get_compile_dir)
  111. cd "${installdir}" || die "failed to change directory"
  112. emake EXDIR="${ED}/usr/share/doc/${PF}/examples" install-examples
  113. fi
  114. }