about summary refs log tree commit diff
path: root/pkgs/development/libraries/libeatmydata/default.nix
blob: 9e8d5970431c919d62e6da3e1bf6568b4827a5ed (plain) (blame)
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
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch2
, fetchurl
, autoreconfHook
, strace
, which
}:

stdenv.mkDerivation rec {
  pname = "libeatmydata";
  version = "131";

  src = fetchFromGitHub {
    owner = "stewartsmith";
    repo = pname;
    rev = "refs/tags/v${version}";
    sha256 = "sha256-0lrYDW51/KSr809whGwg9FYhzcLRfmoxipIgrK1zFCc=";
  };

  patches = [
    # Fixes "error: redefinition of 'open'" on musl
    (fetchpatch2 {
      url = "https://raw.githubusercontent.com/void-linux/void-packages/861ac185a6b60134292ff93d40e40b5391d0aa8e/srcpkgs/libeatmydata/patches/musl.patch";
      hash = "sha256-MZfTgf2Qn94UpPlYNRM2zK99iKQorKQrlbU5/1WJhJM=";
    })

    # Don't use transitional LFS64 API, removed in musl 1.2.4.
    (fetchurl {
      url = "https://git.alpinelinux.org/aports/plain/main/libeatmydata/lfs64.patch?id=f87f2c59384cc4a8a1b71aaa875be2b3ae2dbce0";
      hash = "sha256-5Jhy9gunKcbrSmLh0DoP/uwJLgaLd+zKV2iVxiDwiHs=";
    })
  ];

  configureFlags = [
    "CFLAGS=-D_FILE_OFFSET_BITS=64"
  ];

  postPatch = ''
    patchShebangs .
  '';

  nativeBuildInputs = [
    autoreconfHook
  ];

  nativeCheckInputs = [
    strace
    which
  ];

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  enableParallelBuilding = true;

  meta = with lib; {
    description = "Small LD_PRELOAD library to disable fsync and friends";
    homepage = "https://www.flamingspork.com/projects/libeatmydata/";
    license = licenses.gpl3Plus;
    mainProgram = "eatmydata";
    platforms = platforms.unix;
  };
}