git: 61c876ad8ccc - main - devel/rubygem-aws-crt: Add rubygem-aws-crt 0.1.5

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sat, 30 Jul 2022 06:01:36 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=61c876ad8ccca9b24b12db2586fbc3ffe135cb1f

commit 61c876ad8ccca9b24b12db2586fbc3ffe135cb1f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-07-30 05:56:32 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-07-30 05:56:32 +0000

    devel/rubygem-aws-crt: Add rubygem-aws-crt 0.1.5
    
    AWS Common Runtime for Ruby
    
    The AWS Common Runtime (CRT) libraries are a base library of the SDKs. The CRT
    is a modular family of independent packages, written in C. Each package provides
    good performance and minimal footprint for different required functionalities.
    These functionalities are common and shared across all SDKs providing better
    code reuse, optimization, and accuracy.
    
    WWW: https://github.com/awslabs/aws-crt-ruby
---
 devel/Makefile                                     |  1 +
 devel/rubygem-aws-crt/Makefile                     | 29 ++++++++++++++++++++++
 devel/rubygem-aws-crt/distinfo                     |  3 +++
 .../files/patch-aws-crt-ffi-crt-s2n-CMakeLists.txt | 17 +++++++++++++
 ...-aws-crt-ffi-crt-s2n-utils-s2n_fork_detection.c | 13 ++++++++++
 devel/rubygem-aws-crt/files/patch-powerpc64le      | 27 ++++++++++++++++++++
 devel/rubygem-aws-crt/pkg-descr                    |  9 +++++++
 devel/rubygem-aws-crt/pkg-plist                    |  6 +++++
 8 files changed, 105 insertions(+)

diff --git a/devel/Makefile b/devel/Makefile
index 3b26052f395a..7c3f9a4f41a5 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -5721,6 +5721,7 @@
     SUBDIR += rubygem-avro
     SUBDIR += rubygem-awesome_print
     SUBDIR += rubygem-awrence
+    SUBDIR += rubygem-aws-crt
     SUBDIR += rubygem-aws-eventstream
     SUBDIR += rubygem-aws-partitions
     SUBDIR += rubygem-aws-sdk
