gnu: Add hdf4

Message ID alpine.DEB.2.20.1605251838550.16068@jpro.nerc-bas.ac.uk
State New
Headers

Commit Message

Jeremy Robst May 25, 2016, 5:42 p.m. UTC
  Hi,

On Tue, 24 May 2016, Eric Bavier wrote:

> Could we apply a variation of the hdf5-config-date.patch?

Ok, I've based a patch on this one, and removed the other unreproduciable 
output, so I've not got a reproduciable build.

> This description is noticeably more verbose than that of the hdf5 
> package. It seems like the first two sentences are not necessary here. 
> It would also be nice to summarize how hdf4 differs from hdf5.

I've shortened the description, and added a statement that hdf4 is not 
compatable with hdf5. It's difficult to add more details of the 
differences without becoming verbose again, but let me know if you think 
it needs to be tweaked again.

Jeremy
  

Comments

Leo Famulari May 27, 2016, 5:19 p.m. UTC | #1
On Wed, May 25, 2016 at 06:42:04PM +0100, Jeremy Robst wrote:
> Hi,
> 
> On Tue, 24 May 2016, Eric Bavier wrote:
> 
> > Could we apply a variation of the hdf5-config-date.patch?
> 
> Ok, I've based a patch on this one, and removed the other unreproduciable
> output, so I've not got a reproduciable build.
> 
> > This description is noticeably more verbose than that of the hdf5
> > package. It seems like the first two sentences are not necessary here.
> > It would also be nice to summarize how hdf4 differs from hdf5.
> 
> I've shortened the description, and added a statement that hdf4 is not
> compatable with hdf5. It's difficult to add more details of the differences
> without becoming verbose again, but let me know if you think it needs to be
> tweaked again.

That sounds perfect, but I still can't apply the patch with `git am`,
although I can't figure out why this is. It *looks* like it should
apply.

Are you able to apply it to the current master branch (b5d08d7c28)?
  
Ludovic Courtès May 28, 2016, 2:32 p.m. UTC | #2
Leo Famulari <leo@famulari.name> skribis:

> On Wed, May 25, 2016 at 06:42:04PM +0100, Jeremy Robst wrote:
>> Hi,
>> 
>> On Tue, 24 May 2016, Eric Bavier wrote:
>> 
>> > Could we apply a variation of the hdf5-config-date.patch?
>> 
>> Ok, I've based a patch on this one, and removed the other unreproduciable
>> output, so I've not got a reproduciable build.
>> 
>> > This description is noticeably more verbose than that of the hdf5
>> > package. It seems like the first two sentences are not necessary here.
>> > It would also be nice to summarize how hdf4 differs from hdf5.
>> 
>> I've shortened the description, and added a statement that hdf4 is not
>> compatable with hdf5. It's difficult to add more details of the differences
>> without becoming verbose again, but let me know if you think it needs to be
>> tweaked again.
>
> That sounds perfect, but I still can't apply the patch with `git am`,
> although I can't figure out why this is. It *looks* like it should
> apply.
>
> Are you able to apply it to the current master branch (b5d08d7c28)?

Same here.  Specifically, ‘git am’ returns:

--8<---------------cut here---------------start------------->8---
Applying: gnu: Add hdf4
.git/rebase-apply/patch:88: space before tab in indent.
 		   HDF4 Version: @H4_VERSION@
.git/rebase-apply/patch:89: space before tab in indent.
 		  Configured on: @CONFIG_DATE@
.git/rebase-apply/patch:92: space before tab in indent.
 		 Configure mode: @CONFIG_MODE@
.git/rebase-apply/patch:97: space before tab in indent.
 		      Libraries: @STATIC_SHARED@
.git/rebase-apply/patch:98: space before tab in indent.
 	     Installation point: @prefix@
fatal: corrupt patch at line 104
Patch failed at 0001 gnu: Add hdf4
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
--8<---------------cut here---------------end--------------->8---

… and then:

--8<---------------cut here---------------start------------->8---
$ patch -p1 < .git/rebase-apply/patch 
patching file gnu/packages/maths.scm
patching file gnu/packages/patches/hdf4-config-settings.patch
patch: **** malformed patch at line 104: @CFLAGS@
--8<---------------cut here---------------end--------------->8---

