xmake.lua 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("pciutils")
  2. set_homepage("https://mj.ucw.cz/sw/pciutils/")
  3. set_description("The PCI Utilities")
  4. set_license("GPL-2.0")
  5. add_urls("https://mj.ucw.cz/download/linux/pci/pciutils-$(version).tar.gz")
  6. add_versions("3.7.0", "08c27e01030d1fcc700d02bc2ea66c638f58a3d150e45e58852aa82ad4160d84")
  7. if is_plat("macosx") then
  8. add_frameworks("IOKit")
  9. end
  10. add_deps("zlib")
  11. add_deps("libudev", {system = true, optional = true})
  12. on_install("macosx", "linux", function (package)
  13. local configs = {"ZLIB=yes"}
  14. table.insert(configs, "SHARED=" .. (package:config("shared") and "yes" or "no"))
  15. table.insert(configs, "PREFIX=" .. package:installdir())
  16. local cflags = {}
  17. local ldflags = {}
  18. for _, dep in ipairs(package:orderdeps()) do
  19. local fetchinfo = dep:fetch()
  20. if fetchinfo then
  21. for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
  22. table.insert(cflags, "-I" .. includedir)
  23. end
  24. for _, linkdir in ipairs(fetchinfo.linkdirs) do
  25. table.insert(ldflags, "-L" .. linkdir)
  26. end
  27. end
  28. end
  29. import("package.tools.make").build(package, configs, {cflags = cflags, ldflags = ldflags})
  30. os.vrunv("make", table.join({"install"}, configs))
  31. os.vrunv("make", table.join({"install-lib"}, configs))
  32. package:addenv("PATH", "sbin")
  33. end)
  34. on_test(function (package)
  35. assert(package:has_cfuncs("pci_init", {includes = "pci/pci.h"}))
  36. end)