2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, libmysqlclient
|
|
|
|
, libaio
|
|
|
|
, luajit
|
|
|
|
# For testing:
|
|
|
|
, testers
|
|
|
|
, sysbench
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sysbench";
|
2020-05-15 21:57:56 +00:00
|
|
|
version = "1.0.20";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = [ libmysqlclient luajit ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libaio ];
|
2024-01-02 11:29:13 +00:00
|
|
|
depsBuildBuild = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "akopytov";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-05-15 21:57:56 +00:00
|
|
|
sha256 = "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
configureFlags = [
|
|
|
|
# The bundled version does not build on aarch64-darwin:
|
|
|
|
# https://github.com/akopytov/sysbench/issues/416
|
|
|
|
"--with-system-luajit"
|
2024-01-02 11:29:13 +00:00
|
|
|
"--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
|
|
|
|
"--with-mysql-libs=${libmysqlclient}/lib/mysql"
|
2022-08-21 13:32:41 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# We cannot use the regular nixpkgs ck here, since it has very
|
|
|
|
# different performance characteristics than the vendored one.
|
|
|
|
# On the downside the vendored libck version require more fixes for cross-compilation.
|
|
|
|
# Sysbench related on statically linked vendored libck.
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace \
|
|
|
|
third_party/concurrency_kit/ck/configure \
|
|
|
|
--replace-fail \
|
|
|
|
'COMPILER=`./.1 2> /dev/null`' \
|
|
|
|
"COMPILER=${if stdenv.cc.isGNU then "gcc" else if stdenv.cc.isClang then "clang" else throw "Unsupported compiler"}" \
|
|
|
|
--replace-fail \
|
|
|
|
'PLATFORM=`uname -m 2> /dev/null`' \
|
|
|
|
"PLATFORM=${stdenv.hostPlatform.parsed.cpu.name}"
|
|
|
|
substituteInPlace \
|
|
|
|
third_party/concurrency_kit/ck/src/Makefile.in \
|
|
|
|
--replace-fail \
|
|
|
|
"ar rcs" \
|
|
|
|
"${stdenv.cc.targetPrefix}ar rcs"
|
|
|
|
'';
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
passthru.tests = {
|
|
|
|
versionTest = testers.testVersion {
|
|
|
|
package = sysbench;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "Modular, cross-platform and multi-threaded benchmark tool";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "sysbench";
|
2022-08-21 13:32:41 +00:00
|
|
|
longDescription = ''
|
|
|
|
sysbench is a scriptable multi-threaded benchmark tool based on LuaJIT.
|
|
|
|
It is most frequently used for database benchmarks, but can also be used
|
|
|
|
to create arbitrarily complex workloads that do not involve a database
|
|
|
|
server.
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/akopytov/sysbench";
|
2022-08-21 13:32:41 +00:00
|
|
|
downloadPage = "https://github.com/akopytov/sysbench/releases/tag/${version}";
|
|
|
|
changelog = "https://github.com/akopytov/sysbench/blob/${version}/ChangeLog";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.gpl2;
|
2022-08-21 13:32:41 +00:00
|
|
|
platforms = lib.platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|