git: 505d19cfeea9 - main - devel/ctypes.sh: Add missing patches

From: Fernando Apesteguía <fernape_at_FreeBSD.org>
Date: Wed, 17 Aug 2022 16:44:35 UTC
The branch main has been updated by fernape:

URL: https://cgit.FreeBSD.org/ports/commit/?id=505d19cfeea99671eecfa7a151e2665eece96a5f

commit 505d19cfeea99671eecfa7a151e2665eece96a5f
Author:     Fernando Apesteguía <fernape@FreeBSD.org>
AuthorDate: 2022-08-17 16:40:36 +0000
Commit:     Fernando Apesteguía <fernape@FreeBSD.org>
CommitDate: 2022-08-17 16:40:36 +0000

    devel/ctypes.sh: Add missing patches
    
    Add patches missing from last update.
    
    PR:     265318
    Fixes:  79f9679c7e795de9a15451910526cea3ea50c21f
---
 devel/ctypes.sh/files/patch-configure.ac       | 20 ++++++++++++++++++++
 devel/ctypes.sh/files/patch-include_builtins.h | 13 +++++++++++++
 devel/ctypes.sh/files/patch-src_callback.c     | 11 +++++++++++
 devel/ctypes.sh/files/patch-src_unpack.c       | 11 +++++++++++
 4 files changed, 55 insertions(+)

diff --git a/devel/ctypes.sh/files/patch-configure.ac b/devel/ctypes.sh/files/patch-configure.ac
new file mode 100644
index 000000000000..f036749e8e85
--- /dev/null
+++ b/devel/ctypes.sh/files/patch-configure.ac
@@ -0,0 +1,20 @@
+--- configure.ac.orig	2020-07-08 18:26:35 UTC
++++ configure.ac
+@@ -32,6 +32,7 @@ AC_CHECK_FUNCS([gelf_getehdr dwfl_version dl_iterate_p
+     disable_struct_support=yes;
+     AC_MSG_WARN([a function needed for struct support was not found])
+ ])
++AC_CHECK_FUNCS([mempcpy])
+ AC_CHECK_HEADER_STDBOOL
+ AC_PROG_CC
+ AC_FUNC_ALLOCA
+@@ -152,6 +153,9 @@ AS_IF([test "x$disable_struct_support" == "xyes"], [
+       AC_SUBST([struct], [struct])
+       AC_SUBST([sizeof], [sizeof])
+ ])
++
++# replace include/config.h
++AC_DEFINE([ARRAY_VARS], [1], [Enable array variable support])
+ 
+ AC_SUBST([soext], [$shrext_cmds])
+ AC_CONFIG_FILES([Makefile src/Makefile ctypes.sh])
diff --git a/devel/ctypes.sh/files/patch-include_builtins.h b/devel/ctypes.sh/files/patch-include_builtins.h
new file mode 100644
index 000000000000..812498cbebf5
--- /dev/null
+++ b/devel/ctypes.sh/files/patch-include_builtins.h
@@ -0,0 +1,13 @@
+--- include/builtins.h.orig	2022-07-19 16:57:21 UTC
++++ include/builtins.h
+@@ -18,7 +18,10 @@
+    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
++#define ARRAY_VARS 1
++#ifdef HAVE_CONFIG_H
+ #include "config.h"
++#endif
+ 
+ #if defined (HAVE_UNISTD_H)
+ #  ifdef _MINIX
diff --git a/devel/ctypes.sh/files/patch-src_callback.c b/devel/ctypes.sh/files/patch-src_callback.c
new file mode 100644
index 000000000000..2e7f0ec22fec
--- /dev/null
+++ b/devel/ctypes.sh/files/patch-src_callback.c
@@ -0,0 +1,11 @@
+--- src/callback.c.orig	2022-07-19 17:26:18 UTC
++++ src/callback.c
+@@ -82,7 +82,7 @@ static int generate_native_callback(WORD_LIST *list)
+     ffi_type *callbacktype;
+     char **proto;
+     char *resultname = "DLRETVAL";
+-    char opt;
++    int opt;
+     reset_internal_getopt();
+ 
+     while ((opt = internal_getopt(list, "d:n:")) != -1) {
diff --git a/devel/ctypes.sh/files/patch-src_unpack.c b/devel/ctypes.sh/files/patch-src_unpack.c
new file mode 100644
index 000000000000..0267ffa08e83
--- /dev/null
+++ b/devel/ctypes.sh/files/patch-src_unpack.c
@@ -0,0 +1,11 @@
+--- src/unpack.c.orig	2022-07-19 16:33:30 UTC
++++ src/unpack.c
+@@ -22,7 +22,7 @@
+ #include "types.h"
+ #include "shell.h"
+ 
+-#if !defined(__GLIBC__) && !defined(__NEWLIB__)
++#if !defined(HAVE_MEMPCPY)
+ static inline void *mempcpy(void *dest, const void *src, size_t n)
+ {
+     memcpy(dest, src, n);