gnu: upower: Enable GObject introspection.
[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>
2ed5b0f4
LC
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)
3e778ad3 25 #:use-module ((guix licenses) #:select (gpl3+ lgpl3+ lgpl2.0+))
0841dcf7 26 #:use-module (gnu packages)
2ed5b0f4
LC
27 #:use-module (gnu packages m4)
28 #:use-module (gnu packages compression))
29
30(define-public elfutils
31 (package
32 (name "elfutils")
004dbec5 33 (version "0.161")
2ed5b0f4
LC
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
cc1e1b38
LC
41 "0w50szymyqvx8g0vkwrvnv17grqxva6x1z9dm9m3i99zg2hr232p"))
42 (patches
43 (list (search-patch "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)))
60 (home-page "https://fedorahosted.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)
82 (arguments '(#:phases (alist-replace
83 'configure
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"))
89 (zero?
90 (system* "./configure"
91 (string-append "--prefix=" out)))))
92 %standard-phases)))
93 (home-page "http://www.mr511.de/software/english.html")
9e771e3b 94 (synopsis "ELF object file access library")
35b9e423 95 (description "Libelf is a C library to access ELF object files.")
3e778ad3
LC
96 (license lgpl2.0+)))
97
98(define-public patchelf
99 (package
100 (name "patchelf")
fd19df72 101 (version "0.8")
3e778ad3
LC
102 (source (origin
103 (method url-fetch)
104 (uri (string-append
105 "http://nixos.org/releases/patchelf/patchelf-"
106 version
107 "/patchelf-" version ".tar.bz2"))
108 (sha256
109 (base32
fd19df72 110 "1rqpg84wrd3fa16wa9vqdvasnc05yz49w207cz1l0wrl4k8q97y9"))
0841dcf7 111 (patches (list (search-patch "patchelf-page-size.patch")))))
3e778ad3 112 (build-system gnu-build-system)
f7d2b496
MW
113
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.
117 (inputs
118 (if (string-prefix? "arm" (or (%current-target-system) (%current-system)))
119 `(("patch/rework-for-arm" ,(search-patch
120 "patchelf-rework-for-arm.patch")))
121 '()))
122 (arguments
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)
127 (let ((patch-file
128 (assoc-ref inputs "patch/rework-for-arm")))
129 (zero? (system* "patch" "--force" "-p1"
130 "--input" patch-file))))
131 %standard-phases))
132 '()))
133
3e778ad3
LC
134 (home-page "http://nixos.org/patchelf.html")
135 (synopsis "Modify the dynamic linker and RPATH of ELF executables")
136 (description
137 "PatchELF allows the ELF \"interpreter\" and RPATH of an ELF binary to be
138changed.")
139 (license gpl3+)))