1{ lib, stdenv, fetchurl, m4, zlib, bzip2, bison, flex, gettext, xz, setupDebugInfoDirs }:
2
3# TODO: Look at the hardcoded paths to kernel, modules etc.
4stdenv.mkDerivation rec {
5 name = "elfutils-${version}";
6 version = "0.176";
7
8 src = fetchurl {
9 url = "https://sourceware.org/elfutils/ftp/${version}/${name}.tar.bz2";
10 sha256 = "08qhrl4g6qqr4ga46jhh78y56a47p3msa5b2x1qhzbxhf71lfmzb";
11 };
12
13 patches = [ ./debug-info-from-env.patch ];
14
15 postPatch = ''
16 patchShebangs tests
17 '';
18
19 hardeningDisable = [ "format" ];
20
21 # We need bzip2 in NativeInputs because otherwise we can't unpack the src,
22 # as the host-bzip2 will be in the path.
23 nativeBuildInputs = [ m4 bison flex gettext bzip2 ];
24 buildInputs = [ zlib bzip2 xz ];
25
26 propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
27
28 configureFlags =
29 [ "--program-prefix=eu-" # prevent collisions with binutils
30 "--enable-deterministic-archives"
31 ];
32
33 enableParallelBuilding = true;
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
42 buildPhase = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
43 pushd libebl
44 make
45 popd
46 pushd libelf
47 make
48 popd
49 pushd libdwfl
50 make
51 popd
52 pushd libdw
53 make
54 popd
55 '';
56
57 installPhase = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
58 pushd libelf
59 make install
60 popd
61 pushd libdwfl
62 make install
63 popd
64 pushd libdw
65 make install
66 popd
67 cp version.h $out/include
68 '';
69
70 doCheck = false; # fails 3 out of 174 tests
71 doInstallCheck = false; # fails 70 out of 174 tests
72
73 meta = {
74 homepage = https://sourceware.org/elfutils/;
75 description = "A set of utilities to handle ELF objects";
76 platforms = lib.platforms.linux;
77 license = lib.licenses.gpl3;
78 maintainers = [ lib.maintainers.eelco ];
79 };
80}