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

neon-* 4713 #103

Closed
wants to merge 4 commits into from
Closed
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
14 changes: 12 additions & 2 deletions Formula/neon-extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class NeonExtension < Formula
desc "Extension enabling storage manager API and Pageserver communication"
homepage "https://github.com/neondatabase/neon"
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 @@ -16,6 +16,16 @@ class NeonExtension < Formula

depends_on "bayandin/tap/neon-postgres"

# 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"
end

def extensions
%w[neon_walredo neon neon_rmgr neon_utils]
end
Expand Down
4 changes: 2 additions & 2 deletions Formula/neon-local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class NeonLocal < Formula
desc "CLI for running Neon locally"
homepage "https://github.com/neondatabase/neon"
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 Down
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
50 changes: 30 additions & 20 deletions Formula/neon-storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ class NeonStorage < Formula
desc "Storage components for Neon"
homepage "https://github.com/neondatabase/neon"
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 @@ -14,14 +14,20 @@ class NeonStorage < Formula
sha256 cellar: :any_skip_relocation, x86_64_linux: "88c87bf0a437c6278a10376a3c20e20b9a0bb36296f3b515f6c51880a7b4937f"
end

depends_on "bayandin/tap/neon-postgres" => :build
depends_on "pkg-config" => :build
depends_on "rust" => :build
depends_on "bayandin/tap/neon-postgres"
depends_on "openssl@3"
depends_on "protobuf"

uses_from_macos "llvm" => :build

on_linux do
# `attachment_service` got linked with system libpq on Linux.
# Not sure how to prevent it from doing that, so just depend on it to make audit happy
depends_on "libpq"
end

def binaries
%w[
attachment_service compute_ctl neon_local pagebench
Expand All @@ -35,9 +41,6 @@ def neon_postgres
end

def install
ENV["BUILD_TAG"] = build.stable? ? "release-#{version}" : "dev-#{Utils.git_short_head}"
ENV["GIT_VERSION"] = Utils.git_head

# 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
if OS.mac?
Expand All @@ -48,20 +51,27 @@ def install
EOS
end

with_env(POSTGRES_INSTALL_DIR: neon_postgres.opt_libexec) do
system "cargo", "install", *std_cargo_args(root: libexec, path: "compute_tools")
system "cargo", "install", *std_cargo_args(root: libexec, path: "control_plane")
system "cargo", "install", *std_cargo_args(root: libexec, path: "control_plane/attachment_service")
system "cargo", "install", *std_cargo_args(root: libexec, path: "libs/postgres_ffi/wal_craft")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver/ctl")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver/pagebench")
system "cargo", "install", *std_cargo_args(root: libexec, path: "proxy")
system "cargo", "install", *std_cargo_args(root: libexec, path: "s3_scrubber")
system "cargo", "install", *std_cargo_args(root: libexec, path: "safekeeper")
system "cargo", "install", *std_cargo_args(root: libexec, path: "storage_broker")
system "cargo", "install", *std_cargo_args(root: libexec, path: "trace")
end
ENV["BUILD_TAG"] = build.stable? ? "release-#{version}" : "dev-#{Utils.git_short_head}"
ENV["GIT_VERSION"] = Utils.git_head
ENV["POSTGRES_INSTALL_DIR"] = neon_postgres.opt_libexec
ENV["POSTGRES_DISTRIB_DIR"] = neon_postgres.opt_libexec

ENV["PQ_LIB_DIR"] = neon_postgres.pg_lib_for("v16") if OS.mac?
mkdir_p libexec/"control_plane/attachment_service"
cp_r "control_plane/attachment_service/migrations", libexec/"control_plane/attachment_service/"

system "cargo", "install", *std_cargo_args(root: libexec, path: "compute_tools")
system "cargo", "install", *std_cargo_args(root: libexec, path: "control_plane")
system "cargo", "install", *std_cargo_args(root: libexec, path: "control_plane/attachment_service")
system "cargo", "install", *std_cargo_args(root: libexec, path: "libs/postgres_ffi/wal_craft")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver/ctl")
system "cargo", "install", *std_cargo_args(root: libexec, path: "pageserver/pagebench")
system "cargo", "install", *std_cargo_args(root: libexec, path: "proxy")
system "cargo", "install", *std_cargo_args(root: libexec, path: "s3_scrubber")
system "cargo", "install", *std_cargo_args(root: libexec, path: "safekeeper")
system "cargo", "install", *std_cargo_args(root: libexec, path: "storage_broker")
system "cargo", "install", *std_cargo_args(root: libexec, path: "trace")
end

test do
Expand Down
Loading