xmake.lua 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. local components = {
  2. composite = { apt_package = "apt::libxcb-composite0-dev", default_value = true },
  3. damage = { apt_package = "apt::libxcb-damage0-dev" , default_value = true},
  4. dpms = { apt_package = "apt::libxcb-dpms0-dev" , default_value = true},
  5. dri2 = { apt_package = "apt::libxcb-dri2-0-dev" , default_value = true},
  6. dri3 = { apt_package = "apt::libxcb-dri3-dev" , default_value = true},
  7. present = { apt_package = "apt::libxcb-present-dev" , default_value = true},
  8. glx = { apt_package = "apt::libxcb-glx0-dev" , default_value = true},
  9. randr = { apt_package = "apt::libxcb-randr0-dev" , default_value = true},
  10. record = { apt_package = "apt::libxcb-record0-dev" , default_value = true},
  11. render = { apt_package = "apt::libxcb-render0-dev" , default_value = true},
  12. resource = { apt_package = "apt::libxcb-xrm-dev" , default_value = true},
  13. screensaver = { apt_package = "apt::libxcb-screensaver-dev" , default_value = true},
  14. shape = { apt_package = "apt::libxcb-shape0-dev" , default_value = true},
  15. shm = { apt_package = "apt::libxcb-shm0-dev" , default_value = true},
  16. sync = { apt_package = "apt::libxcb-sync0-dev" , default_value = true},
  17. xevie = { apt_package = "apt::libxcb-xevie0-dev" , default_value = true},
  18. ["xfree86-dri"] = { apt_package = "apt::libxcb-xfreedri0-dev" , default_value = true},
  19. xfixes = { apt_package = "apt::libxcb-xfixes0-dev" , default_value = true},
  20. xinerama = { apt_package = "apt::libxcb-xinerama0-dev" , default_value = true},
  21. xinput = { apt_package = "apt::libxcb-xinput-dev" , default_value = true},
  22. xkb = { apt_package = "apt::libxcb-xkb-dev" , default_value = true},
  23. xprint = { apt_package = "apt::libxcb-xprint0-dev" , default_value = false},
  24. selinux = { default_value = false},
  25. xtest = { apt_package = "apt::libxcb-xtest0-dev" , default_value = true},
  26. xv = { apt_package = "apt::libxcb-xv0-dev" , default_value = true},
  27. xvmc = { apt_package = "apt::libxcb-xvmc0-dev" , default_value = true},
  28. ge = { default_value = true}
  29. }
  30. package("libxcb")
  31. set_homepage("https://www.x.org/")
  32. set_description("X.Org: Interface to the X Window System protocol")
  33. set_urls("https://xcb.freedesktop.org/dist/libxcb-$(version).tar.gz")
  34. add_versions("1.13.1", "f09a76971437780a602303170fd51b5f7474051722bc39d566a272d2c4bde1b5")
  35. add_versions("1.14", "2c7fcddd1da34d9b238c9caeda20d3bd7486456fc50b3cc6567185dbd5b0ad02")
  36. for name, opt in pairs(components) do
  37. add_configs(name, {description = format("Enable %s submodule (default is %s).", name, opt.default_value), default = opt.default_value})
  38. end
  39. if is_plat("linux") then
  40. add_extsources("apt::libxcb1-dev", "pacman::libxcb")
  41. end
  42. if is_plat("macosx", "linux") then
  43. add_deps("pkg-config", "python 3.x", {kind = "binary"})
  44. add_deps("xcb-proto", "libpthread-stubs", "libxau", "libxdmcp")
  45. end
  46. on_load("linux", function(package)
  47. for name, opt in pairs(components) do
  48. if opt.apt_package and package:config(name) then
  49. package:add("extsources", opt.apt_package)
  50. end
  51. end
  52. end)
  53. on_install("macosx", "linux", function (package)
  54. local configs = {"--sysconfdir=" .. package:installdir("etc"),
  55. "--localstatedir=" .. package:installdir("var"),
  56. "--disable-dependency-tracking",
  57. "--disable-silent-rules",
  58. "--enable-devel-docs=no",
  59. "--with-doxygen=no"}
  60. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  61. if package:is_plat("linux") and package:config("pic") ~= false then
  62. table.insert(configs, "--with-pic")
  63. end
  64. for name, opt in pairs(components) do
  65. table.insert(configs, format("--enable-%s=%s", name, package:config(name) and "yes" or "no"))
  66. end
  67. import("package.tools.autoconf").install(package, configs)
  68. end)
  69. on_test(function (package)
  70. assert(package:has_cfuncs("xcb_connect", {includes = "xcb/xcb.h"}))
  71. end)