fio: fix build on Darwin (#497450)

This commit is contained in:
Aleksana
2026-03-07 11:34:46 +00:00
committed by GitHub
+21 -8
View File
@@ -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/";