xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728
  1. package("pkg-config")
  2. set_kind("binary")
  3. set_homepage("https://freedesktop.org/wiki/Software/pkg-config/")
  4. set_description("A helper tool used when compiling applications and libraries.")
  5. if is_host("macosx", "linux", "bsd") then
  6. add_urls("https://pkgconfig.freedesktop.org/releases/pkg-config-$(version).tar.gz")
  7. add_urls("http://fresh-center.net/linux/misc/pkg-config-$(version).tar.gz")
  8. add_versions("0.29.2", "6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591")
  9. end
  10. on_install("@macosx", "@linux", "@bsd", function (package)
  11. local pcpath = {"/usr/local/lib/pkgconfig", "/usr/lib/pkgconfig"}
  12. if package:is_plat("linux") and package:is_arch("x86_64") then
  13. table.insert(pcpath, "/usr/lib64/pkgconfig")
  14. table.insert(pcpath, "/usr/lib/x86_64-linux-gnu/pkgconfig")
  15. end
  16. if is_host("macosx") then
  17. table.insert(pcpath, "/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/" .. macos.version():major() .. '.' .. macos.version():minor())
  18. end
  19. -- see https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/81
  20. local opt = {cflags = "-Wno-int-conversion"}
  21. import("package.tools.autoconf").install(package, {"--disable-werror", "--disable-compile-warnings", "--disable-debug", "--disable-host-tool", "--with-internal-glib", ["with-pc-path"] = table.concat(pcpath, ':')}, opt)
  22. end)
  23. on_test(function (package)
  24. os.vrun("pkg-config --version")
  25. end)