Skip to content

Commit 11d2862

Browse files
authored
Merge pull request #220126 from kewitz/formula/libpq/16
libpq@16 16.8 (new formula)
2 parents 96e1fc4 + 2f6e313 commit 11d2862

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

Aliases/libpq@17

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Formula/lib/libpq.rb

Formula/lib/[email protected]

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
class LibpqAT16 < Formula
2+
desc "Postgres C API library"
3+
homepage "https://www.postgresql.org/docs/16/libpq.html"
4+
url "https://ftp.postgresql.org/pub/source/v16.9/postgresql-16.9.tar.bz2"
5+
sha256 "07c00fb824df0a0c295f249f44691b86e3266753b380c96f633c3311e10bd005"
6+
license "PostgreSQL"
7+
8+
livecheck do
9+
url "https://ftp.postgresql.org/pub/source/"
10+
regex(%r{href=["']?v?(16(?:\.\d+)+)/?["' >]}i)
11+
end
12+
13+
bottle do
14+
sha256 arm64_sequoia: "67a3882334f2448796238f87a74a594218dbf8cf19ab4161d7de7b0ca6146415"
15+
sha256 arm64_sonoma: "25b4ea9f563b4d7098da7aec89f0891af7f4c60bd2fec6cc914b6791266c882d"
16+
sha256 arm64_ventura: "af1e4227b8408aa7d62ecce5681d739ca5e967e244ea47638c92cfd2c4fb4320"
17+
sha256 sonoma: "234174030c3d3b291162f43c23b12515e0b16ce559b863c9933f7fd906c1cc11"
18+
sha256 ventura: "ff78291761e454338f6f567915cd3e491f7775c92e8b4f7c9ca0577038d0f73f"
19+
sha256 x86_64_linux: "c2dc9c741adb74eb78080bbd99630fccb056a3eb8e19220ba732b7a9829c8a46"
20+
end
21+
22+
keg_only :versioned_formula
23+
24+
# https://endoflife.date/postgresql
25+
deprecate! date: "2028-11-09", because: :unmaintained, replacement_formula: "libpq"
26+
27+
depends_on "pkgconf" => :build
28+
depends_on "icu4c@77"
29+
# GSSAPI provided by Kerberos.framework crashes when forked.
30+
# See https://github.com/Homebrew/homebrew-core/issues/47494.
31+
depends_on "krb5"
32+
depends_on "openssl@3"
33+
34+
uses_from_macos "zlib"
35+
36+
on_linux do
37+
depends_on "readline"
38+
end
39+
40+
def install
41+
system "./configure", "--disable-debug",
42+
"--prefix=#{prefix}",
43+
"--with-gssapi",
44+
"--with-openssl",
45+
"--libdir=#{opt_lib}",
46+
"--includedir=#{opt_include}"
47+
dirs = %W[
48+
libdir=#{lib}
49+
includedir=#{include}
50+
pkgincludedir=#{include}/postgresql
51+
includedir_server=#{include}/postgresql/server
52+
includedir_internal=#{include}/postgresql/internal
53+
]
54+
system "make"
55+
system "make", "-C", "src/bin", "install", *dirs
56+
system "make", "-C", "src/include", "install", *dirs
57+
system "make", "-C", "src/interfaces", "install", *dirs
58+
system "make", "-C", "src/common", "install", *dirs
59+
system "make", "-C", "src/port", "install", *dirs
60+
system "make", "-C", "doc", "install", *dirs
61+
end
62+
63+
test do
64+
(testpath/"libpq.c").write <<~EOS
65+
#include <stdlib.h>
66+
#include <stdio.h>
67+
#include <libpq-fe.h>
68+
69+
int main()
70+
{
71+
const char *conninfo;
72+
PGconn *conn;
73+
74+
conninfo = "dbname = postgres";
75+
76+
conn = PQconnectdb(conninfo);
77+
78+
if (PQstatus(conn) != CONNECTION_OK) // This should always fail
79+
{
80+
printf("Connection to database attempted and failed");
81+
PQfinish(conn);
82+
exit(0);
83+
}
84+
85+
return 0;
86+
}
87+
EOS
88+
system ENV.cc, "libpq.c", "-L#{lib}", "-I#{include}", "-lpq", "-o", "libpqtest"
89+
assert_equal "Connection to database attempted and failed", shell_output("./libpqtest")
90+
end
91+
end

0 commit comments

Comments
 (0)