sysbench: Use vendored statically linked libck

This partially revert and redo 4af1355454
Vendored version of concurrency kit (aka libck) require little more
patching to support cross-compilation
This commit is contained in:
Alexander V. Nikolaev 2024-04-29 14:25:09 +03:00 committed by Jörg Thalheim
parent 3b61d595b1
commit 2df7707d2b

View File

@ -5,7 +5,6 @@
, pkg-config
, libmysqlclient
, libaio
, libck
, luajit
# For testing:
, testers
@ -17,7 +16,7 @@ stdenv.mkDerivation rec {
version = "1.0.20";
nativeBuildInputs = [ autoreconfHook pkg-config ];
buildInputs = [ libmysqlclient luajit libck ] ++ lib.optionals stdenv.isLinux [ libaio ];
buildInputs = [ libmysqlclient luajit ] ++ lib.optionals stdenv.isLinux [ libaio ];
depsBuildBuild = [ pkg-config ];
src = fetchFromGitHub {
@ -33,11 +32,30 @@ stdenv.mkDerivation rec {
# The bundled version does not build on aarch64-darwin:
# https://github.com/akopytov/sysbench/issues/416
"--with-system-luajit"
"--with-system-ck"
"--with-mysql-includes=${lib.getDev libmysqlclient}/include/mysql"
"--with-mysql-libs=${libmysqlclient}/lib/mysql"
];
# 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"
'';
passthru.tests = {
versionTest = testers.testVersion {
package = sysbench;