Skip to content

Commit

Permalink
neon-postgres 4713
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Jan 31, 2024
1 parent 7a1bf7f commit c3c96b1
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions Formula/neon-postgres.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class NeonPostgres < Formula
desc "Neon's fork of PostgreSQL"
homepage "https://github.com/neondatabase/postgres"
url "https://github.com/neondatabase/neon.git",
tag: "release-4642",
revision: "a1a74eef2c60c283bc038b65b99db2ed0c68f5bb"
tag: "release-4713",
revision: "1ec3e39d4e777d53d78eea8eba7d21f37942b000"
license "Apache-2.0"
head "https://github.com/neondatabase/neon.git", branch: "main"

Expand All @@ -28,15 +28,9 @@ class NeonPostgres < Formula
uses_from_macos "libxml2"
uses_from_macos "libxslt"

# A workaround for `FATAL: postmaster became multithreaded during startup` on macOS >= 14.2
# See https://www.postgresql.org/message-id/flat/CYMBV0OT7216.JNRUO6R6GH86%40neon.tech
on_macos do
depends_on "bayandin/tap/curl-without-ipv6"
end

on_linux do
depends_on "curl"
depends_on "libseccomp"
depends_on "util-linux"
end

def pg_versions(with: nil, without: nil)
Expand All @@ -50,6 +44,10 @@ def pg_bin_for(version)
opt_libexec/version/"bin"
end

def pg_lib_for(version)
opt_libexec/version/"lib"
end

def dlsuffix(version)
# Ref https://github.com/postgres/postgres/commit/b55f62abb2c2e07dfae99e19a2b3d7ca9e58dc1a
(OS.linux? || "v14 v15".include?(version)) ? "so" : "dylib"
Expand All @@ -58,21 +56,16 @@ def dlsuffix(version)
def install
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"

ENV.prepend "LDFLAGS", "-L#{Formula["openssl@3"].opt_lib} -L#{Formula["readline"].opt_lib}"
ENV.prepend "CPPFLAGS", "-I#{Formula["openssl@3"].opt_include} -I#{Formula["readline"].opt_include}"

if OS.linux?
ENV.prepend "LDFLAGS", "-L#{Formula["curl"].opt_lib}"
ENV.prepend "CPPFLAGS", "-I#{Formula["curl"].opt_include}"
end

deps = %w[openssl@3 readline]
pg_versions.each do |v|
cd "vendor/postgres-#{v}" do
args = %W[
--prefix=#{libexec}/#{v}
--datadir=#{HOMEBREW_PREFIX}/share/#{name}/#{v}
--libdir=#{HOMEBREW_PREFIX}/lib/#{name}/#{v}
--includedir=#{HOMEBREW_PREFIX}/include/#{name}/#{v}
--with-includes=#{deps.map { |d| Formula[d].opt_include }.join(" ")}
--with-libraries=#{deps.map { |d| Formula[d].opt_lib }.join(" ")}
--enable-debug
--with-icu
--with-libxml
Expand All @@ -82,7 +75,7 @@ def install
--with-uuid=e2fs
]
args << "--with-zstd" if v != "v14"
args << "PG_SYSROOT=#{MacOS.sdk_path}" if MacOS.sdk_root_needed?
args << "PG_SYSROOT=#{MacOS.sdk_path}" if OS.mac? && MacOS.sdk_root_needed?

system "./configure", *args
system "make"
Expand Down

0 comments on commit c3c96b1

Please sign in to comment.