Jeremy: could you send it as an attachment, or using ‘git send-email’?

Thank you!

Ludo’.
  

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 19ed44f..ab4785b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -408,6 +408,47 @@  plotting engine by third-party applications like Octave.")
      (license (license:fsf-free
                "http://gnuplot.cvs.sourceforge.net/gnuplot/gnuplot/Copyright"))))

+(define-public hdf4
+  (package
+    (name "hdf4")
+    (version "4.2.11")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "http://www.hdfgroup.org/ftp/HDF/releases/HDF" version
+             "/src/hdf-" version ".tar.bz2"))
+       (sha256
+        (base32
+         "16yr50j845zlfx20skmw3y75ww77akk9gg0affjqkg66ih5r03mv"))
+       (patches (list (search-patch "hdf4-config-settings.patch")))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gfortran" ,gfortran)
+       ("bison" ,bison)
+       ("flex" ,flex)))
+    (inputs
+     `(("zlib" ,zlib)
+       ("libjpeg" ,libjpeg)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'patch-configure
+          (lambda _
+            (substitute*
+                '("mfhdf/hdfimport/testutil.sh.in" "hdf/util/testutil.sh.in")
+              (("/bin/rm") "rm")
+              (("/bin/mkdir") "mkdir"))
+            #t)))))
+    (home-page "https://www.hdfgroup.org/products/hdf4/")
+    (synopsis
+     "Library and multi-object file format for storing and managing data")
+    (description "HDF4 is a library and multi-object file format for storing
+and managing data between machines.  HDF4 is an older hiearchical data format,
+incompatible with HDF5.")
+    (license (license:non-copyleft
+              "https://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/COPYING"))))
+
  (define-public hdf5
    (package
      (name "hdf5")
diff --git a/gnu/packages/patches/hdf4-config-settings.patch b/gnu/packages/patches/hdf4-config-settings.patch
new file mode 100644
index 0000000..e79362e
--- /dev/null
+++ b/gnu/packages/patches/hdf4-config-settings.patch
@@ -0,0 +1,55 @@ 
+Honor SOURCE_DATE_EPOCH when exporting configuraton date.
+Remove unreproducible configuration data.
+
+--- a/configure
++++ b/configure
+@@ -23169,7 +23169,14 @@
+ 
+ 
+ ## Configuration date
+- CONFIG_DATE="`date`"
++ CONFIG_DATE="`date -u`"
++if test -n "$SOURCE_DATE_EPOCH"; then
++  CONFIG_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null \
++               || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null`
++  if test -z "$CONFIG_DATE"; then
++    as_fn_error $? "malformed SOURCE_DATE_EPOCH" "$LINENO" 5
++  fi
++fi
+ 
+ ## User doing the configuration
+  CONFIG_USER="`whoami`@`hostname`"
+
+--- a/libhdf4.settings.in
++++ b/libhdf4.settings.in
+@@ -5,17 +5,17 @@
+ -------------------
+ 		   HDF4 Version: @H4_VERSION@
+ 		  Configured on: @CONFIG_DATE@
+-		  Configured by: @CONFIG_USER@
++		  Configured by: guix
+ 		 Configure mode: @CONFIG_MODE@
+-		    Host system: @host_cpu@-@host_vendor@-@host_os@
+-              Uname information: @UNAME_INFO@
++		    Host system: guix
++              Uname information: guix
+ 		      Libraries: @STATIC_SHARED@
+ 	     Installation point: @prefix@
+ 
+ Compiling Options:
+ ------------------
+                Compilation Mode: @CONFIG_MODE@
+-                     C compiler: @CC_VERSION@
++                     C compiler: 
+                          CFLAGS: @CFLAGS@
+                        CPPFLAGS: @CPPFLAGS@
+                Shared Libraries: @enable_shared@
+@@ -29,7 +29,7 @@
+ Languages:
+ ----------
+                         Fortran: @BUILD_FORTRAN@
+-@HDF_BUILD_FORTRAN_TRUE@               Fortran Compiler: @F77_VERSION@
++@HDF_BUILD_FORTRAN_TRUE@               Fortran Compiler: 
+ @HDF_BUILD_FORTRAN_TRUE@                         FFLAGS: @FFLAGS@
+ 
+ Features: