diff mbox

Add LAPACKE

Message ID idjoa64ttxj.fsf@bimsb-sys02.mdc-berlin.net
State New
Headers show

Commit Message

Ricardo Wurmus July 11, 2016, 9:17 a.m. UTC
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Instead of building LAPACKE as part of the lapack package this patch adds a
> new package "lapack-with-lapacke".  I did this because an increase in closure
> size of 20MiB is a little much for a commonly used package, in my opinion.
>
> A third option would be to move LAPACKE to its own output.

A patch is attached.  It produces two output directories:

  /gnu/store/40g0xqcikbz6ya7h2gbyj8gck043ajl8-lapack-3.5.0-lapacke
  /gnu/store/lqnm7fmpz3si0rgyqz1pzax4ipa25xlx-lapack-3.5.0

The closure of the lapacke output is larger, as expected:

$ guix size /gnu/store/40g0xqcikbz6ya7h2gbyj8gck043ajl8-lapack-3.5.0-lapacke
store item                                                       total    self
/gnu/store/40g0xqcikbz6ya7h2gbyj8gck043ajl8-lapack-3.5.0-lapacke    97.2     2.9   3.0%
/gnu/store/lqnm7fmpz3si0rgyqz1pzax4ipa25xlx-lapack-3.5.0            71.4     6.4   6.6%
/gnu/store/gaximh48qbqf4712bw224ghq919hqp64-gfortran-4.9.3-lib      64.9    27.1  27.9%
/gnu/store/v39bh3ln3ncnzhyw0kd12d46kww9747v-gcc-4.9.3-lib           60.7    22.9  23.5%
/gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22              37.9    36.5  37.5%
/gnu/store/5y72ql4zbnbd50lf88k91k0y766kq75x-bash-static-4.3.42       1.4     1.4   1.4%
total: 97.2 MiB

But the plain output is unchanged:

$ guix size /gnu/store/lqnm7fmpz3si0rgyqz1pzax4ipa25xlx-lapack-3.5.0
store item                                                       total    self
/gnu/store/lqnm7fmpz3si0rgyqz1pzax4ipa25xlx-lapack-3.5.0            71.4     6.4   9.0%
/gnu/store/gaximh48qbqf4712bw224ghq919hqp64-gfortran-4.9.3-lib      64.9    27.1  38.0%
/gnu/store/8m00x5x8ykmar27s9248cmhnkdb2n54a-glibc-2.22              37.9    36.5  51.1%
/gnu/store/5y72ql4zbnbd50lf88k91k0y766kq75x-bash-static-4.3.42       1.4     1.4   2.0%
total: 71.4 MiB


I have yet to test that this works as expected with the package I’m
working on.

~~ Ricardo

Comments

Ricardo Wurmus July 12, 2016, 1:45 p.m. UTC | #1
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
>> Instead of building LAPACKE as part of the lapack package this patch adds a
>> new package "lapack-with-lapacke".  I did this because an increase in closure
>> size of 20MiB is a little much for a commonly used package, in my opinion.
>>
>> A third option would be to move LAPACKE to its own output.
>
> A patch is attached.  It produces two output directories:

[...]

> I have yet to test that this works as expected with the package I’m
> working on.

This works.  I think this is the best of the available options.

~~ Ricardo
diff mbox

Patch

From 4e04199427902f535f772cd534a9bd20fb2e4112 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 8 Jul 2016 17:34:30 +0200
Subject: [PATCH] gnu: lapack: Add output for lapacke.

* gnu/packages/maths.scm (lapack)[outputs]: New field.
[arguments]: Add build phase to move lapacke to separate output.
---
 gnu/packages/maths.scm | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 68fb272..86a466e 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -331,10 +331,12 @@  large scale eigenvalue problems.")
         "0lk3f97i9imqascnlf6wr5mjpyxqcdj73pgj97dj2mgvyg9z1n4s"))))
     (build-system cmake-build-system)
     (home-page "http://www.netlib.org/lapack/")
+    (outputs '("out" "lapacke"))
     (inputs `(("fortran" ,gfortran)
               ("python" ,python-2)))
     (arguments
-     `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
+     `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES"
+                           "-DLAPACKE=ON")
        #:phases
        (modify-phases %standard-phases
          (add-before 'check 'patch-python
@@ -342,13 +344,26 @@  large scale eigenvalue problems.")
              (let ((python (assoc-ref inputs "python")))
                (substitute* "lapack_testing.py"
                  (("/usr/bin/env python") python))
-               #t))))))
+               #t)))
+         (add-after 'install 'use-separate-outputs
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out     (assoc-ref outputs "out"))
+                   (lapacke (assoc-ref outputs "lapacke")))
+               (mkdir-p (string-append lapacke "/lib/pkgconfig"))
+               (for-each
+                (lambda (file)
+                  (rename-file (string-append out file)
+                               (string-append lapacke file)))
+                (list "/lib/liblapacke.so"
+                      "/lib/pkgconfig/lapacke.pc"
+                      "/include")))
+             #t)))))
     (synopsis "Library for numerical linear algebra")
     (description
      "LAPACK is a Fortran 90 library for solving the most commonly occurring
 problems in numerical linear algebra.")
     (license (license:non-copyleft "file://LICENSE"
-                                "See LICENSE in the distribution."))))
+                                   "See LICENSE in the distribution."))))
 
 (define-public scalapack
   (package
-- 
2.9.0