Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpq@15: add libpq 15.8 #193209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Aliases/libpq@17
79 changes: 79 additions & 0 deletions Formula/lib/libpq@15.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
class LibpqAT15 < Formula
desc "Postgres C API library"
homepage "https://www.postgresql.org/docs/15/libpq.html"
url "https://ftp.postgresql.org/pub/source/v15.8/postgresql-15.8.tar.bz2"
sha256 "4403515f9a69eeb3efebc98f30b8c696122bfdf895e92b3b23f5b8e769edcb6a"
license "PostgreSQL"

livecheck do
url "https://ftp.postgresql.org/pub/source/"
regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i)
end

keg_only "conflicts with postgres formula"
keg_only :versioned_formula
Comment on lines +13 to +14
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keg_only "conflicts with postgres formula"
keg_only :versioned_formula
keg_only :versioned_formula


# GSSAPI provided by Kerberos.framework crashes when forked.
# See https://github.com/Homebrew/homebrew-core/issues/47494.
depends_on "krb5"

depends_on "openssl@3"

uses_from_macos "zlib"

on_linux do
depends_on "readline"
end

def install
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--with-gssapi",
"--with-openssl",
"--libdir=#{opt_lib}",
"--includedir=#{opt_include}"
dirs = %W[
libdir=#{lib}
includedir=#{include}
pkgincludedir=#{include}/postgresql
includedir_server=#{include}/postgresql/server
includedir_internal=#{include}/postgresql/internal
]
system "make"
system "make", "-C", "src/bin", "install", *dirs
system "make", "-C", "src/include", "install", *dirs
system "make", "-C", "src/interfaces", "install", *dirs
system "make", "-C", "src/common", "install", *dirs
system "make", "-C", "src/port", "install", *dirs
system "make", "-C", "doc", "install", *dirs
end

test do
(testpath/"libpq.c").write <<~EOS
#include <stdlib.h>
#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