icu4c: improve windows build (#3993)

* icu4c: improve windows build

* fix arm
pull/4001/head
star9029 9 months ago committed by GitHub
parent cae46e86d5
commit f1de1728ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 43
      packages/i/icu4c/xmake.lua

@ -19,13 +19,12 @@ 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")
add_patches("73.1", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
add_patches("73.2", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
add_patches(">=69.1", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
end
add_configs("tools", {description = "Build tools.", default = false, type = "boolean"})
if is_plat("windows") then
add_deps("python 3.x", {kind = "binary"})
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
end
if is_plat("linux") then
@ -44,26 +43,44 @@ package("icu4c")
on_install("windows", function (package)
import("package.tools.msbuild")
local projectfiles = os.files("source/**.vcxproj")
table.join2(projectfiles, path.join("source", "allinone", "allinone.sln"), os.files("source/**.props"))
local sln = path.join("source", "allinone", "allinone.sln")
table.join2(projectfiles, sln, os.files("source/**.props"))
if package:is_cross() then
-- icu build requires native tools
local configs = {path.join("source", "allinone", "allinone.sln")}
table.insert(configs, "/p:Configuration=Release")
table.insert(configs, "/p:Platform=" .. package:arch())
local configs = {
sln,
"/p:Configuration=Release",
"/target:pkgdata,genrb"
}
local arch_prev = package:arch()
package:arch_set(os.arch())
msbuild.build(package, configs, {upgrade = projectfiles})
package:arch_set(arch_prev)
end
local configs = {
sln,
"/p:SkipUWP=True",
"/p:_IsNativeEnvironment=true"
}
if not package:config("tools") then
table.insert(configs, "/target:common,i18n,uconv,io,stubdata")
end
local configs = {path.join("source", "allinone", "allinone.sln"), "/p:SkipUWP=True", "/p:_IsNativeEnvironment=true"}
msbuild.build(package, configs, {upgrade = projectfiles})
local suffix = package:is_plat("arm.*") and "ARM" or ""
local suffix = package:is_arch("arm.*") and "ARM" or ""
if package:is_arch(".*64") then
suffix = suffix .. "64"
end
os.cp("include", package:installdir())
os.cp("bin" .. suffix .. "/*", package:installdir("bin"))
os.cp("lib" .. suffix .. "/*", package:installdir("lib"))
os.vcp("include", package:installdir())
os.vcp("bin" .. suffix .. "/*", package:installdir("bin"))
os.vcp("lib" .. suffix .. "/*", package:installdir("lib"))
package:addenv("PATH", "bin")
end)

Loading…
Cancel
Save