Unverified Commit db475b5c authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

Merge pull request #309564 from avnik/avnik/sysbench-improvements

sysbench: Use vendored statically linked libck
parents cfed66d1 2df7707d
Loading
Loading
Loading
Loading
+21 −3
Original line number Diff line number Diff line
@@ -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;