xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. if is_subhost("msys") then
  11. add_deps("pacman::pkg-config")
  12. end
  13. on_install("@msys", function (package)
  14. end)
  15. on_install("@macosx", "@linux", "@bsd", function (package)
  16. local pcpath = {"/usr/local/lib/pkgconfig", "/usr/lib/pkgconfig"}
  17. if package:is_plat("linux") and package:is_arch("x86_64") then
  18. table.insert(pcpath, "/usr/lib64/pkgconfig")
  19. table.insert(pcpath, "/usr/lib/x86_64-linux-gnu/pkgconfig")
  20. end
  21. if is_host("macosx") then
  22. table.insert(pcpath, "/usr/local/Homebrew/Library/Homebrew/os/mac/pkgconfig/" .. macos.version():major() .. '.' .. macos.version():minor())
  23. end
  24. local configs = {
  25. "--disable-werror",
  26. "--disable-compile-warnings",
  27. "--disable-debug",
  28. "--disable-host-tool",
  29. "--with-internal-glib",
  30. ["with-pc-path"] = table.concat(pcpath, ':'),
  31. }
  32. local opt = {
  33. cflags = {
  34. "-Wno-int-conversion", -- https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/81
  35. "-std=gnu99", -- gcc15 default c23
  36. }
  37. }
  38. import("package.tools.autoconf").install(package, configs, opt)
  39. end)
  40. on_test(function (package)
  41. os.vrun("pkg-config --version")
  42. end)