From b2d4ede5869d12688c7a160d93cf1eb64a3d1300 Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:14:28 -0800 Subject: [PATCH 1/5] add patch for constant namescheme issue --- .../const-namescheme-delim-char-4.12.0.patch | 57 +++++++ .../builtin/packages/silo/package.py | 156 ++++++++++++++---- 2 files changed, 177 insertions(+), 36 deletions(-) create mode 100644 repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch diff --git a/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch b/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch new file mode 100644 index 00000000000..174bc843056 --- /dev/null +++ b/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch @@ -0,0 +1,57 @@ +From 43a52d788a3c15bee3b9391906e8ed276c5a456c Mon Sep 17 00:00:00 2001 +From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> +Date: Fri, 23 Jan 2026 19:03:18 -0800 +Subject: [PATCH] fix const nameschemes + +--- + src/silo/silo_ns.c | 25 ++++++++++++++++++------- + 1 file changed, 18 insertions(+), 7 deletions(-) + +diff --git a/src/silo/silo_ns.c b/src/silo/silo_ns.c +index 645077dd..e17a57d4 100644 +--- a/src/silo/silo_ns.c ++++ b/src/silo/silo_ns.c +@@ -424,22 +424,33 @@ DBMakeNamescheme(char const *fmt, ...) + */ + if (rv->ncspecs == 0) + { +- int rm_unnecessary_delim = 0; ++ free(rv->fmt); + +- if (n > 2 && fmt[0] == fmt[n-1]) +- rm_unnecessary_delim = !db_VariableNameValid(fmt); ++ /* If whole string is valid, take all of it. */ ++ if (db_VariableNameValid(fmt)) ++ { ++ rv->fmt = STRNDUP(&fmt[0],n); ++ rv->fmtlen = n; ++ return rv; ++ } + +- free(rv->fmt); ++ /* If whole string but first char is valid, take all but first char */ ++ if (db_VariableNameValid(&fmt[1])) ++ { ++ rv->fmt = STRNDUP(&fmt[1],n-1); ++ rv->fmtlen = n-1; ++ return rv; ++ } + +- if (rm_unnecessary_delim) ++ if (fmt[0] == fmt[n-1]) + { + rv->fmt = STRNDUP(&fmt[1],n-2); + rv->fmtlen = n-2; + } + else + { +- rv->fmt = STRNDUP(&fmt[0],n); +- rv->fmtlen = n; ++ rv->fmt = STRNDUP(&fmt[0],n-1); ++ rv->fmtlen = n-1; + } + + return rv; +-- +2.50.1 (Apple Git-155) + diff --git a/repos/spack_repo/builtin/packages/silo/package.py b/repos/spack_repo/builtin/packages/silo/package.py index 755c814e7d3..80ba808e561 100644 --- a/repos/spack_repo/builtin/packages/silo/package.py +++ b/repos/spack_repo/builtin/packages/silo/package.py @@ -2,24 +2,35 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) -from spack_repo.builtin.build_systems.autotools import AutotoolsPackage +from spack_repo.builtin.build_systems import autotools, cmake from spack.package import * -class Silo(AutotoolsPackage): +class Silo(autotools.AutotoolsPackage, cmake.CMakePackage): """Silo is a library for reading and writing a wide variety of scientific - data to binary, disk files.""" + data to binary, disk or memory (in-situ) files.""" - homepage = "https://wci.llnl.gov/simulation/computer-codes/silo" + homepage = "https://silo.llnl.gov" git = "https://github.com/LLNL/Silo.git" - url = "https://wci.llnl.gov/sites/wci/files/2021-01/silo-4.10.2.tgz" - maintainers("patrickb314") + url = "https://github.com/LLNL/Silo/releases/tag/4.12.0" + maintainers("patrickb314", "markcmiller86") + + # Base license is BSD; fpzip and hzip variants change effective licensing. + # Versions of both hzip and fpzip built into silo are NOT BSD licensed. + # Newer versions of fpzip are BSD licensed but not version 1.0.2 in Silo. + license("BSD-3-Clause", when="license=bsdonly") version("main", branch="main") + version("4.12RC", branch="4.12RC") version( - "4.11.1", + "4.12.0", preferred=True, + sha256="bde1685e4547d5dd7416bd6215b41f837efef0e4934d938ba776957afbebdff0", + url="https://github.com/LLNL/Silo/releases/download/4.12.0/Silo-4.12.0.tar.xz", + ) + version( + "4.11.1", sha256="49eddc00304aa4a19074b099559edbdcaa3532c98df32f99aa62b9ec3ea7cee2", url="https://github.com/LLNL/Silo/releases/download/4.11.1/silo-4.11.1.tar.xz", ) @@ -41,47 +52,73 @@ class Silo(AutotoolsPackage): version( "4.10.2", sha256="3af87e5f0608a69849c00eb7c73b11f8422fa36903dd14610584506e7f68e638", - preferred=True, + url="https://sd.llnl.gov/sites/sd/files/2021-01/silo-4.10.2.tgz", ) version( "4.10.2-bsd", sha256="4b901dfc1eb4656e83419a6fde15a2f6c6a31df84edfad7f1dc296e01b20140e", - url="https://wci.llnl.gov/sites/wci/files/2021-01/silo-4.10.2-bsd.tgz", + url="https://sd.llnl.gov/sites/sd/files/2021-01/silo-4.10.2-bsd.tgz", + ) + version( + "4.9", + sha256="90f3d069963d859c142809cfcb034bc83eb951f61ac02ccb967fc8e8d0409854", + url="https://sd.llnl.gov/sites/sd/files/2021-01/silo-4.9.tgz", + ) + version( + "4.8", + sha256="c430c1d33fcb9bc136a99ad473d535d6763bd1357b704a915ba7b1081d58fb21", + url="https://sd.llnl.gov/sites/sd/files/2021-01/silo-4.8.tgz", ) - version("4.9", sha256="90f3d069963d859c142809cfcb034bc83eb951f61ac02ccb967fc8e8d0409854") - version("4.8", sha256="c430c1d33fcb9bc136a99ad473d535d6763bd1357b704a915ba7b1081d58fb21") variant("python", default=True, description="Enable Python support") variant("fortran", default=True, description="Enable Fortran support") variant("shared", default=True, description="Build shared libraries") - variant("silex", default=False, description="Builds Silex, a GUI for viewing Silo files") + variant( + "silex", + default=False, + description="Build Silex, a GUI alternative to text browser for viewing Silo files", + ) variant("pic", default=True, description="Produce position-independent code (for shared libs)") - variant("mpi", default=True, description="Compile with MPI Compatibility") + variant("mpi", default=False, when="@:4.11", description="(deprecated)") variant("hdf5", default=True, description="Support HDF5 for database I/O") - variant("hzip", default=True, description="Enable hzip support") - variant("fpzip", default=True, description="Enable fpzip support") + variant("zfp", default=True, description="Enable zfp compression features") + variant("hzip", default=False, description="Enable hzip compression features (!BSD)") + variant("fpzip", default=False, description="Enable fpzip compression features (!BSD)") + + # convenience multi-valued 'license mode' + variant( + "license", + values=("llnllegacy", "bsdonly"), + default="bsdonly", + when="@4.12.0:", + description="BSD-only licensed build (disables !BSD compression features)", + ) depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated depends_on("fortran", type="build") # generated - depends_on("python", type=("build", "link"), when="+python") + # The mkinc tool uses perl. Silo project could elim. this + # by relying upon mkinc generated files committed to repo depends_on("perl", type="build") - depends_on("m4", type="build", when="+shared") - depends_on("autoconf", type="build", when="+shared") - depends_on("autoconf-archive", type="build", when="+shared") - depends_on("automake", type="build", when="+shared") - depends_on("libtool", type="build", when="+shared") - depends_on("mpi", when="+mpi") depends_on("hdf5@1.8:1.10", when="@:4.10+hdf5") depends_on("hdf5@1.12:", when="@4.11:+hdf5") - depends_on("qt+gui~framework@4.8:4.9", when="+silex") + depends_on("qt +gui~framework@4.8:4.9", when="+silex") + depends_on("qt-base@6: +gui +widgets", when="@4.12.0: +silex") + depends_on("qt@5.0:5", when="@:4.11.1 +silex") depends_on("libx11", when="+silex") # Xmu dependency is required on Ubuntu 18-20 depends_on("libxmu", when="+silex") depends_on("readline") depends_on("zlib-api") + with when("build_system=autotools"): + depends_on("m4", type="build", when="+shared") + depends_on("autoconf", type="build", when="+shared") + depends_on("autoconf-archive", type="build", when="+shared") + depends_on("automake", type="build", when="+shared") + depends_on("libtool", type="build", when="+shared") + patch("remove-mpiposix.patch", when="@4.8:4.10.2") # hdf5 1.10 added an additional field to the H5FD_class_t struct @@ -102,9 +139,18 @@ class Silo(AutotoolsPackage): patch("hdf5-113.patch", when="@4.11:4.11-bsd +hdf5 ^hdf5@1.13:") conflicts("^hdf5@1.13:", when="@:4.10.2-bsd") + # compression features available only w/ HDF5 driver + conflicts("+hzip", when="~hdf5", msg="+hzip requires +hdf5") + conflicts("+fpzip", when="~hdf5", msg="+fpzip requires +hdf5") + conflicts("+zfp", when="~hdf5", msg="zfp requires +hdf5") + # hzip and fpzip are not available in the BSD releases - conflicts("+hzip", when="@4.10.2-bsd,4.11-bsd") - conflicts("+fpzip", when="@4.10.2-bsd,4.11-bsd") + conflicts("+hzip", when="@4.10.2-bsd,4.11-bsd,4.11.1-bsd") + conflicts("+fpzip", when="@4.10.2-bsd,4.11-bsd,4.11.1-bsd") + + # If bsdonly enbabled, hzip and fpzip cannot be enabled + conflicts("license=bsdonly", when="+hzip", msg="BSD-only build cannot use +hzip") + conflicts("license=bsdonly", when="+fpzip", msg="BSD-only build cannot use +fpzip") # zfp include missing patch("zfp_error.patch", when="@4.11:4.11-bsd +hdf5") @@ -112,6 +158,20 @@ class Silo(AutotoolsPackage): # use /usr/bin/env perl for portability patch("mkinc-usr-bin-env-perl.patch", when="@:4.11-bsd") + # CMake was introduced in version 4.12.0. Autotools is still + # available but deprecated in 4.12.0 and is fully removed after + # 4.12.0. So, 4.12.0 is only version where both are available. + build_system( + conditional("cmake", when="@4.12.0:"), + conditional("autotools", when="@:4.12.0"), + default="cmake", + ) + + # Fix issue with delimiter char in constant nameschemes + patch("const-namescheme-delim-char-4.12.0.patch", when="@4.12.0") + +class AutotoolsBuilder(autotools.AutotoolsBuilder): + def flag_handler(self, name, flags): spec = self.spec if name == "ldflags": @@ -161,19 +221,18 @@ def flag_handler(self, name, flags): flags.append("-Wno-implicit-function-declaration") return (flags, None, None) - @when("%clang@9:") + @when("@:4.11.1 %clang@9:") def patch(self): self.clang_9_patch() - @when("%apple-clang@11.0.3:") + @when("@:4.11.1 %apple-clang@11.0.3:") def patch(self): self.clang_9_patch() def clang_9_patch(self): # Clang 9 and later include macro definitions in that conflict - # with typedefs DOMAIN and RANGE used in Silo plugins. - # It looks like the upstream fpzip repo has been fixed, but that change - # hasn't yet made it into silo. + # with typedefs DOMAIN and RANGE used in Silo compression libraries. + # This change didn't make it into Silo until version 4.12.0. # https://github.com/LLNL/fpzip/blob/master/src/pcmap.h if str(self.spec.version).endswith("-bsd"): @@ -202,7 +261,11 @@ def repl(match): def force_autoreconf(self): # Update autoconf's tests whether libtool supports shared libraries. # (Otherwise, shared libraries are always disabled on Darwin.) - if self.spec.satisfies("@4.11-bsd") or self.spec.satisfies("@4.10.2-bsd"): + if ( + self.spec.satisfies("@4.11.1-bsd") + or self.spec.satisfies("@4.11-bsd") + or self.spec.satisfies("@4.10.2-bsd") + ): return False else: return self.spec.satisfies("+shared") @@ -217,6 +280,7 @@ def configure_args(self): config_args.extend(self.enable_or_disable("shared")) config_args.extend(self.enable_or_disable("hzip")) config_args.extend(self.enable_or_disable("fpzip")) + config_args.extend(self.enable_or_disable("zfp")) # Do not specify the prefix of zlib if it is in a system directory # (see https://github.com/spack/spack/pull/21900). @@ -242,14 +306,34 @@ def configure_args(self): ] ) - if "+mpi" in spec: - config_args.append("CC=%s" % spec["mpi"].mpicc) - config_args.append("CXX=%s" % spec["mpi"].mpicxx) - config_args.append("FC=%s" % spec["mpi"].mpifc) - return config_args @property def libs(self): shared = "+shared" in self.spec return find_libraries("libsilo*", root=self.prefix, shared=shared, recursive=True) + + +class CMakeBuilder(cmake.CMakeBuilder): + def cmake_args(self): + args = [ + self.define("SILO_ENABLE_SILOCK", True), + self.define("SILO_ENABLE_BROWSER", True), + self.define("SILO_ENABLE_INSTALL_LITE_HEADERS", True), + self.define_from_variant("SILO_ENABLE_SHARED", "shared"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + self.define_from_variant("SILO_ENABLE_SILEX", "silex"), + self.define_from_variant("SILO_ENABLE_HDF5", "hdf5"), + self.define_from_variant("SILO_ENABLE_FORTRAN", "fortran"), + self.define_from_variant("SILO_ENABLE_PYTHON_MODULE", "python"), + self.define_from_variant("SILO_ENABLE_HZIP", "hzip"), + self.define_from_variant("SILO_ENABLE_FPZIP", "fpzip"), + self.define_from_variant("SILO_ENABLE_ZFP", "zfp"), + ] + + if self.spec.satisfies("license=bsdonly"): + args.append(self.define("SILO_BUILD_FOR_BSD_LICENSE", True)) + else: + args.append(self.define("SILO_BUILD_FOR_BSD_LICENSE", False)) + + return args From c9bf9f48db2f6d094c86a681c06adef8cfc5d8ee Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> Date: Wed, 4 Feb 2026 09:19:49 -0800 Subject: [PATCH 2/5] fix style/format --- repos/spack_repo/builtin/packages/silo/package.py | 1 + 1 file changed, 1 insertion(+) diff --git a/repos/spack_repo/builtin/packages/silo/package.py b/repos/spack_repo/builtin/packages/silo/package.py index 80ba808e561..d5a5fc75810 100644 --- a/repos/spack_repo/builtin/packages/silo/package.py +++ b/repos/spack_repo/builtin/packages/silo/package.py @@ -170,6 +170,7 @@ class Silo(autotools.AutotoolsPackage, cmake.CMakePackage): # Fix issue with delimiter char in constant nameschemes patch("const-namescheme-delim-char-4.12.0.patch", when="@4.12.0") + class AutotoolsBuilder(autotools.AutotoolsBuilder): def flag_handler(self, name, flags): From d44a9ead039e0582ad7ea49673273e0402e678d8 Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> Date: Wed, 4 Feb 2026 21:36:17 -0800 Subject: [PATCH 3/5] Update repos/spack_repo/builtin/packages/silo/package.py Co-authored-by: Alec Scott --- repos/spack_repo/builtin/packages/silo/package.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/silo/package.py b/repos/spack_repo/builtin/packages/silo/package.py index d5a5fc75810..7b9279435b1 100644 --- a/repos/spack_repo/builtin/packages/silo/package.py +++ b/repos/spack_repo/builtin/packages/silo/package.py @@ -168,7 +168,11 @@ class Silo(autotools.AutotoolsPackage, cmake.CMakePackage): ) # Fix issue with delimiter char in constant nameschemes - patch("const-namescheme-delim-char-4.12.0.patch", when="@4.12.0") + patch( + "https://github.com/llnl/Silo/commit/023ca72.patch?full_index=1", + sha256="8f349208f404a7230857f14a34f4eb69db58bb8fa245257209821186c48eeb22", + when="@4.12.0", + ) class AutotoolsBuilder(autotools.AutotoolsBuilder): From 3c7ba3097f021f09b6f92f19b2cc3d6ed6f662e2 Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> Date: Wed, 4 Feb 2026 21:38:04 -0800 Subject: [PATCH 4/5] Delete repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch Handle via ref to upstream merge commit instead of copy of patch --- .../const-namescheme-delim-char-4.12.0.patch | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch diff --git a/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch b/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch deleted file mode 100644 index 174bc843056..00000000000 --- a/repos/spack_repo/builtin/packages/silo/const-namescheme-delim-char-4.12.0.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 43a52d788a3c15bee3b9391906e8ed276c5a456c Mon Sep 17 00:00:00 2001 -From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> -Date: Fri, 23 Jan 2026 19:03:18 -0800 -Subject: [PATCH] fix const nameschemes - ---- - src/silo/silo_ns.c | 25 ++++++++++++++++++------- - 1 file changed, 18 insertions(+), 7 deletions(-) - -diff --git a/src/silo/silo_ns.c b/src/silo/silo_ns.c -index 645077dd..e17a57d4 100644 ---- a/src/silo/silo_ns.c -+++ b/src/silo/silo_ns.c -@@ -424,22 +424,33 @@ DBMakeNamescheme(char const *fmt, ...) - */ - if (rv->ncspecs == 0) - { -- int rm_unnecessary_delim = 0; -+ free(rv->fmt); - -- if (n > 2 && fmt[0] == fmt[n-1]) -- rm_unnecessary_delim = !db_VariableNameValid(fmt); -+ /* If whole string is valid, take all of it. */ -+ if (db_VariableNameValid(fmt)) -+ { -+ rv->fmt = STRNDUP(&fmt[0],n); -+ rv->fmtlen = n; -+ return rv; -+ } - -- free(rv->fmt); -+ /* If whole string but first char is valid, take all but first char */ -+ if (db_VariableNameValid(&fmt[1])) -+ { -+ rv->fmt = STRNDUP(&fmt[1],n-1); -+ rv->fmtlen = n-1; -+ return rv; -+ } - -- if (rm_unnecessary_delim) -+ if (fmt[0] == fmt[n-1]) - { - rv->fmt = STRNDUP(&fmt[1],n-2); - rv->fmtlen = n-2; - } - else - { -- rv->fmt = STRNDUP(&fmt[0],n); -- rv->fmtlen = n; -+ rv->fmt = STRNDUP(&fmt[0],n-1); -+ rv->fmtlen = n-1; - } - - return rv; --- -2.50.1 (Apple Git-155) - From 437df79da5500b1620c5eee9aa2288e5beedbfef Mon Sep 17 00:00:00 2001 From: "Mark C. Miller" <5720676+markcmiller86@users.noreply.github.com> Date: Wed, 4 Feb 2026 21:45:32 -0800 Subject: [PATCH 5/5] rm trailing space chars --- repos/spack_repo/builtin/packages/silo/package.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/spack_repo/builtin/packages/silo/package.py b/repos/spack_repo/builtin/packages/silo/package.py index 7b9279435b1..f0ee682d094 100644 --- a/repos/spack_repo/builtin/packages/silo/package.py +++ b/repos/spack_repo/builtin/packages/silo/package.py @@ -169,8 +169,8 @@ class Silo(autotools.AutotoolsPackage, cmake.CMakePackage): # Fix issue with delimiter char in constant nameschemes patch( - "https://github.com/llnl/Silo/commit/023ca72.patch?full_index=1", - sha256="8f349208f404a7230857f14a34f4eb69db58bb8fa245257209821186c48eeb22", + "https://github.com/llnl/Silo/commit/023ca72.patch?full_index=1", + sha256="8f349208f404a7230857f14a34f4eb69db58bb8fa245257209821186c48eeb22", when="@4.12.0", )