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