-
Notifications
You must be signed in to change notification settings - Fork 0
/
neon-storage.rb
80 lines (68 loc) · 3.19 KB
/
neon-storage.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
class NeonStorage < Formula
desc "Storage components for Neon"
homepage "https://github.com/neondatabase/neon"
url "https://github.com/neondatabase/neon.git",
tag: "release-7381",
revision: "671889b0e959a6520337ba3c56d645d6ff2ec1c1"
license "Apache-2.0"
head "https://github.com/neondatabase/neon.git", branch: "main"
livecheck do
url :head
regex(/^release-(\d+)$/i)
end
bottle do
root_url "https://ghcr.io/v2/bayandin/tap"
sha256 cellar: :any, arm64_sequoia: "20d7f21a0595d4d8955fee5cf6692c499317d98fab1a8bdc8a40ebd6357e7e90"
sha256 cellar: :any, arm64_sonoma: "c1e59da95704f9bf0f8500a90f6fbec8b01e748ed45099936ab2d51207db9620"
sha256 cellar: :any, ventura: "d7f865958d49158df43430134661da214a62a7d6b132c5f96bd07ca69b54d984"
sha256 cellar: :any_skip_relocation, x86_64_linux: "bc99d532c2e18bab71bd60e93c711773524530e5f2c436774dbae78d14820f24"
end
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
# `storage_controller` 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[
compute_ctl neon_local pagebench pagectl pageserver
safekeeper storage_broker storage_controller
storage_scrubber storcon_cli wal_craft
]
end
def neon_postgres
Formula["bayandin/tap/neon-postgres"]
end
def install
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/"storage_controller"
cp_r "storage_controller/migrations", libexec/"storage_controller/"
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/storcon_cli")
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: "safekeeper")
system "cargo", "install", *std_cargo_args(root: libexec, path: "storage_broker")
system "cargo", "install", *std_cargo_args(root: libexec, path: "storage_controller")
system "cargo", "install", *std_cargo_args(root: libexec, path: "storage_scrubber")
end
test do
(binaries - %w[pagebench wal_craft]).each do |file|
system libexec/"bin"/file, "--version"
end
system libexec/"bin/wal_craft", "--help"
system libexec/"bin/pagebench", "--help"
end
end