pari-2.5.2.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 multilib
  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 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
  11. IUSE="data doc fltk gmp qt4 X"
  12. RDEPEND="sys-libs/readline
  13. data? ( sci-mathematics/pari-data )
  14. doc? ( X? ( x11-misc/xdg-utils ) )
  15. fltk? ( x11-libs/fltk:1 )
  16. gmp? ( dev-libs/gmp )
  17. qt4? ( dev-qt/qtgui:4 )
  18. X? ( x11-libs/libX11 )"
  19. DEPEND="${RDEPEND}
  20. doc? ( virtual/latex-base )"
  21. get_compile_dir() {
  22. pushd "${S}/config" > /dev/null
  23. local fastread=yes
  24. source ./get_archos
  25. popd > /dev/null
  26. echo "O${osname}-${arch}"
  27. }
  28. src_prepare() {
  29. epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
  30. epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
  31. # fix parallel make
  32. epatch "${FILESDIR}"/${PN}-2.5.0-doc-make.patch
  33. # sage error handling patch
  34. epatch "${FILESDIR}"/${PN}-2.5.0-mp.c.patch
  35. # OS X: add -install_name to the linker option
  36. epatch "${FILESDIR}"/${PN}-2.5.0-macos.patch
  37. # fix automagic
  38. epatch "${FILESDIR}"/${PN}-2.5.1-no-automagic.patch
  39. # disable default building of docs during install
  40. sed -i \
  41. -e "s:install-doc install-examples:install-examples:" \
  42. config/Makefile.SH || die "Failed to fix makefile"
  43. # propagate ldflags
  44. sed -i \
  45. -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
  46. config/get_dlld || die "failed to fix LDFLAGS"
  47. # move doc dir to a gentoo doc dir and replace acroread by xdg-open
  48. sed -i \
  49. -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
  50. -e 's:"acroread":"xdg-open":' \
  51. doc/gphelp.in || die "Failed to fix doc dir"
  52. sed -i "s:/\(usr\|lib64\):${EPREFIX}/\1:g" \
  53. config/get_{Qt,X11,include_path,libpth} \
  54. || die "Failed to fix get_X11"
  55. # usersch3.tex is generated
  56. rm doc/usersch3.tex || die "failed to remove generated file"
  57. }
  58. src_configure() {
  59. tc-export CC
  60. # need to force optimization here, as it breaks without
  61. if is-flag -O0; then
  62. replace-flags -O0 -O2
  63. elif ! is-flag -O?; then
  64. append-flags -O2
  65. fi
  66. # sysdatadir installs a pari.cfg stuff which is informative only
  67. ./Configure \
  68. --prefix="${EPREFIX}"/usr \
  69. --datadir="${EPREFIX}"/usr/share/${PN} \
  70. --libdir="${EPREFIX}"/usr/$(get_libdir) \
  71. --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
  72. --mandir="${EPREFIX}"/usr/share/man/man1 \
  73. --with-readline="${EPREFIX}"/usr \
  74. --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
  75. $(use_with fltk) \
  76. $(use_with gmp) \
  77. $(use_with qt4 qt) \
  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. }