about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/aws-crt-cpp
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/aws-crt-cpp')
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-crt-cpp/0001-build-Make-includedir-properly-overrideable.patch59
-rw-r--r--nixpkgs/pkgs/development/libraries/aws-crt-cpp/default.nix80
2 files changed, 139 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/aws-crt-cpp/0001-build-Make-includedir-properly-overrideable.patch b/nixpkgs/pkgs/development/libraries/aws-crt-cpp/0001-build-Make-includedir-properly-overrideable.patch
new file mode 100644
index 000000000000..2b06ce0aec63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-crt-cpp/0001-build-Make-includedir-properly-overrideable.patch
@@ -0,0 +1,59 @@
+From fd3f3a28e7fce7fe4e10ed2d7edc4bfda8ab27df Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Sun, 9 Jan 2022 01:57:18 +0100
+Subject: [PATCH] build: Make includedir properly overrideable
+
+This is required by some package managers like Nix.
+---
+ CMakeLists.txt | 22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ec6d172..6514c23 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -49,6 +49,10 @@ if(${CMAKE_INSTALL_LIBDIR} STREQUAL "lib64")
+     set(FIND_LIBRARY_USE_LIB64_PATHS true)
+ endif()
+ 
++if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
++    set(CMAKE_INSTALL_INCLUDEDIR "include")
++endif()
++
+ if(NOT CMAKE_CXX_STANDARD)
+     set(CMAKE_CXX_STANDARD 11)
+ endif()
+@@ -307,7 +311,7 @@ endif()
+ target_include_directories(${PROJECT_NAME} PUBLIC
+     $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+     $<BUILD_INTERFACE:${GENERATED_INCLUDE_DIR}>
+-    $<INSTALL_INTERFACE:include>)
++    $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
+ 
+ aws_use_package(aws-c-http)
+ aws_use_package(aws-c-mqtt)
+@@ -324,14 +328,14 @@ aws_add_sanitizers(${PROJECT_NAME})
+ 
+ target_link_libraries(${PROJECT_NAME} PUBLIC ${DEP_AWS_LIBS})
+ 
+-install(FILES ${AWS_CRT_HEADERS} DESTINATION "include/aws/crt" COMPONENT Development)
+-install(FILES ${AWS_CRT_AUTH_HEADERS} DESTINATION "include/aws/crt/auth" COMPONENT Development)
+-install(FILES ${AWS_CRT_CRYPTO_HEADERS} DESTINATION "include/aws/crt/crypto" COMPONENT Development)
+-install(FILES ${AWS_CRT_IO_HEADERS} DESTINATION "include/aws/crt/io" COMPONENT Development)
+-install(FILES ${AWS_CRT_IOT_HEADERS} DESTINATION "include/aws/iot" COMPONENT Development)
+-install(FILES ${AWS_CRT_MQTT_HEADERS} DESTINATION "include/aws/crt/mqtt" COMPONENT Development)
+-install(FILES ${AWS_CRT_HTTP_HEADERS} DESTINATION "include/aws/crt/http" COMPONENT Development)
+-install(FILES ${AWS_CRT_ENDPOINT_HEADERS} DESTINATION "include/aws/crt/endpoints" COMPONENT Development)
++install(FILES ${AWS_CRT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt" COMPONENT Development)
++install(FILES ${AWS_CRT_AUTH_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/auth" COMPONENT Development)
++install(FILES ${AWS_CRT_CRYPTO_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/crypto" COMPONENT Development)
++install(FILES ${AWS_CRT_IO_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/io" COMPONENT Development)
++install(FILES ${AWS_CRT_IOT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/iot" COMPONENT Development)
++install(FILES ${AWS_CRT_MQTT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/mqtt" COMPONENT Development)
++install(FILES ${AWS_CRT_HTTP_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/http" COMPONENT Development)
++install(FILES ${AWS_CRT_ENDPOINT_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aws/crt/endpoints" COMPONENT Development)
+ 
+ install(
+     TARGETS ${PROJECT_NAME}
+-- 
+2.42.0
diff --git a/nixpkgs/pkgs/development/libraries/aws-crt-cpp/default.nix b/nixpkgs/pkgs/development/libraries/aws-crt-cpp/default.nix
new file mode 100644
index 000000000000..0cd6e4940c4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/aws-crt-cpp/default.nix
@@ -0,0 +1,80 @@
+{ lib, stdenv
+, fetchFromGitHub
+, aws-c-auth
+, aws-c-cal
+, aws-c-common
+, aws-c-compression
+, aws-c-event-stream
+, aws-c-http
+, aws-c-io
+, aws-c-mqtt
+, aws-c-s3
+, aws-checksums
+, cmake
+, s2n-tls
+, nix
+}:
+
+stdenv.mkDerivation rec {
+  pname = "aws-crt-cpp";
+  version = "0.24.7";
+
+  outputs = [ "out" "dev" ];
+
+  src = fetchFromGitHub {
+    owner = "awslabs";
+    repo = "aws-crt-cpp";
+    rev = "v${version}";
+    sha256 = "sha256-AYO0ckqEx2jG7HduvaxASQMOsxuHGkRkyVsUP5WOs98=";
+  };
+
+  patches = [
+    # Correct include path for split outputs.
+    # https://github.com/awslabs/aws-crt-cpp/pull/325
+    ./0001-build-Make-includedir-properly-overrideable.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace CMakeLists.txt --replace '-Werror' ""
+  '';
+
+  nativeBuildInputs = [
+    cmake
+  ];
+
+  propagatedBuildInputs = [
+    aws-c-auth
+    aws-c-cal
+    aws-c-common
+    aws-c-compression
+    aws-c-event-stream
+    aws-c-http
+    aws-c-io
+    aws-c-mqtt
+    aws-c-s3
+    aws-checksums
+    s2n-tls
+  ];
+
+  cmakeFlags = [
+    "-DBUILD_DEPS=OFF"
+    "-DBUILD_SHARED_LIBS=ON"
+  ];
+
+  postInstall = ''
+    # Prevent dependency cycle.
+    moveToOutput lib/aws-crt-cpp/cmake "$dev"
+  '';
+
+  passthru.tests = {
+    inherit nix;
+  };
+
+  meta = with lib; {
+    description = "C++ wrapper around the aws-c-* libraries";
+    homepage = "https://github.com/awslabs/aws-crt-cpp";
+    license = licenses.asl20;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ r-burns ];
+  };
+}