Unverified Commit 2871ea34 authored by Yueh-Shun Li's avatar Yueh-Shun Li Committed by GitHub
Browse files

azure-sdk-for-cpp: init at various versions (#348202)

parents 10596b65 651d15c2
Loading
Loading
Loading
Loading
+70 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  apple-sdk,
  macro-utils-c,
  umock-c,
  cmake,
  ninja,
  pkg-config,
  curl,
  openssl,
}:
stdenv.mkDerivation {
  pname = "azure-c-shared-utility";
  # Same version as in VCPKG as of July 2025.
  # https://github.com/microsoft/vcpkg/blob/master/ports/azure-c-shared-utility/portfile.cmake
  version = "LTS_07_2022_Ref02-unstable-2025-03-31";

  src = fetchFromGitHub {
    owner = "Azure";
    repo = "azure-c-shared-utility";
    rev = "772a4f8bc338140b4a0f404cf9c344283c5c937f";
    hash = "sha256-NSgY7EQhqR01s00mwgLJFMi8salbsCoAG2PMFrONBGk=";
  };

  # Using the cmake target instead of the variable correctly propagates
  # transitive dependencies when using static libraries.
  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail "\''${CURL_LIBRARIES}" "CURL::libcurl"
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    ninja
    pkg-config
  ];
  buildInputs = [
    macro-utils-c
    umock-c
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk;
  propagatedBuildInputs = [ curl ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) openssl;

  cmakeFlags = [
    "-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
    "-Duse_default_uuid=ON"
    "-Duse_installed_dependencies=ON"
  ];

  env = {
    NIX_CFLAGS_COMPILE = "-Wno-error";
  };

  postInstall = ''
    mkdir $out/include/azureiot
  '';

  meta = {
    homepage = "https://github.com/Azure/azure-c-shared-utility";
    description = "Azure C SDKs common code";
    sourceProvenance = [ lib.sourceTypes.fromSource ];
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.tobim ];
    platforms = lib.platforms.all;
  };
}
+80 −0
Original line number Diff line number Diff line
{
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  core,
  c-shared-utility,
  macro-utils-c,
  umock-c,
  nix-update-script,
  meta,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "azure-sdk-for-cpp-core-amqp";
  version = "1.0.0-beta.11";
  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "Azure";
    repo = "azure-sdk-for-cpp";
    tag = "azure-core-amqp_1.0.0-beta.11";
    hash = "sha256-MQsz5Dmv1BwfUaN1VXMC3hPdMHihlgOBaukp5wgTNJc=";
  };
  sourceRoot = "source/sdk/core/azure-core-amqp";

  postPatch = ''
    sed -i '/CMAKE_CXX_STANDARD/d' CMakeLists.txt
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    ninja
  ];

  propagatedBuildInputs = [
    core
    c-shared-utility
    macro-utils-c
    umock-c
  ];

  env = {
    AZURE_SDK_DISABLE_AUTO_VCPKG = 1;
    NIX_CFLAGS_COMPILE = "-Wno-error";
  };

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=ON"
    "-DDISABLE_RUST_IN_BUILD=ON"
    "-DWARNINGS_AS_ERRORS=OFF"
  ];

  postInstall = ''
    moveToOutput "share" "$dev"
    moveToOutput "share/$(basename "$sourceRoot")-cpp/copyright" "$out"
  '';

  # See note in ./core.nix.
  doCheck = false;

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version-regex"
      "azure-core-amqp_(.*)"
    ];
  };

  meta = (
    meta
    // {
      description = "Azure SDK AMQP Library for C++";
      changelog = "https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-amqp/CHANGELOG.md";
    }
  );
})
+72 −0
Original line number Diff line number Diff line
{
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  core,
  opentelemetry-cpp,
  nix-update-script,
  meta,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "azure-sdk-for-cpp-core-tracing-opentelemetry";
  version = "1.0.0-beta.4";
  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "Azure";
    repo = "azure-sdk-for-cpp";
    tag = "azure-core-tracing-opentelemetry_1.0.0-beta.4";
    hash = "sha256-3PqHpoi7zlTUYJ4A4APKp2yPg9nVwgGiyOZ+bng4Crk=";
  };
  sourceRoot = "source/sdk/core/azure-core-tracing-opentelemetry";

  postPatch = ''
    sed -i '/CMAKE_CXX_STANDARD/d' CMakeLists.txt
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [ opentelemetry-cpp ];
  propagatedBuildInputs = [ core ];

  env = {
    AZURE_SDK_DISABLE_AUTO_VCPKG = 1;
  };

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=ON"
    "-DWARNINGS_AS_ERRORS=OFF"
  ];

  postInstall = ''
    moveToOutput "share" "$dev"
    moveToOutput "share/$(basename "$sourceRoot")-cpp/copyright" "$out"
  '';

  # See note in ./core.nix.
  doCheck = false;

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version-regex"
      "azure-core-tracing-opentelemetry_(.*)"
    ];
  };

  meta = (
    meta
    // {
      description = "Azure SDK Core Tracing Library for C++";
      changelog = "https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core-tracing-opentelemetry/CHANGELOG.md";
    }
  );
})
+77 −0
Original line number Diff line number Diff line
{
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  curl,
  libxml2,
  nix-update-script,
  meta,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "azure-sdk-for-cpp-core";
  version = "1.16.1";
  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "Azure";
    repo = "azure-sdk-for-cpp";
    tag = "azure-core_1.16.1";
    hash = "sha256-gMINz3bH80l0QYX3iKJlL962WIMujR1wuN+t4t7g7qg=";
  };
  sourceRoot = "source/sdk/core/azure-core";

  postPatch = ''
    sed -i '/CMAKE_CXX_STANDARD/d' CMakeLists.txt
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    ninja
  ];

  propagatedBuildInputs = [
    curl
    libxml2
  ];

  env = {
    AZURE_SDK_DISABLE_AUTO_VCPKG = 1;
  };

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=ON"
    "-DBUILD_TRANSPORT_CURL=ON"
    "-DWARNINGS_AS_ERRORS=OFF"
  ];

  postInstall = ''
    moveToOutput "share" "$dev"
    moveToOutput "share/$(basename "$sourceRoot")-cpp/copyright" "$out"
  '';

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version-regex"
      "azure-core_(.*)"
    ];
  };

  # Testing this is moderately involved, see:
  # https://github.com/Azure/azure-sdk-for-cpp/blob/main/CONTRIBUTING.md#testing-the-project
  # Unless issues arise, it does not seem worth the effort.
  doCheck = false;

  meta = (
    meta
    // {
      description = "Azure SDK Core Library for C++";
      changelog = "https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/core/azure-core/CHANGELOG.md";
    }
  );
})
+76 −0
Original line number Diff line number Diff line
{
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  core,
  openssl,
  libxml2,
  nix-update-script,
  meta,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "azure-sdk-for-cpp-data-tables";
  version = "1.0.0-beta.6";
  outputs = [
    "out"
    "dev"
  ];

  src = fetchFromGitHub {
    owner = "Azure";
    repo = "azure-sdk-for-cpp";
    tag = "azure-data-tables_1.0.0-beta.6";
    hash = "sha256-gfkjoA16UP6ToIueYPfhQFh+LEhlVtvTk3qRJoHR5OY=";
  };
  sourceRoot = "source/sdk/tables/azure-data-tables";

  postPatch = ''
    sed -i '/CMAKE_CXX_STANDARD/d' CMakeLists.txt
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    ninja
  ];

  buildInputs = [
    openssl
    libxml2
  ];
  propagatedBuildInputs = [ core ];

  env = {
    AZURE_SDK_DISABLE_AUTO_VCPKG = 1;
  };

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=ON"
    "-DWARNINGS_AS_ERRORS=OFF"
  ];

  postInstall = ''
    moveToOutput "share" "$dev"
    moveToOutput "share/$(basename "$sourceRoot")-cpp/copyright" "$out"
  '';

  # See note in ./core.nix.
  doCheck = false;

  passthru.updateScript = nix-update-script {
    extraArgs = [
      "--version-regex"
      "azure-data-tables_(.*)"
    ];
  };

  meta = (
    meta
    // {
      description = "Azure Tables client library for C++";
      changelog = "https://github.com/Azure/azure-sdk-for-cpp/blob/main/sdk/tables/azure-data-tables/CHANGELOG.md";
    }
  );
})
Loading