gsl-2.3.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.3"
  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 +deprecated 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. if use deprecated; then
  40. sed -i -e "/GSL_DISABLE_DEPRECATED/,+2d" configure.ac || die
  41. fi
  42. eautoreconf
  43. cp "${FILESDIR}"/eselect.cblas.gsl "${T}"/ || die
  44. sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.gsl || die
  45. if [[ ${CHOST} == *-darwin* ]] ; then
  46. sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
  47. "${T}"/eselect.cblas.gsl || die
  48. fi
  49. }
  50. src_configure() {
  51. if use cblas-external; then
  52. export CBLAS_LIBS="$($(tc-getPKG_CONFIG) --libs cblas)"
  53. export CBLAS_CFLAGS="$($(tc-getPKG_CONFIG) --cflags cblas)"
  54. fi
  55. econf \
  56. --enable-shared \
  57. $(use_with cblas-external) \
  58. $(use_enable static-libs static)
  59. }
  60. src_test() {
  61. local MAKEOPTS="${MAKEOPTS} -j1"
  62. default
  63. }
  64. src_install() {
  65. default
  66. find "${ED}" -name '*.la' -exec rm -f {} +
  67. # take care of pkgconfig file for cblas implementation.
  68. sed \
  69. -e "s/@LIBDIR@/$(get_libdir)/" \
  70. -e "s/@PV@/${PV}/" \
  71. -e "/^prefix=/s:=:=${EPREFIX}:" \
  72. -e "/^libdir=/s:=:=${EPREFIX}:" \
  73. "${FILESDIR}"/cblas.pc.in > cblas.pc \
  74. || die "sed cblas.pc failed"
  75. insinto /usr/$(get_libdir)/blas/gsl
  76. doins cblas.pc
  77. eselect cblas add $(get_libdir) "${T}"/eselect.cblas.gsl \
  78. ${ESELECT_PROF}
  79. }
  80. pkg_postinst() {
  81. local p=cblas
  82. local current_lib=$(eselect ${p} show | cut -d' ' -f2)
  83. if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
  84. # work around eselect bug #189942
  85. local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
  86. [[ -e ${configfile} ]] && rm -f ${configfile}
  87. eselect ${p} set ${ESELECT_PROF}
  88. elog "${p} has been eselected to ${ESELECT_PROF}"
  89. else
  90. elog "Current eselected ${p} is ${current_lib}"
  91. elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
  92. elog "\t eselect ${p} set ${ESELECT_PROF}"
  93. fi
  94. }