gnu: Add enet.
[jackhill/guix/guix.git] / gnu / packages / elf.scm
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>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
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.
12 ;;;
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.
17 ;;;
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/>.
20
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))
29
30 (define-public elfutils
31 (package
32 (name "elfutils")
33 (version "0.166")
34 (source (origin
35 (method url-fetch)
36 (uri (string-append
37 "https://fedorahosted.org/releases/e/l/elfutils/"
38 version "/elfutils-" version ".tar.bz2"))
39 (sha256
40 (base32
41 "0c5s9klq1zyb0zkmrw636k97kz30p5ih8y8dpq8b4f54r0a6j19w"))
42 (patches (search-patches "elfutils-tests-ptrace.patch"))))
43 (build-system gnu-build-system)
44
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.
49
50 (arguments
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")
55 "/lib"))))
56
57 (native-inputs `(("m4" ,m4)))
58 (inputs `(("zlib" ,zlib)))
59 (home-page "https://fedorahosted.org/elfutils/")
60 (synopsis "Linker and ELF manipulation tools")
61 (description
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.")
65
66 ;; Libraries are dual-licensed LGPLv3.0+ | GPLv2, and programs are GPLv3+.
67 (license lgpl3+)))
68
69 (define-public libelf
70 (package
71 (name "libelf")
72 (version "0.8.13")
73 (source (origin
74 (method url-fetch)
75 (uri (string-append "http://www.mr511.de/software/libelf-"
76 version ".tar.gz"))
77 (sha256
78 (base32
79 "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr"))))
80 (build-system gnu-build-system)
81 (arguments '(#:phases (alist-replace
82 'configure
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"))
88 (zero?
89 (system* "./configure"
90 (string-append "--prefix=" out)))))
91 %standard-phases)))
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.")
95 (license lgpl2.0+)))
96
97 (define-public patchelf
98 (package
99 (name "patchelf")
100 (version "0.8")
101 (source (origin
102 (method url-fetch)
103 (uri (string-append
104 "http://nixos.org/releases/patchelf/patchelf-"
105 version
106 "/patchelf-" version ".tar.bz2"))
107 (sha256
108 (base32
109 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
110 (patches (search-patches "patchelf-page-size.patch"))))
111 (build-system gnu-build-system)
112
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.
116 (inputs
117 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
118 `(("patch/rework-for-arm" ,(search-patch
119 "patchelf-rework-for-arm.patch")))
120 '()))
121 (arguments
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)
126 (let ((patch-file
127 (assoc-ref inputs "patch/rework-for-arm")))
128 (zero? (system* "patch" "--force" "-p1"
129 "--input" patch-file))))
130 %standard-phases))
131 '()))
132
133 (home-page "http://nixos.org/patchelf.html")
134 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
135 (description
136 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be
137 changed.")
138 (license gpl3+)))