From b0795d84c70cdfbb0f69bb65f713e967899d86d2 Mon Sep 17 00:00:00 2001 From: Mike Pozulp Date: Tue, 6 Mar 2018 12:49:36 -0800 Subject: [PATCH] adds patches required to build hdf5 1.8.10 (#7386) For hdf5 `1.8.10` and some compilers, the hdf5 build system adds the '-ansi' flag. hdf5 1.8.10 is not actually ansi compliant so this adds a patch to modify the places where it violates ansi compatibility (which ends up being a few comments). --- .../repos/builtin/packages/hdf5/package.py | 13 ++++++ .../packages/hdf5/pre-c99-comments.patch | 43 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 var/spack/repos/builtin/packages/hdf5/pre-c99-comments.patch diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index abfde6541b..68c81f68cb 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -50,6 +50,7 @@ class Hdf5(AutotoolsPackage): version('1.8.14', 'a482686e733514a51cde12d6fe5c5d95') version('1.8.13', 'c03426e9e77d7766944654280b467289') version('1.8.12', 'd804802feb99b87fc668a90e6fa34411') + version('1.8.10', '710aa9fb61a51d61a7e2c09bf0052157') variant('debug', default=False, description='Builds a debug version of the library') @@ -97,6 +98,18 @@ class Hdf5(AutotoolsPackage): patch('h5f90global-mult-obj-same-equivalence-same-common-block.patch', when='@1.10.1%intel@18') + # Turn line comments into block comments to conform with pre-C99 language + # standards. Versions of hdf5 after 1.8.10 don't require this patch, + # either because they conform to pre-C99 or neglect to ask for pre-C99 + # language standards from their compiler. The hdf5 build system adds + # the -ansi cflag (run 'man gcc' for info on -ansi) for some versions + # of some compilers (see hdf5-1.8.10/config/gnu-flags). The hdf5 build + # system does not provide an option to disable -ansi, but since the + # pre-C99 code is restricted to just five lines of line comments in + # three src files, this patch accomplishes the simple task of patching the + # three src files and leaves the hdf5 build system alone. + patch('pre-c99-comments.patch', when='@1.8.10') + filter_compiler_wrappers('h5cc', 'h5c++', 'h5fc', relative_root='bin') def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/hdf5/pre-c99-comments.patch b/var/spack/repos/builtin/packages/hdf5/pre-c99-comments.patch new file mode 100644 index 0000000000..97743e8fa5 --- /dev/null +++ b/var/spack/repos/builtin/packages/hdf5/pre-c99-comments.patch @@ -0,0 +1,43 @@ +diff --git a/test/th5s.c b/test/th5s.c +index 462bc36..8e18fad 100644 +--- a/test/th5s.c ++++ b/test/th5s.c +@@ -730,8 +730,8 @@ test_h5s_zero_dim(void) + ret = H5Pset_chunk(plist_id, SPACE1_RANK, chunk_dims); + CHECK(ret, FAIL, "H5Pset_chunk"); + +- // ret = H5Pset_alloc_time(plist_id, alloc_time); +- // CHECK(ret, FAIL, "H5Pset_alloc_time"); ++ /* ret = H5Pset_alloc_time(plist_id, alloc_time); */ ++ /* CHECK(ret, FAIL, "H5Pset_alloc_time"); */ + + dset1 = H5Dcreate2(fid1, BASICDATASET1, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); +diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c +index ee6de5e..3ed6045 100644 +--- a/tools/h5dump/h5dump_ddl.c ++++ b/tools/h5dump/h5dump_ddl.c +@@ -1341,8 +1341,8 @@ handle_attributes(hid_t fid, const char *attr, void UNUSED * data, int UNUSED pe + string_dataformat.do_escape = display_escape; + outputformat = &string_dataformat; + +- //attr_name = attr + j + 1; +- // need to replace escape characters ++ /* attr_name = attr + j + 1; */ ++ /* need to replace escape characters */ + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + + +diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c +index 9ce3524..3b4e5e7 100644 +--- a/tools/lib/h5tools_str.c ++++ b/tools/lib/h5tools_str.c +@@ -632,7 +632,7 @@ h5tools_str_indent(h5tools_str_t *str, const h5tool_format_t *info, + h5tools_str_append(str, "%s", OPT(info->line_indent, "")); + } + +-// ctx->need_prefix = 0; ++/* ctx->need_prefix = 0; */ + } + + /*-------------------------------------------------------------------------