-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
class PostgresqlPlpyAT17 < Formula | ||
desc "Python3 as procedural language for Postgres" | ||
homepage "https://www.postgresql.org/" | ||
url "https://ftp.postgresql.org/pub/source/v17.0/postgresql-17.0.tar.bz2" | ||
sha256 "7e276131c0fdd6b62588dbad9b3bb24b8c3498d5009328dba59af16e819109de" | ||
license "PostgreSQL" | ||
|
||
livecheck do | ||
url "https://ftp.postgresql.org/pub/source/" | ||
regex(%r{href=["']?v?(17(?:\.\d+)+)/?["' >]}i) | ||
end | ||
|
||
keg_only :versioned_formula | ||
|
||
# https://www.postgresql.org/support/versioning/ | ||
deprecate! date: "2029-11-08", because: :unsupported | ||
|
||
depends_on "postgresql@17" | ||
depends_on "[email protected]" | ||
|
||
def install | ||
print "#{buildpath}/stage" | ||
# Modify Makefile to link macOS binaries using Cellar path. Otherwise, binaries are linked | ||
# using #{HOMEBREW_PREFIX}/lib path set during ./configure, which will cause audit failures | ||
# for broken linkage as the paths are not created until post-install step. | ||
|
||
inreplace "src/Makefile.shlib", "-install_name '$(libdir)/", "-install_name '#{lib}/postgresql/" | ||
|
||
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog" | ||
ENV.delete "PKG_CONFIG_LIBDIR" | ||
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}" | ||
ENV.prepend "PYTHON", "#{HOMEBREW_PREFIX}/opt/[email protected]/bin/python3.12" | ||
|
||
# Fix 'libintl.h' file not found for extensions | ||
if OS.mac? | ||
ENV.prepend "LDFLAGS", "-L#{Formula["gettext"].opt_lib}" | ||
ENV.prepend "CPPFLAGS", "-I#{Formula["gettext"].opt_include}" | ||
end | ||
|
||
args = std_configure_args + %W[ | ||
--datadir=#{HOMEBREW_PREFIX}/share/postgresql@17 | ||
--libdir=#{HOMEBREW_PREFIX}/lib/postgresql@17 | ||
--includedir=#{HOMEBREW_PREFIX}/include/postgresql@17 | ||
--sysconfdir=#{etc} | ||
--docdir=#{doc} | ||
--enable-nls | ||
--enable-thread-safety | ||
--with-gssapi | ||
--with-icu | ||
--with-ldap | ||
--with-libxml | ||
--with-libxslt | ||
--with-lz4 | ||
--with-zstd | ||
--with-openssl | ||
--with-pam | ||
--with-python | ||
--with-uuid=e2fs | ||
--with-extra-version=\ (#{tap.user}) | ||
] | ||
args += %w[--with-bonjour --with-tcl] if OS.mac? | ||
|
||
# PostgreSQL by default uses xcodebuild internally to determine this, | ||
# which does not work on CLT-only installs. | ||
args << "PG_SYSROOT=#{MacOS.sdk_path}" if OS.mac? && MacOS.sdk_root_needed? | ||
|
||
system "./configure", *args | ||
system "make" | ||
chdir "src/pl/plpython" do | ||
system "make", "install", "datadir=#{share}/postgresql", | ||
"libdir=#{lib}/postgresql", | ||
"includedir=#{include}/postgresql" | ||
end | ||
chdir "contrib/hstore_plpython" do | ||
system "make", "install", "datadir=#{share}/postgresql", | ||
"libdir=#{lib}/postgresql", | ||
"includedir=#{include}/postgresql" | ||
end | ||
chdir "contrib/ltree_plpython" do | ||
system "make", "install", "datadir=#{share}/postgresql", | ||
"libdir=#{lib}/postgresql", | ||
"includedir=#{include}/postgresql" | ||
end | ||
chdir "contrib/jsonb_plpython" do | ||
system "make", "install", "datadir=#{share}/postgresql", | ||
"libdir=#{lib}/postgresql", | ||
"includedir=#{include}/postgresql" | ||
end | ||
end | ||
|
||
def post_install | ||
|
||
Check failure on line 93 in Formula/[email protected] GitHub Actions / test-bot (macos-13)
|
||
# Manually link files from keg to non-conflicting versioned directories in HOMEBREW_PREFIX. | ||
%w[include lib share locale].each do |dir| | ||
dst_dir = HOMEBREW_PREFIX/dir/"postgresql@17" | ||
src_dir = prefix/dir/"postgresql" | ||
src_dir.find do |src| | ||
dst = dst_dir/src.relative_path_from(src_dir) | ||
|
||
# Retain existing real directories for extensions if directory structure matches | ||
next if dst.directory? && !dst.symlink? && src.directory? && !src.symlink? | ||
|
||
rm_r(dst) if dst.exist? || dst.symlink? | ||
if src.symlink? || src.file? | ||
Find.prune if src.basename.to_s == ".DS_Store" | ||
dst.parent.install_symlink src | ||
print(src, " -> ",dst,"\n") | ||
Check failure on line 108 in Formula/[email protected] GitHub Actions / test-bot (macos-13)
Check failure on line 108 in Formula/[email protected] GitHub Actions / test-bot (macos-13)
|
||
elsif src.directory? | ||
dst.mkpath | ||
end | ||
end | ||
end | ||
end | ||
|
||
def postgresql_datadir | ||
var/name | ||
end | ||
|
||
|
||
Check failure on line 120 in Formula/[email protected] GitHub Actions / test-bot (macos-13)
Check failure on line 120 in Formula/[email protected] GitHub Actions / test-bot (macos-13)
|
||
end |