summary refs log tree commit diff
path: root/gnu/packages/gdb.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-09-09 23:25:22 +0200
committerLudovic Courtès <ludo@gnu.org>2015-09-09 23:27:10 +0200
commit2fecbdbd82efda717d0e56101afcf41b79404a4f (patch)
tree9770573838438d9cd7bc9d77edf68cc8a017196a /gnu/packages/gdb.scm
parentf19b9b96cda5ff45810f1363ef30df8d163451ad (diff)
downloadguix-2fecbdbd82efda717d0e56101afcf41b79404a4f.tar.gz
gnu: gdb: Remove headers and libraries already in Binutils.
* gnu/packages/gdb.scm (gdb)[arguments]: Add #:modules.  Rename
  'post-install' phase to 'remove-libs-already-in-binutils'.  Change it
  to compute the intersection of the set of headers and libraries of GDB
  vs. Binutils and to remove each of the files found in both.
Diffstat (limited to 'gnu/packages/gdb.scm')
-rw-r--r--gnu/packages/gdb.scm28
1 files changed, 21 insertions, 7 deletions
diff --git a/gnu/packages/gdb.scm b/gnu/packages/gdb.scm
index 5849831f04..f17b398048 100644
--- a/gnu/packages/gdb.scm
+++ b/gnu/packages/gdb.scm
@@ -46,7 +46,11 @@
                "1a08c9svaihqmz2mm44il1gwa810gmwkckns8b0y0v3qz52amgby"))))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f ; FIXME "make check" fails on single-processor systems.
+     `(#:tests? #f ; FIXME "make check" fails on single-processor systems.
+
+       #:modules ((srfi srfi-1)
+                  ,@%gnu-build-system-modules)
+
        #:phases (modify-phases %standard-phases
                   (add-after
                    'configure 'post-configure
@@ -54,15 +58,25 @@
                      (for-each patch-makefile-SHELL
                                (find-files "." "Makefile\\.in"))))
                   (add-after
-                   'install 'post-install
-                   (lambda* (#:key outputs #:allow-other-keys)
-                     ;; Like Binutils, GDB installs libbfd and libopcodes.
+                   'install 'remove-libs-already-in-binutils
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     ;; Like Binutils, GDB installs libbfd, libopcodes, etc.
                      ;; However, this leads to collisions when both are
                      ;; installed, and really is none of its business,
                      ;; conceptually.  So remove them.
-                     (for-each delete-file
-                               (find-files (assoc-ref outputs "out")
-                                           "^lib(opcodes|bfd)\\.")))))))
+                     (let* ((binutils (assoc-ref inputs "binutils"))
+                            (out      (assoc-ref outputs "out"))
+                            (files1   (with-directory-excursion binutils
+                                        (append (find-files "lib")
+                                                (find-files "include"))))
+                            (files2   (with-directory-excursion out
+                                        (append (find-files "lib")
+                                                (find-files "include"))))
+                            (common   (lset-intersection string=?
+                                                         files1 files2)))
+                       (with-directory-excursion out
+                         (for-each delete-file common)
+                         #t)))))))
     (inputs
      `(("expat" ,expat)
        ("mpfr" ,mpfr)