gsl-2.1.ebuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit autotools eutils flag-o-matic toolchain-funcs
  5. DESCRIPTION="The GNU Scientific Library"
  6. HOMEPAGE="https://www.gnu.org/software/gsl/"
  7. SRC_URI="mirror://gnu/${PN}/${P}.tar.gz"
  8. LICENSE="GPL-3"
  9. SLOT="0/19"
  10. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~x86-macos ~sparc-solaris ~x86-solaris"
  11. IUSE="cblas-external static-libs"
  12. RDEPEND="cblas-external? ( virtual/cblas )"
  13. DEPEND="${RDEPEND}
  14. app-eselect/eselect-cblas
  15. virtual/pkgconfig"
  16. PATCHES=( "${FILESDIR}"/${P}-cblas.patch )
  17. pkg_pretend() {
  18. # prevent to use external cblas from a previously installed gsl
  19. local current_lib
  20. if use cblas-external; then
  21. current_lib=$(eselect cblas show | cut -d' ' -f2)
  22. if [[ ${current_lib} == gsl ]]; then
  23. ewarn "USE flag cblas-external is set: linking gsl with an external cblas."
  24. ewarn "However the current selected external cblas is gsl."
  25. ewarn "Please install and/or eselect another cblas"
  26. die "Circular gsl dependency"
  27. fi
  28. fi
  29. }
  30. src_prepare() {
  31. ESELECT_PROF="gsl"
  32. # bug 349005
  33. [[ $(tc-getCC)$ == *gcc* ]] && \
  34. [[ $(tc-getCC)$ != *apple* ]] && \
  35. [[ $(gcc-major-version)$(gcc-minor-version) -eq 44 ]] \
  36. && filter-mfpmath sse
  37. filter-flags -ffast-math
  38. default
  39. eautoreconf
  40. cp "${FILESDIR}"/eselect.cblas.gsl "${T}"/
  41. sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.gsl || die
  42. if [[ ${CHOST} == *-darwin* ]] ; then
  43. sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
  44. "${T}"/eselect.cblas.gsl || die
  45. fi
  46. }
  47. src_configure() {
  48. if use cblas-external; then
  49. export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)"
  50. export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)"
  51. fi
  52. econf \
  53. --enable-shared \
  54. $(use_with cblas-external) \
  55. $(use_enable static-libs static)
  56. }
  57. src_test() {
  58. local MAKEOPTS="${MAKEOPTS} -j1"
  59. default
  60. }
  61. src_install() {
  62. default
  63. find "${ED}" -name '*.la' -exec rm -f {} +
  64. # take care of pkgconfig file for cblas implementation.
  65. sed \
  66. -e "s/@LIBDIR@/$(get_libdir)/" \
  67. -e "s/@PV@/${PV}/" \
  68. -e "/^prefix=/s:=:=${EPREFIX}:" \
  69. -e "/^libdir=/s:=:=${EPREFIX}:" \
  70. "${FILESDIR}"/cblas.pc.in > cblas.pc \
  71. || die "sed cblas.pc failed"
  72. insinto /usr/$(get_libdir)/blas/gsl
  73. doins cblas.pc
  74. eselect cblas add $(get_libdir) "${T}"/eselect.cblas.gsl \
  75. ${ESELECT_PROF}
  76. }
  77. pkg_postinst() {
  78. local p=cblas
  79. local current_lib=$(eselect ${p} show | cut -d' ' -f2)
  80. if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
  81. # work around eselect bug #189942
  82. local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
  83. [[ -e ${configfile} ]] && rm -f ${configfile}
  84. eselect ${p} set ${ESELECT_PROF}
  85. elog "${p} has been eselected to ${ESELECT_PROF}"
  86. else
  87. elog "Current eselected ${p} is ${current_lib}"
  88. elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
  89. elog "\t eselect ${p} set ${ESELECT_PROF}"
  90. fi
  91. }