xmake.lua 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. add_urls("https://xcb.freedesktop.org/dist/libxcb-$(version).tar.gz",
  34. "https://www.x.org/archive/individual/lib/libxcb-$(version).tar.gz")
  35. add_versions("1.13.1", "f09a76971437780a602303170fd51b5f7474051722bc39d566a272d2c4bde1b5")
  36. add_versions("1.14", "2c7fcddd1da34d9b238c9caeda20d3bd7486456fc50b3cc6567185dbd5b0ad02")
  37. add_versions("1.16", "bc0f75f84b28e6496a19a1d094d7e47def861a50cb7cce5b23b62eecdc2a4479")
  38. add_versions("1.17.0", "2c69287424c9e2128cb47ffe92171e10417041ec2963bceafb65cb3fcf8f0b85")
  39. for name, opt in pairs(components) do
  40. add_configs(name, {description = format("Enable %s submodule (default is %s).", name, opt.default_value), default = opt.default_value})
  41. end
  42. if is_plat("linux") then
  43. add_extsources("apt::libxcb1-dev", "pacman::libxcb")
  44. end
  45. if is_plat("macosx", "linux", "bsd", "cross") then
  46. add_deps("pkg-config", "python 3.x", {kind = "binary"})
  47. add_deps("xcb-proto", "libpthread-stubs", "libxau", "libxdmcp")
  48. end
  49. on_load("linux", function(package)
  50. for name, opt in pairs(components) do
  51. if opt.apt_package and package:config(name) then
  52. package:add("extsources", opt.apt_package)
  53. end
  54. end
  55. end)
  56. on_install("macosx", "linux", "bsd", "cross", function (package)
  57. local configs = {"--sysconfdir=" .. package:installdir("etc"),
  58. "--localstatedir=" .. package:installdir("var"),
  59. "--disable-dependency-tracking",
  60. "--disable-silent-rules",
  61. "--enable-devel-docs=no",
  62. "--with-doxygen=no",
  63. "PYTHON=python3"}
  64. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  65. if package:is_plat("linux") and package:config("pic") ~= false then
  66. table.insert(configs, "--with-pic")
  67. end
  68. for name, opt in pairs(components) do
  69. table.insert(configs, format("--enable-%s=%s", name, package:config(name) and "yes" or "no"))
  70. end
  71. if package:is_plat("macosx") and package:is_cross() then
  72. import("package.tools.autoconf").install(package, configs, {cflags = "-arch " .. package:arch(), shflags = "-arch " .. package:arch()})
  73. else
  74. import("package.tools.autoconf").install(package, configs)
  75. end
  76. end)
  77. on_test(function (package)
  78. assert(package:has_cfuncs("xcb_connect", {includes = "xcb/xcb.h"}))
  79. end)