~ruther/guix-local

06ed59825ecc0dc78d4d16d06c129e2f4879201a — Andreas Enge 12 years ago 5d17cf8
guix: cmake: Add input and package libraries to the rpath, and adapt package
  definitions accordingly.

* guix/build/cmake-build-system.scm (configure): Add flags.
* gnu/packages/maths.scm (lapack): Drop special code.
* gnu/packages/ssh.scm (libssh): Drop special code.
* gnu/packages/slim.scm (slim): Drop special code and enable shared library.

Co-authored-by: Eric Bavier <bavier@member.fsf.org>
4 files changed, 14 insertions(+), 73 deletions(-)

M gnu/packages/maths.scm
M gnu/packages/slim.scm
M gnu/packages/ssh.scm
M guix/build/cmake-build-system.scm
M gnu/packages/maths.scm => gnu/packages/maths.scm +3 -32
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 John Darrington <jmd@gnu.org>
;;;


@@ 190,43 190,14 @@ output in text, PostScript, PDF or HTML.")
    (inputs `(("fortran" ,gfortran-4.8)
              ("python" ,python-2)))
    (arguments
     `(#:modules ((guix build cmake-build-system)
                  (guix build utils)
                  (guix build rpath)
                  (srfi srfi-1))
       #:imported-modules ((guix build cmake-build-system)
                           (guix build gnu-build-system)
                           (guix build utils)
                           (guix build rpath))
       #:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
     `(#:configure-flags '("-DBUILD_SHARED_LIBS:BOOL=YES")
       #:phases (alist-cons-before
                 'check 'patch-python
                 (lambda* (#:key inputs #:allow-other-keys)
                   (let ((python (assoc-ref inputs "python")))
                     (substitute* "lapack_testing.py"
                       (("/usr/bin/env python") python))))
                 (alist-cons-after
                  'strip 'add-libs-to-runpath
                  (lambda* (#:key inputs outputs #:allow-other-keys)
                    (let* ((out     (assoc-ref outputs "out"))
                           (fortran (assoc-ref inputs "fortran"))
                           (libc    (assoc-ref inputs "libc"))
                           (rpaths  `(,(string-append fortran "/lib64")
                                      ,(string-append fortran "/lib")
                                      ,(string-append libc "/lib")
                                      ,(string-append out "/lib"))))
                      ;; Set RUNPATH for all libraries
                      (with-directory-excursion out
                        (for-each
                         (lambda (lib)
                           (let ((lib-rpaths (file-rpath lib)))
                             (for-each
                              (lambda (dir)
                                (or (member dir lib-rpaths)
                                    (augment-rpath lib dir)))
                              rpaths)))
                         (find-files "lib" ".*so$")))))
                  %standard-phases))))
                  %standard-phases)))
    (synopsis "Library for numerical linear algebra")
    (description
     "LAPACK is a Fortran 90 library for solving the most commonly occurring

M gnu/packages/slim.scm => gnu/packages/slim.scm +3 -9
@@ 1,6 1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Guy Grant <gzg@riseup.net>
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 75,15 76,8 @@
                      ;; "systemd".  Strip that.
                      "")))
		 %standard-phases)
       #:configure-flags '("-DUSE_PAM=yes" "-DUSE_CONSOLEKIT=no"

                           ;; Don't build libslim.so, because then the build
                           ;; system is unable to set the right RUNPATH on the
                           ;; 'slim' binary.
                           "-DBUILD_SHARED_LIBS=OFF"

                           ;; Leave a valid RUNPATH upon install.
                           "-DCMAKE_SKIP_BUILD_RPATH=ON")
       #:configure-flags '("-DUSE_PAM=yes"
                           "-DUSE_CONSOLEKIT=no")
       #:tests? #f))
    (home-page "http://slim.berlios.de/")
    (synopsis "Desktop-independent graphcal login manager for X11")

M gnu/packages/ssh.scm => gnu/packages/ssh.scm +3 -32
@@ 1,5 1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.


@@ 53,39 53,10 @@
                "1jyaj9h1iglvn02hrvcchbx8ycjpj8b91h8mi459k7q5jp2xgd9b"))))
    (build-system cmake-build-system)
    (arguments
     '(#:configure-flags '("-DWITH_GCRYPT=ON"

                           ;; Leave a valid RUNPATH upon install.
                           "-DCMAKE_SKIP_BUILD_RPATH=ON")
     '(#:configure-flags '("-DWITH_GCRYPT=ON")

       ;; TODO: Add 'CMockery' and '-DWITH_TESTING=ON' for the test suite.
       #:tests? #f

       #:modules ((guix build cmake-build-system)
                  (guix build utils)
                  (guix build rpath))
       #:imported-modules ((guix build gnu-build-system)
                           (guix build cmake-build-system)
                           (guix build utils)
                           (guix build rpath))

       #:phases (alist-cons-after
                 'install 'augment-runpath
                 (lambda* (#:key outputs #:allow-other-keys)
                   ;; libssh_threads.so NEEDs libssh.so, so add $libdir to its
                   ;; RUNPATH.
                   (define (dereference file)
                     (let ((target (false-if-exception (readlink file))))
                       (if target
                           (dereference target)
                           file)))

                   (let* ((out (assoc-ref outputs "out"))
                          (lib (string-append out "/lib")))
                     (with-directory-excursion lib
                       (augment-rpath (dereference "libssh_threads.so")
                                      lib))))
                 %standard-phases)))
       #:tests? #f))
    (inputs `(("zlib" ,zlib)
               ;; Link against an older gcrypt, because libssh tries to access
               ;; fields of 'gcry_thread_cbs' that are now private:

M guix/build/cmake-build-system.scm => guix/build/cmake-build-system.scm +5 -0
@@ 1,6 1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 48,6 49,10 @@

    (let ((args `(,srcdir
                  ,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
                  ;; add input libraries to rpath
                  "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"
                  ;; add (other) libraries of the project itself to rpath
                  ,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
                  ,@configure-flags)))
      (setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
      (setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))