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