Răsfoiți Sursa

fix: add patch for `Xerces-C` (Android arm64-v8a, NDK version < 26) (#4023)

zjyhjqs 1 an în urmă
părinte
comite
a99892097d

+ 33 - 0
packages/x/xerces-c/patches/patch-android.diff

@@ -0,0 +1,33 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 33bc40f41..a5d0c5b6d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -111,6 +111,7 @@ include(XercesICU)
+ include(XercesMutexMgrSelection)
+ include(XercesNetAccessorSelection)
+ include(XercesMsgLoaderSelection)
++include(XercesWChar)
+ include(XercesTranscoderSelection)
+ include(XercesFileMgrSelection)
+ include(XercesXMLCh)
+@@ -126,7 +127,6 @@ include(XercesStdLibs)
+ include(XercesStdNamespace)
+ include(XercesSSE2)
+ include(XercesPathMax)
+-include(XercesWChar)
+ include(XercesIconvConst)
+ include(XercesLFS)
+ 
+diff --git a/cmake/XercesTranscoderSelection.cmake b/cmake/XercesTranscoderSelection.cmake
+index 4ff5b1621..862cc4908 100644
+--- a/cmake/XercesTranscoderSelection.cmake
++++ b/cmake/XercesTranscoderSelection.cmake
+@@ -82,7 +82,7 @@ check_function_exists(wcstombs HAVE_WCSTOMBS)
+ check_function_exists(mbstowcs HAVE_MBSTOWCS)
+ 
+ set(iconv_available 0)
+-if(HAVE_WCHAR_H AND HAVE_MBLEN AND HAVE_WCSTOMBS AND HAVE_MBSTOWCS)
++if(HAVE_WCHAR_H AND (HAVE_MBRLEN OR HAVE_MBLEN) AND HAVE_WCSTOMBS AND HAVE_MBSTOWCS)
+   set(iconv_available 1)
+   list(APPEND transcoders iconv)
+ endif()

+ 9 - 2
packages/x/xerces-c/xmake.lua

@@ -6,19 +6,26 @@ package("xerces-c")
 
     add_urls("https://archive.apache.org/dist/xerces/c/3/sources/xerces-c-$(version).zip")
     add_versions("3.2.5", "4aa0f7ed265a45d253f900fa145cc8cae10414d085695f1de03a2ec141a3358b")
+    add_versions("3.2.4", "563a668b331ca5d1fc08ed52e5f62a13508b47557f88a068ad1db6f68e1f2eb2")
 
     add_deps("cmake")
     if is_plat("windows") then
         add_syslinks("advapi32")
     elseif is_plat("macosx") then
         add_frameworks("CoreFoundation", "CoreServices")
+    elseif is_plat("android") then
+        -- for NDK version less than 26
+        add_patches(">=3.2.4",
+            path.join(os.scriptdir(), "patches", "patch-android.diff"),
+            "f58fa2c89e1d4a17d5af193df3e3e5918986b71beb6ce055e9edd1546c20318a")
     end
+
     on_install("windows", "macosx", "linux", "android", function (package)
-        if package:is_plat("android") then
+        if package:is_plat("android") and package:is_arch("armeabi-v7a") then
             import("core.tool.toolchain")
             local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
             local ndk_sdkver = ndk:config("ndk_sdkver")
-            assert(ndk_sdkver and tonumber(ndk_sdkver) >= 26, "package(xerces-c): need ndk api level >= 26 for android")
+            assert(ndk_sdkver and tonumber(ndk_sdkver) >= 26, "package(xerces-c): need ndk api level >= 26 for android armeabi-v7a")
         end
 
         local configs = {"-Dnetwork=OFF", "-DCMAKE_DISABLE_FIND_PACKAGE_ICU=ON", "-DCMAKE_DISABLE_FIND_PACKAGE_CURL=ON"}