unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add hdf-eos5.
@ 2016-09-27 20:28 Thomas Danckaert
  2016-10-03 15:59 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Danckaert @ 2016-09-27 20:28 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: 0001-gnu-Add-hdf-eos5.patch --]
[-- Type: Text/X-Patch, Size: 9768 bytes --]

From f1a3bc9dcfbe9091110aacf353d8224a88788292 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <thomas.danckaert@gmail.com>
Date: Fri, 17 Jun 2016 10:51:38 +0200
Subject: [PATCH] gnu: Add hdf-eos5.

* gnu/packages/maths.scm (hdf-eos5): New variable.
* gnu/packages/patches/hdf-eos5-build-shared.patch: New file.
* gnu/packages/patches/hdf-eos5-remove-gctp.patch: New file.
* gnu/packages/patches/hdf-eos5-fix-szip.patch: New file.
---
 gnu/packages/maths.scm                           | 45 ++++++++++++
 gnu/packages/patches/hdf-eos5-build-shared.patch | 88 ++++++++++++++++++++++++
 gnu/packages/patches/hdf-eos5-fix-szip.patch     | 32 +++++++++
 gnu/packages/patches/hdf-eos5-headers.patch      | 14 ++++
 gnu/packages/patches/hdf-eos5-remove-gctp.patch  | 61 ++++++++++++++++
 5 files changed, 240 insertions(+)
 create mode 100644 gnu/packages/patches/hdf-eos5-build-shared.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-fix-szip.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-headers.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-remove-gctp.patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0401cd3..1cc041d 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -42,6 +42,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system r)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages autotools)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -483,6 +484,50 @@ extremely large and complex data collections.")
     (license (license:x11-style
               "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
 
+(define-public hdf-eos5
+  (package
+    (name "hdf-eos5")
+    (version "1.15")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
+/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
+              (sha256
+               (base32
+                "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
+              (patches (search-patches "hdf-eos5-build-shared.patch"
+                                       "hdf-eos5-remove-gctp.patch"
+                                       "hdf-eos5-fix-szip.patch"
+                                       "hdf-eos5-headers.patch"))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)))
+    (build-system gnu-build-system)
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("zlib" ,zlib)
+       ("gctp" ,gctp)))
+    (arguments
+     `(#:configure-flags '("--enable-install-include")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before
+             'configure 'autogen
+           (lambda _  ; configure.ac was patched
+             (and (chmod "./configure" #o755)
+                  (zero? (system* "autoreconf" "--install"))))))
+       #:parallel-tests? #f))
+    (synopsis
+     "HDF-EOS5: HDF5-based data format for NASA's Earth Observing System")
+    (description
+     "HDF-EOS5 is a software library built on HDF5 to support the construction
+of data structures used in NASA's Earth Observing System (Grid, Point and
+Swath).")
+    (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
+    (license (license:bsd-style
+              "http://www.hdfeos.org/software/library.php#HDF-EOS5"))))
+
 (define-public hdf5-parallel-openmpi
   (package (inherit hdf5)
     (name "hdf5-parallel-openmpi")
diff --git a/gnu/packages/patches/hdf-eos5-build-shared.patch b/gnu/packages/patches/hdf-eos5-build-shared.patch
new file mode 100644
index 0000000..d1b4806
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-build-shared.patch
@@ -0,0 +1,88 @@
+Allow shared build.
+
+We remove all references to the 'testdrivers' directory.  This directory is
+not included in the distributed source archive, and its absence trips up
+automake.
+
+---
+ Makefile.am             |  6 ------
+ configure.ac            | 12 ------------
+ include/HE5_HdfEosDef.h |  1 +
+ src/Makefile.am         |  3 ++-
+ 4 files changed, 3 insertions(+), 19 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 363bcfb..01ed024 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -3,13 +3,7 @@
+ # Include boilerplate
+ include $(top_srcdir)/config/include.am
+ 
+-# List of subdirectories.
+-# Only build the testdrivers directory if configure detected that it's present.
+-if TESTDRIVERS_CONDITIONAL
+-TESTDRIVERS=testdrivers
+-else
+ TESTDRIVERS=
+-endif
+ 
+ if INSTALL_INCLUDE_CONDITIONAL
+ INCLUDE=include
+diff --git a/configure.ac b/configure.ac
+index 5d48b43..cfa9d4e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -13,9 +13,6 @@ AC_CONFIG_AUX_DIR([config])
+ AM_INIT_AUTOMAKE([foreign])
+ AM_MAINTAINER_MODE
+ 
+-# Disable shared libraries (for now)
+-AC_DISABLE_SHARED
+-
+ AM_PROG_LIBTOOL
+ 
+ dnl ----------------------------------------------------------------------
+@@ -597,13 +594,4 @@ AC_CONFIG_FILES([Makefile
+                  gctp/src/Makefile
+                  samples/Makefile])
+ 
+-if test "X$TESTDRIVERS_DIR" = "Xyes"; then
+-  AC_CONFIG_FILES([ testdrivers/Makefile
+-                 testdrivers/grid/Makefile
+-                 testdrivers/point/Makefile
+-                 testdrivers/swath/Makefile
+-                 testdrivers/threads/Makefile
+-                 testdrivers/za/Makefile])
+-fi
+-
+ AC_OUTPUT
+diff --git a/include/HE5_HdfEosDef.h b/include/HE5_HdfEosDef.h
+index 9ed7881..abf0a90 100755
+--- a/include/HE5_HdfEosDef.h
++++ b/include/HE5_HdfEosDef.h
+@@ -24,6 +24,7 @@
+ #ifndef HE5_HDFEOSDEF_H_
+ #define HE5_HDFEOSDEF_H_
+ 
++#define H5_USE_16_API 1 // required for compilation with recent HDF5
+ #include <hdf5.h>
+ 
+ #ifdef H5_USE_16_API
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 76b1d4c..daf7ad8 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -10,7 +10,8 @@ INCLUDES=-I$(top_srcdir)/include/
+ 
+ # Set LDFLAGS to allow the HDF-EOS library to use extern variables from
+ # HDF5
+-LDFLAGS=-Wl,-single_module
++LDFLAGS+= -shrext .so
++LIBS+= -lhdf5_hl -lhdf5 -lm
+ 
+ # Build HDF-EOS5
+ lib_LTLIBRARIES=libhe5_hdfeos.la
+-- 
+2.5.0
+
diff --git a/gnu/packages/patches/hdf-eos5-fix-szip.patch b/gnu/packages/patches/hdf-eos5-fix-szip.patch
new file mode 100644
index 0000000..f66ad51
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-fix-szip.patch
@@ -0,0 +1,32 @@
+Fix compilation without szip.
+
+An ill-placed #endif causes missing symbols when the library is compiled
+without szip.
+
+---
+ src/EHapi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/EHapi.c b/src/EHapi.c
+index 46a9b5c..504d8f2 100755
+--- a/src/EHapi.c
++++ b/src/EHapi.c
+@@ -11379,6 +11379,7 @@ int HE5_szip_can_encode(void )
+   return(-1);
+ }
+ 
++#endif /* H5_HAVE_FILTER_SZIP */
+ 
+ 
+ /*----------------------------------------------------------------------------|
+@@ -11509,7 +11510,6 @@ HE5_EHHEisHE5(char *filename)
+     }
+ }
+ 
+-#endif /* H5_HAVE_FILTER_SZIP */
+ 
+ 
+ #ifndef __cplusplus
+-- 
+2.5.0
+
diff --git a/gnu/packages/patches/hdf-eos5-headers.patch b/gnu/packages/patches/hdf-eos5-headers.patch
new file mode 100644
index 0000000..84fd90c
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-headers.patch
@@ -0,0 +1,14 @@
+Do not install unnecessary headers.
+
+diff --git a/include/Makefile.am b/include/Makefile.am
+index 3de93db..52246af 100755
+--- a/include/Makefile.am
++++ b/include/Makefile.am
+@@ -4,6 +4,5 @@
+ include $(top_srcdir)/config/include.am
+ 
+ # Headers to install
+-include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
+-                  isin.h proj.h tutils.h cfortHdf.h
++include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h ease.h isin.h cfortHdf.h
+ 
diff --git a/gnu/packages/patches/hdf-eos5-remove-gctp.patch b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
new file mode 100644
index 0000000..359d486
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
@@ -0,0 +1,61 @@
+Do not build/install the bundled GCTP and link shared -lgctp.
+
+---
+ Makefile.am         | 2 +-
+ config/include.am   | 1 -
+ configure.ac        | 3 ---
+ include/Makefile.am | 3 +--
+ src/Makefile.am     | 2 +-
+ 5 files changed, 3 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 01ed024..ef325ac 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -11,5 +11,5 @@ else
+ INCLUDE=
+ endif
+ 
+-SUBDIRS=gctp src $(INCLUDE) samples $(TESTDRIVERS)
++SUBDIRS=src $(INCLUDE) samples $(TESTDRIVERS)
+ 
+diff --git a/config/include.am b/config/include.am
+index b82fae9..a1e0332 100644
+--- a/config/include.am
++++ b/config/include.am
+@@ -4,5 +4,4 @@
+ ## shared definitions.
+ 
+ LIBHDFEOS5=$(top_builddir)/src/libhe5_hdfeos.la
+-LIBGCTP=$(top_builddir)/gctp/src/libGctp.la
+ 
+diff --git a/configure.ac b/configure.ac
+index cfa9d4e..860da1c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -589,9 +589,6 @@ AM_CONDITIONAL([SZIP_ENCODER_CONDITIONAL], [test "X$USE_SZIP_ENCODER" = "Xyes"])
+ AC_CONFIG_FILES([Makefile
+                  include/Makefile
+                  src/Makefile
+-                 gctp/Makefile
+-                 gctp/include/Makefile
+-                 gctp/src/Makefile
+                  samples/Makefile])
+ 
+ AC_OUTPUT
+diff --git a/src/Makefile.am b/src/Makefile.am
+index daf7ad8..f4828cb 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -11,7 +11,7 @@ INCLUDES=-I$(top_srcdir)/include/
+ # Set LDFLAGS to allow the HDF-EOS library to use extern variables from
+ # HDF5
+ LDFLAGS+= -shrext .so
+-LIBS+= -lhdf5_hl -lhdf5 -lm
++LIBS+= -lgctp -lhdf5_hl -lhdf5 -lm
+ 
+ # Build HDF-EOS5
+ lib_LTLIBRARIES=libhe5_hdfeos.la
+-- 
+2.5.0
+
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add hdf-eos5.
  2016-09-27 20:28 [PATCH] gnu: Add hdf-eos5 Thomas Danckaert
@ 2016-10-03 15:59 ` Ludovic Courtès
  2016-10-04 20:15   ` Thomas Danckaert
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2016-10-03 15:59 UTC (permalink / raw)
  To: Thomas Danckaert; +Cc: guix-devel

Hi Thomas,

Thomas Danckaert <thomas.danckaert@gmail.com> skribis:

> From f1a3bc9dcfbe9091110aacf353d8224a88788292 Mon Sep 17 00:00:00 2001
> From: Thomas Danckaert <thomas.danckaert@gmail.com>
> Date: Fri, 17 Jun 2016 10:51:38 +0200
> Subject: [PATCH] gnu: Add hdf-eos5.
>
> * gnu/packages/maths.scm (hdf-eos5): New variable.
> * gnu/packages/patches/hdf-eos5-build-shared.patch: New file.
> * gnu/packages/patches/hdf-eos5-remove-gctp.patch: New file.
> * gnu/packages/patches/hdf-eos5-fix-szip.patch: New file.

Thanks for this patch!  Overall it looks pretty good to me; some
comments/suggestions follow.

First, please make sure to list the patches in gnu/local.mk.

Also, for each patch, could you add a word stating what the upstream
status is, such as the URL of the upstream commit or discussion, when it
exists?

> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm

Please add a copyright line for you.

> +    (native-inputs
> +     `(("autoconf" ,autoconf)
> +       ("automake" ,automake)
> +       ("libtool" ,libtool)))
> +    (build-system gnu-build-system)
> +    (inputs
> +     `(("hdf5" ,hdf5)
> +       ("zlib" ,zlib)
> +       ("gctp" ,gctp)))
> +    (arguments
> +     `(#:configure-flags '("--enable-install-include")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before
> +             'configure 'autogen
> +           (lambda _  ; configure.ac was patched
> +             (and (chmod "./configure" #o755)
> +                  (zero? (system* "autoreconf" "--install"))))))

I wonder if we could avoid running autoreconf, which would mean patching
configure/Makefile.in instead of configure.ac/Makefile.am.

> +    (synopsis
> +     "HDF-EOS5: HDF5-based data format for NASA's Earth Observing System")

Remove “HDF-EOS5:” here.

> +++ b/gnu/packages/patches/hdf-eos5-build-shared.patch
> @@ -0,0 +1,88 @@
> +Allow shared build.
> +
> +We remove all references to the 'testdrivers' directory.  This directory is
> +not included in the distributed source archive, and its absence trips up
> +automake.
> +
> +---
> + Makefile.am             |  6 ------
> + configure.ac            | 12 ------------
> + include/HE5_HdfEosDef.h |  1 +
> + src/Makefile.am         |  3 ++-
> + 4 files changed, 3 insertions(+), 19 deletions(-)
> +
> +diff --git a/Makefile.am b/Makefile.am
> +index 363bcfb..01ed024 100644
> +--- a/Makefile.am
> ++++ b/Makefile.am
> +@@ -3,13 +3,7 @@
> + # Include boilerplate
> + include $(top_srcdir)/config/include.am
> + 
> +-# List of subdirectories.
> +-# Only build the testdrivers directory if configure detected that it's present.
> +-if TESTDRIVERS_CONDITIONAL
> +-TESTDRIVERS=testdrivers
> +-else
> + TESTDRIVERS=
> +-endif

What about patching ‘configure’ such that the shell variable
‘TESTDRIVERS_DIR’ is set to “no”, and such that the
‘TESTDRIVERS_CONDITIONAL’ Automake condition is false?

That should be doable and would avoid this relatively length patch.

> +-# Disable shared libraries (for now)
> +-AC_DISABLE_SHARED

This macro only changes the default behavior.  Passing “--enable-shared”
to #:configure-flags should be enough to build shared libraries.

Could you check if that works?

> --- /dev/null
> +++ b/gnu/packages/patches/hdf-eos5-headers.patch
> @@ -0,0 +1,14 @@
> +Do not install unnecessary headers.
> +
> +diff --git a/include/Makefile.am b/include/Makefile.am
> +index 3de93db..52246af 100755
> +--- a/include/Makefile.am
> ++++ b/include/Makefile.am
> +@@ -4,6 +4,5 @@
> + include $(top_srcdir)/config/include.am
> + 
> + # Headers to install
> +-include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
> +-                  isin.h proj.h tutils.h cfortHdf.h
> ++include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h ease.h isin.h cfortHdf.h

What about removing the extra files in a separate phase?  That would
avoid the need to modify Makefile.am.

Also please add a comment on why you think it’s unnecessary.  :-)

> diff --git a/gnu/packages/patches/hdf-eos5-remove-gctp.patch b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
> new file mode 100644
> index 0000000..359d486
> --- /dev/null
> +++ b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
> @@ -0,0 +1,61 @@
> +Do not build/install the bundled GCTP and link shared -lgctp.
> +
> +---
> + Makefile.am         | 2 +-
> + config/include.am   | 1 -
> + configure.ac        | 3 ---
> + include/Makefile.am | 3 +--
> + src/Makefile.am     | 2 +-
> + 5 files changed, 3 insertions(+), 8 deletions(-)
> +
> +diff --git a/Makefile.am b/Makefile.am
> +index 01ed024..ef325ac 100644
> +--- a/Makefile.am
> ++++ b/Makefile.am
> +@@ -11,5 +11,5 @@ else
> + INCLUDE=
> + endif
> + 
> +-SUBDIRS=gctp src $(INCLUDE) samples $(TESTDRIVERS)
> ++SUBDIRS=src $(INCLUDE) samples $(TESTDRIVERS)

I think this can be achieved by removing it from Makefile.in with
‘substitute*’.  The LDFLAGS below can be passed like this:

  #:configure-flags (list … "LDFLAGS=-Wl,--as-needed -lgctp")

Could you send an updated patch?

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add hdf-eos5.
  2016-10-03 15:59 ` Ludovic Courtès
@ 2016-10-04 20:15   ` Thomas Danckaert
  2016-10-06 16:17     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Danckaert @ 2016-10-04 20:15 UTC (permalink / raw)
  Cc: guix-devel

[-- Attachment #1: Type: Text/Plain, Size: 1241 bytes --]

Hi Ludovic,

you were right, there was a lot of room to simplify.  This patch 
modifies autotools' generated files, so there's no need for 
autoreconf anymore.

In the meantime, I discovered that the library can also build a 
Fortran wrapper.  I enabled this wrapper, but some of the Fortran 
tests contain some bugs (multi-line string formatting errors).  
Fixing those tests requires a rather long (but simple) patch.  
Alternatively, disabling the tests (or the Fortran wrapper) would 
shorten the patch.

From: ludo@gnu.org (Ludovic Courtès)
Subject: Re: [PATCH] gnu: Add hdf-eos5.
Date: Mon, 03 Oct 2016 17:59:14 +0200

> Also, for each patch, could you add a word stating what the upstream
> status is, such as the URL of the upstream commit or discussion, 
> when it
> exists?

The patches related to actual bugs (fortrantests, fix-szip) were 
reported to the maintainer (The library is maintained for there's no 
public bugtracker, but a contact address in the documentation), and 
might be included in a future release.

I didn't submit patches related to the shared build and removal of 
bundled GCTP, as I didn't think they would be interested to take up 
such “big” changes.

best,

Thomas

[-- Attachment #2: 0001-gnu-Add-hdf-eos5.patch --]
[-- Type: Text/X-Patch, Size: 15054 bytes --]

From 481d66b1178fdd539111ee54233c9dcc0376d986 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <thomas.danckaert@gmail.com>
Date: Fri, 17 Jun 2016 10:51:38 +0200
Subject: [PATCH] gnu: Add hdf-eos5.

* gnu/packages/maths.scm (hdf-eos5): New variable.
* gnu/packages/patches/hdf-eos5-build-shared.patch: New file.
* gnu/packages/patches/hdf-eos5-remove-gctp.patch: New file.
* gnu/packages/patches/hdf-eos5-fix-szip.patch: New file.
* gnu/packages/patches/hdf-eos5-fortrantests.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patches.
---
 gnu/local.mk                                     |   4 +
 gnu/packages/maths.scm                           |  37 ++++++
 gnu/packages/patches/hdf-eos5-build-shared.patch |  31 +++++
 gnu/packages/patches/hdf-eos5-fix-szip.patch     |  30 +++++
 gnu/packages/patches/hdf-eos5-fortrantests.patch | 156 +++++++++++++++++++++++
 gnu/packages/patches/hdf-eos5-remove-gctp.patch  |  55 ++++++++
 6 files changed, 313 insertions(+)
 create mode 100644 gnu/packages/patches/hdf-eos5-build-shared.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-fix-szip.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-fortrantests.patch
 create mode 100644 gnu/packages/patches/hdf-eos5-remove-gctp.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index b864ea9..d5baf3b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -568,6 +568,10 @@ dist_patch_DATA =						\
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
   %D%/packages/patches/hdf5-config-date.patch			\
+  %D%/packages/patches/hdf-eos5-build-shared.patch 		\
+  %D%/packages/patches/hdf-eos5-remove-gctp.patch		\
+  %D%/packages/patches/hdf-eos5-fix-szip.patch			\
+  %D%/packages/patches/hdf-eos5-fortrantests.patch		\
   %D%/packages/patches/higan-remove-march-native-flag.patch	\
   %D%/packages/patches/hop-bigloo-4.0b.patch			\
   %D%/packages/patches/hop-linker-flags.patch			\
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0401cd3..ba107cf 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -14,6 +14,7 @@
 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
 ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -483,6 +484,42 @@ extremely large and complex data collections.")
     (license (license:x11-style
               "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
 
+(define-public hdf-eos5
+  (package
+    (name "hdf-eos5")
+    (version "1.15")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "ftp://edhs1.gsfc.nasa.gov\
+/edhs/hdfeos5/latest_release/HDF-EOS5." version ".tar.Z"))
+              (sha256
+               (base32
+                "1p83333nzzy8rn5chxlm0hrkjjnhh2w1ji8ac0f9q4xzg838i58i"))
+              (patches (search-patches "hdf-eos5-build-shared.patch"
+                                       "hdf-eos5-remove-gctp.patch"
+                                       "hdf-eos5-fix-szip.patch"
+                                       "hdf-eos5-fortrantests.patch"))))
+    (native-inputs
+     `(("gfortran" ,gfortran)))
+    (build-system gnu-build-system)
+    (inputs
+     `(("hdf5" ,hdf5)
+       ("zlib" ,zlib)
+       ("gctp" ,gctp)))
+    (arguments
+     `(#:configure-flags '("--enable-install-include" "--enable-shared"
+                           "CC=h5cc -Df2cFortran" "LIBS=-lgctp")
+       #:parallel-tests? #f))
+    (synopsis
+     "HDF5-based data format for NASA's Earth Observing System")
+    (description
+     "HDF-EOS5 is a software library built on HDF5 to support the construction
+of data structures used in NASA's Earth Observing System (Grid, Point and
+Swath).")
+    (home-page "http://www.hdfeos.org/software/library.php#HDF-EOS5")
+    (license (license:bsd-style
+              "http://www.hdfeos.org/software/library.php#HDF-EOS5"))))
+
 (define-public hdf5-parallel-openmpi
   (package (inherit hdf5)
     (name "hdf5-parallel-openmpi")
diff --git a/gnu/packages/patches/hdf-eos5-build-shared.patch b/gnu/packages/patches/hdf-eos5-build-shared.patch
new file mode 100644
index 0000000..f4ae5c7
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-build-shared.patch
@@ -0,0 +1,31 @@
+Make shared library linking work.
+---
+ src/Makefile.in | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/src/Makefile.in b/src/Makefile.in
+index 86880e5..24efffe 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -72,7 +72,7 @@ LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) $(DEFS) \
+ 	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ 	$(AM_CFLAGS) $(CFLAGS) -DH5_USE_16_API
+ CCLD = $(CC)
+-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
++LINK = HDF5_USE_SHLIB=yes $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+ SOURCES = $(libhe5_hdfeos_la_SOURCES)
+ DIST_SOURCES = $(libhe5_hdfeos_la_SOURCES)
+@@ -124,9 +124,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+ INSTALL_SCRIPT = @INSTALL_SCRIPT@
+ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+ 
+-# Set LDFLAGS to allow the HDF-EOS library to use extern variables from
+-# HDF5
+-LDFLAGS = -Wl,-single_module
+ LIBOBJS = @LIBOBJS@
+ LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+-- 
+2.10.0
+
diff --git a/gnu/packages/patches/hdf-eos5-fix-szip.patch b/gnu/packages/patches/hdf-eos5-fix-szip.patch
new file mode 100644
index 0000000..799f542
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-fix-szip.patch
@@ -0,0 +1,30 @@
+Ill-placed #endif causes missing symbol errors when compiling without
+szip.  Reported to upstream maintainer.
+---
+ src/EHapi.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/EHapi.c b/src/EHapi.c
+index 46a9b5c..208f447 100755
+--- a/src/EHapi.c
++++ b/src/EHapi.c
+@@ -11379,6 +11379,7 @@ int HE5_szip_can_encode(void )
+   return(-1);
+ }
+ 
++#endif /* H5_HAVE_FILTER_SZIP */
+ 
+ 
+ /*----------------------------------------------------------------------------|
+@@ -11509,8 +11510,6 @@ HE5_EHHEisHE5(char *filename)
+     }
+ }
+ 
+-#endif /* H5_HAVE_FILTER_SZIP */
+-
+ 
+ #ifndef __cplusplus
+ 
+-- 
+2.10.0
+
diff --git a/gnu/packages/patches/hdf-eos5-fortrantests.patch b/gnu/packages/patches/hdf-eos5-fortrantests.patch
new file mode 100644
index 0000000..3a9b89b
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-fortrantests.patch
@@ -0,0 +1,156 @@
+Fix fortran line length/indentation issues in Fortran test programs.
+Reported to upstream maintainer.
+
+diff --git a/samples/he5_gd_writedataF_32.f b/samples/he5_gd_writedataF_32.f
+index 515edf9..9c86299 100755
+--- a/samples/he5_gd_writedataF_32.f
++++ b/samples/he5_gd_writedataF_32.f
+@@ -77,26 +77,26 @@ c           ------------------------------
+ 
+ 		attr4 = "ABCDEFGH"
+ 		count(1) = 8
+-		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_gdwrattr():  ',status
+ 
+ 		attr4 = "111"
+ 		count(1) = 3
+-		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_gdwrgattr():  ',status
+ 
+ 		attr4 = "222222"
+ 		count(1) = 6
+-		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+ 
+ 		attr5 = "abcdefgh111111111111"
+ 		count(1) = 20
+-		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
+-	1	HE5T_NATIVE_CHAR,count,attr5)
++		status = he5_gdwrlattr(gdid,"Vegetation"
++     &               ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count,attr5)
+ 	write(*,*) 'Status returned by he5_gdwrlattr():  ',status
+ 
+ 		 endif
+diff --git a/samples/he5_gd_writedataF_64.f b/samples/he5_gd_writedataF_64.f
+index eff04f5..62a7398 100755
+--- a/samples/he5_gd_writedataF_64.f
++++ b/samples/he5_gd_writedataF_64.f
+@@ -77,26 +77,26 @@ c           ------------------------------
+ 
+ 		attr4 = "ABCDEFGH"
+ 		count(1) = 8
+-		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_gdwrattr(gdid,"GLOBAL_CHAR_ATTR"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_gdwrattr():  ',status
+ 
+ 		attr4 = "111"
+ 		count(1) = 3
+-		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_gdwrgattr(gdid,"GLOBAL_CHAR_ATTR_1"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_gdwrgattr():  ',status
+ 
+ 		attr4 = "222222"
+ 		count(1) = 6
+-		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++		status = he5_ehwrglatt(gdfid,"GLOBAL_CHAR_ATTR_2"
++     &               ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+ 
+ 		attr5 = "abcdefgh111111111111"
+ 		count(1) = 20
+-		status = he5_gdwrlattr(gdid,"Vegetation","LocalAttribute_0",
+-	1	HE5T_NATIVE_CHAR,count,attr5)
++		status = he5_gdwrlattr(gdid,"Vegetation"
++     &               ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count,attr5)
+ 	write(*,*) 'Status returned by he5_gdwrlattr():  ',status
+ 
+ 		 endif
+diff --git a/samples/he5_sw_writedataF_32.f b/samples/he5_sw_writedataF_32.f
+index 7abab9b..fedd49a 100755
+--- a/samples/he5_sw_writedataF_32.f
++++ b/samples/he5_sw_writedataF_32.f
+@@ -173,20 +173,21 @@ c     Write Global Attribute
+ c     ----------------------
+ 			attr4 = "ABCDEFGH"
+ 			count(1) = 8
+-			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR"
++     &                       ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_swwrattr():  ',status
+ 
+ 			attr4 = "111"
+ 			count(1) = 3
+-			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1"
++     &                       ,HE5T_NATIVE_CHAR,count,attr4)
+ 	write(*,*) 'Status returned by he5_swwrgattr():  ',status
+ 
+ 			attr4 = "222222"
+ 			count(1) = 6
+-			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_ehwrglatt(swfid
++     &                       ,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR
++     &                       ,count,attr4)
+ 	write(*,*) 'Status returned by he5_ehwrglatt():  ',status
+ 
+ c     Write Local Attribute
+diff --git a/samples/he5_sw_writedataF_64.f b/samples/he5_sw_writedataF_64.f
+index 79e34bd..e5d74cb 100755
+--- a/samples/he5_sw_writedataF_64.f
++++ b/samples/he5_sw_writedataF_64.f
+@@ -162,25 +162,27 @@ c     Write Global Attribute
+ c     ----------------------
+ 			attr4 = "ABCDEFGH"
+ 			count(1) = 8
+-			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_swwrattr(swid,"GLOBAL_CHAR_ATTR"
++     &                       ,HE5T_NATIVE_CHAR,count,attr4)
+ 
+ 			attr4 = "111"
+ 			count(1) = 3		
+-			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_swwrgattr(swid,"GLOBAL_CHAR_ATTR_1"
++     &                       ,HE5T_NATIVE_CHAR,count,attr4)
+ 
+ 			attr4 = "222222"
+ 			count(1) = 6
+-			status = he5_ehwrglatt(swfid,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR,
+-	1	count,attr4)
++			status = he5_ehwrglatt(swfid
++     &                       ,"GLOBAL_CHAR_ATTR_2",HE5T_NATIVE_CHAR
++     &                       ,count,attr4)
+ 
+ c     Write Local Attribute
+ c     ---------------------
+ 			attr5 = "abababababababababab"
+ 			count(1) = 20
+-			status = he5_swwrlattr(swid,"Density","LocalAttribute_0",
+-	1	HE5T_NATIVE_CHAR,count,attr5)
++			status = he5_swwrlattr(swid,"Density"
++     &                       ,"LocalAttribute_0",HE5T_NATIVE_CHAR,count
++     &                       ,attr5)
+ 
+ 	      
+ 		 endif
+-- 
+2.10.0
+
diff --git a/gnu/packages/patches/hdf-eos5-remove-gctp.patch b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
new file mode 100644
index 0000000..3b78357
--- /dev/null
+++ b/gnu/packages/patches/hdf-eos5-remove-gctp.patch
@@ -0,0 +1,55 @@
+Don't build/install/use bundled gctp code/headers.
+
+* cproj.h, proj.h: part of GCTP, therefore already present.
+* HE5_config.h, tutils.h: used for library building and testing.
+
+diff --git a/Makefile.in b/Makefile.in
+index f160d0d..367b537 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -206,7 +206,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+ @TESTDRIVERS_CONDITIONAL_TRUE@TESTDRIVERS = testdrivers
+ @INSTALL_INCLUDE_CONDITIONAL_FALSE@INCLUDE = 
+ @INSTALL_INCLUDE_CONDITIONAL_TRUE@INCLUDE = include
+-SUBDIRS = gctp src $(INCLUDE) samples $(TESTDRIVERS)
++SUBDIRS = src $(INCLUDE) samples $(TESTDRIVERS)
+ all: all-recursive
+ 
+ .SUFFIXES:
+diff --git a/samples/Makefile.in b/samples/Makefile.in
+index 59331dd..64fda89 100644
+--- a/samples/Makefile.in
++++ b/samples/Makefile.in
+@@ -206,7 +206,6 @@ he5_gd_datainfo_SOURCES = he5_gd_datainfo.c
+ he5_gd_datainfo_OBJECTS = he5_gd_datainfo.$(OBJEXT)
+ he5_gd_datainfo_LDADD = $(LDADD)
+ am__DEPENDENCIES_1 = $(top_builddir)/src/libhe5_hdfeos.la
+-am__DEPENDENCIES_2 = $(top_builddir)/gctp/src/libGctp.la
+ he5_gd_datainfo_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ 	$(am__DEPENDENCIES_2)
+ he5_gd_defexternalfld_SOURCES = he5_gd_defexternalfld.c
+@@ -1093,7 +1092,7 @@ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+ LIBHDFEOS5 = $(top_builddir)/src/libhe5_hdfeos.la
+-LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
++LIBGCTP =
+ 
+ # Boilerplate definitions file
+ 
+diff --git a/include/Makefile.in b/include/Makefile.in
+index a572128..64dabb5 100644
+--- a/include/Makefile.in
++++ b/include/Makefile.in
+@@ -190,8 +190,7 @@ LIBGCTP = $(top_builddir)/gctp/src/libGctp.la
+ # Boilerplate include
+ 
+ # Headers to install
+-include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h HE5_config.h cproj.h ease.h \
+-                  isin.h proj.h tutils.h cfortHdf.h
++include_HEADERS = HE5_GctpFunc.h HE5_HdfEosDef.h ease.h isin.h cfortHdf.h
+ 
+ all: HE5_config.h
+ 	$(MAKE) $(AM_MAKEFLAGS) all-am
+-- 
+2.10.0
-- 
2.10.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: Add hdf-eos5.
  2016-10-04 20:15   ` Thomas Danckaert
@ 2016-10-06 16:17     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2016-10-06 16:17 UTC (permalink / raw)
  To: Thomas Danckaert; +Cc: guix-devel

Hi Thomas,

Thomas Danckaert <post@thomasdanckaert.be> skribis:

> you were right, there was a lot of room to simplify.  This patch
> modifies autotools' generated files, so there's no need for autoreconf
> anymore.
>
> In the meantime, I discovered that the library can also build a
> Fortran wrapper.  I enabled this wrapper, but some of the Fortran
> tests contain some bugs (multi-line string formatting errors).  Fixing
> those tests requires a rather long (but simple) patch.  Alternatively,
> disabling the tests (or the Fortran wrapper) would shorten the patch.

Cool.

> From: ludo@gnu.org (Ludovic Courtès)
> Subject: Re: [PATCH] gnu: Add hdf-eos5.
> Date: Mon, 03 Oct 2016 17:59:14 +0200
>
>> Also, for each patch, could you add a word stating what the upstream
>> status is, such as the URL of the upstream commit or discussion,
>> when it
>> exists?
>
> The patches related to actual bugs (fortrantests, fix-szip) were
> reported to the maintainer (The library is maintained for there's no
> public bugtracker, but a contact address in the documentation), and
> might be included in a future release.
>
> I didn't submit patches related to the shared build and removal of
> bundled GCTP, as I didn't think they would be interested to take up
> such “big” changes.

Makes sense.

> From 481d66b1178fdd539111ee54233c9dcc0376d986 Mon Sep 17 00:00:00 2001
> From: Thomas Danckaert <thomas.danckaert@gmail.com>
> Date: Fri, 17 Jun 2016 10:51:38 +0200
> Subject: [PATCH] gnu: Add hdf-eos5.
>
> * gnu/packages/maths.scm (hdf-eos5): New variable.
> * gnu/packages/patches/hdf-eos5-build-shared.patch: New file.
> * gnu/packages/patches/hdf-eos5-remove-gctp.patch: New file.
> * gnu/packages/patches/hdf-eos5-fix-szip.patch: New file.
> * gnu/packages/patches/hdf-eos5-fortrantests.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add patches.

Applied.  I modified the ‘license’ field and added a comment after
checking what’s going on: their web page doesn’t say much, but all the
source files carry a lax license notice like this:

  ----------------------------------------------------------------------------
  |    Copyright (c) 1999  Emergent IT Inc.  and Raytheon Systems Company    |
  |                                                                          |
  |  Permission to use, modify, and distribute this software and its         |
  |  documentation for any purpose without fee is hereby granted, provided   |
  |  that the above copyright notice appear in all copies and that both that |
  |  copyright notice and this permission notice appear in supporting        |
  |                          documentation.                                  |
  ----------------------------------------------------------------------------

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-06 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27 20:28 [PATCH] gnu: Add hdf-eos5 Thomas Danckaert
2016-10-03 15:59 ` Ludovic Courtès
2016-10-04 20:15   ` Thomas Danckaert
2016-10-06 16:17     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).