From b8e32ff6b3d23ca0c90ef813e25e80183724045b Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 18 Sep 2023 10:47:25 -0600 Subject: Fix several build errors for hdf-eos2 (not only but in particular on macOS w/ apple-clang) (#39877) Fix permissions for configure file in var/spack/repos/builtin/packages/hdf-eos2/package.py, fix dependencies to match what hdf provides, update compiler flags for apple-clang --- .../repos/builtin/packages/hdf-eos2/package.py | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/hdf-eos2/package.py b/var/spack/repos/builtin/packages/hdf-eos2/package.py index 6b45c9c630..f7cad7c7ce 100644 --- a/var/spack/repos/builtin/packages/hdf-eos2/package.py +++ b/var/spack/repos/builtin/packages/hdf-eos2/package.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) import sys +from os import chmod from spack.package import * @@ -20,6 +21,8 @@ class HdfEos2(AutotoolsPackage): # Template for url_for_version. 0 is sha256 checksum, 1 is filename url = "https://git.earthdata.nasa.gov/rest/git-lfs/storage/DAS/hdfeos/{0}?response-content-disposition=attachment%3B%20filename%3D%22{1}%22%3B%20filename*%3Dutf-8%27%27{1}" + maintainers("climbfuji") + # Crazy URL scheme, differing with each version, and including the # sha256 checksum in the URL. Yuck # The data in version_list is used to generate versions and urls @@ -54,6 +57,11 @@ class HdfEos2(AutotoolsPackage): # Build dependencies depends_on("hdf") + # Because hdf always depends on zlib and jpeg in spack, the tests below in configure_args + # (if "jpeg" in self.spec:) always returns true and hdf-eos2 wants zlib and jpeg, too. + depends_on("zlib-api") + depends_on("jpeg") + depends_on("szip", when="^hdf +szip") # The standard Makefile.am, etc. add a --single_module flag to LDFLAGS # to pass to the linker. @@ -75,6 +83,20 @@ class HdfEos2(AutotoolsPackage): "version/checksum not found in version_list".format(version) ) + # spack patches the configure file unless autoconf is run, + # and this fails because configure has the wrong permissions (644) + @run_before("configure") + def fix_permissions(self): + if not self.force_autoreconf: + chmod(join_path(self.stage.source_path, "configure"), 0o755) + + def flag_handler(self, name, flags): + if self.spec.compiler.name == "apple-clang": + if name == "cflags": + flags.append("-Wno-error=implicit-function-declaration") + + return flags, None, None + def configure_args(self): extra_args = [] @@ -83,6 +105,7 @@ class HdfEos2(AutotoolsPackage): # We always build PIC code extra_args.append("--with-pic") + extra_args.append("--enable-install_include") # Set shared/static appropriately extra_args.extend(self.enable_or_disable("shared")) @@ -92,8 +115,8 @@ class HdfEos2(AutotoolsPackage): extra_args.append("--with-hdf4={0}".format(self.spec["hdf"].prefix)) if "jpeg" in self.spec: extra_args.append("--with-jpeg={0}".format(self.spec["jpeg"].prefix)) - if "libszip" in self.spec: - extra_args.append("--with-szlib={0}".format(self.spec["libszip"].prefix)) + if "szip" in self.spec: + extra_args.append("--with-szlib={0}".format(self.spec["szip"].prefix)) if "zlib" in self.spec: extra_args.append("--with-zlib={0}".format(self.spec["zlib-api"].prefix)) -- cgit v1.2.3-60-g2f50