# Copyright 2014-2016 Julian Ospald <hasufell@posteo.de>
# Distributed under the terms of the GNU General Public License v2

SUMMARY="Fast Library for Number Theory"
HOMEPAGE="http://www.flintlib.org/"
DOWNLOADS="http://www.flintlib.org/${PNV}.tar.gz"

LICENCES="GPL-2"
SLOT="0"
PLATFORMS="~amd64 ~x86"

DEPENDENCIES="
    build+run:
        dev-libs/gmp
        dev-libs/mpfr
"

DEFAULT_SRC_COMPILE_PARAMS=( verbose )
DEFAULT_SRC_TEST_PARAMS=( AT= QUIET_CC= QUIET_CXX= QUIET_AR= )
DEFAULT_SRC_INSTALL_PARAMS=( DESTDIR="${IMAGE}" LIBDIR="/usr/$(exhost --target)/lib" )

src_prepare() {
    edo sed -i -e "s#include/flint#$(exhost --target)/include/flint#" \
        Makefile.in
}

src_configure() {
    # NOT an autotools script
    edo ./configure \
        --prefix="/usr" \
        --with-gmp="/usr" \
        --with-mpfr="/usr" \
        --disable-static \
        CC=${CC} \
        CXX=${CXX} \
        AR=${AR}
}