gnu: Add nlopt.

Message ID 87bn4n5ngw.fsf@gnu.org
State Committed
Headers

Commit Message

Roel Janssen May 3, 2016, 12:34 p.m. UTC
  Ludovic Courtès writes:

> Roel Janssen <roel@gnu.org> skribis:
>
>> Ludovic Courtès writes:
>
> [...]
>
>>> Still, according to luksan/COPYRIGHT, “[s]ubroutines PBUN, PNEW, PVAR,
>>> PSEN” are “for your personal use […] [n]ot for redistribution”.
>>>
>>> So my understanding is that we need to remove those four subroutines.
>>> The rest in that directory is LGPLv2.1+.
>>>
>>> WDYT?
>>
>> I agree to your understanding.
>>
>> A little later in the same file I found: "This library (with exception
>> of PBUN, PNEW, PVAR, PSEN) is a free software".
>>
>>> I don’t see it at
>>> <https://libreplanet.org/wiki/List_of_software_that_does_not_respect_the_Free_System_Distribution_Guidelines>.
>>> Debian has a package: <https://packages.debian.org/source/sid/nlopt>.
>>> Could you check if they apply any patches?
>>
>> I haven't found any patches.  So I dug a little deeper and attempted to
>> remove them myself with a patch, but I haven't been able to find these
>> subroutines.
>>
>> I ran the following commands on the root of the source directory:
>> grep -i -r "pbun" .
>> grep -i -r "pmin" .
>> grep -i -r "psen" .
>> grep -i -r "pvar" .
>>
>> And I haven't found the routines.  So I think we're safe.  That could
>> also be why Debian doesn't have a patch for this either.
>
> Indeed.  Actually, luksan/README states:
>
>   [We also did not convert the PMIN, PBUN, PNEW, or PVAR subroutines
>   since these were published in ACM Trans. on Math. Software (TOMS) and
>   are subject to the non-free ACM licensing conditions.]
>
> So indeed, the COPYRIGHT file is confusing, but we’re safe.
>
> Sorry for the false alarm.
>
>>> Besides, I suggest reusing the bits about Guile bindings from the patch
>>> I sent.
>>
>> Shall I prepare a new patch?
>
> Yes please.

I added your magic for Guile.  Here is the patch:

>From 6221baadea331cff7e8ab6b9ea1b3bb7737b227f Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 3 May 2016 14:30:25 +0200
Subject: [PATCH] gnu: Add nlopt.

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

Comments

Ludovic Courtès May 3, 2016, 8:02 p.m. UTC | #1
Roel Janssen <roel@gnu.org> skribis:

> I added your magic for Guile.  Here is the patch:
>
>>From 6221baadea331cff7e8ab6b9ea1b3bb7737b227f Mon Sep 17 00:00:00 2001
> From: Roel Janssen <roel@gnu.org>
> Date: Tue, 3 May 2016 14:30:25 +0200
> Subject: [PATCH] gnu: Add nlopt.
>
> * gnu/packages/maths.scm (nlopt): New variable.

Pushed with minor cosmetic changes, notably:

