libpq 9.6.3 (new formula)
This commit is contained in:
parent
54a8897bfd
commit
8e78f4a8c9
1 changed files with 49 additions and 0 deletions
49
Formula/libpq.rb
Normal file
49
Formula/libpq.rb
Normal file
|
@ -0,0 +1,49 @@
|
|||
class Libpq < Formula
|
||||
desc "Postgres C API library"
|
||||
homepage "https://www.postgresql.org/docs/9.6/static/libpq.html"
|
||||
url "https://ftp.postgresql.org/pub/source/v9.6.3/postgresql-9.6.3.tar.bz2"
|
||||
sha256 "1645b3736901f6d854e695a937389e68ff2066ce0cde9d73919d6ab7c995b9c6"
|
||||
|
||||
keg_only "conflicts with postgres formula"
|
||||
|
||||
depends_on "openssl"
|
||||
|
||||
def install
|
||||
system "./configure", "--disable-debug",
|
||||
"--prefix=#{prefix}",
|
||||
"--with-openssl"
|
||||
system "make"
|
||||
system "make", "-C", "src/bin", "install"
|
||||
system "make", "-C", "src/include", "install"
|
||||
system "make", "-C", "src/interfaces", "install"
|
||||
system "make", "-C", "doc", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"libpq.c").write <<-EOS
|
||||
#include <stdio.h>
|
||||
#include <libpq-fe.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
const char *conninfo;
|
||||
PGconn *conn;
|
||||
|
||||
conninfo = "dbname = postgres";
|
||||
|
||||
conn = PQconnectdb(conninfo);
|
||||
|
||||
if (PQstatus(conn) != CONNECTION_OK) // This should always fail
|
||||
{
|
||||
printf("Connection to database attempted and failed");
|
||||
PQfinish(conn);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system ENV.cc, "libpq.c", "-L#{lib}", "-I#{include}", "-lpq", "-o", "libpqtest"
|
||||
assert_equal "Connection to database attempted and failed", shell_output("./libpqtest")
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue