From 890c955eead364e53c770d5cf68364c1161fb6db Mon Sep 17 00:00:00 2001
From: Greg Hogan <code@greghogan.com>
Date: Mon, 18 Oct 2021 17:43:35 +0000
Subject: [PATCH 07/14] gnu: aws-c-auth: Update to 0.6.4.

* gnu/packages/c.scm (aws-c-auth): Update to 0.6.4.
[arguments]: Fix CMAKE_PREFIX_PATH, disable network tests.
[source]: Add and remove patches.
* gnu/packages/patches/aws-c-auth-install-private-headers.patch:
New file.
* gnu/packages/patches/aws-c-auth-cmake-prefix.patch,
gnu/packages/patches/aws-c-auth-disable-networking-tests.patch:
Delete files.
* gnu/local.mk: Add and remove them.
---
 gnu/local.mk                                  |  3 +-
 gnu/packages/c.scm                            | 13 ++--
 .../patches/aws-c-auth-cmake-prefix.patch     | 13 ----
 .../aws-c-auth-disable-networking-tests.patch | 64 -------------------
 .../aws-c-auth-install-private-headers.patch  | 19 ++++++
 5 files changed, 28 insertions(+), 84 deletions(-)
 delete mode 100644 gnu/packages/patches/aws-c-auth-cmake-prefix.patch
 delete mode 100644 gnu/packages/patches/aws-c-auth-disable-networking-tests.patch
 create mode 100644 gnu/packages/patches/aws-c-auth-install-private-headers.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 9104ff22a3..cdddaaf865 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -870,8 +870,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/avahi-localstatedir.patch		\
   %D%/packages/patches/avidemux-install-to-lib.patch		\
   %D%/packages/patches/awesome-reproducible-png.patch		\
