unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 2/2] gnu: Add Mlucas.
@ 2015-10-25  6:12 Alex Vong
  2015-10-26 11:34 ` Paul van der Walt
  2015-11-05 22:08 ` Ludovic Courtès
  0 siblings, 2 replies; 9+ messages in thread
From: Alex Vong @ 2015-10-25  6:12 UTC (permalink / raw)
  To: guix-devel

From 876bbbeafaa2dae8e584820645ca21efecf6ae7c Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Sun, 25 Oct 2015 00:18:29 +0800
Subject: [PATCH 2/2] gnu: Add Mlucas.

* gnu/packages/mlucas.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Register it.
---
 gnu-system.am           |  1 +
 gnu/packages/mlucas.scm | 92
  +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93
  insertions(+) create mode 100644 gnu/packages/mlucas.scm

diff --git a/gnu-system.am b/gnu-system.am
index 3e976e9..66265e5 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -215,6 +215,7 @@ GNU_SYSTEM_MODULES =
\ gnu/packages/mg.scm				\
   gnu/packages/miscfiles.scm			\
   gnu/packages/mit-krb5.scm			\
+  gnu/packages/mlucas.scm			\
   gnu/packages/moe.scm				\
   gnu/packages/moreutils.scm			\
   gnu/packages/mpd.scm				\
