unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: Alex Vong <alexvong1995@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: Add Mlucas.
Date: Mon, 05 Oct 2015 19:42:05 +0300	[thread overview]
Message-ID: <87zizx5kte.fsf@gmail.com> (raw)
In-Reply-To: <20151005130123.2091f6e4@debian> (Alex Vong's message of "Mon, 5 Oct 2015 13:01:23 +0800")

Hello and thank you for contributing.  This is a tremendous patch for
the first attempt!

As Mathieu noted, if this auxiliary code for adding 'flags' is needed,
it should be separated from the package commit and it shouldn't be
placed in the package module.

You will probably receive useful comments on the matter of the patch, I
just have some general notes on the scheme code.

Please remove TABs: we use spaces instead of tabulation.

Typos:

[...]
> +;;; Procedures to manupulate build flags, similar to dpkg-buildflags.
                     manipulate

> +;;;
> +;;; The data strcture flag-list is constrcuted by (flag-list <flag-sublist>...)
                structure             constructed

> +;;; The constructor flag-list does something to the argument,
> +;;; such as trimming whitespaces, to ensure no two arguments mean the same.
> +;;;
> +;;; The data structure flag-sublist is in fact an ordinary list
> +;;; with the following structure (<flag-type-symbol> <flag-string>...)
> +;;;
> +;;; Here is an example:
> +;;; (flag-list
> +;;;  '(CFLAGS "-O2" "-g")
> +;;;  '(LDFLAGS "-lm" "-lpthread"))
> +;;;
> +;;; flag-list+ and flag-list- are analogous to
> +;;; numberic + and - but operate on flag-list.
       numeric

> +;;; flag-list->string-list converts flag-list into
> +;;; configure-flags-compatible string-list.
> +;;;
> +
> +;;; selectors of flag-sublist
> +(define (flag-type flag-sublist)
> +  (car flag-sublist))
> +(define (flag-string-list flag-sublist)
> +  (cdr flag-sublist))

IMO it is clearer to write it like this:

  (define flag-type first)
  (define flag-string-list second)

Although I think it is better to use records for such things.  We also
have 'define-record-type*' in (guix records) module.

(also some people don't like car/cdr with passion)

> +;;; constructor of flag-list
> +(define (flag-list . flag-lst)
> +  ;; Trim leading and trailing whitespaces of all flag-string
> +  ;; in flag-list.
> +  (define (trim-flag-string flag-lst)
> +    (map (λ(flag-sublist)

We use 'lambda'.  I'm personally not against 'λ', but maybe others
wouldn't like it.  Anyway a common convention is to have a space before
"(", i.e.:

  (map (λ (flag-sublist) ...))

[...]
> +;;; implement the bootstrap-build-system using syntax-case macro
> +;;; bootstrap-build-system use a bootstrap script
> +;;; to run autoreconf and generate documentation.
> +(define-syntax package*

This is not how new build systems are implemented.  Look at
(guix build-system ...) modules.

Also I'm not sure if it is worth to make a new build system just for
adding 'autoreconf' phase.  If you grep package modules for "autoreconf"
or "autogen", you will see many examples how to add such a phase to a
gnu-build-system.

> +  (lambda(x)
> +    ;; add autoconf, automake and perl as build dependencies
> +    ;; Modify the gnu-build-system
> +    ;; by adding bootstrap phase before configure phase.
> +    (define (extend-fields s-exp)
> +      (cond ((eq? (car s-exp) 'inputs)
> +	     (list 'inputs
> +		   (list 'quasiquote
> +			 (append '(("autoconf" ,autoconf)
> +				   ("automake" ,automake)
> +				   ("perl" ,perl))
> +				 (cadadr s-exp)))))

And absolutely all people don't like 'cadadr'!!  Please use 'match' for
such things:
<https://www.gnu.org/software/guile/manual/html_node/Pattern-Matching.html>.

[...]
> +(define-public mlucas
> +  ;; descriptions of the package
> +  (let ((short-description
> +         "Program to perform Lucas-Lehmer test on a Mersenne number")
> +        (long-description
> +         "mlucas is an open-source (and free/libre) program
> +for performing Lucas-Lehmer test on prime-exponent Mersenne numbers,
> +that is, integers of the form 2 ^ p - 1, with prime exponent p.
> +In short, everything you need to search for world-record Mersenne primes!
> +It has been used in the verification of various Mersenne primes,
> +including the 45th, 46th and 48th found Mersenne prime.
> +
> +You may use it to test any suitable number as you wish,
> +but it is preferable that you do so in a coordinated fashion,
> +as part of the Great Internet Mersenne Prime Search (GIMPS).
> +For more information on GIMPS,
> +see <http://www.mersenne.org/prime.html> for details.
> +")

This is not necessary, just put these directly into 'synopsis' and
'description'.

-- 
Alex

  parent reply	other threads:[~2015-10-05 16:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05  5:01 [PATCH] gnu: Add Mlucas Alex Vong
2015-10-05 10:46 ` Mathieu Lirzin
2015-10-06  3:13   ` Alex Vong
2015-10-06 10:04     ` Ludovic Courtès
2015-10-06 13:58       ` Alex Vong
2015-10-06 19:31         ` Ludovic Courtès
2015-10-06 15:06     ` Mathieu Lirzin
2015-10-06 15:31       ` Alex Kost
2015-10-05 16:42 ` Alex Kost [this message]
2015-10-06 13:43   ` Alex Vong
2015-10-06 14:40     ` Alex Kost
2015-10-06 19:28       ` Ludovic Courtès

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=87zizx5kte.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=alexvong1995@gmail.com \
    --cc=guix-devel@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).