1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
{
lib,
stdenv,
fetchurl,
fetchpatch,
pkg-config,
musl-fts,
musl-obstack,
m4,
zlib,
zstd,
bzip2,
bison,
flex,
gettext,
xz,
setupDebugInfoDirs,
argp-standalone,
enableDebuginfod ? lib.meta.availableOn stdenv.hostPlatform libarchive,
sqlite,
curl,
json_c,
libmicrohttpd,
libarchive,
gitUpdater,
}:
# TODO: Look at the hardcoded paths to kernel, modules etc.
stdenv.mkDerivation (finalAttrs: {
pname = "elfutils";
version = "0.195";
src = fetchurl {
url = "https://sourceware.org/elfutils/ftp/${finalAttrs.version}/elfutils-${finalAttrs.version}.tar.bz2";
hash = "sha256-N2Kf338fPcKBjhOPyiuAlBd9bC0PcB07tlClYSGNwCY=";
};
patches = [
./debug-info-from-env.patch
(fetchpatch {
name = "fix-aarch64_fregs.patch";
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/fix-aarch64_fregs.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
sha256 = "zvncoRkQx3AwPx52ehjA2vcFroF+yDC2MQR5uS6DATs=";
})
(fetchpatch {
name = "musl-asm-ptrace-h.patch";
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-asm-ptrace-h.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
sha256 = "8D1wPcdgAkE/TNBOgsHaeTZYhd9l+9TrZg8d5C7kG6k=";
})
(fetchpatch {
name = "musl-macros.patch";
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-macros.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
sha256 = "tp6O1TRsTAMsFe8vw3LMENT/vAu6OmyA8+pzgThHeA8=";
})
(fetchpatch {
name = "musl-strndupa.patch";
url = "https://git.alpinelinux.org/aports/plain/main/elfutils/musl-strndupa.patch?id=2e3d4976eeffb4704cf83e2cc3306293b7c7b2e9";
sha256 = "sha256-7daehJj1t0wPtQzTv+/Rpuqqs5Ng/EYnZzrcf2o/Lb0=";
})
(fetchpatch {
name = "fix-i386_tlsdesc_relocation.patch";
url = "https://sourceware.org/git/?p=elfutils.git;a=patch;h=bfd519cc58e190544a6785d3f0a27fcfaf7d8da3";
hash = "sha256-N7DL2FG1AWLc+hcnxGMbUl5TuieoAc9OD6gc0sbsiGI=";
})
]
++ lib.optionals stdenv.hostPlatform.isMusl [ ./musl-error_h.patch ];
postPatch = ''
patchShebangs tests/*.sh
''
+ lib.optionalString stdenv.hostPlatform.isRiscV ''
# disable failing test:
#
# > dwfl_thread_getframes: No DWARF information found
sed -i s/run-backtrace-dwarf.sh//g tests/Makefile.in
'';
outputs = [
"bin"
"dev"
"out"
"man"
];
# We need bzip2 in NativeInputs because otherwise we can't unpack the src,
# as the host-bzip2 will be in the path.
nativeBuildInputs = [
m4
bison
flex
gettext
bzip2
pkg-config
];
buildInputs = [
zlib
zstd
bzip2
xz
]
++ lib.optionals stdenv.hostPlatform.isMusl [
argp-standalone
musl-fts
musl-obstack
]
++ lib.optionals enableDebuginfod [
sqlite
curl
json_c
libmicrohttpd
libarchive
];
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
strictDeps = true;
hardeningDisable = [ "strictflexarrays3" ];
configureFlags = [
"--program-prefix=eu-" # prevent collisions with binutils
"--enable-deterministic-archives"
(lib.enableFeature enableDebuginfod "libdebuginfod")
(lib.enableFeature enableDebuginfod "debuginfod")
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766
# Versioned symbols are nice to have, but we can do without.
(lib.enableFeature (!stdenv.hostPlatform.isMicroBlaze) "symbol-versioning")
]
++ lib.optional (stdenv.targetPlatform.useLLVM or false) "--disable-demangler";
enableParallelBuilding = true;
doCheck =
# Backtrace unwinding tests rely on glibc-internal symbol names.
# Musl provides slightly different forms and fails.
# Let's disable tests there until musl support is fully upstreamed.
!stdenv.hostPlatform.isMusl
# Test suite tries using `uname` to determine whether certain tests
# can be executed, so we need to match build and host platform exactly.
&& (stdenv.hostPlatform == stdenv.buildPlatform);
doInstallCheck = !stdenv.hostPlatform.isMusl && (stdenv.hostPlatform == stdenv.buildPlatform);
passthru.updateScript = gitUpdater {
url = "https://sourceware.org/git/elfutils.git";
rev-prefix = "elfutils-";
};
__structuredAttrs = true;
meta = {
homepage = "https://sourceware.org/elfutils/";
description = "Set of utilities to handle ELF objects";
platforms = lib.platforms.linux;
# https://lists.fedorahosted.org/pipermail/elfutils-devel/2014-November/004223.html
badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ];
# licenses are GPL2 or LGPL3+ for libraries, GPL3+ for bins,
# but since this package isn't split that way, all three are listed.
license = with lib.licenses; [
gpl2Only
lgpl3Plus
gpl3Plus
];
maintainers = with lib.maintainers; [ r-burns ];
identifiers.cpeParts = lib.meta.cpeFullVersionWithVendor "elfutils_project" finalAttrs.version;
};
})
|