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