+(define-public r-rhdf5lib
+ (package
+ (name "r-rhdf5lib")
+ (version "1.10.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (bioconductor-uri "Rhdf5lib" version))
+ (sha256
+ (base32
+ "0f45sqrvzj6x4mckalyp8366hm8v0rrmzklx3xd4gs6l2wallcn9"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Delete bundled binaries
+ (delete-file-recursively "src/wininclude/")
+ (delete-file-recursively "src/winlib-4.9.3/")
+ (delete-file-recursively "src/winlib-8.3.0/")
+ (delete-file "src/hdf5small_cxx_hl_1.10.6.tar.gz")
+ #t))))
+ (properties `((upstream-name . "Rhdf5lib")))
+ (build-system r-build-system)
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'do-not-use-bundled-hdf5
+ (lambda* (#:key inputs #:allow-other-keys)
+ (for-each delete-file '("configure" "configure.ac"))
+ ;; Do not make other packages link with the proprietary libsz.
+ (substitute* "R/zzz.R"
+ ((" \"%s/libsz.a\"") ""))
+ (with-directory-excursion "src"
+ (invoke "tar" "xvf" (assoc-ref inputs "hdf5-source"))
+ (rename-file (string-append "hdf5-" ,(package-version hdf5-1.10))
+ "hdf5")
+ ;; Remove timestamp and host system information to make
+ ;; the build reproducible.
+ (substitute* "hdf5/src/libhdf5.settings.in"
+ (("Configured on: @CONFIG_DATE@")
+ "Configured on: Guix")
+ (("Uname information:.*")
+ "Uname information: Linux\n")
+ ;; Remove unnecessary store reference.
+ (("C Compiler:.*")
+ "C Compiler: GCC\n"))
+ (rename-file "Makevars.in" "Makevars")
+ (substitute* "Makevars"
+ (("@ZLIB_LIB@") "-lz")
+ (("@ZLIB_INCLUDE@") "")
+ (("HDF5_CXX_LIB=.*")
+ (string-append "HDF5_CXX_LIB="
+ (assoc-ref inputs "hdf5") "/lib/libhdf5_cpp.a\n"))
+ (("HDF5_LIB=.*")
+ (string-append "HDF5_LIB="
+ (assoc-ref inputs "hdf5") "/lib/libhdf5.a\n"))
+ (("HDF5_CXX_INCLUDE=.*") "HDF5_CXX_INCLUDE=./hdf5/c++/src\n")
+ (("HDF5_INCLUDE=.*") "HDF5_INCLUDE=./hdf5/src\n")
+ (("HDF5_HL_INCLUDE=.*") "HDF5_HL_INCLUDE=./hdf5/hl/src\n")
+ (("HDF5_HL_CXX_INCLUDE=.*") "HDF5_HL_CXX_INCLUDE=./hdf5/hl/c++/src\n")
+ (("HDF5_HL_LIB=.*")
+ (string-append "HDF5_HL_LIB="
+ (assoc-ref inputs "hdf5") "/lib/libhdf5_hl.a\n"))
+ (("HDF5_HL_CXX_LIB=.*")
+ (string-append "HDF5_HL_CXX_LIB="
+ (assoc-ref inputs "hdf5") "/lib/libhdf5_hl_cpp.a\n"))
+ ;; szip is non-free software
+ (("cp \"\\$\\{SZIP_LIB\\}.*") "")
+ (("PKG_LIBS =.*") "PKG_LIBS = -lz -lhdf5\n")))
+ #t)))))
+ (inputs
+ `(("zlib" ,zlib)))
+ (propagated-inputs
+ `(("hdf5" ,hdf5-1.10)))
+ (native-inputs
+ `(("hdf5-source" ,(package-source hdf5-1.10))
+ ("r-knitr" ,r-knitr)))
+ (home-page "https://bioconductor.org/packages/Rhdf5lib")
+ (synopsis "HDF5 library as an R package")
+ (description "This package provides C and C++ HDF5 libraries for use in R
+packages.")
+ (license license:artistic2.0)))
+