app-misc/nci: bump 1.4.1 -> 1.5.0
[sgilles-overlay.git] / sci-mathematics / pari / pari-2.7.0.ebuild
blob6f9a494af071869d84d65b2f9694d39c7efb26d2
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 $
5 EAPI=5
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"
13 LICENSE="GPL-2"
14 SLOT="0/4"
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"
18 RDEPEND="
19         sys-libs/readline:0=
20         data? ( sci-mathematics/pari-data )
21         doc? ( X? ( x11-misc/xdg-utils ) )
22         x11-libs/fltk:1=
23         gmp? ( dev-libs/gmp:0= )
24         qt4? ( dev-qt/qtgui:4= )
25         X? ( x11-libs/libX11:0= )"
26 DEPEND="${RDEPEND}
27         doc? ( virtual/latex-base )"
29 get_compile_dir() {
30         pushd "${S}/config" > /dev/null
31         local fastread=yes
32         source ./get_archos
33         popd > /dev/null
34         echo "O${osname}-${arch}"
37 src_prepare() {
38         epatch "${FILESDIR}"/${PN}-2.3.2-strip.patch
39         epatch "${FILESDIR}"/${PN}-2.3.2-ppc-powerpc-arch-fix.patch
40         # fix parallel make
41         epatch "${FILESDIR}"/${PN}-2.7.0-doc-make.patch
42         # fix automagic
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
48         sed -i \
49                 -e "s:install-doc install-examples:install-examples:" \
50                 config/Makefile.SH || die "Failed to fix makefile"
52         # propagate ldflags
53         sed -i \
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
57         sed -i \
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"
66 src_configure() {
67         tc-export CC
68         export CPLUSPLUS=$(tc-getCXX)
70         # need to force optimization here, as it breaks without
71         if is-flag -O0; then
72                 replace-flags -O0 -O2
73         elif ! is-flag -O?; then
74                 append-flags -O2
75         fi
77         # sysdatadir installs a pari.cfg stuff which is informative only
78         ./Configure \
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) \
86                 $(use_with gmp) \
87                 $(use_with qt4 qt) \
88                 || die "./Configure failed"
91 src_compile() {
92         use hppa && \
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
101         emake ${mymake} \
102                 CFLAGS="${CFLAGS} -fno-strict-aliasing -DGCC_INLINE -fPIC" lib-dyn
103         emake ${mymake} ${mycxxmake} \
104                 CFLAGS="${CFLAGS} -DGCC_INLINE" gp ../gp
106         if use doc; then
107                 cd "${S}" || die "failed to change directory"
108                 # To prevent sandbox violations by metafont
109                 VARTEXFONTS="${T}"/fonts emake docpdf
110         fi
113 src_test() {
114         emake dobench
117 src_install() {
118         emake ${mymake} ${mycxxmake} DESTDIR="${D}" install
119         dodoc MACHINES COMPAT
120         if use doc; then
121                 # install gphelp and the pdf documentations manually.
122                 # the install-doc target is overkill.
123                 dodoc doc/*.pdf
124                 dobin doc/gphelp
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
131         fi