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