Skip to content

Commit

Permalink
[libiconv] Fix for NDK r28 API level < 23
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Oct 3, 2024
1 parent 1acb36a commit 51c44ee
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions ports/libiconv/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ vcpkg_extract_source_archive(SOURCE_PATH
0003-Add-export.patch
0004-ModuleFileName.patch
clang-fortify.patch # ported from https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=522aea1093a598246346b3e1c426505c344fe19a
rename-gl-mempcpy.diff # for Android NDK r28 with API level < 23
)

vcpkg_list(SET OPTIONS)
Expand Down
43 changes: 43 additions & 0 deletions ports/libiconv/rename-gl-mempcpy.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/srclib/canonicalize-lgpl.c b/srclib/canonicalize-lgpl.c
index a7fa7fe..8199b35 100644
--- a/srclib/canonicalize-lgpl.c
+++ b/srclib/canonicalize-lgpl.c
@@ -71,6 +71,10 @@
# define __getcwd(buf, max) getwd (buf)
# endif
# define __mempcpy mempcpy
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 23
+# undef __mempcpy
+# define __mempcpy rpl_mempcpy
+#endif
# define __pathconf pathconf
# define __rawmemchr rawmemchr
# define __readlink readlink
diff --git a/srclib/mempcpy.c b/srclib/mempcpy.c
index 9aae418..c24f58e 100644
--- a/srclib/mempcpy.c
+++ b/srclib/mempcpy.c
@@ -21,6 +21,9 @@

/* A function definition is only needed if HAVE_MEMPCPY is not defined. */
#if !HAVE_MEMPCPY
+#if defined(__ANDROID_API__) && __ANDROID_API__ < 23
+# define mempcpy rpl_mempcpy
+#endif

/* Copy N bytes of SRC to DEST, return pointer to bytes after the
last written byte. */
diff --git a/srclib/stdlib.in.h b/srclib/stdlib.in.h
index a86643c..92dff31 100644
--- a/srclib/stdlib.in.h
+++ b/srclib/stdlib.in.h
@@ -1553,6 +1553,9 @@ _GL_CXXALIASWARN (wctomb);
# endif
#endif

+#if defined(__ANDROID_API__) && __ANDROID_API__ < 23
+_GL_FUNCDECL_RPL (mempcpy, void *, (void *, const void *, size_t));
+#endif

#endif /* _@GUARD_PREFIX@_STDLIB_H */
#endif /* _@GUARD_PREFIX@_STDLIB_H */
2 changes: 1 addition & 1 deletion ports/libiconv/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libiconv",
"version": "1.17",
"port-version": 4,
"port-version": 5,
"description": "GNU Unicode text conversion",
"homepage": "https://www.gnu.org/software/libiconv/",
"license": null
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4630,7 +4630,7 @@
},
"libiconv": {
"baseline": "1.17",
"port-version": 4
"port-version": 5
},
"libics": {
"baseline": "1.6.6",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libiconv.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "50c14f093f27eccf755ddff4da37cff1d13d62a8",
"version": "1.17",
"port-version": 5
},
{
"git-tree": "6549f7452c383df31d471692b339f985d0000a88",
"version": "1.17",
Expand Down

0 comments on commit 51c44ee

Please sign in to comment.