Unverified Commit b58c7088 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #243288 from gaelreyrol/libpulsar-update-3.2.0

libpulsar: 2.10.2 -> 3.5.0, pythonPackages.pulsar: init at 3.4.1
parents e7b5a19d 46f48e86
Loading
Loading
Loading
Loading
+22 −33
Original line number Diff line number Diff line
{ lib
, clang-tools
, llvmPackages
, boost179
, protobuf
, python3Support ? false
, python3
, asioSupport ? true
, asio
, boost180
, log4cxxSupport ? false
, log4cxx
, snappySupport ? false
@@ -17,7 +14,8 @@
, gtestSupport ? false
, cmake
, curl
, fetchurl
, fetchFromGitHub
, protobuf
, jsoncpp
, openssl
, pkg-config
@@ -37,48 +35,39 @@ let
  */
  enableCmakeFeature = p: if (p == null || p == false) then "OFF" else "ON";

  # Not really sure why I need to do this.. If I call clang-tools without the override it defaults to a different version and fails
  clangTools = clang-tools.override { inherit stdenv llvmPackages; };
  # If boost has python enabled, then boost-python package will be installed which is used by libpulsars python wrapper
  boost = if python3Support then boost179.override { inherit stdenv; enablePython = python3Support; python = python3; } else boost179;
  defaultOptionals = [ boost protobuf ]
    ++ lib.optional python3Support python3
  defaultOptionals = [ protobuf ]
    ++ lib.optional snappySupport snappy.dev
    ++ lib.optional zlibSupport zlib
    ++ lib.optional zstdSupport zstd
    ++ lib.optional log4cxxSupport log4cxx;
    ++ lib.optional log4cxxSupport log4cxx
    ++ lib.optional asioSupport asio
    ++ lib.optional (!asioSupport) boost180;

in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: rec {
  pname = "libpulsar";
  version = "2.10.2";
  version = "3.5.0";

  src = fetchurl {
    hash = "sha256-IONnsSDbnX2qz+Xya0taHYSViTOiRI36AfcxmY3dNpo=";
    url = "mirror://apache/pulsar/pulsar-${version}/apache-pulsar-${version}-src.tar.gz";
  src = fetchFromGitHub {
    owner = "apache";
    repo = "pulsar-client-cpp";
    rev = "v${version}";
    hash = "sha256-pNeoStDryyMtBolpp5nT5GFjYPuXg2ks1Ka1mjjN/9k=";
  };

  sourceRoot = "apache-pulsar-${version}-src/pulsar-client-cpp";

  # clang-tools needed for clang-format
  nativeBuildInputs = [ cmake pkg-config clangTools ]
  nativeBuildInputs = [ cmake pkg-config ]
    ++ defaultOptionals
    ++ lib.optional gtestSupport gtest.dev;

  buildInputs = [ jsoncpp openssl curl ]
    ++ defaultOptionals;

  # Needed for GCC on Linux
  env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=return-type" ];

  cmakeFlags = [
    "-DBUILD_TESTS=${enableCmakeFeature gtestSupport}"
    "-DBUILD_PYTHON_WRAPPER=${enableCmakeFeature python3Support}"
    "-DUSE_LOG4CXX=${enableCmakeFeature log4cxxSupport}"
    "-DClangTools_PATH=${clangTools}/bin"
    "-DUSE_ASIO=${enableCmakeFeature asioSupport}"
  ];

  enableParallelBuilding = true;
  doInstallCheck = true;
  installCheckPhase = ''
    echo ${lib.escapeShellArg ''
@@ -92,11 +81,11 @@ stdenv.mkDerivation rec {
  '';

  meta = with lib; {
    homepage = "https://pulsar.apache.org/docs/en/client-libraries-cpp";
    homepage = "https://pulsar.apache.org/docs/next/client-libraries-cpp/";
    description = "Apache Pulsar C++ library";

    changelog = "https://github.com/apache/pulsar-client-cpp/releases/tag/v${version}";
    platforms = platforms.all;
    license = licenses.asl20;
    maintainers = [ maintainers.corbanr ];
    maintainers = with maintainers; [ corbanr gaelreyrol ];
  };
}
})
+60 −0
Original line number Diff line number Diff line
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, cmake
, pkg-config
, libpulsar
, pybind11
, certifi
}:

buildPythonPackage rec {
  pname = "pulsar";
  version = "3.4.0";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "apache";
    repo = "pulsar-client-python";
    rev = "v${version}";
    hash = "sha256-WcD88s8V4AT/juW0qmYHdtYzrS3hWeom/4r8TETlmFE=";
  };

  disabled = pythonOlder "3.7";

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    libpulsar
    pybind11
  ];

  preBuild = ''
    make -j$NIX_BUILD_CORES
    make install
    cd ..
  '';

  propagatedBuildInputs = [
    certifi
  ];

  # Requires to setup a cluster
  doCheck = false;

  pythonImportsCheck = [
    "pulsar"
  ];

  meta = with lib; {
    description = "Apache Pulsar Python client library";
    homepage = "https://pulsar.apache.org/docs/next/client-libraries-python/";
    changelog = "https://github.com/apache/pulsar-client-python/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ gaelreyrol ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -10299,6 +10299,8 @@ self: super: with self; {
  pulsectl-asyncio = callPackage ../development/python-modules/pulsectl-asyncio { };
  pulsar = callPackage ../development/python-modules/pulsar { };
  pulsectl = callPackage ../development/python-modules/pulsectl { };
  pure-cdb = callPackage ../development/python-modules/pure-cdb { };