1{stdenv, fetchurl, m4, zlib, bzip2, bison, flex, gettext}:
2
3# TODO: Look at the hardcoded paths to kernel, modules etc.
4stdenv.mkDerivation rec {
5 name = "elfutils-${version}";
6 version = "0.163";
7
8 src = fetchurl {
9 urls = [
10 "http://fedorahosted.org/releases/e/l/elfutils/${version}/${name}.tar.bz2"
11 "mirror://gentoo/distfiles/${name}.tar.bz2"
12 ];
13 sha256 = "7c774f1eef329309f3b05e730bdac50013155d437518a2ec0e24871d312f2e23";
14 };
15
16 patches = [
17 (fetchurl {
18 url = "http://fedorahosted.org/releases/e/l/elfutils/${version}/elfutils-portability-${version}.patch";
19 sha256 = "e4e82315dad2efaa4e4476503e7537e01b7c1b1f98a96de4ca1c7fa85f4f1045";
20 }) ];
21
22 # We need bzip2 in NativeInputs because otherwise we can't unpack the src,
23 # as the host-bzip2 will be in the path.
24 nativeBuildInputs = [m4 bison flex gettext bzip2];
25 buildInputs = [zlib bzip2];
26
27 configureFlags = "--disable-werror";
28
29 crossAttrs = {
30
31 /* Having bzip2 will harm, because anything using elfutils
32 as buildInput cross-building, will not be able to run 'bzip2' */
33 propagatedBuildInputs = [ zlib.crossDrv ];
34
35 # This program does not cross-build fine. So I only cross-build some parts
36 # I need for the linux perf tool.
37 # On the awful cross-building:
38 # http://comments.gmane.org/gmane.comp.sysutils.elfutils.devel/2005
39 #
40 # I wrote this testing for the nanonote.
41 buildPhase = ''
42 pushd libebl
43 make
44 popd
45 pushd libelf
46 make
47 popd
48 pushd libdwfl
49 make
50 popd
51 pushd libdw
52 make
53 popd
54 '';
55
56 installPhase = ''
57 pushd libelf
58 make install
59 popd
60 pushd libdwfl
61 make install
62 popd
63 pushd libdw
64 make install
65 popd
66 cp version.h $out/include
67 '';
68 };
69
70 dontAddDisableDepTrack = true;
71
72 meta = {
73 homepage = https://fedorahosted.org/elfutils/;
74 };
75}