|
| 1 | +# Copyright 1999-2019 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=7 |
| 5 | + |
| 6 | +# FIXME: currently this is a safety measure. Is it really needed by the |
| 7 | +# fortran modules? |
| 8 | +FORTRAN_NEED_OPENMP=1 |
| 9 | + |
| 10 | +# FIXME: how to handle cmake without having a root CMakeLists.txt? |
| 11 | +inherit fortran-2 multiprocessing toolchain-funcs |
| 12 | + |
| 13 | +MY_PN="SuiteSparse" |
| 14 | + |
| 15 | +DESCRIPTION="Package for a suite of sparse matrix tools" |
| 16 | +HOMEPAGE="http://faculty.cse.tamu.edu/davis/suitesparse.html" |
| 17 | +SRC_URI="http://faculty.cse.tamu.edu/davis/${MY_PN}/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz" |
| 18 | + |
| 19 | +# BSD: amd, camd, ccolamd, colamd, ssget |
| 20 | +# LGPL-2.1+: btf, cholmod/Check, choldmod/Cholesky, cholmod/Core, |
| 21 | +# cholmod/Partition, cxsparse, klu, ldl |
| 22 | +# GPL-2+: choldmod/Demo, cholmod/Matlab, cholmod/MatrixOps, |
| 23 | +# cholmod/Modify, cholmod/Supernodal, cholmod/Tcov, cholmod/Valgrind, |
| 24 | +# GPUQREngine, RBio, spqr, SuiteSparse_GPURuntime, umfpack |
| 25 | +# Apache-2.0: GraphBLAS |
| 26 | +# GPL-3: Mongoose |
| 27 | +LICENSE="Apache-2.0 BSD GPL-2+ GPL-3 LGPL-2.1+" |
| 28 | +SLOT="0" |
| 29 | + |
| 30 | +KEYWORDS="~amd64 ~x86" |
| 31 | + |
| 32 | +FORTRAN_NEEDED="amd" |
| 33 | + |
| 34 | +# FIXME: currently not included: |
| 35 | +# Piro_Band, Skyline_SVD |
| 36 | +# GraphBLAS and Mongoose are cmake based builds |
| 37 | +# SuiteSparse_GPURuntime and GPUQREngine are part of spqr[cuda] |
| 38 | +# FIXME: cuda is not compiling due to C/C++ mixing |
| 39 | +# FIXME: testing |
| 40 | +IUSE="cuda fortran tbb test" |
| 41 | + |
| 42 | +# Tests currently fail in cholmod library |
| 43 | +#RESTRICT="!test? ( test )" |
| 44 | +RESTRICT="test" |
| 45 | + |
| 46 | +# FIXME: Exclude the old packages. These could be removed once the package |
| 47 | +# and revdeps are fully updated. |
| 48 | +RDEPEND=" |
| 49 | + !<sci-libs/suitesparse-5 |
| 50 | + !sci-libs/amd |
| 51 | + !sci-libs/btf |
| 52 | + !sci-libs/camd |
| 53 | + !sci-libs/ccolamd |
| 54 | + !sci-libs/cholmod |
| 55 | + !sci-libs/colamd |
| 56 | + !sci-libs/cxsparse |
| 57 | + !sci-libs/klu |
| 58 | + !sci-libs/ldl |
| 59 | + !sci-libs/spqr |
| 60 | + !sci-libs/suitesparseconfig |
| 61 | + !sci-libs/umfpack |
| 62 | + || ( >=sci-libs/metis-5.1.0-r3[openmp(+)] >=sci-libs/parmetis-4.0.3[openmp(+)] ) |
| 63 | + virtual/blas |
| 64 | + virtual/lapack |
| 65 | + cuda? ( |
| 66 | + >=dev-util/nvidia-cuda-toolkit-9.2.88:= |
| 67 | + >=sci-libs/magma-2.4.0 |
| 68 | + ) |
| 69 | + tbb? ( >=dev-cpp/tbb-2017.20161128 ) |
| 70 | +" |
| 71 | + |
| 72 | +DEPEND=" |
| 73 | + ${RDEPEND} |
| 74 | + sys-devel/m4 |
| 75 | + test? ( >=app-shells/tcsh-6.20.00 ) |
| 76 | +" |
| 77 | +BDEPEND=">=sys-apps/grep-3.1" |
| 78 | + |
| 79 | +S=${WORKDIR}/${MY_PN} |
| 80 | + |
| 81 | +PATCHES=( |
| 82 | + "${FILESDIR}/${P}-0001-Suitesparse_config-Suitesparse_config.mk-drop-RPATH.patch" |
| 83 | + "${FILESDIR}/${P}-0002-AMD-Lib-Makefile-also-build-shared-library.patch" |
| 84 | +) |
| 85 | + |
| 86 | +DOCS=( README.txt ) |
| 87 | + |
| 88 | +pkg_setup() { |
| 89 | + # several of the packages need openmp support, so check for it early |
| 90 | + tc-check-openmp || die "Need OpenMP to build ${P}" |
| 91 | +} |
| 92 | + |
| 93 | +src_compile() { |
| 94 | + local myblas=$($(tc-getPKG_CONFIG) --libs blas) |
| 95 | + local mylapack=$($(tc-getPKG_CONFIG) --libs lapack) |
| 96 | + # FIXME: AUTOCC auto-enables intel compilers |
| 97 | + local mymakeopts="OPTIMIZATION= AUTOCC=no JOBS=$(makeopts_jobs)" |
| 98 | + mymakeopts="${mymakeopts} INSTALL=${ED}/usr INSTALL_LIB=${ED}/usr/$(get_libdir)" |
| 99 | + mymakeopts="${mymakeopts} LAPACK=\"${mylapack}\" BLAS=\"${myblas}\"" |
| 100 | + mymakeopts="${mymakeopts} MY_METIS_LIB=-lmetis" |
| 101 | + if use cuda; then |
| 102 | + mymakeopts="${mymakeopts} CUDA=yes magma_inc=${EPREFIX}/usr magma_lib=${EPREFIX}/usr/$(get_libdir) -lmagma" |
| 103 | + mymakeopts="${mymakeopts} CHOLDMOD_CONFIG+=-DGPU_BLAS SPQR_CONFIG+=-DGPU_BLAS" |
| 104 | + else |
| 105 | + mymakeopts="${mymakeopts} CUDA=no" |
| 106 | + fi |
| 107 | + if use fortran; then |
| 108 | + local myf77=$(tc-getF77) |
| 109 | + mymakeopts="${mymakeopts} F77=${myf77}" |
| 110 | + fi |
| 111 | + if use tbb; then |
| 112 | + mymakeopts="${mymakeopts} TBB=-ltbb SPQR_CONFIG+=-DHAVE_TBB" |
| 113 | + fi |
| 114 | + use test && mymakeopts="${mymakeopts} TCOV=yes" |
| 115 | + export LD_LIBRARY_PATH="${S}/lib" |
| 116 | +# emake ${mymakeopts} config # FIXME: remove on final ebuild |
| 117 | + emake ${mymakeopts} library |
| 118 | +# use static-libs && emake ${mymakeopts} static |
| 119 | + if use fortran; then |
| 120 | + emake -C "${S}/AMD" ${mymakeopts} fortran |
| 121 | + fi |
| 122 | +} |
| 123 | + |
| 124 | +src_test() { |
| 125 | + local myblas=$($(tc-getPKG_CONFIG) --libs blas) |
| 126 | + local mylapack=$($(tc-getPKG_CONFIG) --libs lapack) |
| 127 | + local mytestargs="OPTIMIZATION= AUTOCC=no BLAS=${myblas} LAPACK=${mylapack}" |
| 128 | + mytestargs="${mytestargs} MY_METIS_LIB=-lmetis" |
| 129 | + if use cuda; then |
| 130 | + mytestargs="${mytestargs} CUDA=yes magma_inc=${EPREFIX}/usr magma_lib=${EPREFIX}/usr/$(get_libdir) -lmagma" |
| 131 | + mytestargs="${mytestargs} CHOLDMOD_CONFIG+=-DGPU_BLAS SPQR_CONFIG+=-DGPU_BLAS" |
| 132 | + else |
| 133 | + mytestargs="${mytestargs} CUDA=no" |
| 134 | + fi |
| 135 | + if use fortran; then |
| 136 | + local myf77=$(tc-getF77) |
| 137 | + mytestargs="${mytestargs} F77=${myf77}" |
| 138 | + fi |
| 139 | + if use tbb; then |
| 140 | + mytestargs="${mytestargs} TBB=-ltbb SPQR_CONFIG+=-DHAVE_TBB" |
| 141 | + fi |
| 142 | + export LD_LIBRARY_PATH="${S}/lib" |
| 143 | + emake ${mytestargs} cov |
| 144 | +} |
| 145 | + |
| 146 | +src_install() { |
| 147 | + local myblas=$($(tc-getPKG_CONFIG) --libs blas) |
| 148 | + local mylapack=$($(tc-getPKG_CONFIG) --libs lapack) |
| 149 | + local myinstallargs="INSTALL=${ED}/usr INSTALL_LIB=${ED}/usr/$(get_libdir)" |
| 150 | + myinstallargs="${myinstallargs} BLAS=${myblas} LAPACK=${mylapack} MY_METIS_LIB=-lmetis" |
| 151 | + if use cuda; then |
| 152 | + myinstallargs="${myinstallargs} CUDA=yes magma_inc=${EPREFIX}/usr magma_lib=${EPREFIX}/usr/$(get_libdir) -lmagma" |
| 153 | + myinstallargs="${myinstallargs} CHOLMOD_CONFIG+=-DGPU_BLAS SPQR_CONFIG+=-DGPU_BLAS" |
| 154 | + else |
| 155 | + myinstallargs="${myinstallargs} CUDA=no" |
| 156 | + fi |
| 157 | + if use fortran; then |
| 158 | + local myf77=$(tc-getF77) |
| 159 | + myinstallargs="${myinstallargs} F77=${myf77}" |
| 160 | + fi |
| 161 | + if use tbb; then |
| 162 | + myinstallargs="${myinstallargs} TBB=-ltbb SPQR_CONFIG+=-DHAVE_TBB" |
| 163 | + fi |
| 164 | + emake ${myinstallargs} install |
| 165 | + if use fortran; then |
| 166 | + emake -C "${S}/AMD/Lib" ${myinstallargs} install-fortran |
| 167 | + fi |
| 168 | +} |
0 commit comments