blas-reference-20151113-r1.ebuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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="Basic Linear Algebra Subprograms F77 reference implementations"
  8. HOMEPAGE="http://www.netlib.org/blas/"
  9. SRC_URI="http://www.netlib.org/${LPN}/${LPN}-${LPV}.tgz"
  10. LICENSE="BSD"
  11. SLOT="0"
  12. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
  13. IUSE="doc"
  14. DEPEND="app-eselect/eselect-blas"
  15. RDEPEND="${DEPEND}
  16. doc? ( app-doc/blas-docs )
  17. virtual/pkgconfig"
  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.blas.reference-r1 "${T}"/eselect.blas.reference || die
  25. sed -i -e "s:/usr:${EPREFIX}/usr:" "${T}"/eselect.blas.reference || die
  26. if [[ ${CHOST} == *-darwin* ]] ; then
  27. sed -i -e 's/\.so\([\.0-9]\+\)\?/\1.dylib/g' \
  28. "${T}"/eselect.blas.reference || die
  29. fi
  30. }
  31. src_configure() {
  32. local mycmakeargs=(
  33. -Wno-dev
  34. -DUSE_OPTIMIZED_BLAS=OFF
  35. -DCMAKE_Fortran_FLAGS="$(get_abi_CFLAGS) ${FCFLAGS}"
  36. -DBUILD_SHARED_LIBS=ON
  37. -DBUILD_STATIC_LIBS=ON
  38. )
  39. cmake-utils_src_configure
  40. }
  41. src_compile() {
  42. cmake-utils_src_compile -C BLAS
  43. }
  44. src_install() {
  45. cmake-utils_src_install -C BLAS
  46. mkdir -p "${ED}/usr/$(get_libdir)/blas/reference" || die
  47. mv "${ED}/usr/$(get_libdir)"/lib* "${ED}/usr/$(get_libdir)/pkgconfig"/* \
  48. "${ED}/usr/$(get_libdir)/blas/reference" || die
  49. rmdir "${ED}/usr/$(get_libdir)/pkgconfig" || die
  50. eselect blas add $(get_libdir) "${T}"/eselect.blas.reference ${ESELECT_PROF}
  51. }
  52. pkg_postinst() {
  53. local p=blas
  54. local current_lib=$(eselect ${p} show | cut -d' ' -f2)
  55. if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
  56. # work around eselect bug #189942
  57. local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
  58. [[ -e ${configfile} ]] && rm -f ${configfile}
  59. eselect ${p} set ${ESELECT_PROF}
  60. elog "${p} has been eselected to ${ESELECT_PROF}"
  61. else
  62. elog "Current eselected ${p} is ${current_lib}"
  63. elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
  64. elog "\t eselect ${p} set ${ESELECT_PROF}"
  65. fi
  66. }