1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages elf)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu)
25 #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
26 #:use-module (gnu packages)
27 #:use-module (gnu packages m4)
28 #:use-module (gnu packages compression))
30 (define-public elfutils
37 "https://fedorahosted.org/releases/e/l/elfutils/"
38 version "/elfutils-" version ".tar.bz2"))
41 "0w50szymyqvx8g0vkwrvnv17grqxva6x1z9dm9m3i99zg2hr232p"))
43 (list (search-patch "elfutils-tests-ptrace.patch")))))
44 (build-system gnu-build-system)
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.
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")
58 (native-inputs `(("m4" ,m4)))
59 (inputs `(("zlib" ,zlib)))
60 (home-page "https://fedorahosted.org/elfutils/")
61 (synopsis "Linker and ELF manipulation tools")
63 "This package provides command-line tools to manipulate binaries in the
64 Executable and Linkable Format (ELF). This includes ld, ar, objdump,
65 addr2line, and more.")
67 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
76 (uri (string-append "http://www.mr511.de/software/libelf-"
80 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
81 (build-system gnu-build-system)
82 (arguments '(#:phases (alist-replace
84 (lambda* (#:key outputs #:allow-other-keys)
85 ;; This old `configure' script doesn't support
86 ;; variables passed as arguments.
87 (let ((out (assoc-ref outputs "out")))
88 (setenv "CONFIG_SHELL" (which "bash"))
90 (system* "./configure"
91 (string-append "--prefix=" out)))))
93 (home-page "http://www.mr511.de/software/english.html")
94 (synopsis "ELF object file access library")
95 (description "Libelf is a C library to access ELF object files.")
98 (define-public patchelf
105 "http://nixos.org/releases/patchelf/patchelf-"
107 "/patchelf-" version ".tar.bz2"))
110 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
111 (patches (list (search-patch "patchelf-page-size.patch")))))
112 (build-system gnu-build-system)
114 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
115 ;; patch makes significant changes to the algorithm, possibly
116 ;; introducing bugs. So, we apply the patch only on ARM systems.
118 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
119 `(("patch/rework-for-arm" ,(search-patch
120 "patchelf-rework-for-arm.patch")))
123 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
124 `(#:phases (alist-cons-after
125 'unpack 'patch/rework-for-arm
126 (lambda* (#:key inputs #:allow-other-keys)
128 (assoc-ref inputs "patch/rework-for-arm")))
129 (zero? (system* "patch" "--force" "-p1"
130 "--input" patch-file))))
134 (home-page "http://nixos.org/patchelf.html")
135 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
137 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be