Skip to content

Commit a6b7cb8

Browse files
Merge pull request #459 from AlysonStahl-NOAA/as_spack3
Update spack recipe
2 parents fd187c8 + a355e0a commit a6b7cb8

1 file changed

Lines changed: 32 additions & 19 deletions

File tree

spack/package.py

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
"tigge": "USE_TIGGE",
2020
"proj4": "USE_PROJ4",
2121
"aec": "USE_AEC",
22+
"g2c": "USE_G2CLIB",
2223
"png": "USE_PNG",
2324
"jasper": "USE_JASPER",
24-
"g2c": "USE_G2CLIB_LOW",
25+
"g2c_low": "USE_G2CLIB_LOW",
2526
"g2c_high": "USE_G2CLIB_HIGH",
2627
"openmp": "USE_OPENMP",
2728
"wmo_validation": "USE_WMO_VALIDATION",
@@ -52,9 +53,13 @@ class Wgrib2(MakefilePackage, CMakePackage):
5253
url = "https://github.com/NOAA-EMC/wgrib2/archive/refs/tags/v3.6.0.tar.gz"
5354
git = "https://github.com/NOAA-EMC/wgrib2.git"
5455

55-
maintainers("t-brown", "AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett")
56+
maintainers(
57+
"AlysonStahl-NOAA", "t-brown", "AlexanderRichert-NOAA", "Hang-Lei-NOAA", "edwardhartnett"
58+
)
5659

57-
build_system(conditional("cmake", when="@3.2:"), conditional("makefile", when="@:3.1"))
60+
build_system(
61+
conditional("cmake", when="@3.2:"), conditional("makefile", when="@:3.1"), default="cmake"
62+
)
5863

5964
version("develop", branch="develop")
6065
version("3.7.0", sha256="b741a07710a8195c99a7d50de05bde90182ab4334f5c4a0d6d057c4e20cc6a75")
@@ -84,9 +89,6 @@ class Wgrib2(MakefilePackage, CMakePackage):
8489
extension="tar.gz",
8590
)
8691

87-
depends_on("c", type="build")
88-
depends_on("fortran", type="build")
89-
9092
def url_for_version(self, version):
9193
if version >= Version("3.2.0"):
9294
url_fmt = "https://github.com/NOAA-EMC/wgrib2/archive/refs/tags/v{0}.tar.gz"
@@ -104,12 +106,12 @@ def url_for_version(self, version):
104106
"netcdf4",
105107
default=False,
106108
description="Link in netcdf4 library to write netcdf3/4 files",
107-
when="@:3.3"
109+
when="@:3.3",
108110
)
109111
variant(
110112
"netcdf",
111-
default=False,
112-
description="Link in netcdf4 library to write netcdf3/4 files",
113+
default=True,
114+
description="Link in netcdf library to write netcdf files",
113115
when="@3.4:"
114116
)
115117
variant(
@@ -152,6 +154,12 @@ def url_for_version(self, version):
152154
)
153155
variant(
154156
"g2c",
157+
default=False,
158+
description="Include NCEP g2clib (mainly for testing purposes)",
159+
when="@:3.1",
160+
)
161+
variant(
162+
"g2c_low",
155163
default=True,
156164
description="Include NCEP g2clib (png,jpeg2000)",
157165
when="@3.7:",
@@ -192,22 +200,27 @@ def url_for_version(self, version):
192200
conflicts("+netcdf3", when="+netcdf4")
193201
conflicts("+netcdf3", when="+netcdf")
194202
conflicts("+openmp", when="%apple-clang")
195-
conflicts("-g2c", when="+g2c_high")
203+
conflicts("~g2c_low", when="+g2c_high")
204+
205+
depends_on("c", type="build")
206+
depends_on("fortran", type="build")
196207

197208
depends_on("ip@5.2:", when="@develop +ipolates")
198-
depends_on("g2c@2.2.0:", when="@3.7: +g2c")
209+
depends_on("g2c@2.2.0:", when="@3.7: +g2c_low")
199210
depends_on("g2c@2.2.0:", when="@3.7: +g2c_high")
200211
depends_on("lapack", when="@develop +ipolates")
201212
depends_on("libaec@1.0.6:", when="@3.2: +aec")
202-
depends_on("netcdf-c", when="@3.2: +netcdf4")
203-
213+
# Options to use netcdf3 or netcdf4 merged into a single option with v3.4.0
214+
depends_on("netcdf-c", when="@3.4: +netcdf")
215+
depends_on("netcdf-c", when="@3.2:3.3 +netcdf4")
204216
depends_on("jasper@:2", when="@3.2:3.4 +jasper")
205-
depends_on("g2c@2.2.0: +jasper", when="@3.4:3.7 +jasper")
206-
depends_on("zlib-api", when="@3.2:3.4 +png")
207-
depends_on("libpng", when="@3.2:3.4 +png")
208-
depends_on("g2c@2.2.0: +png", when="@3.4:3.7 +png")
217+
depends_on("g2c", when="@3.5: +jasper")
218+
depends_on("zlib-api", when="@3.2: +png")
219+
depends_on("libpng", when="@3.2: +png")
220+
depends_on("g2c +png", when="@3.5: +png")
209221
depends_on("openjpeg", when="@3.2:3.4 +openjpeg")
210-
depends_on("g2c@2.2.0: +openjpeg", when="@3.4:3.7 +openjpeg")
222+
depends_on("g2c +openjpeg", when="@3.5: +openjpeg")
223+
requires("^g2c@1.9:", when="@3.5: ^g2c")
211224

212225
@when("@:2 ^gmake@4.2:")
213226

@@ -217,7 +230,7 @@ def patch(self):
217230
# Use Spack compiler wrapper flags
218231
def inject_flags(self, name, flags):
219232
if name == "cflags":
220-
if self.spec.compiler.name == "apple-clang":
233+
if self.spec.compiler.name in ["apple-clang", "clang"]:
221234
flags.append("-Wno-error=implicit-function-declaration")
222235

223236
# When mixing Clang/gfortran need to link to -lgfortran

0 commit comments

Comments
 (0)