# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

inherit toolchain-funcs

DESCRIPTION="GNU Multiple Precision Arithmetic Library benchmark"
HOMEPAGE="http://gmplib.org/"
SRC_URI="
	ftp://ftp.gmplib.org/pub/misc/${P}.tar.bz2
	http://gmplib.org/gexpr.c
"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="hppa ppc x86"
IUSE=""

DEPEND="dev-libs/gmp"

src_unpack() {
	unpack ${A}
	cp "${DISTDIR}"/gexpr.c .
}

src_prepare() {
	sed -i runbench -e 's|gexpr|../&|g' || die "sed runbench"
}

src_compile() {
	cd "${WORKDIR}"
	$(tc-getCC) ${CFLAGS} ${LDFLAGS} -o gexpr gexpr.c -lm || die
}

src_test() {
	CFLAGS="${CFLAGS}" CC=$(tc-getCC) ./runbench
}

src_install() {
	dodoc README RES*
}