1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-mathematics/pari/pari-2.7.0.ebuild,v 1.1 2014/05/08 21:27:43 bicatali Exp $
7 inherit eutils flag-o-matic toolchain-funcs multilib
9 DESCRIPTION="Computer-aided number theory C library and tools"
10 HOMEPAGE="http://pari.math.u-bordeaux.fr/"
11 SRC_URI="http://pari.math.u-bordeaux.fr/pub/${PN}/unix/${P}.tar.gz"
15 KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-fbsd ~x86-linux ~x86-macos ~x86-solaris"
16 IUSE="data doc fltk gmp qt4 X"
20 data? ( sci-mathematics/pari-data )
21 doc? ( X? ( x11-misc/xdg-utils ) )
23 gmp? ( dev-libs/gmp:0= )
24 qt4? ( dev-qt/qtgui:4= )
25 X? ( x11-libs/libX11:0= )"
27 doc? ( virtual/latex-base )"
30 pushd "${S}/config" > /dev/null
34 echo "O${osname}-${arch}"
38 epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
39 epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
41 epatch "${FILESDIR}"/${PN}-2.7.0-doc-make.patch
43 epatch "${FILESDIR}"/${PN}-2.7.0-no-automagic.patch
44 # sage-on-gentoo trac 15654: PARI discriminant speed depends on stack size
45 epatch "${FILESDIR}"/${PN}-2.7.0-slow-discriminant.patch
47 # disable default building of docs during install
49 -e "s:install-doc install-examples:install-examples:" \
50 config/Makefile.SH || die "Failed to fix makefile"
54 -e 's/$shared $extra/$shared $extra \\$(LDFLAGS)/' \
55 config/get_dlld || die "failed to fix LDFLAGS"
56 # move doc dir to a gentoo doc dir and replace acroread by xdg-open
58 -e "s:\$d = \$0:\$d = '${EPREFIX}/usr/share/doc/${PF}':" \
59 -e 's:"acroread":"xdg-open":' \
60 doc/gphelp.in || die "Failed to fix doc dir"
62 # usersch3.tex is generated
63 rm doc/usersch3.tex || die "failed to remove generated file"
68 export CPLUSPLUS=$(tc-getCXX)
70 # need to force optimization here, as it breaks without
73 elif ! is-flag -O?; then
77 # sysdatadir installs a pari.cfg stuff which is informative only
79 --prefix="${EPREFIX}"/usr \
80 --datadir="${EPREFIX}"/usr/share/${PN} \
81 --libdir="${EPREFIX}"/usr/$(get_libdir) \
82 --sysdatadir="${EPREFIX}"/usr/share/doc/${PF} \
83 --mandir="${EPREFIX}"/usr/share/man/man1 \
84 --with-readline="${EPREFIX}"/usr \
85 --with-ncurses-lib="${EPREFIX}"/usr/$(get_libdir) \
88 || die "./Configure failed"
93 mymake=DLLD\="${EPREFIX}"/usr/bin/gcc\ DLLDFLAGS\=-shared\ -Wl,-soname=\$\(LIBPARI_SONAME\)\ -lm
95 mycxxmake=LD\=$(tc-getCXX)
97 local installdir=$(get_compile_dir)
98 cd "${installdir}" || die "failed to change directory"
99 # upstream set -fno-strict-aliasing.
100 # aliasing is a known issue on amd64, work on x86 by sheer luck
102 CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
103 emake ${mymake} ${mycxxmake} \
104 CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
107 cd "${S}" || die "failed to change directory"
108 # To prevent sandbox violations by metafont
109 VARTEXFONTS="${T}"/fonts emake docpdf
118 emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
119 dodoc MACHINES COMPAT
121 # install gphelp and the pdf documentations manually.
122 # the install-doc target is overkill.
125 insinto /usr/share/doc/${PF}
126 # gphelp looks for some of the tex sources...
127 doins doc/*.tex doc/translations
128 # Install the examples - for real.
129 emake EXDIR="${ED}/usr/share/doc/${PF}/examples" \
130 -C $(get_compile_dir) install-examples