xmake.lua 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package("util-linux")
  2. set_homepage("https://github.com/karelzak/util-linux")
  3. set_description("Collection of Linux utilities.")
  4. set_urls("https://www.kernel.org/pub/linux/utils/util-linux/v$(version).tar.xz", {version = function (version)
  5. return format("%s.%s/util-linux-%s", version:major(), version:minor(), version)
  6. end})
  7. add_versions("2.32.1", "86e6707a379c7ff5489c218cfaf1e3464b0b95acf7817db0bc5f179e356a67b2")
  8. add_versions("2.36.2", "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f")
  9. add_patches("2.36.2", path.join(os.scriptdir(), "patches", "2.36.2", "includes.patch"), "7274762cac2810b5f0d17ecb5ac69c7069e7ff2b880df663b7072628df0867f3")
  10. if is_plat("macosx") then
  11. add_extsources("brew::util-linux")
  12. elseif is_plat("linux") then
  13. add_extsources("apt::util-linux", "pacman::util-linux")
  14. add_deps("ncurses", "zlib")
  15. end
  16. add_configs("ipcs", {description = "Enable ipcs.", default = false, type = "boolean"})
  17. add_configs("ipcrm", {description = "Enable ipcrm.", default = false, type = "boolean"})
  18. add_configs("wall", {description = "Enable wall.", default = false, type = "boolean"})
  19. add_configs("libuuid", {description = "Enable libuuid.", default = false, type = "boolean"})
  20. add_configs("libmount", {description = "Enable libmount.", default = false, type = "boolean"})
  21. add_configs("libsmartcols", {description = "Enable libsmartcols.", default = false, type = "boolean"})
  22. add_configs("use-tty-group", {description = "Enable use-tty-group.", default = false, type = "boolean"})
  23. add_configs("kill", {description = "Enable kill.", default = false, type = "boolean"})
  24. add_configs("cal", {description = "Enable cal.", default = false, type = "boolean"})
  25. add_configs("systemd", {description = "Enable systemd.", default = false, type = "boolean"})
  26. add_configs("chfn-chsh", {description = "Enable chfn-chsh.", default = false, type = "boolean"})
  27. add_configs("login", {description = "Enable login.", default = false, type = "boolean"})
  28. add_configs("su", {description = "Enable su.", default = false, type = "boolean"})
  29. add_configs("mount", {description = "Enable mount.", default = false, type = "boolean"})
  30. add_configs("runuser", {description = "Enable runuser.", default = false, type = "boolean"})
  31. add_configs("makeinstall-chown", {description = "Enable makeinstall-chown.", default = false, type = "boolean"})
  32. add_configs("makeinstall-setuid", {description = "Enable makeinstall-setuid.", default = false, type = "boolean"})
  33. on_load(function (package)
  34. package:addenv("PATH", "bin")
  35. end)
  36. on_install("macosx", "linux", function (package)
  37. local configs = {"--disable-dependency-tracking",
  38. "--disable-silent-rules",
  39. "--without-python",
  40. "--without-systemd",
  41. "--with-bashcompletiondir=" .. path.join(package:installdir("share"), "bash-completion")}
  42. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  43. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  44. if package:debug() then
  45. table.insert(configs, "--enable-debug")
  46. end
  47. if package:config("pic") ~= false then
  48. table.insert(configs, "--with-pic")
  49. end
  50. for name, enabled in pairs(package:configs()) do
  51. if not package:extraconf("configs", name, "builtin") then
  52. if enabled then
  53. table.insert(configs, "--enable-" .. name)
  54. else
  55. table.insert(configs, "--disable-" .. name)
  56. end
  57. end
  58. end
  59. import("package.tools.autoconf").install(package, configs)
  60. end)