2022-08-19 13:39:45 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, libmysqlclient
|
|
|
|
, libaio
|
|
|
|
, luajit
|
|
|
|
# For testing:
|
|
|
|
, testers
|
|
|
|
, sysbench
|
2019-11-05 17:50:06 +00:00
|
|
|
}:
|
2012-10-26 13:45:16 +01:00
|
|
|
|
2019-11-05 17:50:06 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "sysbench";
|
2020-05-04 10:17:21 +01:00
|
|
|
version = "1.0.20";
|
2015-04-02 00:39:50 +01:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config ];
|
2024-04-29 12:25:09 +01:00
|
|
|
buildInputs = [ libmysqlclient luajit ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libaio ];
|
2023-12-19 20:14:52 +00:00
|
|
|
depsBuildBuild = [ pkg-config ];
|
2015-04-02 00:39:50 +01:00
|
|
|
|
2017-04-27 17:42:57 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "akopytov";
|
2019-11-05 17:50:06 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2020-05-04 10:17:21 +01:00
|
|
|
sha256 = "1sanvl2a52ff4shj62nw395zzgdgywplqvwip74ky8q7s6qjf5qy";
|
2012-10-26 13:45:16 +01:00
|
|
|
};
|
2015-04-02 00:39:50 +01:00
|
|
|
|
2019-11-05 17:50:06 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-08-19 13:39:45 +01:00
|
|
|
configureFlags = [
|
|
|
|
# The bundled version does not build on aarch64-darwin:
|
|
|
|
# https://github.com/akopytov/sysbench/issues/416
|
|
|
|
"--with-system-luajit"
|
2023-12-19 20:14:52 +00:00
|
|
|
"--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
|
|
|
|
"--with-mysql-libs=${libmysqlclient}/lib/mysql"
|
2022-08-19 13:39:45 +01:00
|
|
|
];
|
|
|
|
|
2024-04-29 12:25:09 +01: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-19 13:39:45 +01:00
|
|
|
passthru.tests = {
|
|
|
|
versionTest = testers.testVersion {
|
|
|
|
package = sysbench;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2012-10-26 13:45:16 +01:00
|
|
|
meta = {
|
2013-10-06 10:49:53 +01:00
|
|
|
description = "Modular, cross-platform and multi-threaded benchmark tool";
|
2024-03-19 02:14:51 +00:00
|
|
|
mainProgram = "sysbench";
|
2022-08-19 13:39:45 +01: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-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/akopytov/sysbench";
|
2022-08-19 13:39:45 +01:00
|
|
|
downloadPage = "https://github.com/akopytov/sysbench/releases/tag/${version}";
|
|
|
|
changelog = "https://github.com/akopytov/sysbench/blob/${version}/ChangeLog";
|
2021-01-23 12:26:19 +00:00
|
|
|
license = lib.licenses.gpl2;
|
2022-08-19 13:39:45 +01:00
|
|
|
platforms = lib.platforms.unix;
|
2012-10-26 13:45:16 +01:00
|
|
|
};
|
|
|
|
}
|