gnu: Add texlive-latex-etoolbox.
[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>
eb9a6033 5;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
7086540d 6;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
2ed5b0f4
LC
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages elf)
24 #:use-module (guix packages)
25 #:use-module (guix download)
26 #:use-module (guix build-system gnu)
3e778ad3 27 #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
0841dcf7 28 #:use-module (gnu packages)
2ed5b0f4
LC
29 #:use-module (gnu packages m4)
30 #:use-module (gnu packages compression))
31
32(define-public elfutils
33 (package
34 (name "elfutils")
c0ad2808 35 (version "0.169")
2ed5b0f4
LC
36 (source (origin
37 (method url-fetch)
7086540d
LF
38 (uri (string-append "https://sourceware.org/elfutils/ftp/"
39 version "/elfutils-" version ".tar.bz2"))
2ed5b0f4
LC
40 (sha256
41 (base32
c0ad2808 42 "1hiv1yqig3292dwqhrwsxwk3qjalxp5fpl8yphwbfwh8ng3zl4ll"))
fc1adab1 43 (patches (search-patches "elfutils-tests-ptrace.patch"))))
2ed5b0f4
LC
44 (build-system gnu-build-system)
45
46 ;; Separate programs because that's usually not what elfutils users want,
47 ;; and because they duplicate what Binutils provides.
48 (outputs '("out" ; libelf.so, elfutils/*.h, etc.
49 "bin")) ; ld, nm, objdump, etc.
50
13cc689a
LC
51 (arguments
52 ;; Programs don't have libelf.so in their RUNPATH and libraries don't
53 ;; know where to find each other.
54 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
55 (assoc-ref %outputs "out")
56 "/lib"))))
57
2ed5b0f4
LC
58 (native-inputs `(("m4" ,m4)))
59 (inputs `(("zlib" ,zlib)))
7086540d 60 (home-page "https://sourceware.org/elfutils/")
b6772a01
LC
61 (synopsis "Linker and ELF manipulation tools")
62 (description
63 "This package provides command-line tools to manipulate binaries in the
64Executable and Linkable Format (ELF). This includes ld, ar, objdump,
65addr2line, and more.")
2ed5b0f4
LC
66
67 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
68 (license lgpl3+)))
3e778ad3
LC
69
70(define-public libelf
71 (package
72 (name "libelf")
73 (version "0.8.13")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append "http://www.mr511.de/software/libelf-"
77 version ".tar.gz"))
78 (sha256
79 (base32
80 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
81 (build-system gnu-build-system)
db700d58
EF
82 (arguments
83 `(#:phases
84 (modify-phases %standard-phases
85 (replace 'configure
86 (lambda* (#:key outputs #:allow-other-keys)
87 ;; This old `configure' script doesn't support
88 ;; variables passed as arguments.
89 (let ((out (assoc-ref outputs "out")))
90 (setenv "CONFIG_SHELL" (which "bash"))
91 (zero?
92 (system* "./configure"
93 (string-append "--prefix=" out)
94 ,@(if (string=? "aarch64-linux"
95 (%current-system))
96 '("--host=aarch64-unknown-linux-gnu")
97 '())))))))))
3e778ad3 98 (home-page "http://www.mr511.de/software/english.html")
9e771e3b 99 (synopsis "ELF object file access library")
35b9e423 100 (description "Libelf is a C library to access ELF object files.")
3e778ad3
LC
101 (license lgpl2.0+)))
102
103(define-public patchelf
104 (package
105 (name "patchelf")
fd19df72 106 (version "0.8")
3e778ad3
LC
107 (source (origin
108 (method url-fetch)
109 (uri (string-append
110 "http://nixos.org/releases/patchelf/patchelf-"
111 version
112 "/patchelf-" version ".tar.bz2"))
113 (sha256
114 (base32
fd19df72 115 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
fc1adab1 116 (patches (search-patches "patchelf-page-size.patch"))))
3e778ad3 117 (build-system gnu-build-system)
f7d2b496
MW
118
119 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
120 ;; patch makes significant changes to the algorithm, possibly
121 ;; introducing bugs. So, we apply the patch only on ARM systems.
122 (inputs
123 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
124 `(("patch/rework-for-arm" ,(search-patch
125 "patchelf-rework-for-arm.patch")))
126 '()))
127 (arguments
128 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
129 `(#:phases (alist-cons-after
130 'unpack 'patch/rework-for-arm
131 (lambda* (#:key inputs #:allow-other-keys)
132 (let ((patch-file
133 (assoc-ref inputs "patch/rework-for-arm")))
134 (zero? (system* "patch" "--force" "-p1"
135 "--input" patch-file))))
136 %standard-phases))
137 '()))
138
3e778ad3
LC
139 (home-page "http://nixos.org/patchelf.html")
140 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
141 (description
142 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be
143changed.")
144 (license gpl3+)))