cholmod-5.2.0.ebuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. inherit cuda cmake-multilib toolchain-funcs
  5. Sparse_PV="7.6.0"
  6. Sparse_P="SuiteSparse-${Sparse_PV}"
  7. DESCRIPTION="Sparse Cholesky factorization and update/downdate library"
  8. HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
  9. SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"
  10. LICENSE="LGPL-2.1+ modify? ( GPL-2+ ) matrixops? ( GPL-2+ )"
  11. SLOT="0/4"
  12. KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
  13. IUSE="+cholesky cuda camd +check debug doc fortran openmp +matrixops +modify +partition +supernodal test static-libs"
  14. RESTRICT="!test? ( test )"
  15. DEPEND=">=sci-libs/suitesparseconfig-${Sparse_PV}
  16. >=sci-libs/amd-3.3.1
  17. >=sci-libs/colamd-3.3.1
  18. supernodal? ( virtual/lapack )
  19. partition? (
  20. >=sci-libs/camd-3.3.1
  21. >=sci-libs/ccolamd-3.3.1
  22. >=sci-libs/metis-5.2.1
  23. )
  24. cuda? (
  25. dev-util/nvidia-cuda-toolkit
  26. x11-drivers/nvidia-drivers
  27. )"
  28. RDEPEND="${DEPEND}"
  29. BDEPEND="doc? ( virtual/latex-base )"
  30. REQUIRED_USE="supernodal? ( cholesky )
  31. modify? ( cholesky )
  32. matrixops? ( check )
  33. partition? ( camd )
  34. test? ( cholesky matrixops supernodal )"
  35. S="${WORKDIR}/${Sparse_P}/${PN^^}"
  36. RESTRICT="mirror"
  37. pkg_pretend() {
  38. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  39. }
  40. pkg_setup() {
  41. [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
  42. }
  43. src_prepare() {
  44. use cuda && cuda_src_prepare
  45. multilib_copy_sources
  46. cmake_src_prepare
  47. }
  48. multilib_src_configure() {
  49. # Not that "N" prefixed options are negative options
  50. # so they need to be turned OFF if you want that option.
  51. # Fortran is turned off as it is only used to compile (untested) demo programs.
  52. CMAKE_BUILD_TYPE=$(usex debug RelWithDebInfo Release)
  53. local mycmakeargs=(
  54. -DBUILD_STATIC_LIBS=$(usex static-libs)
  55. -DCHOLMOD_USE_CUDA=$(usex cuda)
  56. -DCHOLMOD_USE_OPENMP=$(usex openmp)
  57. -DSUITESPARSE_HAS_FORTRAN=$(usex fortran)
  58. -DCHOLMOD_CAMD=$(usex camd)
  59. -DCHOLMOD_CHECK=$(usex check)
  60. -DCHOLMOD_CHOLESKY=$(usex cholesky)
  61. -DCHOLMOD_MATRIXOPS=$(usex matrixops)
  62. -DCHOLMOD_MODIFY=$(usex modify)
  63. -DCHOLMOD_PARTITION=$(usex partition)
  64. -DCHOLMOD_SUPERNODAL=$(usex supernodal)
  65. -DSUITESPARSE_DEMOS=$(usex test)
  66. )
  67. cmake_src_configure
  68. }
  69. multilib_src_test() {
  70. # Run demo files
  71. ./cholmod_demo < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
  72. ./cholmod_l_demo < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
  73. ./cholmod_demo < "${S}"/Demo/Matrix/lp_afiro.tri || die "failed testing"
  74. ./cholmod_l_demo < "${S}"/Demo/Matrix/lp_afiro.tri || die "failed testing"
  75. ./cholmod_demo < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
  76. ./cholmod_l_demo < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
  77. ./cholmod_demo < "${S}"/Demo/Matrix/c.tri || die "failed testing"
  78. ./cholmod_l_demo < "${S}"/Demo/Matrix/c.tri || die "failed testing"
  79. ./cholmod_simple < "${S}"/Demo/Matrix/c.tri || die "failed testing"
  80. ./cholmod_simple < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
  81. ./cholmod_simple < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
  82. }
  83. multilib_src_install() {
  84. if use doc; then
  85. pushd "${S}/Doc"
  86. rm -rf *.pdf
  87. emake
  88. popd
  89. DOCS="${S}/Doc/*.pdf"
  90. fi
  91. cmake_src_install
  92. }
  93. multilib_src_install_all() {
  94. # no static archives
  95. use !static-libs && ( find "${ED}" -name "*.a" -delete || die )
  96. # strip .la files
  97. find "${D}" -name '*.la' -delete || die
  98. }