cblas-reference-20151113-r2.ebuild 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils fortran-2 cmake-utils multilib flag-o-matic toolchain-funcs
  5. LPN=lapack
  6. LPV=3.6.0
  7. DESCRIPTION="C wrapper interface to the F77 reference BLAS implementation"
  8. HOMEPAGE="http://www.netlib.org/cblas/"
  9. SRC_URI="http://www.netlib.org/${LPN}/${LPN}-${LPV}.tgz"
  10. LICENSE="BSD"
  11. SLOT="0"
  12. KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~x64-macos"
  13. IUSE=""
  14. DEPEND="app-eselect/eselect-cblas
  15. >=virtual/blas-3.6
  16. virtual/pkgconfig"
  17. RDEPEND="${DEPEND}"
  18. S="${WORKDIR}/${LPN}-${LPV}"
  19. PATCHES=( "${FILESDIR}/lapack-reference-${LPV}-fix-build-system.patch" )
  20. src_prepare() {
  21. epatch "${PATCHES[@]}"
  22. eapply_user
  23. ESELECT_PROF=reference
  24. cp "${FILESDIR}"/eselect.cblas.reference-r2 "${T}"/eselect.cblas.reference || die
  25. sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.cblas.reference || die
  26. if [[ ${CHOST} == *-darwin* ]] ; then
  27. sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
  28. "${T}"/eselect.cblas.reference || die
  29. fi
  30. sed -i \
  31. -e 's:/CMAKE/:/cmake/:g' \
  32. CBLAS/CMakeLists.txt || die
  33. }
  34. src_configure() {
  35. local mycmakeargs=(
  36. -Wno-dev
  37. -DCBLAS=ON
  38. -DUSE_OPTIMIZED_BLAS=ON
  39. -DBLAS_LIBRARIES="$($(tc-getPKG_CONFIG) --libs blas)"
  40. -DCMAKE_C_FLAGS="$($(tc-getPKG_CONFIG) --cflags blas) ${CFLAGS}"
  41. -DCMAKE_Fortran_FLAGS="$($(tc-getPKG_CONFIG) --cflags blas) $(get_abi_CFLAGS) ${FCFLAGS}"
  42. -DBUILD_SHARED_LIBS=ON
  43. -DBUILD_STATIC_LIBS=ON
  44. )
  45. cmake-utils_src_configure
  46. }
  47. src_compile() {
  48. cmake-utils_src_compile -C CBLAS
  49. }
  50. src_install() {
  51. cmake-utils_src_install -C CBLAS
  52. mkdir -p "${ED}/usr/$(get_libdir)/blas/reference" || die
  53. mv "${ED}/usr/$(get_libdir)"/lib* "${ED}/usr/include"/cblas* \
  54. "${ED}/usr/$(get_libdir)/pkgconfig"/* \
  55. "${ED}/usr/$(get_libdir)/blas/reference" || die
  56. rmdir "${ED}/usr/$(get_libdir)/pkgconfig" || die
  57. rmdir "${ED}/usr/include" || die
  58. eselect cblas add $(get_libdir) "${T}"/eselect.cblas.reference ${ESELECT_PROF}
  59. }
  60. pkg_postinst() {
  61. local p=cblas
  62. local current_lib=$(eselect ${p} show | cut -d' ' -f2)
  63. if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
  64. # work around eselect bug #189942
  65. local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
  66. [[ -e ${configfile} ]] && rm -f ${configfile}
  67. eselect ${p} set ${ESELECT_PROF}
  68. elog "${p} has been eselected to ${ESELECT_PROF}"
  69. else
  70. elog "Current eselected ${p} is ${current_lib}"
  71. elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
  72. elog "\t eselect ${p} set ${ESELECT_PROF}"
  73. fi
  74. }