gnu: gdb: Fix build with Python >= 3.7.
[jackhill/guix/guix.git] / gnu / packages / gdb.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages gdb)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages ncurses)
24 #:use-module (gnu packages readline)
25 #:use-module (gnu packages dejagnu)
26 #:use-module (gnu packages texinfo)
27 #:use-module (gnu packages multiprecision)
28 #:use-module (gnu packages xml)
29 #:use-module (gnu packages guile)
30 #:use-module (gnu packages python)
31 #:use-module (gnu packages pkg-config)
32 #:use-module ((guix licenses) #:select (gpl3+))
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix build-system gnu))
36
37 (define-public gdb
38 (package
39 (name "gdb")
40 (version "8.1")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append "mirror://gnu/gdb/gdb-"
44 version ".tar.xz"))
45 (patches (search-patches "gdb-python-3.7.patch"))
46 (sha256
47 (base32
48 "0d2bpqk58fqlx21rbnk8mbcjlggzc9kb5sjirrfrrrjq70ka0qdg"))))
49 (build-system gnu-build-system)
50 (arguments
51 `(#:tests? #f ; FIXME "make check" fails on single-processor systems.
52
53 #:modules ((srfi srfi-1)
54 ,@%gnu-build-system-modules)
55
56 #:phases (modify-phases %standard-phases
57 (add-after
58 'configure 'post-configure
59 (lambda _
60 (for-each patch-makefile-SHELL
61 (find-files "." "Makefile\\.in"))
62 #t))
63 (add-after
64 'install 'remove-libs-already-in-binutils
65 (lambda* (#:key inputs outputs #:allow-other-keys)
66 ;; Like Binutils, GDB installs libbfd, libopcodes, etc.
67 ;; However, this leads to collisions when both are
68 ;; installed, and really is none of its business,
69 ;; conceptually. So remove them.
70 (let* ((binutils (assoc-ref inputs "binutils"))
71 (out (assoc-ref outputs "out"))
72 (files1 (with-directory-excursion binutils
73 (append (find-files "lib")
74 (find-files "include"))))
75 (files2 (with-directory-excursion out
76 (append (find-files "lib")
77 (find-files "include"))))
78 (common (lset-intersection string=?
79 files1 files2)))
80 (with-directory-excursion out
81 (for-each delete-file common)
82 #t)))))))
83 (inputs
84 `(("expat" ,expat)
85 ("mpfr" ,mpfr)
86 ("gmp" ,gmp)
87 ("readline" ,readline)
88 ("ncurses" ,ncurses)
89 ("guile" ,guile-2.0)
90 ("python" ,python)
91 ("python-wrapper" ,python-wrapper)
92 ("dejagnu" ,dejagnu)
93
94 ;; Allow use of XML-formatted syscall information. This enables 'catch
95 ;; syscall' and similar commands.
96 ("libxml2" ,libxml2)))
97 (native-inputs
98 `(("texinfo" ,texinfo)
99 ("pkg-config" ,pkg-config)))
100 (home-page "https://www.gnu.org/software/gdb/")
101 (synopsis "The GNU debugger")
102 (description
103 "GDB is the GNU debugger. With it, you can monitor what a program is
104 doing while it runs or what it was doing just before a crash. It allows you
105 to specify the runtime conditions, to define breakpoints, and to change how
106 the program is running to try to fix bugs. It can be used to debug programs
107 written in C, C++, Ada, Objective-C, Pascal and more.")
108 (license gpl3+)))