0b4672d57dc6eaa04c6e09ac059dbd4040a82f2d
[gentoo.git] / sci-mathematics / msieve / msieve-1.51-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 inherit eutils toolchain-funcs
7
8 DESCRIPTION="A C library implementing a suite of algorithms to factor large integers"
9 HOMEPAGE="https://sourceforge.net/projects/msieve/"
10 SRC_URI="mirror://sourceforge/${PN}/${PN}/Msieve%20v${PV}/${PN}${PV/./}.tar.gz"
11
12 LICENSE="public-domain"
13 SLOT="0"
14 KEYWORDS="~amd64 ~x86"
15 IUSE="zlib +ecm mpi"
16
17 DEPEND="
18         ecm? ( sci-mathematics/gmp-ecm )
19         mpi? ( virtual/mpi )
20         zlib? ( sys-libs/zlib )"
21 RDEPEND="${DEPEND}"
22
23 src_prepare() {
24         # TODO: Integrate ggnfs properly
25         epatch \
26                 "${FILESDIR}"/${P}-reduce-printf.patch \
27                 "${FILESDIR}"/fix-version.patch \
28                 "${FILESDIR}"/fix-version2.patch
29         sed -i -e 's/-march=k8//' Makefile              || die
30         sed -i -e 's/CC =/#CC =/' Makefile              || die
31         sed -i -e 's/CFLAGS =/CFLAGS +=/' Makefile      || die
32         sed -i -e 's/LIBS += -lecm/LIBS += -lecm -lgomp/' Makefile || die
33 }
34
35 src_compile() {
36         use ecm && export "ECM=1"
37         use mpi && export "MPI=1"
38         use zlib && export "ZLIB=1"
39         emake \
40                 CC=$(tc-getCC) \
41                 AR=$(tc-getAR) \
42                 OPT_FLAGS="${CFLAGS}" \
43                 all
44 }
45
46 src_install() {
47         mkdir -p "${D}/usr/include/msieve"
48         mkdir -p "${D}/usr/lib/"
49         mkdir -p "${D}/usr/share/doc/${P}/"
50         cp include/* "${D}/usr/include/msieve" || die "Failed to install"
51         cp libmsieve.a "${D}/usr/lib/" || die "Failed to install"
52         dobin msieve || die "Failed to install"
53         cp Readme* "${D}/usr/share/doc/${P}/" || die "Failed to install"
54 }