1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 autoreconfHook,
7 pkg-config,
8 libiconv,
9 gettext,
10 xxd,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "dosfstools";
15 version = "4.2";
16
17 src = fetchFromGitHub {
18 owner = "dosfstools";
19 repo = "dosfstools";
20 rev = "v${version}";
21 sha256 = "sha256-2gxB0lQixiHOHw8uTetHekaM57fvUd9zOzSxWnvUz/c=";
22 };
23
24 patches = [
25 # macOS and FreeBSD build fixes backported from master
26 # TODO: remove on the next release
27 (fetchpatch {
28 url = "https://github.com/dosfstools/dosfstools/commit/77ffb87e8272760b3bb2dec8f722103b0effb801.patch";
29 sha256 = "sha256-xHxIs3faHK/sK3vAVoG8JcTe4zAV+ZtkozWIIFBvPWI=";
30 })
31 (fetchpatch {
32 url = "https://github.com/dosfstools/dosfstools/commit/2d3125c4a74895eae1f66b93287031d340324524.patch";
33 sha256 = "nlIuRDsNjk23MKZL9cZ05odOfTXvsyQaKcv/xEr4c+U=";
34 })
35 # reproducible builds fix backported from master
36 # (respect SOURCE_DATE_EPOCH)
37 # TODO: remove on the next release
38 (fetchpatch {
39 url = "https://github.com/dosfstools/dosfstools/commit/8da7bc93315cb0c32ad868f17808468b81fa76ec.patch";
40 sha256 = "sha256-Quegj5uYZgACgjSZef6cjrWQ64SToGQxbxyqCdl8C7o=";
41 })
42 ./gettext-0.25.patch
43 ];
44
45 nativeBuildInputs = [
46 autoreconfHook
47 gettext
48 pkg-config
49 ]
50 ++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
51
52 configureFlags = [ "--enable-compat-symlinks" ];
53
54 nativeCheckInputs = [ xxd ];
55 doCheck = true;
56
57 meta = {
58 description = "Utilities for creating and checking FAT and VFAT file systems";
59 homepage = "https://github.com/dosfstools/dosfstools";
60 platforms = lib.platforms.unix;
61 license = lib.licenses.gpl3;
62 };
63}