From 4772fd7723d14e934f0b0803fe9ea3bcce44e752 Mon Sep 17 00:00:00 2001 From: Alex Richert <82525672+AlexanderRichert-NOAA@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:31:51 -0700 Subject: Add MADIS package (#38097) * Add MADIS package * madis update * [@spackbot] updating style on behalf of AlexanderRichert-NOAA * allow arg mismatch for gcc@10: for madis --- var/spack/repos/builtin/packages/madis/package.py | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 var/spack/repos/builtin/packages/madis/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/madis/package.py b/var/spack/repos/builtin/packages/madis/package.py new file mode 100644 index 0000000000..320a936abd --- /dev/null +++ b/var/spack/repos/builtin/packages/madis/package.py @@ -0,0 +1,75 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class Madis(MakefilePackage): + """ + Meteorological Assimilation Data Ingest System (MADIS) is an observational + database and delivery system which integrates real-time observations from a + wide variety of observing infrastructures to make them useable for + numerical weather prediction models and nowcasting. + """ + + homepage = "https://madis-data.ncep.noaa.gov/" + url = "https://madis-data.ncep.noaa.gov/source/madis-4.3.tar.gz" + + maintainers("AlexanderRichert-NOAA") + + version("4.3", sha256="5d1ee9800c84e623dcf4271653aa66d17a744143e58354e70f8a0646cd6b246c") + + variant("pic", default=True, description="Build with position-independent code (PIC)") + variant("pnetcdf", default=False, description="Build with parallel NetCDF") + + depends_on("netcdf-fortran") + depends_on("parallel-netcdf", when="+pnetcdf") + + def setup_build_environment(self, env): + fflags = [] + if self.spec.satisfies("%gcc@10:"): + fflags += ["-fallow-argument-mismatch"] + + if self.spec.satisfies("+pic"): + fflags += ["-fPIC"] + + env.set("FFLAGS", " ".join(fflags)) + + ldflags = [] + libs = [] + + if self.spec.satisfies("+pnetcdf"): + pnetcdf = self.spec["parallel-netcdf"] + ldflags.append(pnetcdf.libs.ld_flags) + libs.append(pnetcdf.libs.link_flags) + + nfconfig = which(os.path.join(self.spec["netcdf-fortran"].prefix.bin, "nf-config")) + ldflags.append(nfconfig("--flibs", output=str).strip()) + netcdf_f = self.spec["netcdf-fortran"] + env.set("NETCDF_INC", netcdf_f.prefix.include) + + env.set("NETCDF_LIB", " ".join(ldflags)) + env.set("LIBS", " ".join(libs)) + + def build(self, spec, prefix): + with working_dir("src"): + make("-j1") + + def install(self, spec, prefix): + with working_dir("src"): + make("-j1") + with working_dir(self.build_directory): + copy_tree("bin", prefix.bin) + copy_tree("doc", prefix.doc) + copy_tree("include", prefix.include) + copy_tree("lib", prefix.lib) + copy_tree("src", prefix.src) + copy_tree("static", prefix.static) + + def patch(self): + for pattern in ["NETCDF_LIB", "NETCDF_INC", "FC", "FFLAGS", "LDFLAGS"]: + filter_file(pattern + "=", "#" + pattern + "=", "src/makefile") -- cgit v1.2.3-60-g2f50