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 "0c5s9klq1zyb0zkmrw636k97kz30p5ih8y8dpq8b4f54r0a6j19w"))
42 (patches (search-patches "elfutils-tests-ptrace.patch"))))
43 (build-system gnu-build-system)
45 ;; Separate programs because that's usually not what elfutils users want,
46 ;; and because they duplicate what Binutils provides.
47 (outputs '("out" ; libelf.so, elfutils/*.h, etc.
48 "bin")) ; ld, nm, objdump, etc.
51 ;; Programs don't have libelf.so in their RUNPATH and libraries don't
52 ;; know where to find each other.
53 `(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
54 (assoc-ref %outputs "out")
57 (native-inputs `(("m4" ,m4)))
58 (inputs `(("zlib" ,zlib)))
59 (home-page "https://fedorahosted.org/elfutils/")
60 (synopsis "Linker and ELF manipulation tools")
62 "This package provides command-line tools to manipulate binaries in the
63 Executable and Linkable Format (ELF). This includes ld, ar, objdump,
64 addr2line, and more.")
66 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
75 (uri (string-append "http://www.mr511.de/software/libelf-"
79 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
80 (build-system gnu-build-system)
81 (arguments '(#:phases (alist-replace
83 (lambda* (#:key outputs #:allow-other-keys)
84 ;; This old `configure' script doesn't support
85 ;; variables passed as arguments.
86 (let ((out (assoc-ref outputs "out")))
87 (setenv "CONFIG_SHELL" (which "bash"))
89 (system* "./configure"
90 (string-append "--prefix=" out)))))
92 (home-page "http://www.mr511.de/software/english.html")
93 (synopsis "ELF object file access library")
94 (description "Libelf is a C library to access ELF object files.")
97 (define-public patchelf
104 "http://nixos.org/releases/patchelf/patchelf-"
106 "/patchelf-" version ".tar.bz2"))
109 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
110 (patches (search-patches "patchelf-page-size.patch"))))
111 (build-system gnu-build-system)
113 ;; XXX: The upstream 'patchelf' doesn't support ARM. The only available
114 ;; patch makes significant changes to the algorithm, possibly
115 ;; introducing bugs. So, we apply the patch only on ARM systems.
117 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
118 `(("patch/rework-for-arm" ,(search-patch
119 "patchelf-rework-for-arm.patch")))
122 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
123 `(#:phases (alist-cons-after
124 'unpack 'patch/rework-for-arm
125 (lambda* (#:key inputs #:allow-other-keys)
127 (assoc-ref inputs "patch/rework-for-arm")))
128 (zero? (system* "patch" "--force" "-p1"
129 "--input" patch-file))))
133 (home-page "http://nixos.org/patchelf.html")
134 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
136 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be