Skip to content

Commit

Permalink
Merge branch 'vbraun' work on suitesparse
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwifb committed Jan 8, 2024
2 parents 543f452 + cffd70e commit 9024cc0
Show file tree
Hide file tree
Showing 47 changed files with 1,221 additions and 80 deletions.
1 change: 1 addition & 0 deletions dev-python/cvxopt/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DIST cvxopt-1.3.2.gh.tar.gz 4095027 BLAKE2B ad4dfba1fe9c5be700ba61268e9d245355493c0334688b7a08bd4b5c4127da7a276cc660a1c1f4fe4df2359f9d2a8e3c4907d57d23c29d8caaf0329f6834cc30 SHA512 a6f9006b8b83445d781b1ba876e5ecefe724cf8666f47744b010e9c61fa1786dbd6233459a6e6a1a333ef9ac075d280076b2aeee3a2636d27541a615c5607b34
175 changes: 175 additions & 0 deletions dev-python/cvxopt/cvxopt-1.3.2-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1 toolchain-funcs

DESCRIPTION="Python package for convex optimization"
HOMEPAGE="
https://cvxopt.org/
https://github.com/cvxopt/cvxopt/
https://pypi.org/project/cvxopt/
"
# no sdist, as of 1.3.1
SRC_URI="
https://github.com/${PN}/${PN}/archive/${PV}.tar.gz
-> ${P}.gh.tar.gz
"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="+dsdp examples fftw +glpk gsl"

DEPEND="
virtual/blas
virtual/lapack
sci-libs/amd:=
sci-libs/cholmod:=
sci-libs/colamd:=
sci-libs/suitesparseconfig:=
sci-libs/umfpack:=
dsdp? ( sci-libs/dsdp:0= )
fftw? ( sci-libs/fftw:3.0= )
glpk? ( >=sci-mathematics/glpk-4.49:0= )
gsl? ( sci-libs/gsl:0= )
"
RDEPEND="
${DEPEND}
"
BDEPEND="
>=dev-python/setuptools-scm-6.2[${PYTHON_USEDEP}]
virtual/pkgconfig
"

distutils_enable_sphinx doc/source \
dev-python/sphinx-rtd-theme
distutils_enable_tests pytest

# The BLAS_LIB and LAPACK_LIB variables (among others) in cvxopt's
# setup.py are passed in as colon-delimited strings. So, for example,
# if your blas "l" flags are "-lblas -lcblas", then cvxopt wants
# "blas;cblas" for BLAS_LIB.
#
# The following function takes a flag type ("l", "L", or "I") as its
# first argument and a list of packages as its remaining arguments. It
# outputs a list of libraries, library paths, or include paths,
# respectively, for the given packages, retrieved using pkg-config and
# deduplicated, in the appropriate format.
#
cvxopt_output() {
local FLAGNAME="${1}"
shift
local PACKAGES="${@}"

local PKGCONFIG_MODE
case "${FLAGNAME}" in
l) PKGCONFIG_MODE="--libs-only-l";;
L) PKGCONFIG_MODE="--libs-only-L";;
I) PKGCONFIG_MODE="--cflags-only-I";;
*) echo "invalid flag name: ${FLAGNAME}"; exit 1;;
esac

local CVXOPT_OUTPUT=""
local PKGCONFIG_ITEM
for PKGCONFIG_ITEM in $($(tc-getPKG_CONFIG) ${PKGCONFIG_MODE} ${PACKAGES})
do
# First strip off the leading "-l", "-L", or "-I", and replace
# it with a semicolon...
PKGCONFIG_ITEM=";${PKGCONFIG_ITEM#-${FLAGNAME}}"

# Now check to see if this element is already present in the
# list, and skip it if it is. This eliminates multiple entries
# from winding up in the list when multiple package arguments are
# passed to this function.
if [[ "${CVXOPT_OUTPUT}" != "${CVXOPT_OUTPUT%${PKGCONFIG_ITEM}}" ]]
then
# It was already the last entry in the list, so skip it.
continue
elif [[ "${CVXOPT_OUTPUT}" != "${CVXOPT_OUTPUT%${PKGCONFIG_ITEM};*}" ]]
then
# It was an earlier entry in the list. These two cases are
# separate to ensure that we can e.g. find ";m" at the end
# of the list, but that we don't find ";metis" in the process.
continue
fi

# It isn't in the list yet, so append it.
CVXOPT_OUTPUT+="${PKGCONFIG_ITEM}"
done

# Strip the leading ";" from ";foo;bar" before output.
echo "${CVXOPT_OUTPUT#;}"
}