diff --git a/devel/rubygem-aws-crt/Makefile b/devel/rubygem-aws-crt/Makefile
new file mode 100644
index 000000000000..df728e9cc8fa
--- /dev/null
+++ b/devel/rubygem-aws-crt/Makefile
@@ -0,0 +1,29 @@
+PORTNAME=	aws-crt
+PORTVERSION=	0.1.5
+CATEGORIES=	devel rubygems
+MASTER_SITES=	RG
+
+MAINTAINER=	sunpoet@FreeBSD.org
+COMMENT=	AWS SDK for Ruby - Common Run Time
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+BUILD_DEPENDS=	cmake:devel/cmake
+RUN_DEPENDS=	rubygem-ffi>=0:devel/rubygem-ffi
+
+USES=		gem python:env shebangfix
+USE_RUBY=	yes
+
+#NO_ARCH=	yes
+
+SHEBANG_FILES=	aws-crt-ffi/crt/s2n/tests/litani/* \
+		aws-crt-ffi/crt/s2n/tests/litani/*/* \
+		aws-crt-ffi/crt/s2n/tests/litani/*/*/*
+SHEBANG_GLOB=	*.py *.sh
+
+post-install:
+	${RM} -r ${STAGEDIR}${PREFIX}/${GEM_LIB_DIR}/tmp/
+	${REINPLACE_CMD} -e '/${GEM_LIB_DIR}\/tmp\//d' ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/devel/rubygem-aws-crt/distinfo b/devel/rubygem-aws-crt/distinfo
new file mode 100644
index 000000000000..ab21a9ebe66d
--- /dev/null
+++ b/devel/rubygem-aws-crt/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1658506549
+SHA256 (rubygem/aws-crt-0.1.5.gem) = 32e42ecb8d7e9d172852cedbbafa6e4692d6bd449730ac443b9daa331f3b7d8d
+SIZE (rubygem/aws-crt-0.1.5.gem) = 49263616
diff --git a/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-CMakeLists.txt b/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-CMakeLists.txt
new file mode 100644
index 000000000000..d3121011d646
--- /dev/null
+++ b/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-CMakeLists.txt
@@ -0,0 +1,17 @@
+--- aws-crt-ffi/crt/s2n/CMakeLists.txt.orig	2022-07-30 03:57:27 UTC
++++ aws-crt-ffi/crt/s2n/CMakeLists.txt
+@@ -460,10 +460,10 @@ if (__RESTRICT__SUPPORTED)
+     target_compile_options(${PROJECT_NAME} PUBLIC -DS2N___RESTRICT__SUPPORTED)
+ endif()
+ 
+-if (MADVISE_SUPPORTED)
+-    target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_MADVISE_SUPPORTED)
+-    message(STATUS "madvise() support detected")
+-endif()
++#if (MADVISE_SUPPORTED)
++#    target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_MADVISE_SUPPORTED)
++#    message(STATUS "madvise() support detected")
++#endif()
+ 
+ if (MINHERIT_SUPPORTED)
+     target_compile_options(${PROJECT_NAME} PUBLIC -DS2N_MINHERIT_SUPPORTED)
diff --git a/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-utils-s2n_fork_detection.c b/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-utils-s2n_fork_detection.c
new file mode 100644
index 000000000000..a22fc992b91f
--- /dev/null
+++ b/devel/rubygem-aws-crt/files/patch-aws-crt-ffi-crt-s2n-utils-s2n_fork_detection.c
@@ -0,0 +1,13 @@
+--- aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c.orig	2022-07-30 03:57:28 UTC
++++ aws-crt-ffi/crt/s2n/utils/s2n_fork_detection.c
+@@ -25,6 +25,10 @@
+     #define _GNU_SOURCE
+ #endif
+ 
++#if !defined(__BSD_VISIBLE)
++#define __BSD_VISIBLE 1
++#endif
++
+ #include <sys/mman.h>
+ 
+ /* Not always defined for Darwin */
diff --git a/devel/rubygem-aws-crt/files/patch-powerpc64le b/devel/rubygem-aws-crt/files/patch-powerpc64le
new file mode 100644
index 000000000000..4223d8e1ef21
--- /dev/null
+++ b/devel/rubygem-aws-crt/files/patch-powerpc64le
@@ -0,0 +1,27 @@
+Reference:	https://cgit.freebsd.org/ports/commit/?id=f08b67611f0b19c0ee8d9053ee4d22e09b03f2b1
+
+--- aws-crt-ffi/crt/aws-lc/CMakeLists.txt.orig	2022-07-30 03:57:26 UTC
++++ aws-crt-ffi/crt/aws-lc/CMakeLists.txt
+@@ -623,7 +623,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm*")
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "mips")
+   # Just to avoid the “unknown processor” error.
+   set(ARCH "generic")
+-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64le")
++elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc64le|ppc64le")
+   set(ARCH "ppc64le")
+ else()
+   message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR})
+--- aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c.orig	2022-07-30 03:57:26 UTC
++++ aws-crt-ffi/crt/aws-lc/crypto/fipsmodule/cpucap/cpu_ppc64le.c
+@@ -25,7 +25,11 @@
+ #endif
+ 
+ void OPENSSL_cpuid_setup(void) {
++#if defined(__linux__)
+   OPENSSL_ppc64le_hwcap2 = getauxval(AT_HWCAP2);
++#elif defined(__FreeBSD__)
++  elf_aux_info(AT_HWCAP2, &OPENSSL_ppc64le_hwcap2, sizeof(OPENSSL_ppc64le_hwcap2));
++#endif
+ }
+ 
+ int CRYPTO_is_PPC64LE_vcrypto_capable(void) {
diff --git a/devel/rubygem-aws-crt/pkg-descr b/devel/rubygem-aws-crt/pkg-descr
new file mode 100644
index 000000000000..343f287eceb4
--- /dev/null
+++ b/devel/rubygem-aws-crt/pkg-descr
@@ -0,0 +1,9 @@
+AWS Common Runtime for Ruby
+
+The AWS Common Runtime (CRT) libraries are a base library of the SDKs. The CRT
+is a modular family of independent packages, written in C. Each package provides
+good performance and minimal footprint for different required functionalities.
+These functionalities are common and shared across all SDKs providing better
+code reuse, optimization, and accuracy.
+
+WWW: https://github.com/awslabs/aws-crt-ruby
diff --git a/devel/rubygem-aws-crt/pkg-plist b/devel/rubygem-aws-crt/pkg-plist
new file mode 100644
index 000000000000..f627801e25e1
--- /dev/null
+++ b/devel/rubygem-aws-crt/pkg-plist
@@ -0,0 +1,6 @@
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/include/README.md
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/proofs/Makefile.common
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/proofs/README.md
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/proofs/run-cbmc-proofs.py
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/sources/README.md
+%%GEM_LIB_DIR%%/aws-crt-ffi/crt/s2n/tests/cbmc/stubs/README.md