-  %D%/packages/patches/aws-c-auth-cmake-prefix.patch		\
-  %D%/packages/patches/aws-c-auth-disable-networking-tests.patch\
+  %D%/packages/patches/aws-c-auth-install-private-headers.patch	\
   %D%/packages/patches/aws-c-event-stream-cmake-prefix.patch  \
   %D%/packages/patches/aws-c-mqtt-cmake-prefix.patch		\
   %D%/packages/patches/aws-c-s3-cmake-prefix.patch		\
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 43f775d41f..f87c51cefb 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -779,7 +779,8 @@ (define-public aws-c-compression
 (define-public aws-c-auth
   (package
     (name "aws-c-auth")
-    (version "0.6.0")
+    ; Update only when updating aws-crt-cpp.
+    (version "0.6.4")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -788,15 +789,17 @@ (define-public aws-c-auth
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0yh9s6q3ahq39xgvihp2a5cn9h39qlq8wfjc32m0ayi9x739rbqg"))
+                "120p69lj279yq3d2b81f45kgfrvf32j6m7s03m8hh27w8yd4vbfp"))
               (patches
                (search-patches
-                "aws-c-auth-cmake-prefix.patch"
-                "aws-c-auth-disable-networking-tests.patch"))))
+                "aws-c-auth-install-private-headers.patch"))))
     (build-system cmake-build-system)
     (arguments
      '(#:configure-flags
-       '("-DBUILD_SHARED_LIBS=ON")))
+       (list "-DBUILD_SHARED_LIBS=ON"
+             (string-append "-DCMAKE_PREFIX_PATH="
+                            (assoc-ref %build-inputs "aws-c-common"))
+             "-DENABLE_NET_TESTS=OFF")))
     (propagated-inputs
      `(("aws-c-cal" ,aws-c-cal)
        ("aws-c-common" ,aws-c-common)
diff --git a/gnu/packages/patches/aws-c-auth-cmake-prefix.patch b/gnu/packages/patches/aws-c-auth-cmake-prefix.patch
deleted file mode 100644
index da3e4eb4a5..0000000000
--- a/gnu/packages/patches/aws-c-auth-cmake-prefix.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,6 +6,10 @@ if (POLICY CMP0069)
-     cmake_policy(SET CMP0069 NEW) # Enable LTO/IPO if available in the compiler, see AwsCFlags
- endif()
- 
-+if (DEFINED ENV{CMAKE_PREFIX_PATH})
-+    set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
-+endif()
-+
- if (DEFINED CMAKE_PREFIX_PATH)
-     file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH)
- endif()
diff --git a/gnu/packages/patches/aws-c-auth-disable-networking-tests.patch b/gnu/packages/patches/aws-c-auth-disable-networking-tests.patch
deleted file mode 100644
index 905247f528..0000000000
--- a/gnu/packages/patches/aws-c-auth-disable-networking-tests.patch
+++ /dev/null
@@ -1,64 +0,0 @@
---- a/tests/CMakeLists.txt
-+++ b/tests/CMakeLists.txt
-@@ -19,8 +19,8 @@ add_test_case(profile_credentials_provider_environment_test)
- add_test_case(credentials_provider_first_in_chain_test)
- add_test_case(credentials_provider_second_in_chain_test)
- add_test_case(credentials_provider_null_chain_test)
--add_test_case(credentials_provider_default_basic_test)
--add_test_case(credentials_provider_default_manual_tls_test)
-+#add_test_case(credentials_provider_default_basic_test)
-+#add_test_case(credentials_provider_default_manual_tls_test)
- add_test_case(credentials_provider_imds_new_destroy)
- add_test_case(credentials_provider_imds_connect_failure)
- add_test_case(credentials_provider_imds_token_request_failure)
-@@ -58,28 +58,28 @@ add_test_case(credentials_provider_x509_basic_success)
- add_test_case(credentials_provider_x509_success_multi_part_doc)
- add_test_case(credentials_provider_x509_real_new_destroy)
- 
--add_net_test_case(credentials_provider_sts_web_identity_new_destroy_from_env)
--add_net_test_case(credentials_provider_sts_web_identity_new_destroy_from_config)
--add_net_test_case(credentials_provider_sts_web_identity_new_failed_without_env_and_config)
--add_net_test_case(credentials_provider_sts_web_identity_connect_failure)
--add_net_test_case(credentials_provider_sts_web_identity_request_failure)
--add_net_test_case(credentials_provider_sts_web_identity_bad_document_failure)
--add_net_test_case(credentials_provider_sts_web_identity_test_retry_error1)
--add_net_test_case(credentials_provider_sts_web_identity_test_retry_error2)
--add_net_test_case(credentials_provider_sts_web_identity_basic_success_env)
--add_net_test_case(credentials_provider_sts_web_identity_basic_success_config)
--add_net_test_case(credentials_provider_sts_web_identity_success_multi_part_doc)
--add_net_test_case(credentials_provider_sts_web_identity_real_new_destroy)
--
--add_net_test_case(credentials_provider_sts_direct_config_succeeds)
--add_net_test_case(credentials_provider_sts_direct_config_succeeds_after_retry)
--add_net_test_case(credentials_provider_sts_direct_config_invalid_doc)
--add_net_test_case(credentials_provider_sts_direct_config_connection_failed)
--add_net_test_case(credentials_provider_sts_direct_config_service_fails)
--add_net_test_case(credentials_provider_sts_from_profile_config_succeeds)
--add_net_test_case(credentials_provider_sts_from_profile_config_manual_tls_succeeds)
--add_net_test_case(credentials_provider_sts_from_profile_config_environment_succeeds)
--add_net_test_case(credentials_provider_sts_cache_expiration_conflict)
-+#add_net_test_case(credentials_provider_sts_web_identity_new_destroy_from_env)
-+#add_net_test_case(credentials_provider_sts_web_identity_new_destroy_from_config)
-+#add_net_test_case(credentials_provider_sts_web_identity_new_failed_without_env_and_config)
-+#add_net_test_case(credentials_provider_sts_web_identity_connect_failure)
-+#add_net_test_case(credentials_provider_sts_web_identity_request_failure)
-+#add_net_test_case(credentials_provider_sts_web_identity_bad_document_failure)
-+#add_net_test_case(credentials_provider_sts_web_identity_test_retry_error1)
-+#add_net_test_case(credentials_provider_sts_web_identity_test_retry_error2)
-+#add_net_test_case(credentials_provider_sts_web_identity_basic_success_env)
-+#add_net_test_case(credentials_provider_sts_web_identity_basic_success_config)
-+#add_net_test_case(credentials_provider_sts_web_identity_success_multi_part_doc)
-+#add_net_test_case(credentials_provider_sts_web_identity_real_new_destroy)
-+
-+#add_net_test_case(credentials_provider_sts_direct_config_succeeds)
-+#add_net_test_case(credentials_provider_sts_direct_config_succeeds_after_retry)
-+#add_net_test_case(credentials_provider_sts_direct_config_invalid_doc)
-+#add_net_test_case(credentials_provider_sts_direct_config_connection_failed)
-+#add_net_test_case(credentials_provider_sts_direct_config_service_fails)
-+#add_net_test_case(credentials_provider_sts_from_profile_config_succeeds)
-+#add_net_test_case(credentials_provider_sts_from_profile_config_manual_tls_succeeds)
-+#add_net_test_case(credentials_provider_sts_from_profile_config_environment_succeeds)
-+#add_net_test_case(credentials_provider_sts_cache_expiration_conflict)
- 
- add_test_case(credentials_provider_process_new_destroy_from_config)
- add_test_case(credentials_provider_process_new_failed)
diff --git a/gnu/packages/patches/aws-c-auth-install-private-headers.patch b/gnu/packages/patches/aws-c-auth-install-private-headers.patch
new file mode 100644
index 0000000000..990fd6f2eb
--- /dev/null
+++ b/gnu/packages/patches/aws-c-auth-install-private-headers.patch
@@ -0,0 +1,19 @@
+aws-sdk-cpp depends on the private headers from aws-c-auth. This dependency was
+added to aws-sdk-cpp in commit 23cca02c2df on 2021-06-04.
+
+The following error is generated when building aws-sdk-cpp when the private
+aws-c-auth headers are not installed:
+
+/tmp/guix-build-aws-sdk-cpp-1.9.121.drv-0/aws-sdk-cpp-1.9.121-checkout/aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp:17:10: fatal error: aws/auth/private/aws_signing.h: No such file or directory
+ #include <aws/auth/private/aws_signing.h>
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -110,6 +114,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC ${DEP_AWS_LIBS} ${PLATFORM_LIBS})
+ aws_prepare_shared_lib_exports(${PROJECT_NAME})
+ 
+ install(FILES ${AWS_AUTH_ROOT_HEADERS} DESTINATION "include/aws/auth" COMPONENT Development)
++install(FILES ${AWS_AUTH_PRIVATE_HEADERS} DESTINATION "include/aws/auth/private" COMPONENT Development)
+ 
+ if (BUILD_SHARED_LIBS)
+    set (TARGET_DIR "shared")
-- 
2.33.1

