1{
2 lib,
3 stdenv,
4 fetchgit,
5 autoreconfHook,
6 pkg-config,
7 cmocka,
8 acl,
9 libuuid,
10 lzo,
11 util-linux,
12 zlib,
13 zstd,
14}:
15
16stdenv.mkDerivation rec {
17 pname = "mtd-utils";
18 version = "2.3.0";
19
20 src = fetchgit {
21 url = "git://git.infradead.org/mtd-utils.git";
22 rev = "v${version}";
23 hash = "sha256-qQ8r0LBxwzdT9q9ILxKD1AfzLimaNHdc9BT3Rox1eXs=";
24 };
25
26 nativeBuildInputs = [
27 autoreconfHook
28 pkg-config
29 ]
30 ++ lib.optional doCheck cmocka;
31 buildInputs = [
32 acl
33 libuuid
34 lzo
35 util-linux
36 zlib
37 zstd
38 ];
39
40 postPatch = ''
41 substituteInPlace ubifs-utils/mount.ubifs \
42 --replace-fail "/bin/mount" "${util-linux}/bin/mount"
43 '';
44
45 enableParallelBuilding = true;
46
47 configureFlags = [
48 (lib.enableFeature doCheck "unit-tests")
49 (lib.enableFeature doCheck "tests")
50 ];
51
52 makeFlags = [ "AR:=$(AR)" ];
53
54 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
55
56 outputs = [
57 "out"
58 "dev"
59 ];
60
61 postInstall = ''
62 mkdir -p $dev/lib
63 mv *.a $dev/lib/
64 mv include $dev/
65 '';
66
67 meta = with lib; {
68 description = "Tools for MTD filesystems";
69 downloadPage = "https://git.infradead.org/mtd-utils.git";
70 license = licenses.gpl2Plus;
71 homepage = "http://www.linux-mtd.infradead.org/";
72 maintainers = with lib.maintainers; [ skeuchel ];
73 platforms = with platforms; linux;
74 };
75}