Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy packages required for OM3 from COSIMA/spack_packages #93

Merged
merged 4 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions packages/fms/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# 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)

from spack.package import *


class Fms(CMakePackage):
"""GFDL's Flexible Modeling System (FMS) is a software environment
that supports the efficient development, construction, execution,
and scientific interpretation of atmospheric, oceanic, and climate
system models."""

homepage = "https://github.com/NOAA-GFDL/FMS"
url = "https://github.com/NOAA-GFDL/FMS/archive/refs/tags/2022.04.tar.gz"
CodeGat marked this conversation as resolved.
Show resolved Hide resolved
git = "https://github.com/NOAA-GFDL/FMS.git"

maintainers("AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett", "rem1776")

version("2023.02", sha256="dc029ffadfd82c334f104268bedd8635c77976485f202f0966ae4cf06d2374be")
version(
"2023.01.01", sha256="f83e2814a1e3ba439ab847ec8bb251f3889d5ca14fb20849507590adbbe8e899"
)
version("2023.01", sha256="6079ea885e9365513b453c77aadfc7c305bf413b840656bb333db1eabba0f18e")
version("2022.04", sha256="f741479128afc2b93ca8291a4c5bcdb024a8cbeda1a26bf77a236c0f629e1b03")
version("2022.03", sha256="42d2ac53d3c889a8177a6d7a132583364c0f6e5d5cbde0d980443b6797ad4838")
version("2022.02", sha256="ad4978302b219e11b883b2f52519e1ee455137ad947474abb316c8654f72c874")
version("2022.01", sha256="a1cba1f536923f5953c28729a28e5431e127b45d6bc2c15d230939f0c02daa9b")
version("2021.04", sha256="dcb4fe80cb3b7846f7cf89b812afff09a78a10261ea048a851f28935d6b241b1")
version(
"2021.03.01", sha256="1f70e2a57f0d01e80fceb9ca9ce9661f5c1565d0437ab67618c2c4dfea0da6e9"
)
version("2021.03", sha256="a9fb6e85f44ff79e6f9e61e65f42a5ffd38fa661fe1a3e4da6f85ffacd2697ac")
version(
"2021.02.01", sha256="9b11d9474d7c90464af66d81fb86c4798cfa309b9a0da20b0fccf33c4f65386b"
)
version("2021.02", sha256="db810b2452a6952239f064b52c0c5c58fc62126057982111b9fcd64f1b3bd879")
version("2021.01", sha256="38c748e2edb94ffeb021095d8bde4d74b7834610ce0ef1dbb4dce353eeb5cd96")
version(
"2020.04.02", sha256="bd6ce752b1018d4418398f14b9fc486f217de76bcbaaf2cdbf4c43e0b3f39f69"
)
version(
"2020.04.01", sha256="2c409242de7dea0cf29f8dbf7495698b6bcac1eeb5c4599a728bdea172ffe37c"
)

variant(
"precision",
values=("32", "64"),
description="Build a version of the library with default 32 or 64 bit reals or both",
default="32",
multi=True,
)
conflicts(
"precision=32,64",
when="@:2022.03",
msg="FMS versions prior to 2022.04 do not support both 32 and 64 bit precision",
)

variant("gfs_phys", default=True, description="Use GFS Physics")
variant("openmp", default=True, description="Use OpenMP")
variant("quad_precision", default=True, description="quad precision reals")
variant(
"yaml",
default=False,
description="yaml input file support(requires libyaml)",
when="@2021.04:",
)
variant(
"constants",
default="GFDL",
description="Build with <X> constants parameter definitions",
values=("GFDL", "GEOS", "GFS"),
multi=False,
when="@2022.02:",
)
variant(
"pic", default=False, description="Build with position independent code", when="@2022.02:"
)
variant(
"deprecated_io",
default=False,
description="Compiles with support for deprecated io modules fms_io and mpp_io",
when="@2023.02:",
)
variant(
"large_file", default=False, description="Not sure."
)
variant(
"internal_file_nml", default=False, description="Not sure."
)

depends_on("netcdf-c")
depends_on("netcdf-fortran")
depends_on("mpi")
depends_on("libyaml", when="+yaml")

def cmake_args(self):
args = [
self.define_from_variant("GFS_PHYS"),
self.define_from_variant("OPENMP"),
self.define_from_variant("ENABLE_QUAD_PRECISION", "quad_precision"),
self.define_from_variant("WITH_YAML", "yaml"),
self.define_from_variant("CONSTANTS"),
self.define_from_variant("LARGEFILE", "large_file"),
self.define_from_variant("INTERNAL_FILE_NML"),
self.define("32BIT", "precision=32" in self.spec),
self.define("64BIT", "precision=64" in self.spec),
self.define_from_variant("FPIC", "pic"),
self.define_from_variant("USE_DEPRECATED_IO", "deprecated_io"),
]

args.append(self.define("CMAKE_C_COMPILER", self.spec["mpi"].mpicc))
args.append(self.define("CMAKE_CXX_COMPILER", self.spec["mpi"].mpicxx))
args.append(self.define("CMAKE_Fortran_COMPILER", self.spec["mpi"].mpifc))

return args
44 changes: 44 additions & 0 deletions packages/fortranxml/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2013-2022 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)

from spack.package import *


class Fortranxml(AutotoolsPackage):
"""Fortran XML (FoX) s a library, written entirely in Fortran, designed to allow
the easy use of XML from Fortran programs. FoX caters for both XML output
and input.
"""

homepage = "https://github.com/andreww/fox"
git = "https://github.com/andreww/fox.git"
url = "https://github.com/andreww/fox/archive/refs/tags/4.1.2.tar.gz"
harshula marked this conversation as resolved.
Show resolved Hide resolved

maintainers = ["andreww"]
harshula marked this conversation as resolved.
Show resolved Hide resolved

version("4.1.2", sha256="dea0adc9cc035238fa9cdba42f2bf56481e3a64ac8aa0aece9119f127f71d4e7")

flag_handler = AutotoolsPackage.build_system_flags

def install(self, spec, prefix):
super(AutotoolsPackage, self).install(spec, prefix)
CodeGat marked this conversation as resolved.
Show resolved Hide resolved

pkgconfig_dir = join_path(prefix.lib, "pkgconfig")
pkgconfig_file = join_path(pkgconfig_dir, "fox.pc")
mkdir(pkgconfig_dir)

with open(pkgconfig_file, "w", encoding="utf-8") as pc:
pc.write(f"""\
prefix={prefix}
exec_prefix=${{prefix}}
libdir=${{exec_prefix}}/lib
includedir=${{prefix}}/finclude

Name: Fortran XML (FoX)
Description: A Fortran XML library
Version: {spec.version}
Libs: -L${{libdir}} -lFoX_dom -lFoX_sax -lFoX_wcml -lFoX_wkml -lFoX_wxml -lFoX_common -lFoX_utils -lFoX_fsys
Cflags: -I${{includedir}}
""")
Loading