summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lister <48282025+AndrewLister-STFC@users.noreply.github.com>2024-05-15 23:48:23 +0100
committerGitHub <noreply@github.com>2024-05-15 16:48:23 -0600
commit9e96ddc5aed1177de50feba8adb728c720a43622 (patch)
treea68e5c125fed19b0d8c7459b5215049d4b7dc126
parent543bd189af6e99ed7b937562a47c8272bb49999d (diff)
downloadspack-9e96ddc5aed1177de50feba8adb728c720a43622.tar.gz
spack-9e96ddc5aed1177de50feba8adb728c720a43622.tar.bz2
spack-9e96ddc5aed1177de50feba8adb728c720a43622.tar.xz
spack-9e96ddc5aed1177de50feba8adb728c720a43622.zip
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
-rw-r--r--var/spack/repos/builtin/packages/coinhsl/package.py97
1 files changed, 61 insertions, 36 deletions
diff --git a/var/spack/repos/builtin/packages/coinhsl/package.py b/var/spack/repos/builtin/packages/coinhsl/package.py
index 9c27063181..0fe8da7c2e 100644
--- a/var/spack/repos/builtin/packages/coinhsl/package.py
+++ b/var/spack/repos/builtin/packages/coinhsl/package.py
@@ -8,7 +8,7 @@ import os
from spack.package import *
-class Coinhsl(AutotoolsPackage):
+class Coinhsl(MesonPackage, AutotoolsPackage):
"""CoinHSL is a collection of linear algebra libraries (KB22, MA27,
MA28, MA54, MA57, MA64, MA77, MA86, MA97, MC19, MC34, MC64, MC68,
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
mirror, see https://spack.readthedocs.io/en/latest/mirrors.html"""
- # NOTE(oxberry1@llnl.gov): an HTTPS version of the URL below does not
- # exist
+ build_system(
+ conditional("autotools", when="@b:2019.05.21"),
+ conditional("meson", when="@2023:,:b"),
+ default="meson",
+ )
+
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
- # CoinHSL has a few versions that vary with respect to stability/features
- # and licensing terms.
+ maintainers("AndrewLister-STFC")
- # Version 2019.05.21 is a full-featured "release candidate"
- # 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.
+ # Meson builds
version(
- "2019.05.21", sha256="95ce1160f0b013151a3e25d40337775c760a8f3a79d801a1d190598bf4e4c0c3"
+ "2024.05.15",
+ sha256="2534807b4f6a4a69661c82dc0da7094f685f0fce6443a9147ee90a21caba9e63",
+ preferred=True,
)
-
- # 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(
- "2015.06.23",
- sha256="3e955a2072f669b8f357ae746531b37aea921552e415dc219a5dd13577575fb3",
- preferred=True,
+ "archive-2024.05.15",
+ sha256="1d907ce5d84331ce8f78125d5fc766184f0fce9a7b340db7f3c4821a7f4b7c4c",
)
- # 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.
+ 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(
+ "2019.05.21", sha256="95ce1160f0b013151a3e25d40337775c760a8f3a79d801a1d190598bf4e4c0c3"
+ )
+ version(
+ "2015.06.23", sha256="3e955a2072f669b8f357ae746531b37aea921552e415dc219a5dd13577575fb3"
+ )
version(
"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(
"2014.01.10", sha256="7c2be60a3913b406904c66ee83acdbd0709f229b652c4e39ee5d0876f6b2e907"
)
- # CoinHSL fails to build in parallel
- parallel = False
-
- variant("blas", default=False, description="Link to external BLAS library")
-
- depends_on("blas", when="+blas")
+ with when("build_system=autotools"):
+ parallel = False
+ variant("blas", default=False, description="Link to external BLAS library")
+ depends_on("blas", when="+blas")
def configure_args(self):
spec = self.spec
args = []
-
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