[PATCH 2/7] gnu: Add niftilib.

  • Done
  • quality assurance status badge
Details
4 participants
  • John Darrington
  • John Darrington
  • Kei Kebreau
  • Ricardo Wurmus
Owner
unassigned
Submitted by
John Darrington
Severity
normal

Debbugs page

John Darrington wrote 8 years ago
(address . guix-patches@gnu.org)(name . John Darrington)(address . jmd@gnu.org)
1489608324-23632-2-git-send-email-jmd@gnu.org
* gnu/packages/image.scm (niftilib): New variable.
---
gnu/packages/image.scm | 58 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)

Toggle diff (75 lines)
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 53ed69a..82ea89c 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -6,7 +6,7 @@
;;; Copyright © 2014, 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
-;;; Copyright © 2014 John Darrington <jmd@gnu.org>
+;;; Copyright © 2014, 2017 John Darrington <jmd@gnu.org>
;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
@@ -1114,3 +1114,59 @@ interface. It supports color space extensions that allow it to compress from
and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).")
(license (list license:bsd-3 ; jsimd*.[ch] and most of simd/
license:ijg)))) ; the rest
+
+(define-public niftilib
+ (package
+ (name "niftilib")
+ (version "2.0.0")
+ (source (origin
+ (method url-fetch)
+ (uri (list (string-append "mirror://sourceforge/niftilib/"
+ "nifticlib/nifticlib_2_0_0/"
+ "/nifticlib-" version ".tar.gz")))
+ (sha256
+ (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:tests? #f
+ #:parallel-build? #f
+ #:phases
+ (modify-phases %standard-phases
+ (replace 'install
+ (lambda _
+ (for-each
+ (lambda (dir)
+ (let ((directory (assoc-ref %outputs "out")))
+ (mkdir-p (string-append directory "/" dir))
+ (zero? (system* "cp" "-a" dir directory))))
+ '("bin" "lib" "include"))))
+ (replace 'configure
+ (lambda _
+ (substitute* "Makefile"
+ (("^SHELL[ \t]*=[ \t]*csh")
+ (string-append "SHELL = "
+ (assoc-ref %build-inputs "bash")
+ "/bin/sh"))
+
+ (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)")
+ "CFLAGS = $(ANSI_FLAGS) -fPIC")
+
+ (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include")
+ (string-append "ZLIB_INC = -I"
+ (assoc-ref %build-inputs "zlib")
+ "/include"))
+
+ (("^CP[ \t]*=[ \t]*cp")
+ (string-append "CP = "
+ (assoc-ref %build-inputs "coreutils")
+ "/bin/cp")))
+ #t)))))
+ (inputs
+ `(("zlib" ,zlib)))
+ (synopsis "Library for reading and writing files in the nifti-1 format")
+ (description "Niftilib is a set of i/o libraries for reading and writing
+files in the nifti-1 data format - a binary file format for storing
+medical image data, e.g. magnetic resonance image (MRI) and functional MRI
+(fMRI) brain images.")
+ (home-page "http://niftilib.sourceforge.net")
+ (license license:public-domain)))
--
2.1.4
Kei Kebreau wrote 8 years ago
(name . John Darrington)(address . jmd@gnu.org)(address . 26112@debbugs.gnu.org)
874lyr7j3c.fsf@openmailbox.org
John Darrington <jmd@gnu.org> writes:

Toggle quote (32 lines)
> * gnu/packages/image.scm (niftilib): New variable.
> ---
> gnu/packages/image.scm | 58 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 57 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
> index 53ed69a..82ea89c 100644
> --- a/gnu/packages/image.scm
> +++ b/gnu/packages/image.scm
> @@ -6,7 +6,7 @@
> ;;; Copyright © 2014, 2016 Ricardo Wurmus <rekado@elephly.net>
> ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
> ;;; Copyright © 2015 Amirouche Boubekki <amirouche@hypermove.net>
> -;;; Copyright © 2014 John Darrington <jmd@gnu.org>
> +;;; Copyright © 2014, 2017 John Darrington <jmd@gnu.org>
> ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
> ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
> ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
> @@ -1114,3 +1114,59 @@ interface. It supports color space extensions that allow it to compress from
> and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).")
> (license (list license:bsd-3 ; jsimd*.[ch] and most of simd/
> license:ijg)))) ; the rest
> +
> +(define-public niftilib
> + (package
> + (name "niftilib")
> + (version "2.0.0")
> + (source (origin
> + (method url-fetch)
> + (uri (list (string-append "mirror://sourceforge/niftilib/"
> + "nifticlib/nifticlib_2_0_0/"

Instead of 2_0_0, you could use the trusty

(string-join (string-split version #\.) "_")

trick. It's less error-prone when updates come around.

Toggle quote (43 lines)
> + "/nifticlib-" version ".tar.gz")))
> + (sha256
> + (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
> + (build-system gnu-build-system)
> + (arguments
> + '(#:tests? #f
> + #:parallel-build? #f
> + #:phases
> + (modify-phases %standard-phases
> + (replace 'install
> + (lambda _
> + (for-each
> + (lambda (dir)
> + (let ((directory (assoc-ref %outputs "out")))
> + (mkdir-p (string-append directory "/" dir))
> + (zero? (system* "cp" "-a" dir directory))))
> + '("bin" "lib" "include"))))
> + (replace 'configure
> + (lambda _
> + (substitute* "Makefile"
> + (("^SHELL[ \t]*=[ \t]*csh")
> + (string-append "SHELL = "
> + (assoc-ref %build-inputs "bash")
> + "/bin/sh"))
> +
> + (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)")
> + "CFLAGS = $(ANSI_FLAGS) -fPIC")
> +
> + (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include")
> + (string-append "ZLIB_INC = -I"
> + (assoc-ref %build-inputs "zlib")
> + "/include"))
> +
> + (("^CP[ \t]*=[ \t]*cp")
> + (string-append "CP = "
> + (assoc-ref %build-inputs "coreutils")
> + "/bin/cp")))
> + #t)))))
> + (inputs
> + `(("zlib" ,zlib)))
> + (synopsis "Library for reading and writing files in the nifti-1 format")
> + (description "Niftilib is a set of i/o libraries for reading and writing

Why is there a triple space between "description" and the double quote?
Am I correct in assuming that it's accidental?

Toggle quote (6 lines)
> +files in the nifti-1 data format - a binary file format for storing
> +medical image data, e.g. magnetic resonance image (MRI) and functional MRI
> +(fMRI) brain images.")
> + (home-page "http://niftilib.sourceforge.net")
> + (license license:public-domain)))

Other than that, LGTM.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAljMRJcACgkQ5qXuPBlG
eg3PyhAAwZLVAVTXLD7zQw32F2lUGIIYLJmXKQSk2Woc3x+QTdS/ANydAUuhRGhw
OtiOEioeSsUxT7e1qKkzVDUNEn7Lh0z2L4N/WRvixQ8SB2p30HSeb0RYgtQxGpuw
8AOS8RAulSZT2TmFwBfvXMjvWDSj12EoGam6paGZ3Hqx2mmqO1dgSQI+GPJBcD+K
W7/Rog08pTbiV6f+HAQNc9IA5F/uKVGEPNujet8yQRzZF4dOenkvDeN2bm6AclXe
8H4onmZbdkp6jYMUfX18y3kbHq/H2tTbbDH33I8e1RFhXGJg8pvZGMgVdrR5XLmK
xcruybAf+GDkCERVTK3GzvVbLCiFtKOwLP5nVTCxFAHCQOvTTeQkQtbKf9oju2VO
hz4yzisaNaj3sBOlCoU/xsfChAJB4lYjFw8xQx0Uu9HEWBeQYQkwpYlSXUUwQw13
5J9Mng40Uq05LZJ4eVPnyHsRRw4NJ4hqAoicdsL3MxXu7fgGnYnEA5JIdZSvKyMb
tz4D4eKyNYhc5lQsabja2F1N9mXr/ocGpnQ4uMOeZ6A5aI8K4FZmWe4WzDMxpBnV
Uftr5nYLXNDxgiqGwZ9kRHN1ynsdmiqvQnswC+Yo4jIi55dCoWajOR1x7yz6ukjo
Ml4SRVHgksyeUyea8RcbFhsvxuVcxZ8A9XduKji+jWUdJlVvWwA=
=DrNG
-----END PGP SIGNATURE-----

John Darrington wrote 8 years ago
Done
(address . 26112-done@debbugs.gnu.org)
201703181435.v2IEZdHY017331@jocasta.intra
I pushed this. Thanks.
Closed
Ricardo Wurmus wrote 8 years ago
Re: bug#26112: [PATCH 2/7] gnu: Add niftilib.
(name . John Darrington)(address . jmd@gnu.org)(address . 26112@debbugs.gnu.org)
8760j5wgvc.fsf@elephly.net
Hi John,

thanks for the contribution.

Toggle quote (2 lines)
> * gnu/packages/image.scm (niftilib): New variable.

I realize this has been pushed already, but here are some comments for
the future.

Toggle quote (17 lines)
> +
> +(define-public niftilib
> + (package
> + (name "niftilib")
> + (version "2.0.0")
> + (source (origin
> + (method url-fetch)
> + (uri (list (string-append "mirror://sourceforge/niftilib/"
> + "nifticlib/nifticlib_2_0_0/"
> + "/nifticlib-" version ".tar.gz")))
> + (sha256
> + (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
> + (build-system gnu-build-system)
> + (arguments
> + '(#:tests? #f
> + #:parallel-build? #f

Please add simple comments explaining why this is required.

Toggle quote (11 lines)
> + #:phases
> + (modify-phases %standard-phases
> + (replace 'install
> + (lambda _
> + (for-each
> + (lambda (dir)
> + (let ((directory (assoc-ref %outputs "out")))
> + (mkdir-p (string-append directory "/" dir))
> + (zero? (system* "cp" "-a" dir directory))))
> + '("bin" "lib" "include"))))

Instead of starting a shell process to copy things please use
“copy-recursively” or “install-file” instead. It’s also better style to
pull the let binding out of the lambda.

Finally, please end the phase on “#t”.

Toggle quote (22 lines)
> + (replace 'configure
> + (lambda _
> + (substitute* "Makefile"
> + (("^SHELL[ \t]*=[ \t]*csh")
> + (string-append "SHELL = "
> + (assoc-ref %build-inputs "bash")
> + "/bin/sh"))
> +
> + (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)")
> + "CFLAGS = $(ANSI_FLAGS) -fPIC")
> +
> + (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include")
> + (string-append "ZLIB_INC = -I"
> + (assoc-ref %build-inputs "zlib")
> + "/include"))
> +
> + (("^CP[ \t]*=[ \t]*cp")
> + (string-append "CP = "
> + (assoc-ref %build-inputs "coreutils")
> + "/bin/cp")))
> + #t)))))

It is preferrable to use #:make-flags instead of patching the Makefile.
When referencing inputs, please use “lambda* (#:key inputs
#:allow-other-keys)” instead of “lambda _” and “%build-inputs”.

It would also be good to check the indentation, which can be done with
“etc/indent-code.el”.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
John Darrington wrote 8 years ago
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 26112@debbugs.gnu.org)(name . John Darrington)(address . jmd@gnu.org)
20170319133317.GA4118@jocasta.intra
Thanks for the heads up.

I'm not sure that all your suggestions will work, but I will try what you suggest
and push follow-up commit.

Regarding indentation - I normally let emacs handle it. Shouldn't that get everything
correct?

J'


On Sun, Mar 19, 2017 at 02:11:51PM +0100, Ricardo Wurmus wrote:
Hi John,
thanks for the contribution.
> * gnu/packages/image.scm (niftilib): New variable.
I realize this has been pushed already, but here are some comments for
the future.
> +
> +(define-public niftilib
> + (package
> + (name "niftilib")
> + (version "2.0.0")
> + (source (origin
> + (method url-fetch)
> + (uri (list (string-append "mirror://sourceforge/niftilib/"
> + "nifticlib/nifticlib_2_0_0/"
> + "/nifticlib-" version ".tar.gz")))
> + (sha256
> + (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
> + (build-system gnu-build-system)
> + (arguments
> + '(#:tests? #f
> + #:parallel-build? #f
Please add simple comments explaining why this is required.
> + #:phases
> + (modify-phases %standard-phases
> + (replace 'install
> + (lambda _
> + (for-each
> + (lambda (dir)
> + (let ((directory (assoc-ref %outputs "out")))
> + (mkdir-p (string-append directory "/" dir))
> + (zero? (system* "cp" "-a" dir directory))))
> + '("bin" "lib" "include"))))
Instead of starting a shell process to copy things please use
???copy-recursively??? or ???install-file??? instead. It???s also better style to
pull the let binding out of the lambda.
Finally, please end the phase on ???#t???.
> + (replace 'configure
> + (lambda _
> + (substitute* "Makefile"
> + (("^SHELL[ \t]*=[ \t]*csh")
> + (string-append "SHELL = "
> + (assoc-ref %build-inputs "bash")
> + "/bin/sh"))
> +
> + (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)")
> + "CFLAGS = $(ANSI_FLAGS) -fPIC")
> +
> + (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include")
> + (string-append "ZLIB_INC = -I"
> + (assoc-ref %build-inputs "zlib")
> + "/include"))
> +
> + (("^CP[ \t]*=[ \t]*cp")
> + (string-append "CP = "
> + (assoc-ref %build-inputs "coreutils")
> + "/bin/cp")))
> + #t)))))
It is preferrable to use #:make-flags instead of patching the Makefile.
When referencing inputs, please use ???lambda* (#:key inputs
#:allow-other-keys)??? instead of ???lambda _??? and ???%build-inputs???.
It would also be good to check the indentation, which can be done with
???etc/indent-code.el???.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC

--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.netor any PGP keyserver for public key.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAljOiJ0ACgkQimdxnC3oJ7M6FwCeMLCoo/KuKoEdhwJhW1L/CZuY
lmgAn12MowHxFIXOKbUJURyVdcU9JTp7
=Tefz
-----END PGP SIGNATURE-----


Ricardo Wurmus wrote 8 years ago
(name . John Darrington)(address . john@darrington.wattle.id.au)(address . 26112@debbugs.gnu.org)(name . John Darrington)(address . jmd@gnu.org)
874lypwehv.fsf@elephly.net
John Darrington <john@darrington.wattle.id.au> writes:

Toggle quote (3 lines)
> I'm not sure that all your suggestions will work, but I will try what you suggest
> and push follow-up commit.

I’ve already done that with commit
f729a4d8b274aebd578f45b2ca55cded31001b85. It builds fine for me.

Toggle quote (3 lines)
> Regarding indentation - I normally let emacs handle it. Shouldn't that get everything
> correct?

We give a couple of hints to Emacs to indent our special forms
differently. This requires use of the “emacs-guix” package, if I’m not
mistaken.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
John Darrington wrote 8 years ago
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 26112@debbugs.gnu.org)(name . John Darrington)(address . john@darrington.wattle.id.au)(name . John Darrington)(address . jmd@gnu.org)
20170319144722.GA4892@jocasta.intra
On Sun, Mar 19, 2017 at 03:03:08PM +0100, Ricardo Wurmus wrote:
John Darrington <john@darrington.wattle.id.au> writes:
> I'm not sure that all your suggestions will work, but I will try what you suggest
> and push follow-up commit.
I???ve already done that with commit
f729a4d8b274aebd578f45b2ca55cded31001b85. It builds fine for me.

Hmm ok. I have a nasty feeling that this may have broken some of my yet-to-be-committed,
dependent packages. But if it has, we'll cross that bridge when we come to it. Thanks
for the fixup anyway.

> Regarding indentation - I normally let emacs handle it. Shouldn't that get everything
> correct?
We give a couple of hints to Emacs to indent our special forms
differently. This requires use of the ???emacs-guix??? package, if I???m not
mistaken.
Ok I will install that. Thanks for the hint.

J'

--
Avoid eavesdropping. Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.netor any PGP keyserver for public key.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAljOmfoACgkQimdxnC3oJ7PbYACfWQfqI88UjPTpsf6VlshEcM6u
kvkAniIMP2K5ry5O+KCsr8JyCI5hO+4j
=2N8B
-----END PGP SIGNATURE-----


?
Your comment

This issue is archived.

To comment on this conversation send an email to 26112@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 26112
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help