xmake.lua 4.3 KB

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