Commit | Line | Data |
---|---|---|
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> |
accb9fe6 | 4 | ;;; Copyright © 2015, 2016, 2019, 2021 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> |
b1fd9531 | 7 | ;;; Copyright © 2020, 2021 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
aa548d24 | 8 | ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
fbbb1c0f LC |
9 | ;;; |
10 | ;;; This file is part of GNU Guix. | |
11 | ;;; | |
12 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
13 | ;;; under the terms of the GNU General Public License as published by | |
14 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
15 | ;;; your option) any later version. | |
16 | ;;; | |
17 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
18 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | ;;; GNU General Public License for more details. | |
21 | ;;; | |
22 | ;;; You should have received a copy of the GNU General Public License | |
23 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
24 | ||
1ffa7090 | 25 | (define-module (gnu packages gdb) |
b20441f2 | 26 | #:use-module (gnu packages) |
41f058d1 | 27 | #:use-module (gnu packages bash) |
76129cd3 | 28 | #:use-module (gnu packages hurd) |
1ffa7090 LC |
29 | #:use-module (gnu packages ncurses) |
30 | #:use-module (gnu packages readline) | |
31 | #:use-module (gnu packages dejagnu) | |
32 | #:use-module (gnu packages texinfo) | |
33 | #:use-module (gnu packages multiprecision) | |
34 | #:use-module (gnu packages xml) | |
684a2f59 | 35 | #:use-module (gnu packages guile) |
480b3279 | 36 | #:use-module (gnu packages pretty-print) |
1ffa7090 | 37 | #:use-module (gnu packages python) |
684a2f59 | 38 | #:use-module (gnu packages pkg-config) |
41f058d1 | 39 | #:use-module (guix download) |
183c9a89 | 40 | #:use-module ((guix licenses) #:select (gpl3+)) |
fbbb1c0f | 41 | #:use-module (guix packages) |
41f058d1 | 42 | #:use-module (guix utils) |
480b3279 | 43 | #:use-module (guix build-system gnu) |
5b6b1608 | 44 | #:use-module ((guix build utils) #:select (alist-replace)) |
480b3279 | 45 | #:use-module (srfi srfi-1)) |
fbbb1c0f | 46 | |
2fc08ccd | 47 | (define-public gdb-11 |
fbbb1c0f LC |
48 | (package |
49 | (name "gdb") | |
2fc08ccd | 50 | (version "11.1") |
fbbb1c0f | 51 | (source (origin |
8a613f9d MC |
52 | (method url-fetch) |
53 | (uri (string-append "mirror://gnu/gdb/gdb-" | |
54 | version ".tar.xz")) | |
55 | (sha256 | |
56 | (base32 | |
2fc08ccd | 57 | "151z6d0265hv9cgx9zqqa4bd6vbp20hrljhd6bxl7lr0gd0crkyc")))) |
fbbb1c0f | 58 | (build-system gnu-build-system) |
41f058d1 | 59 | (outputs '("out" "debug")) |
fbbb1c0f | 60 | (arguments |
2fc08ccd | 61 | `(#:tests? #f ;FIXME: 217 unexpected failures |
759883ab | 62 | #:out-of-source? #t |
2fecbdbd LC |
63 | #:modules ((srfi srfi-1) |
64 | ,@%gnu-build-system-modules) | |
f19b9b96 | 65 | #:phases (modify-phases %standard-phases |
41f058d1 MC |
66 | (add-after 'unpack 'patch-paths |
67 | (lambda* (#:key inputs #:allow-other-keys) | |
68 | (let ((sh (string-append (assoc-ref inputs "bash") | |
69 | "/bin/sh"))) | |
70 | (substitute* '("gdb/ser-pipe.c" | |
71 | "gdbsupport/pathstuff.cc") | |
72 | (("\"/bin/sh\"") | |
73 | (format #f "~s" sh)))))) | |
b1fd9531 JN |
74 | ,@(if (hurd-target?) |
75 | '((add-after 'unpack 'patch-gdb/hurd | |
76 | (lambda* (#:key inputs #:allow-other-keys) | |
77 | (let ((patch (assoc-ref inputs "hurd-build.patch"))) | |
78 | (invoke "patch" "-p1" "--force" "-i" patch))))) | |
79 | '()) | |
8a613f9d MC |
80 | (add-after 'configure 'post-configure |
81 | (lambda _ | |
82 | (for-each patch-makefile-SHELL | |
83 | (find-files "." "Makefile\\.in")))) | |
84 | (add-after 'install 'remove-libs-already-in-binutils | |
85 | (lambda* (#:key native-inputs inputs outputs | |
86 | #:allow-other-keys) | |
87 | ;; Like Binutils, GDB installs libbfd, libopcodes, etc. | |
88 | ;; However, this leads to collisions when both are | |
89 | ;; installed, and really is none of its business, | |
90 | ;; conceptually. So remove them. | |
91 | (let* ((binutils (or (assoc-ref inputs "binutils") | |
92 | (assoc-ref native-inputs "binutils"))) | |
93 | (out (assoc-ref outputs "out")) | |
94 | (files1 (with-directory-excursion binutils | |
95 | (append (find-files "lib") | |
96 | (find-files "include")))) | |
97 | (files2 (with-directory-excursion out | |
98 | (append (find-files "lib") | |
99 | (find-files "include")))) | |
100 | (common (lset-intersection string=? | |
101 | files1 files2))) | |
102 | (with-directory-excursion out | |
103 | (for-each delete-file common)))))))) | |
fbbb1c0f | 104 | (inputs |
41f058d1 MC |
105 | `(("bash" ,bash) |
106 | ("expat" ,expat) | |
fbbb1c0f LC |
107 | ("mpfr" ,mpfr) |
108 | ("gmp" ,gmp) | |
109 | ("readline" ,readline) | |
110 | ("ncurses" ,ncurses) | |
5b6b1608 | 111 | ("guile" ,guile-3.0) |
684a2f59 | 112 | ("python-wrapper" ,python-wrapper) |
759883ab | 113 | ("source-highlight" ,source-highlight) |
03f45001 LC |
114 | |
115 | ;; Allow use of XML-formatted syscall information. This enables 'catch | |
116 | ;; syscall' and similar commands. | |
76129cd3 JN |
117 | ("libxml2" ,libxml2) |
118 | ||
119 | ;; The Hurd needs -lshouldbeinlibc. | |
b1fd9531 JN |
120 | ,@(if (hurd-target?) |
121 | `(("hurd" ,hurd) | |
122 | ("hurd-build.patch" | |
123 | ,(search-patch "gdb-fix-gnu-nat-build.patch"))) | |
124 | '()))) | |
c4c4cc05 | 125 | (native-inputs |
8a613f9d MC |
126 | `(("texinfo" ,texinfo) |
127 | ("dejagnu" ,dejagnu) | |
128 | ("pkg-config" ,pkg-config) | |
129 | ,@(if (hurd-target?) | |
130 | ;; When cross-compiling from x86_64-linux, make sure to use a | |
131 | ;; 32-bit MiG because we assume target i586-pc-gnu. | |
132 | `(("mig" ,(if (%current-target-system) | |
133 | mig/32-bit | |
134 | mig))) | |
135 | '()))) | |
5e214051 MC |
136 | ;; TODO: Add support for the GDB_DEBUG_FILE_DIRECTORY environment |
137 | ;; variable in GDB itself instead of relying on some glue code in | |
138 | ;; the Guix-provided .gdbinit file. | |
720a4adc MC |
139 | (native-search-paths (list (search-path-specification |
140 | (variable "GDB_DEBUG_FILE_DIRECTORY") | |
141 | (files '("lib/debug"))))) | |
caaa715d | 142 | (home-page "https://www.gnu.org/software/gdb/") |
f50d2669 | 143 | (synopsis "The GNU debugger") |
fbbb1c0f | 144 | (description |
a22dc0c4 LC |
145 | "GDB is the GNU debugger. With it, you can monitor what a program is |
146 | doing while it runs or what it was doing just before a crash. It allows you | |
147 | to specify the runtime conditions, to define breakpoints, and to change how | |
148 | the program is running to try to fix bugs. It can be used to debug programs | |
149 | written in C, C++, Ada, Objective-C, Pascal and more.") | |
fbbb1c0f | 150 | (license gpl3+))) |
a8e7ba75 | 151 | |
2eb2501d GH |
152 | (define-public gdb-12 |
153 | (package | |
154 | (inherit gdb-11) | |
155 | (version "12.1") | |
156 | (source (origin | |
157 | (method url-fetch) | |
158 | (uri (string-append "mirror://gnu/gdb/gdb-" | |
159 | version ".tar.xz")) | |
160 | (sha256 | |
161 | (base32 | |
162 | "1vczsqcbh5y0gx7qrclpna0qzx26sk7lra6y8qzxam1biyzr65qf")))))) | |
163 | ||
a8e7ba75 LC |
164 | (define-public gdb |
165 | ;; This is the fixed version that packages depend on. Update it rarely | |
166 | ;; enough to avoid massive rebuilds. | |
2fc08ccd | 167 | gdb-11) |
35691bf5 JN |
168 | |
169 | (define-public gdb-minimal | |
8a613f9d MC |
170 | (package/inherit gdb |
171 | (name "gdb-minimal") | |
172 | (inputs (fold alist-delete (package-inputs gdb) | |
173 | '("libxml2" "ncurses" "python-wrapper" "source-highlight"))))) |