xmake.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package("icu4c")
  2. set_homepage("http://site.icu-project.org/")
  3. set_description("C/C++ libraries for Unicode and globalization.")
  4. add_urls("https://github.com/unicode-org/icu/releases/download/release-$(version)-src.tgz", {version = function (version)
  5. return (version:gsub("%.", "-")) .. "/icu4c-" .. (version:gsub("%.", "_"))
  6. end})
  7. add_versions("73.2", "818a80712ed3caacd9b652305e01afc7fa167e6f2e94996da44b90c2ab604ce1")
  8. add_versions("73.1", "a457431de164b4aa7eca00ed134d00dfbf88a77c6986a10ae7774fc076bb8c45")
  9. add_versions("72.1", "a2d2d38217092a7ed56635e34467f92f976b370e20182ad325edea6681a71d68")
  10. add_versions("71.1", "67a7e6e51f61faf1306b6935333e13b2c48abd8da6d2f46ce6adca24b1e21ebf")
  11. add_versions("70.1", "8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5")
  12. add_versions("69.1", "4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745")
  13. add_versions("68.2", "c79193dee3907a2199b8296a93b52c5cb74332c26f3d167269487680d479d625")
  14. add_versions("68.1", "a9f2e3d8b4434b8e53878b4308bd1e6ee51c9c7042e2b1a376abefb6fbb29f2d")
  15. add_versions("64.2", "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c")
  16. add_patches("69.1", path.join(os.scriptdir(), "patches", "69.1", "replace-py-3.patch"), "ae27a55b0e79a8420024d6d349a7bae850e1dd403a8e1131e711c405ddb099b9")
  17. add_patches("70.1", path.join(os.scriptdir(), "patches", "70.1", "replace-py-3.patch"), "6469739da001721122b62af513370ed62901caf43af127de3f27ea2128830e35")
  18. if is_plat("mingw") then
  19. add_patches("72.1", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
  20. add_patches("73.1", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
  21. add_patches("73.2", path.join(os.scriptdir(), "patches", "72.1", "mingw.patch"), "9ddbe7f691224ccf69f8c0218f788f0a39ab8f1375cc9aad2cc92664ffcf46a5")
  22. end
  23. if is_plat("windows") then
  24. add_deps("python 3.x", {kind = "binary"})
  25. end
  26. if is_plat("linux") then
  27. add_syslinks("dl")
  28. end
  29. on_load(function (package)
  30. local libsuffix = package:is_debug() and package:is_plat("mingw", "windows") and "d" or ""
  31. package:add("links", "icutu" .. libsuffix, "icuio" .. libsuffix)
  32. if package:is_plat("mingw", "windows") then
  33. package:add("links", "icuin" .. libsuffix, "icuuc" .. libsuffix, "icudt" .. libsuffix)
  34. else
  35. package:add("links", "icui18n" .. libsuffix, "icuuc" .. libsuffix, "icudata" .. libsuffix)
  36. end
  37. end)
  38. on_install("windows", function (package)
  39. import("package.tools.msbuild")
  40. local projectfiles = os.files("source/**.vcxproj")
  41. table.join2(projectfiles, path.join("source", "allinone", "allinone.sln"), os.files("source/**.props"))
  42. if package:is_cross() then
  43. -- icu build requires native tools
  44. local configs = {path.join("source", "allinone", "allinone.sln")}
  45. table.insert(configs, "/p:Configuration=Release")
  46. table.insert(configs, "/p:Platform=" .. package:arch())
  47. msbuild.build(package, configs, {upgrade = projectfiles})
  48. end
  49. local configs = {path.join("source", "allinone", "allinone.sln"), "/p:SkipUWP=True", "/p:_IsNativeEnvironment=true"}
  50. msbuild.build(package, configs, {upgrade = projectfiles})
  51. local suffix = package:is_plat("arm.*") and "ARM" or ""
  52. if package:is_arch(".*64") then
  53. suffix = suffix .. "64"
  54. end
  55. os.cp("include", package:installdir())
  56. os.cp("bin" .. suffix .. "/*", package:installdir("bin"))
  57. os.cp("lib" .. suffix .. "/*", package:installdir("lib"))
  58. package:addenv("PATH", "bin")
  59. end)
  60. on_install("macosx", "linux", "mingw@msys", function (package)
  61. import("package.tools.autoconf")
  62. os.cd("source")
  63. local configs = {"--disable-samples", "--disable-tests"}
  64. if package:debug() then
  65. table.insert(configs, "--enable-debug")
  66. table.insert(configs, "--disable-release")
  67. end
  68. if package:config("shared") then
  69. table.insert(configs, "--enable-shared")
  70. table.insert(configs, "--disable-static")
  71. else
  72. table.insert(configs, "--disable-shared")
  73. table.insert(configs, "--enable-static")
  74. end
  75. if package:is_plat("mingw") then
  76. table.insert(configs, "--with-data-packaging=dll")
  77. end
  78. local envs = {}
  79. if package:is_plat("linux") and package:config("pic") ~= false then
  80. envs = autoconf.buildenvs(package, {cxflags = "-fPIC"})
  81. else
  82. envs = autoconf.buildenvs(package)
  83. end
  84. -- suppress ar errors when passing --toolchain=clang
  85. envs.ARFLAGS = nil
  86. autoconf.install(package, configs, {envs = envs})
  87. package:addenv("PATH", "bin")
  88. end)
  89. on_test(function (package)
  90. assert(package:has_cfuncs("ucnv_convert", {includes = "unicode/ucnv.h"}))
  91. end)