xmake.lua 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package("wayland")
  2. set_homepage("https://wayland.freedesktop.org/")
  3. set_description("Wayland is a protocol for a compositor to talk to its clients as well as a C library implementation of that protocol.")
  4. set_license("MIT")
  5. add_urls("https://wayland.freedesktop.org/releases/wayland-$(version).tar.xz")
  6. add_versions("1.18.0", "4675a79f091020817a98fd0484e7208c8762242266967f55a67776936c2e294d")
  7. add_versions("1.19.0", "baccd902300d354581cd5ad3cc49daa4921d55fb416a5883e218750fef166d15")
  8. add_resources("1.18.0", "protocols", "https://wayland.freedesktop.org/releases/wayland-protocols-1.20.tar.xz", "9782b7a1a863d82d7c92478497d13c758f52e7da4f197aa16443f73de77e4de7")
  9. add_resources("1.19.0", "protocols", "https://wayland.freedesktop.org/releases/wayland-protocols-1.21.tar.xz", "b99945842d8be18817c26ee77dafa157883af89268e15f4a5a1a1ff3ffa4cde5")
  10. if is_plat("linux") then
  11. add_extsources("apt::libwayland-dev", "pacman::wayland")
  12. end
  13. add_deps("meson", "ninja >=1.8.2", "libxml2", "libffi", "expat", "bison", "pkg-config")
  14. on_install("linux", function (package)
  15. -- imports
  16. import("package.tools.meson")
  17. import("package.tools.autoconf")
  18. import("lib.detect.find_file")
  19. -- set environment variables
  20. package:addenv("PATH", "bin")
  21. local LD_LIBRARY_PATH = package:installdir("lib")
  22. local PKG_CONFIG_PATH = path.joinenv({package:installdir("lib", "pkgconfig"), package:installdir("share", "pkgconfig")})
  23. local ACLOCAL_PATH = package:installdir("share", "aclocal")
  24. local ACLOCAL = "aclocal -I " .. package:installdir("share", "aclocal")
  25. os.mkdir(package:installdir("share", "aclocal"))
  26. -- build wayland
  27. local configs = {"-Ddocumentation=false", "-Dc_link_args=-lm"}
  28. table.insert(configs, "--libdir=lib")
  29. local envs = meson.buildenvs(package)
  30. envs.LD_LIBRARY_PATH = path.joinenv(table.join(LD_LIBRARY_PATH, envs.LD_LIBRARY_PATH))
  31. envs.PKG_CONFIG_PATH = path.joinenv(table.join(PKG_CONFIG_PATH, envs.PKG_CONFIG_PATH))
  32. envs.ACLOCAL_PATH = path.joinenv(table.join(ACLOCAL_PATH, envs.ACLOCAL_PATH))
  33. envs.ACLOCAL = ACLOCAL
  34. meson.install(package, configs, {envs = envs})
  35. -- install wayland-protocols
  36. local protocol = assert(package:resourcedir("protocols"), "wayland-protocols not found!")
  37. local configfile = find_file("configure.ac", path.join(protocol, "**"))
  38. os.cd(path.directory(configfile))
  39. envs = autoconf.buildenvs(package)
  40. envs.LD_LIBRARY_PATH = path.joinenv(table.join(LD_LIBRARY_PATH, envs.LD_LIBRARY_PATH))
  41. envs.PKG_CONFIG_PATH = path.joinenv(table.join(PKG_CONFIG_PATH, envs.PKG_CONFIG_PATH))
  42. envs.ACLOCAL_PATH = path.joinenv(table.join(ACLOCAL_PATH, envs.ACLOCAL_PATH))
  43. envs.ACLOCAL = ACLOCAL
  44. autoconf.install(package, {}, {envs = envs})
  45. end)
  46. on_test(function (package)
  47. os.vrun("wayland-scanner --version")
  48. assert(package:has_cfuncs("wl_list_init", {includes = "wayland-util.h"}))
  49. end)