xmake.lua 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package("libstatgrab")
  2. set_homepage("https://libstatgrab.org/")
  3. set_description("A cross platform library for accessing system statistics")
  4. set_license("GPL-2.1")
  5. add_urls("https://github.com/libstatgrab/libstatgrab.git")
  6. add_urls("https://github.com/libstatgrab/libstatgrab/releases/download/$(version).tar.gz", {version = function (version)
  7. return "LIBSTATGRAB_" .. version:gsub('%.', '_') .. "/libstatgrab-" .. version
  8. end})
  9. add_versions("0.92.1", "5688aa4a685547d7174a8a373ea9d8ee927e766e3cc302bdee34523c2c5d6c11")
  10. add_configs("thread_support", {description = "support for multi-threaded environments", default = true, type = "boolean"})
  11. add_deps("automake", "autoconf", "libtool")
  12. if is_plat("macosx") then
  13. add_frameworks("IOKit", "CoreFoundation")
  14. end
  15. on_install("macosx", "linux", function (package)
  16. local configs = {"--disable-statgrab",
  17. "--disable-saidar",
  18. "--disable-man",
  19. "--disable-tests"}
  20. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  21. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  22. if not package:config("thread_support") then
  23. table.insert(configs, "--disable-thread-support")
  24. else
  25. package:add("syslinks", "pthread")
  26. end
  27. import("package.tools.autoconf").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cfuncs("sg_init", {includes = "statgrab.h"}))
  31. end)