Selaa lähdekoodia

add icu4c on mingw (#2045)

* add icu4c on mingw

* patch mingw to avoid build failure

* reapply patch from msys repo

* fix icu data issue and checksum issue

* fix crossbuild detect on mingw installed on macos

* disable package on macos msys environment

since the author has no mac device.

* fix macos build issue

* fix macos build issue

* adjust package script

* disable cross build test and revert windows change

* adjust patch

* run reconfigure on mingw

* disable mingw on macos
jingkaimori 2 vuotta sitten
vanhempi
commit
4c3adfbe3e
2 muutettua tiedostoa jossa 68 lisäystä ja 2 poistoa
  1. 54 0
      packages/i/icu4c/patches/72.1/mingw.patch
  2. 14 2
      packages/i/icu4c/xmake.lua

+ 54 - 0
packages/i/icu4c/patches/72.1/mingw.patch

@@ -0,0 +1,54 @@
+diff --git a/source/config/mh-mingw b/source/config/mh-mingw
+index 30f6e5b..7cadf9d 100644
+--- a/source/config/mh-mingw
++++ b/source/config/mh-mingw
+@@ -15,11 +15,6 @@
+ # If you prefer to have the DLLs in the lib folder, then set this to NO instead.
+ MINGW_MOVEDLLSTOBINDIR = YES
+ 
+-# We install sbin tools into the same bin directory because
+-# pkgdata needs some of the tools in sbin, and we can't always depend on
+-# icu-config working on Windows.
+-sbindir=$(bindir)
+-
+ ## Commands to generate dependency files
+ GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
+ GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
+@@ -81,6 +76,10 @@ else
+ SO_TARGET_VERSION_SUFFIX = 
+ endif
+ 
++## Remove shared library 's'
++STATIC_PREFIX_WHEN_USED = 
++STATIC_PREFIX = 
++
+ # Static library prefix and file extension
+ LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
+ A = a
+diff --git a/source/config/mh-mingw64 b/source/config/mh-mingw64
+index fb64c56..40b436a 100644
+--- a/source/config/mh-mingw64
++++ b/source/config/mh-mingw64
+@@ -15,11 +15,6 @@ MINGW_MOVEDLLSTOBINDIR = YES
+ # This file is similar to mh-mingw
+ # Any changes made here may also need to be made in mh-mingw
+ 
+-# We install sbin tools into the same bin directory because
+-# pkgdata needs some of the tools in sbin, and we can't always depend on
+-# icu-config working on Windows.
+-sbindir=$(bindir)
+-
+ ## Commands to generate dependency files
+ GEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
+ GEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
+@@ -81,6 +76,10 @@ else
+ SO_TARGET_VERSION_SUFFIX = 
+ endif
+ 
++## Remove shared library 's'
++STATIC_PREFIX_WHEN_USED = 
++STATIC_PREFIX = 
++
+ # Static library prefix and file extension
+ LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
+ A = a

+ 14 - 2
packages/i/icu4c/xmake.lua

@@ -16,8 +16,17 @@ package("icu4c")
 
     add_patches("69.1", path.join(os.scriptdir(), "patches", "69.1", "replace-py-3.patch"), "ae27a55b0e79a8420024d6d349a7bae850e1dd403a8e1131e711c405ddb099b9")
     add_patches("70.1", path.join(os.scriptdir(), "patches", "70.1", "replace-py-3.patch"), "6469739da001721122b62af513370ed62901caf43af127de3f27ea2128830e35")
+    if is_plat("mingw") then
+        add_patches("72.1", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
+    end
+
+    add_links("icuuc", "icutu", "icui18n", "icuio")
+    if is_plat("mingw") then
+        add_links("icudt")
+    else
+        add_links("icudata")
+    end
 
-    add_links("icuuc", "icutu", "icui18n", "icuio", "icudata")
     if is_plat("linux") then
         add_syslinks("dl")
     end
@@ -36,7 +45,7 @@ package("icu4c")
         package:addenv("PATH", "bin")
     end)
 
-    on_install("macosx", "linux", function (package)
+    on_install("macosx", "linux", "mingw@msys", function (package)
         import("package.tools.autoconf")
 
         os.cd("source")
@@ -52,6 +61,9 @@ package("icu4c")
             table.insert(configs, "--disable-shared")
             table.insert(configs, "--enable-static")
         end
+        if package:is_plat("mingw") then
+            table.insert(configs, "--with-data-packaging=dll")
+        end
 
         local envs = {}
         if package:is_plat("linux") and package:config("pic") ~= false then