xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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("windows") then
  9. add_syslinks("advapi32")
  10. end
  11. on_fetch(function (package, opt)
  12. if opt.system then
  13. return package:find_package("system::intl", {includes = "libintl.h"})
  14. end
  15. end)
  16. on_install("windows", "macosx", "android", function (package)
  17. -- on linux libintl is already a part of libc
  18. os.cp(path.join(os.scriptdir(), "port", package:version_str(), "xmake.lua"), "xmake.lua")
  19. for _, conffile in ipairs({"gettext-runtime/config.h.in", "gettext-runtime/intl/config.h.in"}) do
  20. io.replace(conffile, "$", "", {plain = true})
  21. io.replace(conffile, "# ?undef (.-)\n", "${define %1}\n")
  22. end
  23. import("package.tools.xmake").install(package, {
  24. vers = package:version_str(),
  25. relocatable = true,
  26. installprefix = package:installdir():gsub("\\", "/")
  27. })
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("ngettext", {includes = "libintl.h"}))
  31. end)