1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 libuuid,
7 autoreconfHook,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "jfsutils";
12 version = "1.1.15";
13
14 src = fetchurl {
15 url = "mirror://sourceforge/jfs/jfsutils-${version}.tar.gz";
16 sha256 = "0kbsy2sk1jv4m82rxyl25gwrlkzvl3hzdga9gshkxkhm83v1aji4";
17 };
18
19 patches = [
20 ./types.patch
21 ./hardening-format.patch
22 # required for cross-compilation
23 ./ar-fix.patch
24 # fix for glibc>=2.28
25 (fetchpatch {
26 name = "add_sysmacros.patch";
27 url = "https://sources.debian.org/data/main/j/jfsutils/1.1.15-4/debian/patches/add_sysmacros.patch";
28 sha256 = "1qcwvxs4d0d24w5x98z59arqfx2n7f0d9xaqhjcg6w8n34vkhnyc";
29 })
30 # fix for musl
31 (fetchpatch {
32 name = "musl-fix-includes.patch";
33 url = "https://git.alpinelinux.org/aports/plain/main/jfsutils/musl-fix-includes.patch?id=567823dca7dc1f8ce919efbe99762d2d5c020124";
34 sha256 = "sha256-FjdUOI+y+MdSWxTR+csH41uR0P+PWWTfIMPwQjBfQtQ=";
35 })
36 ];
37
38 nativeBuildInputs = [ autoreconfHook ];
39 buildInputs = [ libuuid ];
40
41 # Workaround build failure on -fno-common toolchains like upstream
42 # gcc-10. Otherwise build fails as:
43 # ld: extract.o:/build/jfsutils-1.1.15/fscklog/extract.c:67: multiple definition of
44 # `xchklog_buffer'; display.o:/build/jfsutils-1.1.15/fscklog/display.c:57: first defined here
45 env.NIX_CFLAGS_COMPILE = "-fcommon";
46
47 # this required for wipefreespace
48 postInstall = ''
49 mkdir -p $out/include
50 cp include/*.h $out/include
51 mkdir -p $out/lib
52 cp ./libfs/libfs.a $out/lib
53 '';
54
55 meta = with lib; {
56 description = "IBM JFS utilities";
57 homepage = "https://jfs.sourceforge.net";
58 license = licenses.gpl3;
59 platforms = platforms.linux;
60 };
61}