> +    (source (origin
> +      (method url-fetch)
> +      (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
> +                          version ".tar.gz"))
> +      (sha256
> +       (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))

“(method” should be indented below the “r” of “origin” (I think this
pattern also appears in the R patches you recently submitted.)

Thank you!

Ludo’.

PS: I’d be happy to add configuration files for editors other than Emacs
    so that everyone has their indentation and stuff properly set up.
  
Roel Janssen May 3, 2016, 8:17 p.m. UTC | #2
Ludovic Courtès writes:

> Roel Janssen <roel@gnu.org> skribis:
>
>> I added your magic for Guile.  Here is the patch:
>>
>>>From 6221baadea331cff7e8ab6b9ea1b3bb7737b227f Mon Sep 17 00:00:00 2001
>> From: Roel Janssen <roel@gnu.org>
>> Date: Tue, 3 May 2016 14:30:25 +0200
>> Subject: [PATCH] gnu: Add nlopt.
>>
>> * gnu/packages/maths.scm (nlopt): New variable.
>
> Pushed with minor cosmetic changes, notably:
>
>> +    (source (origin
>> +      (method url-fetch)
>> +      (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
>> +                          version ".tar.gz"))
>> +      (sha256
>> +       (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
>
> “(method” should be indented below the “r” of “origin” (I think this
> pattern also appears in the R patches you recently submitted.)
>
> Thank you!

I've been submitting most packages this way.  Should I align (method
...) to the r in origin for all packages in the future?

Thank you!

Kind regards,
Roel Janssen
  
Alex Kost May 4, 2016, 8:38 a.m. UTC | #3
Roel Janssen (2016-05-03 23:17 +0300) wrote:

> Ludovic Courtès writes:
>
>> Roel Janssen <roel@gnu.org> skribis:
>>
>>> I added your magic for Guile.  Here is the patch:
>>>
>>>>From 6221baadea331cff7e8ab6b9ea1b3bb7737b227f Mon Sep 17 00:00:00 2001
>>> From: Roel Janssen <roel@gnu.org>
>>> Date: Tue, 3 May 2016 14:30:25 +0200
>>> Subject: [PATCH] gnu: Add nlopt.
>>>
>>> * gnu/packages/maths.scm (nlopt): New variable.
>>
>> Pushed with minor cosmetic changes, notably:
>>
>>> +    (source (origin
>>> +      (method url-fetch)
>>> +      (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
>>> +                          version ".tar.gz"))
>>> +      (sha256
>>> +       (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
>>
>> “(method” should be indented below the “r” of “origin” (I think this
>> pattern also appears in the R patches you recently submitted.)
>>
>> Thank you!
>
> I've been submitting most packages this way.  Should I align (method
> ...) to the r in origin for all packages in the future?

Yes, 'method' is a sub-expression or 'origin', not of 'source', and it
should be aligned accordingly.

I suppose you don't use Emacs; may I ask what editor do you use?
  
Roel Janssen May 4, 2016, 8:52 a.m. UTC | #4
Alex Kost writes:

> Roel Janssen (2016-05-03 23:17 +0300) wrote:
>
>> I've been submitting most packages this way.  Should I align (method
>> ...) to the r in origin for all packages in the future?
>
> Yes, 'method' is a sub-expression or 'origin', not of 'source', and it
> should be aligned accordingly.
>
> I suppose you don't use Emacs; may I ask what editor do you use?

I use Emacs.  So, how did it adjust indenting to source instead of
origin you might ask next..  The answer is: I did that manually :-).

Kind regards,
Roel Janssen
  

Patch

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index d37897d..0ad6f4b 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -59,6 +59,7 @@ 
   #:use-module (gnu packages less)
   #:use-module (gnu packages lisp)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages guile)
   #:use-module (gnu packages xorg)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages m4)
@@ -430,6 +431,41 @@  extremely large and complex data collections.")
     (license (license:x11-style
               "http://www.hdfgroup.org/ftp/HDF5/current/src/unpacked/COPYING"))))
 
+(define-public nlopt
+  (package
+    (name "nlopt")
+    (version "2.4.2")
+    (source (origin
+      (method url-fetch)
+      (uri (string-append "http://ab-initio.mit.edu/nlopt/nlopt-"
+                          version ".tar.gz"))
+      (sha256
+       (base32 "12cfkkhcdf4zmb6h7y6qvvdvqjs2xf9sjpa3rl3bq76px4yn76c0"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:configure-flags '("--enable-shared") ; Also create a shared library.
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-guile-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Make sure the Scheme module refers to the library by its
+             ;; absolute file name (we cannot do that from a snippet
+             ;; because the expansion of @libdir@ contains
+             ;; ${exec_prefix}.)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "swig/nlopt.scm.in"
+                 (("libnlopt")
+                  (string-append out "/lib/libnlopt")))
+               #t))))))
+    (inputs
+     `(("guile" ,guile-2.0)))
+    (home-page "http://ab-initio.mit.edu/wiki/")
+    (synopsis "Library for nonlinear optimization")
+    (description "NLopt is a library for nonlinear optimization, providing a
+common interface for a number of different free optimization routines available
+online as well as original implementations of various other algorithms.")
+    (license license:lgpl2.1+)))
+
 
 ;; For a fully featured Octave, users  are strongly recommended also to install
 ;; the following packages: texinfo, less, ghostscript, gnuplot.