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