src_configure() {
# Mandatory dependencies.
export CVXOPT_BLAS_LIB="$(cvxopt_output l blas)"
export CVXOPT_BLAS_LIB_DIR="${EPREFIX}/usr/$(get_libdir);$(cvxopt_output L blas)"
export CVXOPT_LAPACK_LIB="$(cvxopt_output l lapack)"
export CVXOPT_SUITESPARSE_LIB_DIR="${EPREFIX}/usr/$(get_libdir)"

# Most of these CVXOPT_* variables can be blank or have "empty"
# entries and the resulting command-line with e.g. "-L -L/some/path"
# won't hurt anything. The INC_DIR variables, however, cause
# problems, because at least gcc doesn't like a bare "-I". We
# pre-populate these variable with something safe so that setup.py
# doesn't look in the wrong place if pkg-config doesn't return any
# extra -I directories. This is
#
# https://github.com/cvxopt/cvxopt/issues/167
#
export CVXOPT_SUITESPARSE_INC_DIR="${EPREFIX}/usr/include/suitesparse"

# optional dependencies
if use dsdp; then
# no pkg-config file at the moment
export CVXOPT_BUILD_DSDP=1
export CVXOPT_DSDP_LIB_DIR="${EPREFIX}/usr/$(get_libdir)"
export CVXOPT_DSDP_INC_DIR="${EPREFIX}/usr/include"
fi

if use fftw; then
export CVXOPT_BUILD_FFTW=1
export CVXOPT_FFTW_LIB_DIR="${EPREFIX}/usr/$(get_libdir);$(cvxopt_output L fftw3)"
CVXOPT_FFTW_INC_DIR="${EPREFIX}/usr/include"
FFTW_LOCAL_INCS="$(cvxopt_output I fftw3)"
if [[ -n "${FFTW_LOCAL_INCS}" ]]; then
CVXOPT_FFTW_INC_DIR+=";${FFTW_LOCAL_INCS}"
fi
export CVXOPT_FFTW_INC_DIR
fi

if use glpk; then
# no pkg-config file at the moment
export CVXOPT_BUILD_GLPK=1
export CVXOPT_GLPK_LIB_DIR="${EPREFIX}/usr/$(get_libdir)"
export CVXOPT_GLPK_INC_DIR="${EPREFIX}/usr/include"
fi

if use gsl; then
export CVXOPT_BUILD_GSL=1
export CVXOPT_GSL_LIB_DIR="${EPREFIX}/usr/$(get_libdir);$(cvxopt_output L gsl)"
CVXOPT_GSL_INC_DIR="${EPREFIX}/usr/include"
GSL_LOCAL_INCS="$(cvxopt_output I gsl)"
if [[ -n "${GSL_LOCAL_INCS}" ]]; then
CVXOPT_GSL_INC_DIR+=";${GSL_LOCAL_INCS}"
fi
export CVXOPT_GSL_INC_DIR
fi

export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
}

