CoinHSL: Support the Meson build system and add new release (#43610)

* Add maintainer and fix linting
* allow for fewer deps in archive
* use meson for archive packages
* Fix version spec and f-string
* fix blas dependency links
* Add new release to spack
* Fix checksums for latest release
This commit is contained in:
Andrew Lister 2024-05-15 23:48:23 +01:00 committed by GitHub
parent 543bd189af
commit 9e96ddc5ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,7 +8,7 @@
from spack.package import * from spack.package import *
class Coinhsl(AutotoolsPackage): class Coinhsl(MesonPackage, AutotoolsPackage):
"""CoinHSL is a collection of linear algebra libraries (KB22, MA27, """CoinHSL is a collection of linear algebra libraries (KB22, MA27,
MA28, MA54, MA57, MA64, MA77, MA86, MA97, MC19, MC34, MC64, MC68, MA28, MA54, MA57, MA64, MA77, MA86, MA97, MC19, MC34, MC64, MC68,
MC69, MC78, MC80, OF01, ZB01, ZB11) bundled for use with IPOPT and MC69, MC78, MC80, OF01, ZB01, ZB11) bundled for use with IPOPT and
@ -21,60 +21,85 @@ class Coinhsl(AutotoolsPackage):
that Spack can find it. For instructions on how to set up a that Spack can find it. For instructions on how to set up a
mirror, see https://spack.readthedocs.io/en/latest/mirrors.html""" mirror, see https://spack.readthedocs.io/en/latest/mirrors.html"""
# NOTE(oxberry1@llnl.gov): an HTTPS version of the URL below does not build_system(
# exist conditional("autotools", when="@b:2019.05.21"),
conditional("meson", when="@2023:,:b"),
default="meson",
)
homepage = "https://www.hsl.rl.ac.uk/ipopt/" homepage = "https://www.hsl.rl.ac.uk/ipopt/"
url = "file://{0}/coinhsl-archive-2014.01.17.tar.gz".format(os.getcwd()) url = f"file://{os.getcwd()}/coinhsl-2023.11.17.tar.gz"
manual_download = True manual_download = True
# CoinHSL has a few versions that vary with respect to stability/features maintainers("AndrewLister-STFC")
# and licensing terms.
# Version 2019.05.21 is a full-featured "release candidate" # Meson builds
# version available via an "academic license" that can be used for version(
# personal teaching and research purposes only. For a full list of "2024.05.15",
# conditions, see https://www.hsl.rl.ac.uk/academic.html. sha256="2534807b4f6a4a69661c82dc0da7094f685f0fce6443a9147ee90a21caba9e63",
preferred=True,
)
version(
"archive-2024.05.15",
sha256="1d907ce5d84331ce8f78125d5fc766184f0fce9a7b340db7f3c4821a7f4b7c4c",
)
with when("build_system=meson @2023:"):
depends_on("blas")
depends_on("lapack")
variant("metis", default=True, description="Build with Metis support.")
depends_on("metis", when="+metis")
def meson_args(self):
spec = self.spec
args = []
if spec.satisfies("@:b"):
return []
blas = spec["blas"].libs.names[0]
blas_paths = [sf[2:] for sf in spec["blas"].libs.search_flags.split()]
lapack = spec["lapack"].libs.names[0]
lapack_paths = [sf[2:] for sf in spec["lapack"].libs.search_flags.split()]
args.append(f"-Dlibblas={blas}")
args.extend([f"-Dlibblas_path={p}" for p in blas_paths])
args.append(f"-Dliblapack={lapack}")
args.extend([f"-Dlibblas_path={p}" for p in lapack_paths])
if spec.satisfies("+metis"):
metis = spec["metis"]
if metis.satisfies("@5"):
args.append("-Dlibmetis_version=5")
else:
args.append("-Dlibmetis_version=4")
args.extend(
[
f"-Dlibmetis_include={metis.prefix.include}",
f"-Dlibmetis_path={metis.prefix.lib}",
]
)
return args
# Autotools builds
version( version(
"2019.05.21", sha256="95ce1160f0b013151a3e25d40337775c760a8f3a79d801a1d190598bf4e4c0c3" "2019.05.21", sha256="95ce1160f0b013151a3e25d40337775c760a8f3a79d801a1d190598bf4e4c0c3"
) )
# Version 2015.06.23 is a full-featured "stable"
# version available via an "academic license" that can be used for
# personal teaching and research purposes only. For a full list of
# conditions, see https://www.hsl.rl.ac.uk/academic.html.
version( version(
"2015.06.23", "2015.06.23", sha256="3e955a2072f669b8f357ae746531b37aea921552e415dc219a5dd13577575fb3"
sha256="3e955a2072f669b8f357ae746531b37aea921552e415dc219a5dd13577575fb3",
preferred=True,
) )
# Version 2014.01.17 is a full-featured "stable" version available
# via an "academic license" that can be used for personal teaching
# and research purposes only.
version( version(
"2014.01.17", sha256="ed49fea62692c5d2f928d4007988930da9ff9a2e944e4c559d028671d122437b" "2014.01.17", sha256="ed49fea62692c5d2f928d4007988930da9ff9a2e944e4c559d028671d122437b"
) )
# Version 2014.01.10 only has MA27, MA28, and MC19, and is
# available as a "personal license" that is free to all, and
# permits commercial use, but *not redistribution* (emphasis from
# original source).
version( version(
"2014.01.10", sha256="7c2be60a3913b406904c66ee83acdbd0709f229b652c4e39ee5d0876f6b2e907" "2014.01.10", sha256="7c2be60a3913b406904c66ee83acdbd0709f229b652c4e39ee5d0876f6b2e907"
) )
# CoinHSL fails to build in parallel with when("build_system=autotools"):
parallel = False parallel = False
variant("blas", default=False, description="Link to external BLAS library")
variant("blas", default=False, description="Link to external BLAS library") depends_on("blas", when="+blas")
depends_on("blas", when="+blas")
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
args = [] args = []
if spec.satisfies("+blas"): if spec.satisfies("+blas"):
args.append("--with-blas={0}".format(spec["blas"].libs.ld_flags)) args.append(f"--with-blas={spec['blas'].libs.ld_flags}")
return args return args