package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.6 KiB

package("libpq")
set_homepage("https://www.postgresql.org/docs/14/libpq.html")
set_description("Postgres C API library")
set_license("PostgreSQL")
add_urls("https://ftp.postgresql.org/pub/source/v$(version)/postgresql-$(version).tar.bz2", {alias = "home"})
add_urls("https://github.com/postgres/postgres/archive/refs/tags/REL_$(version).tar.gz", {alias = "github", version = function (version)
return version:gsub("%.", "_")
end})
add_versions("home:14.1", "4d3c101ea7ae38982f06bdc73758b53727fb6402ecd9382006fa5ecc7c2ca41f")
add_versions("github:14.1", "14809c9f669851ab89b344a50219e85b77f3e93d9df9e255b9781d8d60fcfbc9")
add_deps("krb5", "openssl", "zlib")
if is_plat("linux") then
add_deps("flex", "bison")
end
on_install("macosx", "linux", function (package)
local configs = {"--with-openssl", "--without-readline"}
table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
if package:is_plat("macosx") then
table.insert(configs, "--with-gssapi")
end
if package:debug() then
table.insert(configs, "--enable-debug")
end
if package:config("pic") ~= false then
table.insert(configs, "--with-pic")
end
import("package.tools.autoconf").install(package, configs, {packagedeps = {"openssl", "zlib"}})
end)
on_test(function (package)
assert(package:has_cfuncs("PQconnectdb", {includes = "libpq-fe.h"}))
end)