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