Commit | Line | Data |
---|---|---|
2ed5b0f4 | 1 | ;;; GNU Guix --- Functional package management for GNU |
cc1e1b38 | 2 | ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> |
fd19df72 | 3 | ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org> |
004dbec5 | 4 | ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr> |
0d01a5a9 | 5 | ;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il> |
7086540d | 6 | ;;; Copyright © 2017 Leo Famulari <leo@famulari.name> |
2062eae7 | 7 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
c5e4b4cc | 8 | ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com> |
e5fcff31 | 9 | ;;; Copyright © 2020 Mark Wielaard <mark@klomp.org> |
2ed5b0f4 LC |
10 | ;;; |
11 | ;;; This file is part of GNU Guix. | |
12 | ;;; | |
13 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
14 | ;;; under the terms of the GNU General Public License as published by | |
15 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
16 | ;;; your option) any later version. | |
17 | ;;; | |
18 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
19 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | ;;; GNU General Public License for more details. | |
22 | ;;; | |
23 | ;;; You should have received a copy of the GNU General Public License | |
24 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
25 | ||
26 | (define-module (gnu packages elf) | |
c24f1f16 | 27 | #:use-module (guix utils) |
2ed5b0f4 LC |
28 | #:use-module (guix packages) |
29 | #:use-module (guix download) | |
30 | #:use-module (guix build-system gnu) | |
3e778ad3 | 31 | #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+)) |
0841dcf7 | 32 | #:use-module (gnu packages) |
c5e4b4cc MB |
33 | #:use-module (gnu packages compression) |
34 | #:use-module (gnu packages documentation) | |
0d01a5a9 | 35 | #:use-module (gnu packages gcc) |
2ed5b0f4 | 36 | #:use-module (gnu packages m4) |
c5e4b4cc MB |
37 | #:use-module (gnu packages pkg-config) |
38 | #:use-module (gnu packages python) | |
9d0c291e | 39 | #:use-module (gnu packages sphinx) |
c5e4b4cc MB |
40 | #:use-module (gnu packages texinfo) |
41 | #:use-module (gnu packages xml)) | |
2ed5b0f4 LC |
42 | |
43 | (define-public elfutils | |
44 | (package | |
45 | (name "elfutils") | |
85fe0fe3 | 46 | (version "0.176") |
2ed5b0f4 LC |
47 | (source (origin |
48 | (method url-fetch) | |
7086540d LF |
49 | (uri (string-append "https://sourceware.org/elfutils/ftp/" |
50 | version "/elfutils-" version ".tar.bz2")) | |
2ed5b0f4 LC |
51 | (sha256 |
52 | (base32 | |
85fe0fe3 | 53 | "08qhrl4g6qqr4ga46jhh78y56a47p3msa5b2x1qhzbxhf71lfmzb")) |
fc1adab1 | 54 | (patches (search-patches "elfutils-tests-ptrace.patch")))) |
2ed5b0f4 LC |
55 | (build-system gnu-build-system) |
56 | ||
57 | ;; Separate programs because that's usually not what elfutils users want, | |
e5fcff31 MW |
58 | ;; and because they duplicate what Binutils provides (but are named |
59 | ;; differently, using the eu- prefix and can be installed in parallel). | |
2ed5b0f4 | 60 | (outputs '("out" ; libelf.so, elfutils/*.h, etc. |
e5fcff31 | 61 | "bin")) ; eu-nm, eu-objdump, etc. |
2ed5b0f4 | 62 | |
13cc689a LC |
63 | (arguments |
64 | ;; Programs don't have libelf.so in their RUNPATH and libraries don't | |
65 | ;; know where to find each other. | |
66 | `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath=" | |
67 | (assoc-ref %outputs "out") | |
0d91cd07 | 68 | "/lib")) |
8b71684a MW |
69 | |
70 | ;; Disable tests on MIPS (without changing | |
71 | ;; the arguments list on other systems). | |
72 | ,@(if (string-prefix? "mips" (or (%current-target-system) | |
73 | (%current-system))) | |
74 | '(#:tests? #f) | |
75 | '()) | |
76 | ||
0d91cd07 EF |
77 | #:phases |
78 | (modify-phases %standard-phases | |
79 | ;; No reason has been found for this test to reliably fail on aarch64-linux. | |
80 | (add-after 'unpack 'disable-failing-aarch64-tests | |
81 | (lambda _ | |
82 | (substitute* "tests/Makefile.in" | |
83 | (("run-backtrace-native.sh") "")) | |
84 | #t))))) | |
13cc689a | 85 | |
2ed5b0f4 LC |
86 | (native-inputs `(("m4" ,m4))) |
87 | (inputs `(("zlib" ,zlib))) | |
7086540d | 88 | (home-page "https://sourceware.org/elfutils/") |
e5fcff31 MW |
89 | (synopsis "Collection of utilities and libraries to handle ELF files and |
90 | DWARF data") | |
b6772a01 | 91 | (description |
e5fcff31 MW |
92 | "Elfutils is a collection of utilities and libraries to read, create and |
93 | modify Executable and Linkable Format (@dfn{ELF}) binary files, find and | |
94 | handle Debugging With Arbitrary Record Formats (@dfn{DWARF}) debug data, | |
95 | symbols, thread state and stacktraces for processes and core files on | |
96 | GNU/Linux. Elfutils includes @file{libelf} for manipulating ELF files, | |
97 | @file{libdw} for inspecting DWARF data and process state and utilities like | |
98 | @command{eu-stack} (to show backtraces), @command{eu-nm} (for listing symbols | |
99 | from object files), @command{eu-size} (for listing the section sizes of an | |
100 | object or archive file), @command{eu-strip} (for discarding symbols), | |
101 | @command{eu-readelf} (to see the raw ELF file structures), | |
102 | @command{eu-elflint} (to check for well-formed ELF files), | |
103 | @command{eu-elfcompress} (to compress or decompress ELF sections), and more.") | |
2ed5b0f4 LC |
104 | |
105 | ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+. | |
106 | (license lgpl3+))) | |
3e778ad3 | 107 | |
c5e4b4cc MB |
108 | (define-public libabigail |
109 | (package | |
110 | (name "libabigail") | |
111 | (home-page "https://sourceware.org/libabigail/") | |
29cc1154 | 112 | (version "1.6") |
c5e4b4cc MB |
113 | (source (origin |
114 | (method url-fetch) | |
4dfdcbf5 TGR |
115 | (uri (string-append "https://sourceware.org/pub/libabigail/" |
116 | "libabigail-" version ".tar.gz")) | |
c5e4b4cc MB |
117 | (sha256 |
118 | (base32 | |
29cc1154 | 119 | "04j07lhvwbp6qp8pdwbf7iqnr7kgpabmqylsw4invpmzwnyp6g6g")))) |
c5e4b4cc MB |
120 | (build-system gnu-build-system) |
121 | (arguments | |
122 | `(#:configure-flags '("--disable-static" | |
123 | "--enable-bash-completion" | |
124 | "--enable-manual") | |
125 | #:make-flags '("V=1") | |
126 | #:phases (modify-phases %standard-phases | |
127 | (add-after 'unpack 'patch-source | |
128 | (lambda _ | |
129 | (substitute* "build-aux/ltmain.sh" | |
130 | ;; Don't add -specs=/usr/lib/rpm/redhat/redhat-hardened-ld | |
131 | ;; to the GCC command line. | |
132 | (("compiler_flags=\"-specs=.*") | |
133 | "compiler_flags=\n")) | |
134 | #t)) | |
135 | (add-after 'build 'build-documentation | |
136 | (lambda _ | |
137 | (invoke "make" "-C" "doc/manuals" "html-doc" "man" "info"))) | |
138 | (add-before 'check 'set-test-environment | |
139 | (lambda _ | |
140 | (setenv "XDG_CACHE_HOME" "/tmp") | |
141 | #t)) | |
142 | (add-after 'install 'install-documentation | |
143 | (lambda _ | |
144 | (invoke "make" "-C" "doc/manuals" | |
145 | "install-man-and-info-doc"))) | |
146 | (add-after 'install-documentation 'install-bash-completion | |
147 | (lambda* (#:key outputs #:allow-other-keys) | |
148 | (for-each (lambda (file) | |
149 | (install-file | |
150 | file (string-append (assoc-ref outputs "out") | |
151 | "/share/bash-completion" | |
152 | "/completions"))) | |
153 | (find-files "bash-completion" ".*abi.*")) | |
154 | #t))))) | |
155 | (native-inputs | |
156 | `(("pkg-config" ,pkg-config) | |
157 | ("makeinfo" ,texinfo) | |
158 | ("python-sphinx" ,python-sphinx) | |
159 | ("python" ,python))) ;for tests | |
160 | (propagated-inputs | |
161 | `(("elfutils" ,elfutils) ;libabigail.la says -lelf | |
162 | ("libxml2" ,libxml2))) ;in Requires.private of libabigail.pc | |
163 | (synopsis "Analyze application binary interfaces (ABIs)") | |
164 | (description | |
165 | "@dfn{ABIGAIL} stands for the Application Binary Interface Generic | |
166 | Analysis and Instrumentation Library. It is a framework which aims at | |
167 | helping developers and software distributors to spot ABI-related issues | |
168 | like interface incompatibility in ELF shared libraries by performing a | |
169 | static analysis of the ELF binaries at hand.") | |
170 | (license lgpl3+))) | |
171 | ||
3e778ad3 LC |
172 | (define-public libelf |
173 | (package | |
174 | (name "libelf") | |
175 | (version "0.8.13") | |
f3addff2 TGR |
176 | (source |
177 | (origin | |
178 | (method url-fetch) | |
179 | (uri (list | |
180 | ;; As of May 2019, the original URL at mr511.de redirects to a | |
181 | ;; domain that doesn't resolve. Use these two mirrors instead. | |
182 | (string-append "https://fossies.org/linux/misc/old/" | |
183 | "libelf-" version ".tar.gz") | |
184 | (string-append "https://ftp.osuosl.org/pub/blfs/conglomeration/" | |
185 | "libelf/libelf-" version ".tar.gz"))) | |
186 | (sha256 | |
187 | (base32 | |
188 | "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr")))) | |
3e778ad3 | 189 | (build-system gnu-build-system) |
db700d58 EF |
190 | (arguments |
191 | `(#:phases | |
192 | (modify-phases %standard-phases | |
193 | (replace 'configure | |
194 | (lambda* (#:key outputs #:allow-other-keys) | |
195 | ;; This old `configure' script doesn't support | |
196 | ;; variables passed as arguments. | |
197 | (let ((out (assoc-ref outputs "out"))) | |
198 | (setenv "CONFIG_SHELL" (which "bash")) | |
257d8974 MW |
199 | (invoke "./configure" |
200 | (string-append "--prefix=" out) | |
db700d58 EF |
201 | ,@(if (string=? "aarch64-linux" |
202 | (%current-system)) | |
203 | '("--host=aarch64-unknown-linux-gnu") | |
257d8974 | 204 | '())))))))) |
f3addff2 TGR |
205 | (home-page (string-append "https://web.archive.org/web/20181111033959/" |
206 | "http://www.mr511.de/software/english.html")) | |
9e771e3b | 207 | (synopsis "ELF object file access library") |
35b9e423 | 208 | (description "Libelf is a C library to access ELF object files.") |
3e778ad3 LC |
209 | (license lgpl2.0+))) |
210 | ||
211 | (define-public patchelf | |
212 | (package | |
213 | (name "patchelf") | |
0d01a5a9 | 214 | (version "0.10") |
3e778ad3 LC |
215 | (source (origin |
216 | (method url-fetch) | |
217 | (uri (string-append | |
05666fb8 | 218 | "https://nixos.org/releases/patchelf/patchelf-" |
3e778ad3 LC |
219 | version |
220 | "/patchelf-" version ".tar.bz2")) | |
221 | (sha256 | |
222 | (base32 | |
0d01a5a9 | 223 | "1wzwvnlyf853hw9zgqq5522bvf8gqadk8icgqa41a5n7593csw7n")))) |
3e778ad3 | 224 | (build-system gnu-build-system) |
f7d2b496 | 225 | (arguments |
0d01a5a9 EF |
226 | '(#:phases |
227 | (modify-phases %standard-phases | |
228 | (add-after 'unpack 'fix-tests | |
229 | ;; Our GCC code ensures that RUNPATH is never empty, it includes | |
230 | ;; at least glibc/lib and gcc:lib/lib. | |
231 | (lambda* (#:key inputs #:allow-other-keys) | |
232 | (substitute* "tests/no-rpath.sh" | |
233 | ;; Disable checking for an empty runpath: | |
234 | (("^if test.*") "") | |
235 | ;; Find libgcc_s.so, which is necessary for the test: | |
236 | (("/xxxxxxxxxxxxxxx") (string-append (assoc-ref inputs "gcc:lib") | |
237 | "/lib"))) | |
238 | #t))))) | |
239 | (native-inputs | |
240 | `(("gcc:lib" ,gcc "lib"))) | |
775989c7 | 241 | (home-page "https://nixos.org/patchelf.html") |
3e778ad3 LC |
242 | (synopsis "Modify the dynamic linker and RPATH of ELF executables") |
243 | (description | |
244 | "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be | |
245 | changed.") | |
246 | (license gpl3+))) |