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