pari-2.3.5.ebuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=3
  4. inherit elisp-common 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_COM="http://pari.math.u-bordeaux.fr/pub/${PN}"
  8. SRC_URI="${SRC_COM}/unix/${P}.tar.gz
  9. data? ( ${SRC_COM}/packages/elldata.tgz
  10. ${SRC_COM}/packages/galdata.tgz
  11. ${SRC_COM}/packages/seadata.tgz
  12. ${SRC_COM}/packages/nftables.tgz )"
  13. LICENSE="GPL-2"
  14. SLOT="0"
  15. KEYWORDS="alpha amd64 hppa ~mips ppc ppc64 sparc x86 ~x86-fbsd ~x86-solaris"
  16. IUSE="doc data fltk gmp static-libs X"
  17. RDEPEND="sys-libs/readline
  18. fltk? ( x11-libs/fltk:1 )
  19. gmp? ( dev-libs/gmp )
  20. X? ( x11-libs/libX11 )
  21. doc? ( X? ( x11-misc/xdg-utils ) )"
  22. DEPEND="${RDEPEND}
  23. doc? ( virtual/latex-base )"
  24. get_compile_dir() {
  25. pushd "${S}/config" >& /dev/null
  26. local fastread=yes
  27. source ./get_archos
  28. popd >& /dev/null
  29. echo "O${osname}-${arch}"
  30. }
  31. src_prepare() {
  32. # move data into place
  33. if use data; then
  34. mv "${WORKDIR}"/data "${S}" || die "failed to move data"
  35. fi
  36. epatch "${FILESDIR}/"${PN}-2.3.2-strip.patch
  37. epatch "${FILESDIR}/"${PN}-2.3.2-ppc-powerpc-arch-fix.patch
  38. epatch "${FILESDIR}/"${PN}-2.3.5-doc-make.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 hardcoded xdvi by xdg-open
  48. sed -i \
  49. -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
  50. -e 's:"xdvi":"xdg-open":' \
  51. -e 's:xdvi -paper 29.7x21cm:xdg-open:' \
  52. doc/gphelp.in || die "Failed to fix doc dir"
  53. # disable emacs support
  54. sed -i -e '/^list=/s/emacs//' Configure \
  55. || die
  56. }
  57. src_configure() {
  58. append-flags -fno-strict-aliasing
  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 \
  74. $(use_with gmp) \
  75. || die "./Configure failed"
  76. }
  77. src_compile() {
  78. local installdir=$(get_compile_dir)
  79. cd "${installdir}" || die "Bad directory"
  80. emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE -fPIC" lib-dyn \
  81. || die "Building shared library failed!"
  82. if use static-libs; then
  83. emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE" lib-sta \
  84. || die "Building static library failed!"
  85. fi
  86. emake ${mymake} CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp \
  87. || die "Building executables failed!"
  88. if use doc; then
  89. cd "${S}"
  90. # To prevent sandbox violations by metafont
  91. VARTEXFONTS="${T}"/fonts emake docpdf \
  92. || die "Failed to generate docs"
  93. fi
  94. }
  95. src_test() {
  96. emake test-kernel || die
  97. }
  98. src_install() {
  99. emake DESTDIR="${D}" install || die "Install failed"
  100. dodoc AUTHORS Announce.2.1 CHANGES README NEW MACHINES COMPAT
  101. if use doc; then
  102. emake \
  103. DESTDIR="${D}" \
  104. EXDIR="${ED}/usr/share/doc/${PF}/examples" \
  105. DOCDIR="${ED}/usr/share/doc/${PF}" \
  106. install-doc || die "Failed to install docs"
  107. insinto /usr/share/doc/${PF}
  108. doins doc/*.pdf || die "Failed to install pdf docs"
  109. fi
  110. if use data; then
  111. emake DESTDIR="${D}" install-data || die "Failed to install data files"
  112. fi
  113. if use static-libs; then
  114. emake \
  115. DESTDIR="${D}" \
  116. install-lib-sta || die "Install of static library failed"
  117. fi
  118. }