xmake.lua 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_versions("2.39.2", "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f")
  12. add_patches("2.36.2", path.join(os.scriptdir(), "patches", "2.36.2", "includes.patch"), "7274762cac2810b5f0d17ecb5ac69c7069e7ff2b880df663b7072628df0867f3")
  13. if is_plat("macosx") then
  14. add_extsources("brew::util-linux")
  15. elseif is_plat("linux") then
  16. add_extsources("apt::util-linux", "pacman::util-linux")
  17. add_deps("ncurses", "zlib")
  18. end
  19. add_configs("nls", {description = "Enable Native Language Support.", default = false, type = "boolean"})
  20. add_configs("ipcs", {description = "Enable ipcs.", default = false, type = "boolean"})
  21. add_configs("ipcrm", {description = "Enable ipcrm.", default = false, type = "boolean"})
  22. add_configs("wall", {description = "Enable wall.", default = false, type = "boolean"})
  23. add_configs("libuuid", {description = "Enable libuuid.", default = false, type = "boolean"})
  24. add_configs("libblkid", {description = "Enable libblkid.", default = false, type = "boolean"})
  25. add_configs("libmount", {description = "Enable libmount.", default = false, type = "boolean"})
  26. add_configs("libsmartcols", {description = "Enable libsmartcols.", default = false, type = "boolean"})
  27. add_configs("libfdisk", {description = "Enable libfdisk.", default = false, type = "boolean"})
  28. add_configs("use-tty-group", {description = "Enable use-tty-group.", default = false, type = "boolean"})
  29. add_configs("kill", {description = "Enable kill.", default = false, type = "boolean"})
  30. add_configs("cal", {description = "Enable cal.", default = false, type = "boolean"})
  31. add_configs("systemd", {description = "Enable systemd.", default = false, type = "boolean"})
  32. add_configs("chfn-chsh", {description = "Enable chfn-chsh.", default = false, type = "boolean"})
  33. add_configs("login", {description = "Enable login.", default = false, type = "boolean"})
  34. add_configs("su", {description = "Enable su.", default = false, type = "boolean"})
  35. add_configs("mount", {description = "Enable mount.", default = false, type = "boolean"})
  36. add_configs("runuser", {description = "Enable runuser.", default = false, type = "boolean"})
  37. add_configs("makeinstall-chown", {description = "Enable makeinstall-chown.", default = false, type = "boolean"})
  38. add_configs("makeinstall-setuid", {description = "Enable makeinstall-setuid.", default = false, type = "boolean"})
  39. on_load(function (package)
  40. if package:is_plat("macosx") and package:config("nls") then
  41. package:add("deps", "libintl")
  42. end
  43. package:addenv("PATH", "bin")
  44. package:addenv("PATH", "sbin")
  45. end)
  46. on_install("macosx", "linux", function (package)
  47. local configs = {"--disable-dependency-tracking",
  48. "--disable-silent-rules",
  49. "--without-python",
  50. "--without-systemd",
  51. "--with-bashcompletiondir=" .. path.join(package:installdir("share"), "bash-completion")}
  52. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  53. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  54. if package:debug() then
  55. table.insert(configs, "--enable-debug")
  56. end
  57. if package:config("pic") ~= false then
  58. table.insert(configs, "--with-pic")
  59. end
  60. for name, enabled in pairs(package:configs()) do
  61. if not package:extraconf("configs", name, "builtin") then
  62. if enabled then
  63. table.insert(configs, "--enable-" .. name)
  64. else
  65. table.insert(configs, "--disable-" .. name)
  66. end
  67. end
  68. end
  69. import("package.tools.autoconf").install(package, configs)
  70. end)