2
0

xmake.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("libpq")
  2. set_homepage("https://www.postgresql.org/docs/14/libpq.html")
  3. set_description("Postgres C API library")
  4. set_license("PostgreSQL")
  5. add_urls("https://github.com/postgres/postgres/archive/refs/tags/REL_$(version).tar.gz", {alias = "github", version = function (version)
  6. return version:gsub("%.", "_")
  7. end})
  8. add_versions("14.1", "14809c9f669851ab89b344a50219e85b77f3e93d9df9e255b9781d8d60fcfbc9")
  9. add_deps("krb5", "openssl", "zlib")
  10. if is_plat("linux") then
  11. add_deps("flex", "bison")
  12. end
  13. on_install("macosx", "linux", function (package)
  14. local configs = {"--with-openssl", "--without-readline"}
  15. table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
  16. table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
  17. if package:is_plat("macosx") then
  18. table.insert(configs, "--with-gssapi")
  19. end
  20. if package:debug() then
  21. table.insert(configs, "--enable-debug")
  22. end
  23. if package:config("pic") ~= false then
  24. table.insert(configs, "--with-pic")
  25. end
  26. import("package.tools.autoconf").install(package, configs, {packagedeps = {"openssl", "zlib"}})
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cfuncs("PQconnectdb", {includes = "libpq-fe.h"}))
  30. end)