1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils flag-o-matic autotools toolchain-funcs
9 DESCRIPTION="The GNU Scientific Library"
10 HOMEPAGE="https://www.gnu.org/software/gsl/"
11 SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
15 KEYWORDS="alpha amd64 arm hppa ~ia64 ~mips ppc ~ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x86-solaris"
16 IUSE="cblas-external static-libs"
18 RDEPEND="cblas-external? ( virtual/cblas )"
20 app-eselect/eselect-cblas
23 DOCS=( AUTHORS BUGS ChangeLog NEWS README THANKS TODO )
26 # prevent to use external cblas from a previously installed gsl
28 if use cblas-external; then
29 current_lib=$(eselect cblas show | cut -d' ' -f2)
30 if [[ ${current_lib} == gsl ]]; then
31 ewarn "USE flag cblas-external is set: linking gsl with an external cblas."
32 ewarn "However the current selected external cblas is gsl."
33 ewarn "Please install and/or eselect another cblas"
34 die "Circular gsl dependency"
43 [[ $(tc-getCC)$ == *gcc* ]] && \
44 [[ $(tc-getCC)$ != *apple* ]] && \
45 [[ $(gcc-major-version)$(gcc-minor-version) -eq 44 ]] \
47 filter-flags -ffast-math
49 epatch "${FILESDIR}"/${P}-cblas.patch
52 cp "${FILESDIR}"/eselect.cblas.gsl "${T}"/ || die
53 sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.gsl || die
54 if [[ ${CHOST} == *-darwin* ]] ; then
55 sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
56 "${T}"/eselect.cblas.gsl || die
61 if use cblas-external; then
62 export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)"
63 export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)"
67 $(use_with cblas-external) \
68 $(use_enable static-libs static)
78 find "${ED}" -name '*.la' -exec rm -f {} + || die
80 # take care of pkgconfig file for cblas implementation.
81 sed -e "s/@LIBDIR@/$(get_libdir)/" \
83 -e "/^prefix=/s:=:=${EPREFIX}:" \
84 -e "/^libdir=/s:=:=${EPREFIX}:" \
85 "${FILESDIR}"/cblas.pc.in > cblas.pc \
86 || die "sed cblas.pc failed"
87 insinto /usr/$(get_libdir)/blas/gsl
89 eselect cblas add $(get_libdir) "${T}"/eselect.cblas.gsl \
95 local current_lib=$(eselect ${p} show | cut -d' ' -f2)
96 if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
97 # work around eselect bug #189942
98 local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
99 [[ -e ${configfile} ]] && rm -f ${configfile}
100 eselect ${p} set ${ESELECT_PROF}
101 elog "${p} has been eselected to ${ESELECT_PROF}"
103 elog "Current eselected ${p} is ${current_lib}"
104 elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
105 elog "\t eselect ${p} set ${ESELECT_PROF}"