python_install_all() {
distutils-r1_python_install_all
if use examples; then
dodoc -r examples
docompress -x "/usr/share/doc/${PF}/examples"
fi
}
28 changes: 28 additions & 0 deletions dev-python/cvxopt/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>[email protected]</email>
<name>Gentoo Mathematics Project</name>
</maintainer>
<maintainer type="project">
<email>[email protected]</email>
<name>Python</name>
</maintainer>
<longdescription lang="en">
CVXOPT is a software for convex optimization based on
the Python programming language. Its main purpose is to make the
development of software for convex optimization applications
straightforward.
</longdescription>
<use>
<flag name="dsdp">Use interior point library
<pkg>sci-libs/dsdp</pkg></flag>
<flag name="glpk">Use GNU Linear Programming Kit
<pkg>sci-mathematics/glpk</pkg></flag>
</use>
<upstream>
<remote-id type="github">cvxopt/cvxopt</remote-id>
<remote-id type="pypi">cvxopt</remote-id>
</upstream>
</pkgmetadata>
16 changes: 16 additions & 0 deletions profiles/package.mask
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# Kept for any experimental package not to be merged by users
# suitesparse 7.4.0 is breaking things because headers are moved to usr/include/suitesparse
>=sci-libs/suitesparseconfig-7.4.0
>=sci-libs/amd-3.3.0
>=sci-libs/camd-3.3.0
>=sci-libs/colamd-3.3.0
>=sci-libs/ccolamd-3.3.0
>=sci-libs/cholmod-5.1.0
>=sci-libs/spqr-4.3.0
>=sci-libs/spex-2.3.0
>=sci-libs/rbio-4.3.0
>=sci-libs/btf-2.3.0
>=sci-libs/cxsparse-4.3.0
>=sci-libs/klu-2.3.0
>=sci-libs/ldl-3.3.0
>=sci-libs/umfpack-6.3.0
=dev-python/cvxopt-1.3.2-r1
3 changes: 2 additions & 1 deletion sci-libs/amd/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST SuiteSparse-7.2.2.gh.tar.gz 65392248 BLAKE2B 7a6107d5b6558d803d5e82f14cc3ea40faae7694ee748356c45885a67df230a59d6f665c376c993d89efa986c245451231cb7a7bef36239f9918055b766a7010 SHA512 14e8c7c143141f2273ef7ea3486e951aff1f3eae60628c2e07dbb8abfed2affa66594a3d7c2bd21d0d2d00cd7c2d5ffd34c2ac059184a3acc35f2364e4a2d9c2
DIST SuiteSparse-7.3.1.gh.tar.gz 65341950 BLAKE2B b54735c9bc85df153e0fdfbe074bd6cc5d7e5a7d8b7c704d5e0b9538c224d37e374eb8ceaed145d064e37f0f1a4651c68cb48d5dc877fe5596920db7d085ccd8 SHA512 681d64349360246aaebea3246a87a7415c3528b4cde4aef6def3988e19087d7184ce1bf1fad0f80f7ea312d59f6f207dc2195f6be100871c5714115705c243f6
DIST SuiteSparse-7.4.0.gh.tar.gz 85395023 BLAKE2B 7b7740820d84ab3e02560cb6cdefeb5a3ba89cffe7f0a5aca84bf2bec88227c62d9f5e07480ca147228f8abddc1c10e190fe67d30b5a9364b024ffff6ec8d2c8 SHA512 c0a256ffeb1b974a8bff6e8cb01ed0f5e48e27e408b56c7ddb4fadab579b2bf1bdd71beafffe497aa9c3b6bc7dde879adc0e2bd74960008d97e406c896c2ea03
8 changes: 4 additions & 4 deletions sci-libs/amd/amd-3.2.1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ EAPI=8
FORTRAN_NEEDED="fortran"
inherit cmake fortran-2

Sparse_PV="7.2.2"
Sparse_PV="7.3.1"
Sparse_P="SuiteSparse-${Sparse_PV}"
DESCRIPTION="Library to order a sparse matrix prior to Cholesky factorization"
HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"

LICENSE="BSD"
SLOT="0/3"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="doc fortran test"
RESTRICT="!test? ( test )"

Expand Down Expand Up @@ -50,8 +50,8 @@ src_test() {
amd_f77demo
)
fi
for i in ${demofiles}; do
./"${i}" > "${i}.out"
for i in ${demofiles[@]}; do
./"${i}" > "${i}.out" || die "failed to run test ${i}"
diff "${S}/Demo/${i}.out" "${i}.out" || die "failed testing ${i}"
done
einfo "All tests passed"
Expand Down
70 changes: 70 additions & 0 deletions sci-libs/amd/amd-3.3.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

FORTRAN_NEEDED="fortran"
inherit cmake fortran-2

Sparse_PV="7.4.0"
Sparse_P="SuiteSparse-${Sparse_PV}"
DESCRIPTION="Library to order a sparse matrix prior to Cholesky factorization"
HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"

LICENSE="BSD"
SLOT="0/3"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="doc fortran test"
RESTRICT="!test? ( test )"

DEPEND=">=sci-libs/suitesparseconfig-${Sparse_PV}"
RDEPEND="${DEPEND}"
BDEPEND="doc? ( virtual/latex-base )"

S="${WORKDIR}/${Sparse_P}/${PN^^}"

src_configure() {
local mycmakeargs=(
-DNSTATIC=ON
-DSUITESPARSE_USE_FORTRAN=$(usex fortran ON OFF)
-DSUITESPARSE_DEMOS=$(usex test)
)
cmake_src_configure
}

src_test() {
# Because we are not using cmake_src_test,
# we have to manually go to BUILD_DIR
cd "${BUILD_DIR}"
# Run demo files
local demofiles=(
amd_demo
amd_l_demo
amd_demo2
amd_simple
)
if use fortran; then
demofiles+=(
amd_f77simple
amd_f77demo
)
fi
for i in ${demofiles}; do
./"${i}" > "${i}.out"
diff "${S}/Demo/${i}.out" "${i}.out" || die "failed testing ${i}"
done
einfo "All tests passed"
}

