xmake.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("eudev")
  2. set_homepage("https://github.com/eudev-project/eudev")
  3. set_description("A fork of systemd with the aim of isolating udev from any particular flavor of system initialization.")
  4. set_license("GPL-2.0")
  5. add_urls("https://github.com/eudev-project/eudev/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/eudev-project/eudev.git")
  7. add_versions("v3.2.14", "c340e6c51dfc5531ac0c0fa84a34b72162acf525f9023eb9cf4931b782c8f177")
  8. add_versions("v3.2.9", "7d281276b480da3935d1acb239748c2c9db01a8043aad7e918ce57a223d8cd24")
  9. add_configs("kmod", {description = "Enable loadable modules support", default = false, type = "boolean"})
  10. add_configs("selinux", {description = "Enable optional SELINUX support", default = false, type = "boolean", readonly = true})
  11. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  12. add_deps("autotools", "pkg-config", "gperf")
  13. on_load(function (package)
  14. if package:config("kmod") then
  15. package:add("deps", "libkmod")
  16. end
  17. end)
  18. on_install("linux", "cross", function (package)
  19. io.replace("autogen.sh", "./make.sh", "", {plain = true}) --remove doc build
  20. if package:config("kmod") then
  21. io.replace("configure.ac", "libkmod >= 15", "libkmod >= v15", {plain = true})
  22. io.replace("src/udev/udev-builtin-kmod.c", "#include <libkmod.h>", "#include <libkmod/libkmod.h>", {plain = true})
  23. end
  24. local configs = {"--disable-manpages"}
  25. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  26. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  27. table.insert(configs, "--enable-kmod=" .. (package:config("kmod") and "yes" or "no"))
  28. table.insert(configs, "--enable-selinux=" .. (package:config("selinux") and "yes" or "no"))
  29. table.insert(configs, "--enable-programs=" .. (package:config("tools") and "yes" or "no"))
  30. import("package.tools.autoconf").install(package, configs)
  31. end)
  32. on_test(function (package)
  33. assert(package:has_cfuncs("udev_new", {includes = "libudev.h"}))
  34. end)