diff --git a/gnu/packages/mlucas.scm b/gnu/packages/mlucas.scm
new file mode 100644
index 0000000..17eeb8a
--- /dev/null
+++ b/gnu/packages/mlucas.scm
@@ -0,0 +1,92 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Alex Vong <alexvong1995@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or
(at +;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages mlucas)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build build-flags)
+  #:use-module (guix licenses)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages autogen)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages perl))
+
+(define-public mlucas
+  (let ( ; some dpkg-buildflags and custom build flags presented as
flag-list
+        (custom-flag-list
+         (flag-list-
+          (flag-list+ all-flag-list
+                      (flag-list
+                       #:CFLAGS '("-Ofast"
+                                  "-pipe"
+                                  "-flto"
+                                  "-fno-aggressive-loop-optimizations")
+                       #:LDFLAGS '("-Wl,--as-needed")))
+          default-flag-list)))
+    ;; start package definition
+    (package
+     (name "mlucas")
+     (version "14.1")
+     (source (origin
+              (method url-fetch)
+              (uri (string-append
"http://hogranch.com/mayer/src/C/mlucas-"
+                                  version
+                                  ".tar.xz"))
+              (sha256
+               (base32
+
"1i6j1479icxfwp3ixs6dk65qilv9hn7213q3iibndlgwjfmh0gb4"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:phases
+        (modify-phases %standard-phases
+                       (add-before 'configure
+                                   'bootstrap
+                                   (lambda _
+                                     (zero? (system "./bootstrap")))))
+        #:configure-flags
+        '("--disable-NORMAL-CFLAGS"
+          "--disable-TRICKY-CFLAGS"
+          "--enable-MLUCAS-DEFAULT-PATH"
+          "--enable-verbose-compiler"
+          ,@(flag-list->string-list custom-flag-list))))
+     ;; run-time dependencies
+     (propagated-inputs `(("coreutils" ,coreutils)
+                          ("sed" ,sed)))
+     ;; build-time dependencies
+     (native-inputs `(("autogen" ,autogen)
+                      ("autoconf" ,autoconf)
+                      ("automake" ,automake)
+                      ("perl" ,perl)))
+     ;; descriptions of the package
+     (synopsis "Program to perform Lucas-Lehmer test on a Mersenne
number")
+     (description "mlucas performs 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.
+")
+     (home-page "http://hogranch.com/mayer/README.html")
+     (license gpl2+))))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-25  6:12 [PATCH 2/2] gnu: Add Mlucas Alex Vong
@ 2015-10-26 11:34 ` Paul van der Walt
  2015-10-26 11:49   ` Alex Vong
  2015-11-07  4:27   ` Andreas Enge
  2015-11-05 22:08 ` Ludovic Courtès
  1 sibling, 2 replies; 9+ messages in thread
From: Paul van der Walt @ 2015-10-26 11:34 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

Hello Alex,

On 2015-10-25 at 07:12, quoth Alex Vong:
> Subject: [PATCH 2/2] gnu: Add Mlucas.
>
> ...
> 
> * gnu/packages/mlucas.scm: New file.

I'm not an expert, and i'm not 100% sure on this so it's an honest
question, but does this application really deserve a new package file?
Shouldn't mlucas perhaps be added to maths.scm?

Cheers,
p.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-26 11:34 ` Paul van der Walt
@ 2015-10-26 11:49   ` Alex Vong
  2015-10-26 11:56     ` Paul van der Walt
  2015-11-07  4:27   ` Andreas Enge
  1 sibling, 1 reply; 9+ messages in thread
From: Alex Vong @ 2015-10-26 11:49 UTC (permalink / raw)
  To: Paul van der Walt; +Cc: guix-devel

Hi Paul,

I don't know there is maths.scm! Is there a general guideline on where
to put new package definition? For example, putting elisp packages in
emacs.scm is pretty obvious but how about other cases?

Cheers,
Alex

On 26/10/2015, Paul van der Walt <paul@denknerd.org> wrote:
> Hello Alex,
>
> On 2015-10-25 at 07:12, quoth Alex Vong:
>> Subject: [PATCH 2/2] gnu: Add Mlucas.
>>
>> ...
>>
>> * gnu/packages/mlucas.scm: New file.
>
> I'm not an expert, and i'm not 100% sure on this so it's an honest
> question, but does this application really deserve a new package file?
> Shouldn't mlucas perhaps be added to maths.scm?
>
> Cheers,
> p.
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-26 11:49   ` Alex Vong
@ 2015-10-26 11:56     ` Paul van der Walt
  2015-11-05 21:57       ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Paul van der Walt @ 2015-10-26 11:56 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel


On 2015-10-26 at 12:49, quoth Alex Vong:
> I don't know there is maths.scm! Is there a general guideline on where
> to put new package definition? For example, putting elisp packages in
> emacs.scm is pretty obvious but how about other cases?

I am far from the right person to be answering this question, but my
heuristic is usually something like "find another similar
package/application and append the definition to that file".  In other
cases, it's ambiguous though, for example i recently added 'dosbox to
games.scm (even though it's not a game) and 'cmus to music.scm (even
though it's a media player and music.scm also contains a lot of
music-making software, but one of the alternatives, mpd.scm, seemed too
specific).  I guess it's a seat-of-your-pants thing, but i am open to
correction.

Cheers,
p.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/2] gnu: Add Mlucas.
@ 2015-10-31 13:56 Alex Vong
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Vong @ 2015-10-31 13:56 UTC (permalink / raw)
  To: guix-devel

From 00c6dce0002c07a1fecbe5d53bbbb724d0e6379b Mon Sep 17 00:00:00 2001
From: Alex Vong <alexvong1995@gmail.com>
Date: Sat, 31 Oct 2015 19:50:50 +0800
Subject: [PATCH 2/2] gnu: Add Mlucas.

* gnu/packages/maths.scm (mlucas): New variable.
---
 gnu/packages/maths.scm | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index b4b930d..8076f51 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -32,10 +32,14 @@
   #:use-module (guix download)
   #:use-module (guix svn-download)
   #:use-module (guix utils)
+  #:use-module (guix build build-flags)
   #:use-module (guix build utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages autogen)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages check)
@@ -1975,3 +1979,67 @@ algorithm and optimum parameters depending on the dataset.
 FLANN is written in C++ and contains bindings for C, Octave and Python.")
     (license (license:non-copyleft "file://COPYING"
                                 "See COPYING in the distribution."))))
+
+(define-public mlucas
+  (let ( ; some dpkg-buildflags and custom build flags presented as flag-list
+        (custom-flag-list
+         (flag-list-
+          (flag-list+ all-flag-list
+                      (flag-list
+                       #:CFLAGS '("-Ofast"
+                                  "-pipe"
+                                  "-flto"
+                                  "-fno-aggressive-loop-optimizations")
+                       #:LDFLAGS '("-Wl,--as-needed")))
+          default-flag-list)))
+    ;; start package definition
+    (package
+     (name "mlucas")
+     (version "14.1")
+     (source (origin
+              (method url-fetch)
+              (uri (string-append "http://hogranch.com/mayer/src/C/mlucas-"
+                                  version
+                                  ".tar.xz"))
+              (sha256
+               (base32
+                "1i6j1479icxfwp3ixs6dk65qilv9hn7213q3iibndlgwjfmh0gb4"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:phases
+        (modify-phases %standard-phases
+                       (add-before 'configure
+                                   'bootstrap
+                                   (lambda _
+                                     (zero? (system "./bootstrap")))))
+        #:configure-flags
+        '("--disable-NORMAL-CFLAGS"
+          "--disable-TRICKY-CFLAGS"
+          "--enable-MLUCAS-DEFAULT-PATH"
+          "--enable-verbose-compiler"
+          ,@(flag-list->string-list custom-flag-list))))
+     ;; run-time dependencies
+     (propagated-inputs `(("coreutils" ,coreutils)
+                          ("sed" ,sed)))
+     ;; build-time dependencies
+     (native-inputs `(("autogen" ,autogen)
+                      ("autoconf" ,autoconf)
+                      ("automake" ,automake)
+                      ("perl" ,perl)))
+     ;; descriptions of the package
+     (synopsis "Program to perform Lucas-Lehmer test on a Mersenne number")
+     (description "mlucas performs 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.
+")
+     (home-page "http://hogranch.com/mayer/README.html")
+     (license license:gpl2+))))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-26 11:56     ` Paul van der Walt
@ 2015-11-05 21:57       ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2015-11-05 21:57 UTC (permalink / raw)
  To: Paul van der Walt; +Cc: guix-devel

Paul van der Walt <paul@denknerd.org> skribis:

> On 2015-10-26 at 12:49, quoth Alex Vong:
>> I don't know there is maths.scm! Is there a general guideline on where
>> to put new package definition? For example, putting elisp packages in
>> emacs.scm is pretty obvious but how about other cases?
>
> I am far from the right person to be answering this question, but my
> heuristic is usually something like "find another similar
> package/application and append the definition to that file".  In other
> cases, it's ambiguous though, for example i recently added 'dosbox to
> games.scm (even though it's not a game) and 'cmus to music.scm (even
> though it's a media player and music.scm also contains a lot of
> music-making software, but one of the alternatives, mpd.scm, seemed too
> specific).  I guess it's a seat-of-your-pants thing, but i am open to
> correction.

I think that’s a good summary.  It’s a joyful mess, as we say in French.
;-)

Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-25  6:12 [PATCH 2/2] gnu: Add Mlucas Alex Vong
  2015-10-26 11:34 ` Paul van der Walt
@ 2015-11-05 22:08 ` Ludovic Courtès
  1 sibling, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2015-11-05 22:08 UTC (permalink / raw)
  To: Alex Vong; +Cc: guix-devel

Alex Vong <alexvong1995@gmail.com> skribis:

> From 876bbbeafaa2dae8e584820645ca21efecf6ae7c Mon Sep 17 00:00:00 2001
> From: Alex Vong <alexvong1995@gmail.com>
> Date: Sun, 25 Oct 2015 00:18:29 +0800
> Subject: [PATCH 2/2] gnu: Add Mlucas.
>
> * gnu/packages/mlucas.scm: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Register it.

I agree with Paul that maths.scm would be more appropriate.

> +;;; the Free Software Foundation; either version 3 of the License, or
> (at +;;; your option) any later version.

The MUA is breaking lines.  Could you try to disable it?

> +         (flag-list-
> +          (flag-list+ all-flag-list
> +                      (flag-list
> +                       #:CFLAGS '("-Ofast"
> +                                  "-pipe"
> +                                  "-flto"
> +                                  "-fno-aggressive-loop-optimizations")
> +                       #:LDFLAGS '("-Wl,--as-needed")))

For now, could you just pass these as #:configure-flags?

I think ‘-pipe’ can be omitted nowdays (and cpp is no longer a separate
process.)

I’m not sure if ‘-Ofast’ is OK: it might entail something equivalent to
‘-mtune=native’, which is inappropriate if the software is to be
distributed by Hydra.

> +          default-flag-list)))

[...]

> +        (modify-phases %standard-phases
> +                       (add-before 'configure
> +                                   'bootstrap
> +                                   (lambda _
> +                                     (zero? (system "./bootstrap")))))

Please use ‘system*’.  Also indent as in the other files.

> +        #:configure-flags
> +        '("--disable-NORMAL-CFLAGS"
> +          "--disable-TRICKY-CFLAGS"

Really?  :-)

> +     ;; run-time dependencies
> +     (propagated-inputs `(("coreutils" ,coreutils)
> +                          ("sed" ,sed)))

Why is this needed?  Could you put the justification in a comment?

> +     ;; build-time dependencies
> +     (native-inputs `(("autogen" ,autogen)
> +                      ("autoconf" ,autoconf)
> +                      ("automake" ,automake)
> +                      ("perl" ,perl)))

Does upstream provide a bootstrapped tarball, resulting from ‘make
dist’?  That would be best (no need to depend on Autoconf and Automake.)

> +     (description "mlucas performs Lucas-Lehmer test

“Mlucas” maybe?

> +on prime-exponent Mersenne numbers,
> +that is, integers of the form 2 ^ p - 1, with prime exponent p.

@math{2^p - 1}

> +For more information on GIMPS,
> +see <http://www.mersenne.org/prime.html> for details.

@uref{http://www.mersenne.org/prime.html}

Could you send an updated patch?

Thanks in advance, and sorry for the delay!

Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-10-26 11:34 ` Paul van der Walt
  2015-10-26 11:49   ` Alex Vong
@ 2015-11-07  4:27   ` Andreas Enge
  2015-11-07 12:47     ` Alex Vong
  1 sibling, 1 reply; 9+ messages in thread
From: Andreas Enge @ 2015-11-07  4:27 UTC (permalink / raw)
  To: Paul van der Walt; +Cc: guix-devel

Hello!

I must admit I was put off looking at this patch by the addition of the
flags system, of which I do not understand the justification. Basically,
it seems to be an additional layer on top of what we already have in
our different build systems. We have #:configure-flags and #:make-flags,
and in extreme cases we can set environment variables such as CPPFLAGS
and so on in an additional phase. Commonly used flags can be added to the
build systems once and for all, for others, my impression is that we already
have the mechanisms for doing it on a per package basis. Which problem does
this part of the patch solve?

On Mon, Oct 26, 2015 at 12:34:59PM +0100, Paul van der Walt wrote:
> > * gnu/packages/mlucas.scm: New file.
> I'm not an expert, and i'm not 100% sure on this so it's an honest
> question, but does this application really deserve a new package file?
> Shouldn't mlucas perhaps be added to maths.scm?

It should go to algebra.scm, which regroups tools of symbolic, exact
computation (whereas maths.scm contains tools for numerical computation).

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] gnu: Add Mlucas.
  2015-11-07  4:27   ` Andreas Enge
@ 2015-11-07 12:47     ` Alex Vong
  0 siblings, 0 replies; 9+ messages in thread
From: Alex Vong @ 2015-11-07 12:47 UTC (permalink / raw)
  To: Andreas Enge; +Cc: guix-devel

Hi,

Sorry, the following reply is written in a spaghetti-style (lots of
gotos) , please be patient :)

On 07/11/2015, Andreas Enge <andreas@enge.fr> wrote:
> Hello!
>
> I must admit I was put off looking at this patch by the addition of the
> flags system, of which I do not understand the justification. Basically,
> it seems to be an additional layer on top of what we already have in
> our different build systems. We have #:configure-flags and #:make-flags,
> and in extreme cases we can set environment variables such as CPPFLAGS
> and so on in an additional phase. Commonly used flags can be added to the
> build systems once and for all, for others, my impression is that we
> already
> have the mechanisms for doing it on a per package basis. Which problem does
> this part of the patch solve?
>
The idea comes from dpkg-buildflags
<http://manpages.debian.org/cgi-bin/man.cgi?query=dpkg-buildflags&apropos=0&sektion=0&manpath=Debian+unstable+sid&format=html&locale=en>.
It exports a selectable sets of build flags which are useful for
almost all packages. For instance, stackprotectorstrong protects your
program from stack smashing. For more detailed explanation, you can
see <https://lists.gnu.org/archive/html/guix-devel/2015-10/msg00079.html>.
I am adding this because I think Guix doesn't have a way to retrieve a
sets of common build flags. You are right that, currently, this only
works for gnu build system, are you proposing this should be in
`guix/build-system/gnu.scm` instead since this is
gnu-build-system-specific? I think "Commonly used flags can be added
to the build systems once and for all" doesn't always work. Some flags
will break the build for some packages, and the easiest fix is to turn
it off. So there should be a way to select the right subset of flags
that works for you instead of having a list of essential build flags.
The aim is to make it easier for packagers to retrieve the right
subset of useful (e.g. security-related) flags that works, *hopefully*
making the binary more secure.

> On Mon, Oct 26, 2015 at 12:34:59PM +0100, Paul van der Walt wrote:
>> > * gnu/packages/mlucas.scm: New file.
>> I'm not an expert, and i'm not 100% sure on this so it's an honest
>> question, but does this application really deserve a new package file?
>> Shouldn't mlucas perhaps be added to maths.scm?
>
> It should go to algebra.scm, which regroups tools of symbolic, exact
> computation (whereas maths.scm contains tools for numerical computation).
>
Mlucas does numerical computation (it makes use of FFT to find
Mersenne primes!), not symbolic, so it should be fine staying in
`maths.scm`.

Thanks for the review!

> Andreas
>
>
Cheers,
Alex

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-11-07 12:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-25  6:12 [PATCH 2/2] gnu: Add Mlucas Alex Vong
2015-10-26 11:34 ` Paul van der Walt
2015-10-26 11:49   ` Alex Vong
2015-10-26 11:56     ` Paul van der Walt
2015-11-05 21:57       ` Ludovic Courtès
2015-11-07  4:27   ` Andreas Enge
2015-11-07 12:47     ` Alex Vong
2015-11-05 22:08 ` Ludovic Courtès
  -- strict thread matches above, loose matches on Subject: below --
2015-10-31 13:56 Alex Vong

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).