src_install() {
if use doc; then
pushd "${S}/Doc"
emake clean
rm -rf *.pdf
emake
popd
DOCS="${S}/Doc/*.pdf"
fi
cmake_src_install
}
3 changes: 2 additions & 1 deletion sci-libs/btf/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST SuiteSparse-7.2.2.gh.tar.gz 65392248 BLAKE2B 7a6107d5b6558d803d5e82f14cc3ea40faae7694ee748356c45885a67df230a59d6f665c376c993d89efa986c245451231cb7a7bef36239f9918055b766a7010 SHA512 14e8c7c143141f2273ef7ea3486e951aff1f3eae60628c2e07dbb8abfed2affa66594a3d7c2bd21d0d2d00cd7c2d5ffd34c2ac059184a3acc35f2364e4a2d9c2
DIST SuiteSparse-7.3.1.gh.tar.gz 65341950 BLAKE2B b54735c9bc85df153e0fdfbe074bd6cc5d7e5a7d8b7c704d5e0b9538c224d37e374eb8ceaed145d064e37f0f1a4651c68cb48d5dc877fe5596920db7d085ccd8 SHA512 681d64349360246aaebea3246a87a7415c3528b4cde4aef6def3988e19087d7184ce1bf1fad0f80f7ea312d59f6f207dc2195f6be100871c5714115705c243f6
DIST SuiteSparse-7.4.0.gh.tar.gz 85395023 BLAKE2B 7b7740820d84ab3e02560cb6cdefeb5a3ba89cffe7f0a5aca84bf2bec88227c62d9f5e07480ca147228f8abddc1c10e190fe67d30b5a9364b024ffff6ec8d2c8 SHA512 c0a256ffeb1b974a8bff6e8cb01ed0f5e48e27e408b56c7ddb4fadab579b2bf1bdd71beafffe497aa9c3b6bc7dde879adc0e2bd74960008d97e406c896c2ea03
4 changes: 2 additions & 2 deletions sci-libs/btf/btf-2.2.1.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ EAPI=8

inherit cmake

Sparse_PV="7.2.2"
Sparse_PV="7.3.1"
Sparse_P="SuiteSparse-${Sparse_PV}"
DESCRIPTION="Algorithm for matrix permutation into block triangular form"
HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0/2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"

DEPEND=">=sci-libs/suitesparseconfig-${Sparse_PV}"
RDEPEND="${DEPEND}"
Expand Down
28 changes: 28 additions & 0 deletions sci-libs/btf/btf-2.3.0.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit cmake

Sparse_PV="7.4.0"
Sparse_P="SuiteSparse-${Sparse_PV}"
DESCRIPTION="Algorithm for matrix permutation into block triangular form"
HOMEPAGE="https://people.engr.tamu.edu/davis/suitesparse.html"
SRC_URI="https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/v${Sparse_PV}.tar.gz -> ${Sparse_P}.gh.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0/2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"

DEPEND=">=sci-libs/suitesparseconfig-${Sparse_PV}"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${Sparse_P}/${PN^^}"

src_configure() {
local mycmakeargs=(
-DNSTATIC=ON
)
cmake_src_configure
}
3 changes: 2 additions & 1 deletion sci-libs/camd/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST SuiteSparse-7.2.2.gh.tar.gz 65392248 BLAKE2B 7a6107d5b6558d803d5e82f14cc3ea40faae7694ee748356c45885a67df230a59d6f665c376c993d89efa986c245451231cb7a7bef36239f9918055b766a7010 SHA512 14e8c7c143141f2273ef7ea3486e951aff1f3eae60628c2e07dbb8abfed2affa66594a3d7c2bd21d0d2d00cd7c2d5ffd34c2ac059184a3acc35f2364e4a2d9c2
DIST SuiteSparse-7.3.1.gh.tar.gz 65341950 BLAKE2B b54735c9bc85df153e0fdfbe074bd6cc5d7e5a7d8b7c704d5e0b9538c224d37e374eb8ceaed145d064e37f0f1a4651c68cb48d5dc877fe5596920db7d085ccd8 SHA512 681d64349360246aaebea3246a87a7415c3528b4cde4aef6def3988e19087d7184ce1bf1fad0f80f7ea312d59f6f207dc2195f6be100871c5714115705c243f6
DIST SuiteSparse-7.4.0.gh.tar.gz 85395023 BLAKE2B 7b7740820d84ab3e02560cb6cdefeb5a3ba89cffe7f0a5aca84bf2bec88227c62d9f5e07480ca147228f8abddc1c10e190fe67d30b5a9364b024ffff6ec8d2c8 SHA512 c0a256ffeb1b974a8bff6e8cb01ed0f5e48e27e408b56c7ddb4fadab579b2bf1bdd71beafffe497aa9c3b6bc7dde879adc0e2bd74960008d97e406c896c2ea03
Loading

0 comments on commit 9024cc0

Please sign in to comment.