|
| 1 | +# Copyright 1999-2018 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=6 |
| 5 | + |
| 6 | +# TODO: patch SuiteSparse_config/SuiteSparse_config.mk |
| 7 | + |
| 8 | +# FIXME: currently this is a safety measure. Is it really needed by the |
| 9 | +# fortran modules? |
| 10 | +FORTRAN_NEED_OPENMP=1 |
| 11 | + |
| 12 | +# FIXME: how to handle cmake without having a root CMakeLists.txt? |
| 13 | +inherit fortran-2 toolchain-funcs |
| 14 | + |
| 15 | +MY_PN="SuiteSparse" |
| 16 | + |
| 17 | +DESCRIPTION="Package for a suite of sparse matrix tools" |
| 18 | +HOMEPAGE="http://faculty.cse.tamu.edu/davis/suitesparse.html" |
| 19 | +SRC_URI="http://faculty.cse.tamu.edu/davis/${MY_PN}/${MY_PN}-${PV}.tar.gz -> ${P}.tar.gz" |
| 20 | + |
| 21 | +# BSD: amd, camd, ccolamd, colamd, ssget |
| 22 | +# LGPL-2.1+: btf, cholmod/Check, choldmod/Cholesky, cholmod/Core, |
| 23 | +# cholmod/Partition, cxsparse, klu, ldl |
| 24 | +# GPL-2+: choldmod/Demo, cholmod/Matlab, cholmod/MatrixOps, |
| 25 | +# cholmod/Modify, cholmod/Supernodal, cholmod/Tcov, cholmod/Valgrind, |
| 26 | +# GPUQREngine, RBio, spqr, SuiteSparse_GPURuntime, umfpack |
| 27 | +# Apache-2.0: GraphBLAS |
| 28 | +# GPL-3: Mongoose |
| 29 | +LICENSE="Apache-2.0 BSD GPL-2+ GPL-3 LGPL-2.1+" |
| 30 | +SLOT="0" |
| 31 | + |
| 32 | +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" |
| 33 | + |
| 34 | +FORTRAN_NEEDED="amd" |
| 35 | + |
| 36 | +# FIXME: currently not included: |
| 37 | +# GraphBLAS, Mongoose, RBio, SuiteSparse_GPURuntime, GPUQREngine, |
| 38 | +# Piro_Band, Skyline_SVD |
| 39 | +# GraphBLAS and Mongoose are cmake based builds |
| 40 | +IUSE="cuda doc fortran tbb test" |
| 41 | + |
| 42 | +RESTRICT="!test? ( test )" |
| 43 | + |
| 44 | +# FIXME: Exclude the old packages. These could be removed once the package |
| 45 | +# and revdeps are fully updated. |
| 46 | +RDEPEND=" |
| 47 | + !<sci-libs/suitesparse-5 |
| 48 | + !sci-libs/amd |
| 49 | + !sci-libs/btf |
| 50 | + !sci-libs/camd |
| 51 | + !sci-libs/ccolamd |
| 52 | + !sci-libs/cholmod |
| 53 | + !sci-libs/colamd |
| 54 | + !sci-libs/cxsparse |
| 55 | + !sci-libs/klu |
| 56 | + !sci-libs/ldl |
| 57 | + !sci-libs/spqr |
| 58 | + !sci-libs/suitesparseconfig |
| 59 | + !sci-libs/umfpack |
| 60 | + || ( >=sci-libs/metis-5.1.0-r3[openmp(+)] >=sci-libs/parmetis-4.0.3[openmp(+)] ) |
| 61 | + virtual/blas:= |
| 62 | + virtual/lapack:= |
| 63 | + cuda? ( |
| 64 | + >=dev-util/nvidia-cuda-toolkit-9.2.88:= |
| 65 | + >=sci-libs/magma-2.4.0:= |
| 66 | + ) |
| 67 | + tbb? ( >=dev-cpp/tbb-2017.20161128:= ) |
| 68 | +" |
| 69 | + |
| 70 | +DEPEND=" |
| 71 | + ${RDEPEND} |
| 72 | + >=dev-util/indent-2.2.11-r1 |
| 73 | + >=sys-apps/grep-3.1 |
| 74 | +" |
| 75 | + |
| 76 | +S=${WORKDIR}/${MY_PN} |
| 77 | + |
| 78 | +PATCHES=( |
| 79 | + "${FILESDIR}/${P}-config.patch" |
| 80 | + "${FILESDIR}/${P}-Makefile.patch" |
| 81 | +) |
| 82 | + |
| 83 | +DOCS=( README.txt ) |
| 84 | + |
| 85 | +pkg_setup() { |
| 86 | + # several of the packages need openmp support, so check for it early |
| 87 | + # FIXME: check which packages exactly need openmp and make the check |
| 88 | + # dependent on USE flags for those packages. |
| 89 | + tc-check-openmp || die "Need OpenMP to build ${P}" |
| 90 | +} |
| 91 | + |
| 92 | +src_compile() { |
| 93 | + local myblas=$($(tc-getPKG_CONFIG) --libs blas) |
| 94 | + local mylapack=$($(tc-getPKG_CONFIG) --libs lapack) |
| 95 | + # FIXME: AUTOCC auto-enables intel compilers |
| 96 | + local mymakeopts="OPTIMIZATION= AUTOCC=no" |
| 97 | + mymakeopts="${mymakeopts} LAPACK=\"${mylapack}\" BLAS=\"${myblas}\"" |
| 98 | + mymakeopts="${mymakeopts} MY_METIS_LIB=-lmetis" |
| 99 | + if use cuda; then |
| 100 | + mymakeopts="${mymakeopts} CUDA=yes magma_inc=/usr magma_lib=/usr/$(get_libdir)" |
| 101 | + else |
| 102 | + mymakeopts="${mymakeopts} CUDA=no" |
| 103 | + fi |
| 104 | + if use tbb; then |
| 105 | + mymakeopts="${mymakeopts} TBB=-ltbb" |
| 106 | + mymakeopts="${mymakeopts} SPQR_CONFIG+=-DHAVE_TBB" |
| 107 | + fi |
| 108 | + use test && mymakeopts="${mymakeopts} TCOV=yes" |
| 109 | + export LD_LIBRARY_PATH="${S}/lib" |
| 110 | + emake ${mymakeopts} config |
| 111 | + emake ${mymakeopts} |
| 112 | +} |
| 113 | + |
| 114 | +src_install() { |
| 115 | + local myblas=$($(tc-getPKG_CONFIG) --libs blas) |
| 116 | + local mylapack=$($(tc-getPKG_CONFIG) --libs lapack) |
| 117 | + local myinstallargs="INSTALL=${ED%/}/usr INSTALL_LIB=${ED%/}/usr/$(get_libdir)" |
| 118 | + myinstallargs="${myinstallargs} BLAS=${myblas} LAPACK=${mylapack} MY_METIS_LIB=-lmetis" |
| 119 | + if use cuda; then |
| 120 | + myinstallargs="${myinstallargs} CUDA=yes magma_inc=/usr magma_lib=/usr/$(get_libdir)" |
| 121 | + else |
| 122 | + myinstallargs="${myinstallargs} CUDA=no" |
| 123 | + fi |
| 124 | + if use tbb; then |
| 125 | + myinstallargs="${myinstallargs} TBB=-ltbb" |
| 126 | + myinstallargs="${myinstallargs} SPQR_CONFIG=-DHAVE_TBB" |
| 127 | + fi |
| 128 | + emake ${myinstallargs} install |
| 129 | +} |
0 commit comments