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.
This commit is contained in:
Ludovic Courtès 2015-09-09 23:25:22 +02:00
parent f19b9b96cd
commit 2fecbdbd82
1 changed files with 21 additions and 7 deletions

View File

@ -46,7 +46,11 @@
"1a08c9svaihqmz2mm44il1gwa810gmwkckns8b0y0v3qz52amgby")))) "1a08c9svaihqmz2mm44il1gwa810gmwkckns8b0y0v3qz52amgby"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (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 #:phases (modify-phases %standard-phases
(add-after (add-after
'configure 'post-configure 'configure 'post-configure
@ -54,15 +58,25 @@
(for-each patch-makefile-SHELL (for-each patch-makefile-SHELL
(find-files "." "Makefile\\.in")))) (find-files "." "Makefile\\.in"))))
(add-after (add-after
'install 'post-install 'install 'remove-libs-already-in-binutils
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
;; Like Binutils, GDB installs libbfd and libopcodes. ;; Like Binutils, GDB installs libbfd, libopcodes, etc.
;; However, this leads to collisions when both are ;; However, this leads to collisions when both are
;; installed, and really is none of its business, ;; installed, and really is none of its business,
;; conceptually. So remove them. ;; conceptually. So remove them.
(for-each delete-file (let* ((binutils (assoc-ref inputs "binutils"))
(find-files (assoc-ref outputs "out") (out (assoc-ref outputs "out"))
"^lib(opcodes|bfd)\\."))))))) (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 (inputs
`(("expat" ,expat) `(("expat" ,expat)
("mpfr" ,mpfr) ("mpfr" ,mpfr)