xmake.lua 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("fontconfig")
  2. set_homepage("https://www.freedesktop.org/wiki/Software/fontconfig/")
  3. set_description("A library for configuring and customizing font access.")
  4. set_license("MIT")
  5. add_urls("https://gitlab.freedesktop.org/fontconfig/fontconfig/-/archive/$(version)/fontconfig-$(version).tar.gz",
  6. "https://gitlab.freedesktop.org/fontconfig/fontconfig.git")
  7. add_versions("2.17.1", "82e73b26adad651b236e5f5d4b3074daf8ff0910188808496326bd3449e5261d")
  8. -- fix the build issue with --enable-static
  9. add_patches("2.13.1", "https://gitlab.freedesktop.org/fontconfig/fontconfig/commit/8208f99fa1676c42bfd8d74de3e9dac5366c150c.diff",
  10. "2abdff214b99f2d074170e6512b0149cc858ea26cd930690aa6b4ccea2c549ef")
  11. add_configs("nls", {description = "Enable Native Language Support (NLS)", default = false, type = "boolean"})
  12. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  13. if is_plat("wasm") then
  14. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  15. end
  16. add_deps("meson", "ninja", "gperf", "python 3.x", {kind = "binary"})
  17. if is_subhost("windows") then
  18. add_deps("pkgconf")
  19. else
  20. add_deps("pkg-config")
  21. end
  22. add_deps("freetype", "expat")
  23. on_load(function (package)
  24. if package:config("nls") and not package:is_plat("linux") then
  25. package:add("deps", "libintl")
  26. end
  27. if package:is_plat("linux") and (package:version() and package:version():lt("2.13.91")) then
  28. package:add("deps", "util-linux", {configs = {libuuid = true}})
  29. package:add("deps", "autotools", "bzip2")
  30. end
  31. end)
  32. on_install(function (package)
  33. if package:is_plat("windows") then
  34. io.replace("meson.build", "c_args = []", "c_args = ['-DXML_STATIC']", {plain = true})
  35. end
  36. local configs = {
  37. "-Dtests=disabled",
  38. "-Ddoc=disabled",
  39. }
  40. table.insert(configs, "-Ddebug=" .. (package:is_debug() and "true" or "false"))
  41. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  42. table.insert(configs, "-Dnls=" .. (package:config("nls") and "enabled" or "disabled"))
  43. table.insert(configs, "-Dtools=" .. (package:config("tools") and "enabled" or "disabled"))
  44. import("package.tools.meson").install(package, configs)
  45. end)
  46. on_test(function (package)
  47. assert(package:has_cfuncs("FcInitLoadConfigAndFonts", {includes = "fontconfig/fontconfig.h"}))
  48. end)