gnu: linux-libre: Update to 5.3.10.
[jackhill/guix/guix.git] / gnu / packages / elf.scm
CommitLineData
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>
0d91cd07 5;;; Copyright © 2017, 2018 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>
2ed5b0f4
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
25(define-module (gnu packages elf)
c24f1f16 26 #:use-module (guix utils)
2ed5b0f4
LC
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
3e778ad3 30 #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
0841dcf7 31 #:use-module (gnu packages)
c5e4b4cc
MB
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages documentation)
2ed5b0f4 34 #:use-module (gnu packages m4)
c5e4b4cc
MB
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages python)
9d0c291e 37 #:use-module (gnu packages sphinx)
c5e4b4cc
MB
38 #:use-module (gnu packages texinfo)
39 #:use-module (gnu packages xml))
2ed5b0f4
LC
40
41(define-public elfutils
42 (package
43 (name "elfutils")
85fe0fe3 44 (version "0.176")
2ed5b0f4
LC
45 (source (origin
46 (method url-fetch)
7086540d
LF
47 (uri (string-append "https://sourceware.org/elfutils/ftp/"
48 version "/elfutils-" version ".tar.bz2"))
2ed5b0f4
LC
49 (sha256
50 (base32
85fe0fe3 51 "08qhrl4g6qqr4ga46jhh78y56a47p3msa5b2x1qhzbxhf71lfmzb"))
fc1adab1 52 (patches (search-patches "elfutils-tests-ptrace.patch"))))
2ed5b0f4
LC
53 (build-system gnu-build-system)
54
55 ;; Separate programs because that's usually not what elfutils users want,
56 ;; and because they duplicate what Binutils provides.
57 (outputs '("out" ; libelf.so, elfutils/*.h, etc.
58 "bin")) ; ld, nm, objdump, etc.
59
13cc689a
LC
60 (arguments
61 ;; Programs don't have libelf.so in their RUNPATH and libraries don't
62 ;; know where to find each other.
63 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
64 (assoc-ref %outputs "out")
0d91cd07 65 "/lib"))
8b71684a
MW
66
67 ;; Disable tests on MIPS (without changing
68 ;; the arguments list on other systems).
69 ,@(if (string-prefix? "mips" (or (%current-target-system)
70 (%current-system)))
71 '(#:tests? #f)
72 '())
73
0d91cd07
EF
74 #:phases
75 (modify-phases %standard-phases
76 ;; No reason has been found for this test to reliably fail on aarch64-linux.
77 (add-after 'unpack 'disable-failing-aarch64-tests
78 (lambda _
79 (substitute* "tests/Makefile.in"
80 (("run-backtrace-native.sh") ""))
81 #t)))))
13cc689a 82
2ed5b0f4
LC
83 (native-inputs `(("m4" ,m4)))
84 (inputs `(("zlib" ,zlib)))
7086540d 85 (home-page "https://sourceware.org/elfutils/")
b6772a01
LC
86 (synopsis "Linker and ELF manipulation tools")
87 (description
88 "This package provides command-line tools to manipulate binaries in the
5b707ab6
TGR
89Executable and Linkable Format (@dfn{ELF}). This includes @command{ld},
90@command{ar}, @command{objdump}, @command{addr2line}, and more.")
2ed5b0f4
LC
91
92 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
93 (license lgpl3+)))
3e778ad3 94
c5e4b4cc
MB
95(define-public libabigail
96 (package
97 (name "libabigail")
98 (home-page "https://sourceware.org/libabigail/")
29cc1154 99 (version "1.6")
c5e4b4cc
MB
100 (source (origin
101 (method url-fetch)
4dfdcbf5
TGR
102 (uri (string-append "https://sourceware.org/pub/libabigail/"
103 "libabigail-" version ".tar.gz"))
c5e4b4cc
MB
104 (sha256
105 (base32
29cc1154 106 "04j07lhvwbp6qp8pdwbf7iqnr7kgpabmqylsw4invpmzwnyp6g6g"))))
c5e4b4cc
MB
107 (build-system gnu-build-system)
108 (arguments
109 `(#:configure-flags '("--disable-static"
110 "--enable-bash-completion"
111 "--enable-manual")
112 #:make-flags '("V=1")
113 #:phases (modify-phases %standard-phases
114 (add-after 'unpack 'patch-source
115 (lambda _
116 (substitute* "build-aux/ltmain.sh"
117 ;; Don't add -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
118 ;; to the GCC command line.
119 (("compiler_flags=\"-specs=.*")
120 "compiler_flags=\n"))
121 #t))
122 (add-after 'build 'build-documentation
123 (lambda _
124 (invoke "make" "-C" "doc/manuals" "html-doc" "man" "info")))
125 (add-before 'check 'set-test-environment
126 (lambda _
127 (setenv "XDG_CACHE_HOME" "/tmp")
128 #t))
129 (add-after 'install 'install-documentation
130 (lambda _
131 (invoke "make" "-C" "doc/manuals"
132 "install-man-and-info-doc")))
133 (add-after 'install-documentation 'install-bash-completion
134 (lambda* (#:key outputs #:allow-other-keys)
135 (for-each (lambda (file)
136 (install-file
137 file (string-append (assoc-ref outputs "out")
138 "/share/bash-completion"
139 "/completions")))
140 (find-files "bash-completion" ".*abi.*"))
141 #t)))))
142 (native-inputs
143 `(("pkg-config" ,pkg-config)
144 ("makeinfo" ,texinfo)
145 ("python-sphinx" ,python-sphinx)
146 ("python" ,python))) ;for tests
147 (propagated-inputs
148 `(("elfutils" ,elfutils) ;libabigail.la says -lelf
149 ("libxml2" ,libxml2))) ;in Requires.private of libabigail.pc
150 (synopsis "Analyze application binary interfaces (ABIs)")
151 (description
152 "@dfn{ABIGAIL} stands for the Application Binary Interface Generic
153Analysis and Instrumentation Library. It is a framework which aims at
154helping developers and software distributors to spot ABI-related issues
155like interface incompatibility in ELF shared libraries by performing a
156static analysis of the ELF binaries at hand.")
157 (license lgpl3+)))
158
3e778ad3
LC
159(define-public libelf
160 (package
161 (name "libelf")
162 (version "0.8.13")
f3addff2
TGR
163 (source
164 (origin
165 (method url-fetch)
166 (uri (list
167 ;; As of May 2019, the original URL at mr511.de redirects to a
168 ;; domain that doesn't resolve. Use these two mirrors instead.
169 (string-append "https://fossies.org/linux/misc/old/"
170 "libelf-" version ".tar.gz")
171 (string-append "https://ftp.osuosl.org/pub/blfs/conglomeration/"
172 "libelf/libelf-" version ".tar.gz")))
173 (sha256
174 (base32
175 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
3e778ad3 176 (build-system gnu-build-system)
db700d58
EF
177 (arguments
178 `(#:phases
179 (modify-phases %standard-phases
180 (replace 'configure
181 (lambda* (#:key outputs #:allow-other-keys)
182 ;; This old `configure' script doesn't support
183 ;; variables passed as arguments.
184 (let ((out (assoc-ref outputs "out")))
185 (setenv "CONFIG_SHELL" (which "bash"))
257d8974
MW
186 (invoke "./configure"
187 (string-append "--prefix=" out)
db700d58
EF
188 ,@(if (string=? "aarch64-linux"
189 (%current-system))
190 '("--host=aarch64-unknown-linux-gnu")
257d8974 191 '()))))))))
f3addff2
TGR
192 (home-page (string-append "https://web.archive.org/web/20181111033959/"
193 "http://www.mr511.de/software/english.html"))
9e771e3b 194 (synopsis "ELF object file access library")
35b9e423 195 (description "Libelf is a C library to access ELF object files.")
3e778ad3
LC
196 (license lgpl2.0+)))
197
198(define-public patchelf
199 (package
200 (name "patchelf")
fd19df72 201 (version "0.8")
3e778ad3
LC
202 (source (origin
203 (method url-fetch)
204 (uri (string-append
05666fb8 205 "https://nixos.org/releases/patchelf/patchelf-"
3e778ad3
LC
206 version
207 "/patchelf-" version ".tar.bz2"))
208 (sha256
209 (base32
fd19df72 210 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
fc1adab1 211 (patches (search-patches "patchelf-page-size.patch"))))
3e778ad3 212 (build-system gnu-build-system)
f7d2b496
MW
213
214 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
215 ;; patch makes significant changes to the algorithm, possibly
216 ;; introducing bugs. So, we apply the patch only on ARM systems.
217 (inputs
c24f1f16 218 (if (target-arm32?)
f7d2b496
MW
219 `(("patch/rework-for-arm" ,(search-patch
220 "patchelf-rework-for-arm.patch")))
221 '()))
222 (arguments
c24f1f16 223 (if (target-arm32?)
dbc75dad
MB
224 `(#:phases
225 (modify-phases %standard-phases
226 (add-after 'unpack 'patch/rework-for-arm
227 (lambda* (#:key inputs #:allow-other-keys)
228 (let ((patch-file (assoc-ref inputs "patch/rework-for-arm")))
229 (invoke "patch" "--force" "-p1" "--input" patch-file))))))
f7d2b496
MW
230 '()))
231
775989c7 232 (home-page "https://nixos.org/patchelf.html")
3e778ad3
LC
233 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
234 (description
235 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be
236changed.")
237 (license gpl3+)))