1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit toolchain-funcs
|
|
6 |
inherit cmake-multilib toolchain-funcs
|
7 |
7 |
|
|
8 |
Sparse_PV="7.0.0"
|
|
9 |
Sparse_P="SuiteSparse-${Sparse_PV}"
|
8 |
10 |
DESCRIPTION="Sparse Cholesky factorization and update/downdate library"
|
9 |
11 |
HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
|
10 |
|
SRC_URI="http://202.36.178.9/sage/${P}.tar.bz2"
|
|
12 |
SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"
|
11 |
13 |
|
12 |
14 |
LICENSE="LGPL-2.1+ modify? ( GPL-2+ ) matrixops? ( GPL-2+ )"
|
13 |
|
SLOT="0"
|
14 |
|
KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ~ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
|
15 |
|
IUSE="cuda doc +lapack +matrixops +modify +partition"
|
16 |
|
|
17 |
|
BDEPEND="virtual/pkgconfig
|
18 |
|
doc? ( virtual/latex-base )"
|
19 |
|
DEPEND="
|
20 |
|
sci-libs/amd
|
21 |
|
sci-libs/colamd
|
|
15 |
SLOT="0/4"
|
|
16 |
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
|
|
17 |
IUSE="+cholesky cuda doc openmp +matrixops +modify +partition +supernodal test"
|
|
18 |
RESTRICT="!test? ( test )"
|
|
19 |
|
|
20 |
DEPEND=">=sci-libs/suitesparseconfig-${Sparse_PV}
|
|
21 |
>=sci-libs/amd-3.0.3
|
|
22 |
>=sci-libs/colamd-3.0.3
|
|
23 |
supernodal? ( virtual/lapack )
|
|
24 |
partition? (
|
|
25 |
>=sci-libs/camd-3.0.3
|
|
26 |
>=sci-libs/ccolamd-3.0.3
|
|
27 |
)
|
22 |
28 |
cuda? (
|
23 |
29 |
dev-util/nvidia-cuda-toolkit
|
24 |
30 |
x11-drivers/nvidia-drivers
|
25 |
|
)
|
26 |
|
lapack? ( virtual/lapack )
|
27 |
|
partition? (
|
28 |
|
sci-libs/camd
|
29 |
|
sci-libs/ccolamd
|
30 |
|
>=sci-libs/metis-5.1.0
|
31 |
31 |
)"
|
32 |
32 |
RDEPEND="${DEPEND}"
|
|
33 |
BDEPEND="doc? ( virtual/latex-base )"
|
33 |
34 |
|
34 |
|
src_configure() {
|
35 |
|
local lapack_libs=no
|
36 |
|
local blas_libs=no
|
37 |
|
if use lapack; then
|
38 |
|
blas_libs=$($(tc-getPKG_CONFIG) --libs blas)
|
39 |
|
lapack_libs=$($(tc-getPKG_CONFIG) --libs lapack)
|
40 |
|
fi
|
|
35 |
REQUIRED_USE="supernodal? ( cholesky )
|
|
36 |
modify? ( cholesky )
|
|
37 |
test? ( cholesky matrixops supernodal )"
|
41 |
38 |
|
42 |
|
local cudaconfargs=( $(use_with cuda) )
|
43 |
|
if use cuda ; then
|
44 |
|
cudaconfargs+=(
|
45 |
|
--with-cublas-libs="-L${EPREFIX}/opt/cuda/$(get_libdir) -lcublas"
|
46 |
|
--with-cublas-cflags="-I${EPREFIX}/opt/cuda/include"
|
47 |
|
)
|
48 |
|
fi
|
|
39 |
S="${WORKDIR}/${Sparse_P}/${PN^^}"
|
49 |
40 |
|
50 |
|
econf \
|
51 |
|
--disable-static \
|
52 |
|
--with-blas="${blas_libs}" \
|
53 |
|
--with-lapack="${lapack_libs}" \
|
54 |
|
$(use_with doc) \
|
55 |
|
$(use_with modify) \
|
56 |
|
$(use_with matrixops) \
|
57 |
|
$(use_with partition) \
|
58 |
|
$(use_with partition camd) \
|
59 |
|
$(use_with lapack supernodal) \
|
60 |
|
"${cudaconfargs[@]}"
|
|
41 |
pkg_pretend() {
|
|
42 |
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
61 |
43 |
}
|
62 |
44 |
|
63 |
|
src_install() {
|
64 |
|
default
|
|
45 |
pkg_setup() {
|
|
46 |
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
|
|
47 |
}
|
65 |
48 |
|
66 |
|
# no static archives
|
67 |
|
find "${D}" -name '*.la' -delete || die
|
|
49 |
multilib_src_configure() {
|
|
50 |
# Not that "N" prefixed options are negative options
|
|
51 |
# so they need to be turned OFF if you want that option.
|
|
52 |
# Fortran is turned off as it is only used to compile (untested) demo programs.
|
|
53 |
local mycmakeargs=(
|
|
54 |
-DNSTATIC=ON
|
|
55 |
-DENABLE_CUDA=$(usex cuda)
|
|
56 |
-DNOPENMP=$(usex openmp OFF ON)
|
|
57 |
-DNFORTRAN=ON
|
|
58 |
-DNCHOLESKY=$(usex cholesky OFF ON)
|
|
59 |
-DNMATRIXOPS=$(usex matrixops OFF ON)
|
|
60 |
-DNMODIFY=$(usex modify OFF ON)
|
|
61 |
-DNPARTITION=$(usex partition OFF ON)
|
|
62 |
-DNSUPERNODAL=$(usex supernodal OFF ON)
|
|
63 |
-DDEMO=$(usex test)
|
|
64 |
)
|
|
65 |
cmake_src_configure
|
|
66 |
}
|
|
67 |
|
|
68 |
multilib_src_test() {
|
|
69 |
# Run demo files
|
|
70 |
./cholmod_demo < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
|
|
71 |
./cholmod_l_demo < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
|
|
72 |
./cholmod_demo < "${S}"/Demo/Matrix/lp_afiro.tri || die "failed testing"
|
|
73 |
./cholmod_l_demo < "${S}"/Demo/Matrix/lp_afiro.tri || die "failed testing"
|
|
74 |
./cholmod_demo < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
|
|
75 |
./cholmod_l_demo < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
|
|
76 |
./cholmod_demo < "${S}"/Demo/Matrix/c.tri || die "failed testing"
|
|
77 |
./cholmod_l_demo < "${S}"/Demo/Matrix/c.tri || die "failed testing"
|
|
78 |
./cholmod_simple < "${S}"/Demo/Matrix/c.tri || die "failed testing"
|
|
79 |
./cholmod_simple < "${S}"/Demo/Matrix/can___24.mtx || die "failed testing"
|
|
80 |
./cholmod_simple < "${S}"/Demo/Matrix/bcsstk01.tri || die "failed testing"
|
|
81 |
}
|
|
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
|
68 |
92 |
}
|