xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("libintl")
  2. set_homepage("https://www.gnu.org/software/gettext/")
  3. set_description("GNU gettext runtime")
  4. add_urls("https://ftpmirror.gnu.org/gnu/gettext/gettext-$(version).tar.xz",
  5. "https://ftp.gnu.org/gnu/gettext/gettext-$(version).tar.xz")
  6. add_versions("0.21", "d20fcbb537e02dcf1383197ba05bd0734ef7bf5db06bdb241eb69b7d16b73192")
  7. add_versions("0.22.3", "b838228b3f8823a6c1eddf07297197c4db13f7e1b173b9ef93f3f945a63080b6")
  8. if is_plat("mingw") then
  9. add_patches("0.22.3", "patches/0.22.3/fix-mingw-build-wgetcwd.diff", "4db86b836cf332151558d5cd4553ed2e8a6dc88676b5d66dda486f55dcd6785c")
  10. end
  11. if is_plat("windows", "mingw") then
  12. add_syslinks("advapi32")
  13. end
  14. on_fetch(function (package, opt)
  15. if opt.system then
  16. return package:find_package("system::intl", {includes = "libintl.h"})
  17. end
  18. end)
  19. on_install("windows", "macosx", "android", "mingw", function (package)
  20. -- on linux libintl is already a part of libc
  21. os.cp(path.join(os.scriptdir(), "port", package:version_str(), "xmake.lua"), "xmake.lua")
  22. for _, conffile in ipairs({"gettext-runtime/config.h.in", "gettext-runtime/intl/config.h.in"}) do
  23. io.replace(conffile, "$", "", {plain = true})
  24. io.replace(conffile, "# ?undef (.-)\n", "${define %1}\n")
  25. end
  26. import("package.tools.xmake").install(package, {
  27. vers = package:version_str(),
  28. relocatable = true,
  29. installprefix = package:installdir():gsub("\\", "/")
  30. })
  31. end)
  32. on_test(function (package)
  33. assert(package:has_cfuncs("ngettext", {includes = "libintl.h"}))
  34. end)