142 lines
4.4 KiB
Ruby
142 lines
4.4 KiB
Ruby
class PostgresqlAT11 < Formula
|
|
desc "Object-relational database system"
|
|
homepage "https://www.postgresql.org/"
|
|
url "https://ftp.postgresql.org/pub/source/v11.18/postgresql-11.18.tar.bz2"
|
|
sha256 "d24f20efc52e918acfbcca21e9cea28e0e263b846a0c408fcfac3b3c4a0f7504"
|
|
license "PostgreSQL"
|
|
revision 1
|
|
|
|
livecheck do
|
|
url "https://ftp.postgresql.org/pub/source/"
|
|
regex(%r{href=["']?v?(11(?:\.\d+)+)/?["' >]}i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_ventura: "ef88dcfb082de812515b3b35b4c7c873b2b03187203a000b14c1b233050b246c"
|
|
sha256 arm64_monterey: "210cf972ae022f1b872c4e614ed0bb26ab157f770148b91bc7f9f4ff3f716229"
|
|
sha256 arm64_big_sur: "63152529e2e6c1418a4cf2bfb10f21fb4099863eb408fe234f8732e8ed908c9d"
|
|
sha256 ventura: "5a2b14a61ad4a7c66b31926f31f89a3396ac4b1a7d743be4db14712fe767bf69"
|
|
sha256 monterey: "e9b2ff6c980a9d10478ecdb90ee6f8c53608e8e19d9949cb4e79ff046940d3c9"
|
|
sha256 big_sur: "37783c805e1a3f8727ca7c77c5365e60f70b32e52378526820c1d46609a89f82"
|
|
sha256 x86_64_linux: "d51dca0c3899cc156c3951289deacfa9601b5d53c779525977b3c9bbf6b401f0"
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
# https://www.postgresql.org/support/versioning/
|
|
deprecate! date: "2023-11-09", because: :unsupported
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "icu4c"
|
|
depends_on "openssl@1.1"
|
|
depends_on "readline"
|
|
|
|
uses_from_macos "krb5"
|
|
uses_from_macos "libxml2"
|
|
uses_from_macos "libxslt"
|
|
uses_from_macos "openldap"
|
|
uses_from_macos "perl"
|
|
|
|
on_linux do
|
|
depends_on "linux-pam"
|
|
depends_on "util-linux"
|
|
end
|
|
|
|
def install
|
|
ENV.prepend "LDFLAGS", "-L#{Formula["openssl@1.1"].opt_lib} -L#{Formula["readline"].opt_lib}"
|
|
ENV.prepend "CPPFLAGS", "-I#{Formula["openssl@1.1"].opt_include} -I#{Formula["readline"].opt_include}"
|
|
|
|
args = %W[
|
|
--disable-debug
|
|
--prefix=#{prefix}
|
|
--datadir=#{opt_pkgshare}
|
|
--libdir=#{opt_lib}
|
|
--includedir=#{opt_include}
|
|
--sysconfdir=#{etc}
|
|
--docdir=#{doc}
|
|
--enable-thread-safety
|
|
--with-gssapi
|
|
--with-icu
|
|
--with-ldap
|
|
--with-libxml
|
|
--with-libxslt
|
|
--with-openssl
|
|
--with-pam
|
|
--with-perl
|
|
--with-uuid=e2fs
|
|
]
|
|
if OS.mac?
|
|
args += %w[
|
|
--with-bonjour
|
|
--with-tcl
|
|
]
|
|
end
|
|
|
|
# PostgreSQL by default uses xcodebuild internally to determine this,
|
|
# which does not work on CLT-only installs.
|
|
args << "PG_SYSROOT=#{MacOS.sdk_path}" if MacOS.sdk_root_needed?
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "install-world", "datadir=#{pkgshare}",
|
|
"libdir=#{lib}",
|
|
"pkglibdir=#{lib}",
|
|
"includedir=#{include}",
|
|
"pkgincludedir=#{include}",
|
|
"includedir_server=#{include}/server",
|
|
"includedir_internal=#{include}/internal"
|
|
|
|
if OS.linux?
|
|
inreplace lib/"pgxs/src/Makefile.global",
|
|
"LD = #{HOMEBREW_PREFIX}/Homebrew/Library/Homebrew/shims/linux/super/ld",
|
|
"LD = #{HOMEBREW_PREFIX}/bin/ld"
|
|
end
|
|
end
|
|
|
|
def post_install
|
|
(var/"log").mkpath
|
|
postgresql_datadir.mkpath
|
|
|
|
# Don't initialize database, it clashes when testing other PostgreSQL versions.
|
|
return if ENV["HOMEBREW_GITHUB_ACTIONS"]
|
|
|
|
system "#{bin}/initdb", "--locale=C", "-E", "UTF-8", postgresql_datadir unless pg_version_exists?
|
|
end
|
|
|
|
def postgresql_datadir
|
|
var/name
|
|
end
|
|
|
|
def postgresql_log_path
|
|
var/"log/#{name}.log"
|
|
end
|
|
|
|
def pg_version_exists?
|
|
(postgresql_datadir/"PG_VERSION").exist?
|
|
end
|
|
|
|
def caveats
|
|
<<~EOS
|
|
This formula has created a default database cluster with:
|
|
initdb --locale=C -E UTF-8 #{postgresql_datadir}
|
|
For more details, read:
|
|
https://www.postgresql.org/docs/#{version.major}/app-initdb.html
|
|
EOS
|
|
end
|
|
|
|
service do
|
|
run [opt_bin/"postgres", "-D", f.postgresql_datadir]
|
|
keep_alive true
|
|
log_path f.postgresql_log_path
|
|
error_log_path f.postgresql_log_path
|
|
working_dir HOMEBREW_PREFIX
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/initdb", testpath/"test" unless ENV["HOMEBREW_GITHUB_ACTIONS"]
|
|
assert_equal opt_pkgshare.to_s, shell_output("#{bin}/pg_config --sharedir").chomp
|
|
assert_equal opt_lib.to_s, shell_output("#{bin}/pg_config --libdir").chomp
|
|
assert_equal opt_lib.to_s, shell_output("#{bin}/pg_config --pkglibdir").chomp
|
|
end
|
|
end
|