Unverified Commit 3f35f03f authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

fio: fix build on Darwin (#497450)

parents cf5c011a db6eb61d
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -6,11 +6,12 @@
  makeWrapper,
  libaio,
  pkg-config,
  cunit,
  python3,
  zlib,
  withGnuplot ? false,
  gnuplot,
  withLibnbd ? true,
  withLibnbd ? stdenv.hostPlatform.isLinux,
  libnbd,
}:

@@ -21,8 +22,8 @@ stdenv.mkDerivation (finalAttrs: {
  src = fetchFromGitHub {
    owner = "axboe";
    repo = "fio";
    rev = "fio-${finalAttrs.version}";
    sha256 = "sha256-m4JskjSc/KHjID+6j/hbhnGzehPxMxA3m2Iyn49bJDU=";
    tag = "fio-${finalAttrs.version}";
    hash = "sha256-m4JskjSc/KHjID+6j/hbhnGzehPxMxA3m2Iyn49bJDU=";
  };

  patches = [
@@ -34,6 +35,7 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  buildInputs = [
    cunit
    python3
    zlib
  ]
@@ -44,7 +46,10 @@ stdenv.mkDerivation (finalAttrs: {
  # We use $CC instead.
  configurePlatforms = [ ];

  configureFlags = lib.optional withLibnbd "--enable-libnbd";
  configureFlags = [
    "--disable-native"
  ]
  ++ lib.optional withLibnbd "--enable-libnbd";

  dontAddStaticConfigureFlags = true;

@@ -59,10 +64,8 @@ stdenv.mkDerivation (finalAttrs: {
  enableParallelBuilding = true;

  postPatch = ''
    substituteInPlace Makefile \
      --replace "mandir = /usr/share/man" "mandir = \$(prefix)/man" \
      --replace "sharedir = /usr/share/fio" "sharedir = \$(prefix)/share/fio"
    substituteInPlace tools/plot/fio2gnuplot --replace /usr/share/fio $out/share/fio
    substituteInPlace tools/plot/fio2gnuplot \
      --replace-fail /usr/share/fio $out/share/fio
  '';

  pythonPath = [ python3.pkgs.six ];
@@ -75,6 +78,16 @@ stdenv.mkDerivation (finalAttrs: {
    wrapPythonProgramsIn "$out/bin" "$out ''${pythonPath[*]}"
  '';

  doCheck = true;

  checkPhase = ''
    runHook preCheck

    ./unittests/unittest

    runHook postCheck
  '';

  meta = {
    description = "Flexible IO Tester - an IO benchmark tool";
    homepage = "https://git.kernel.dk/cgit/fio/";