unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: John Darrington <jmd@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: 01/01: gnu: Add niftilib.
Date: Sun, 19 Mar 2017 16:42:54 -0400	[thread overview]
Message-ID: <87d1dd5775.fsf@netris.org> (raw)
In-Reply-To: <20170318142617.B58A320DF8@vcs0.savannah.gnu.org> (John Darrington's message of "Sat, 18 Mar 2017 10:26:17 -0400 (EDT)")

john@darrington.wattle.id.au (John Darrington) writes:

> jmd pushed a commit to branch master
> in repository guix.
>
> commit 21122bd79e7f9b0b5349ffffe2c146bace7205dc
> Author: John Darrington <jmd@gnu.org>
> Date:   Tue Mar 7 07:59:21 2017 +0100
>
>     gnu: Add niftilib.
>     
>     * gnu/packages/image.scm (niftilib): New variable.

Did you post this for review?  Please see below for comments.

> +(define-public niftilib
> +  (package
> +   (name "niftilib")
> +   (version "2.0.0")
> +   (source (origin
> +            (method url-fetch)
> +            (uri (list (string-append "mirror://sourceforge/niftilib/"
> +                                      "nifticlib/nifticlib_"
> +                                      (string-join (string-split version #\.) "_")
> +                                      "/nifticlib-" version ".tar.gz")))

Omit the superfluous 'list' call above.

> +            (sha256
> +             (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3"))))
> +   (build-system gnu-build-system)
> +   (arguments
> +    '(#:tests? #f
> +      #:parallel-build? #f
> +      #:phases
> +      (modify-phases %standard-phases
> +        (replace 'install

Is there a reason not to use the included "make install" target?  It
looks like it should work, if you pass appropriate settings for
INSTALL_{BIN,LIB,INC}_DIR in #:make-flags.

> +                 (lambda _
> +                   (for-each
> +                    (lambda (dir)
> +                      (let ((directory (assoc-ref %outputs "out")))

If you were going to keep the custom 'install' phase, then instead of
using %outputs, please accept the 'outputs' keyword argument and use
that.

> +                        (mkdir-p (string-append directory "/" dir))
> +                        (zero? (system* "cp" "-a" dir directory))))
> +                    '("bin" "lib" "include"))))

We have a 'copy-recursively' procedure that you could use here.  If you
were going to use "cp", then you should pay attention to its result code
so that failures are not silently ignored (by using 'every' instead of
'for-each').

> +        (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")))

Instead of patching the Makefile, it's preferable to simply pass these
settings in #:make-flags.  Also, within phase procedures, please accept
the 'inputs' and 'outputs' keyword arguments instead of using
%build-inputs and %outputs.  Finally, for purposes of Makefile settings,
SHELL can simply be set to "bash" or "sh", since it's in the PATH.  I'm
not sure why you changed the setting for CP.

      Mark

       reply	other threads:[~2017-03-19 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170318142616.19421.55332@vcs0.savannah.gnu.org>
     [not found] ` <20170318142617.B58A320DF8@vcs0.savannah.gnu.org>
2017-03-19 20:42   ` Mark H Weaver [this message]
2017-03-19 21:03     ` 01/01: gnu: Add niftilib Kei Kebreau
2017-03-20 10:56       ` Alex Kost
2017-03-20  5:57     ` John Darrington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d1dd5775.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guix-devel@gnu.org \
    --cc=jmd@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).