blas-reference-20161223.ebuild 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.7.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. if [[ ${CHOST} == *-darwin* ]] ; then
  50. # modify install_names accordingly, bug #605214
  51. local lib
  52. for lib in "${ED}"/usr/$(get_libdir)/blas/reference/*.dylib ; do
  53. install_name_tool -id "${lib#${D%/}}" "${lib}"
  54. done
  55. fi
  56. rmdir "${ED}/usr/$(get_libdir)/pkgconfig" || die
  57. eselect blas add $(get_libdir) "${T}"/eselect.blas.reference ${ESELECT_PROF}
  58. }
  59. pkg_postinst() {
  60. local p=blas
  61. local current_lib=$(eselect ${p} show | cut -d' ' -f2)
  62. if [[ ${current_lib} == ${ESELECT_PROF} || -z ${current_lib} ]]; then
  63. # work around eselect bug #189942
  64. local configfile="${EROOT}"/etc/env.d/${p}/$(get_libdir)/config
  65. [[ -e ${configfile} ]] && rm -f ${configfile}
  66. eselect ${p} set ${ESELECT_PROF}
  67. elog "${p} has been eselected to ${ESELECT_PROF}"
  68. else
  69. elog "Current eselected ${p} is ${current_lib}"
  70. elog "To use ${p} ${ESELECT_PROF} implementation, you have to issue (as root):"
  71. elog "\t eselect ${p} set ${ESELECT_PROF}"
  72. fi
  73. }