Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Last active November 3, 2017 16:46
Show Gist options
  • Save ddrscott/4576209d510a26ec6e5b43984b87a35f to your computer and use it in GitHub Desktop.
Save ddrscott/4576209d510a26ec6e5b43984b87a35f to your computer and use it in GitHub Desktop.
Postgres Formula 9.3.14
class PostgresqlAT93 < Formula
desc "Relational database management system"
homepage "https://www.postgresql.org/"
version = "9.3.19"
url "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2"
sha256 "fb9e872cd9e927ba331690d86bc63dcb5a596acb7a536fa0518a3c7d43ac2fb5"
head do
url "https://git.postgresql.org/git/postgresql.git", :branch => "REL9_3_STABLE"
depends_on "open-sp" => :build
depends_on "petere/sgml/docbook-dsssl" => :build
depends_on "petere/sgml/docbook-sgml" => :build
depends_on "petere/sgml/openjade" => :build
end
keg_only :versioned_formula
deprecated_option "enable-cassert" => "with-cassert"
option "with-cassert", "Enable assertion checks (for debugging)"
depends_on "gettext"
depends_on "openldap"
depends_on "openssl"
depends_on "ossp-uuid"
depends_on "readline"
depends_on "tcl-tk"
# Fix uuid-ossp build issues: https://archives.postgresql.org/pgsql-general/2012-07/msg00654.php
patch :DATA
def install
args = %W[
--prefix=#{prefix}
--enable-dtrace
--enable-nls
--with-bonjour
--with-gssapi
--with-krb5
--with-ldap
--with-libxml
--with-libxslt
--with-openssl
--with-ossp-uuid
--with-pam
--with-perl
--with-python
--with-tcl
XML2_CONFIG=:
]
# Add include and library directories of dependencies, so that
# they can be used for compiling extensions. Superenv does this
# when compiling this package, but won't record it for pg_config.
deps = %w[gettext openldap openssl readline tcl-tk]
with_includes = deps.map { |f| Formula[f].opt_include }.join(":")
with_libraries = deps.map { |f| Formula[f].opt_lib }.join(":")
args << "--with-includes=#{with_includes}"
args << "--with-libraries=#{with_libraries}"
args << "--enable-cassert" if build.with? "cassert"
system "./configure", *args
system "make", "install-world"
end
def caveats; <<-EOS.undent
To use this PostgreSQL installation, do one or more of the following:
- Call all programs explicitly with #{opt_prefix}/bin/...
- Add #{opt_bin} to your PATH
- brew link -f #{name}
- Install the postgresql-common package
To access the man pages, do one or more of the following:
- Refer to them by their full path, like `man #{opt_share}/man/man1/psql.1`
- Add #{opt_share}/man to your MANPATH
- brew link -f #{name}
EOS
end
test do
system "#{bin}/initdb", "pgdata"
end
end
__END__
--- a/contrib/uuid-ossp/uuid-ossp.c 2012-07-30 18:34:53.000000000 -0700
+++ b/contrib/uuid-ossp/uuid-ossp.c 2012-07-30 18:35:03.000000000 -0700
@@ -9,6 +9,8 @@
*-------------------------------------------------------------------------
*/
+#define _XOPEN_SOURCE
+
#include "postgres.h"
#include "fmgr.h"
#include "utils/builtins.h"
@ddrscott
Copy link
Author

ddrscott commented May 18, 2017

Download the file to a directory and run brew install postgresql93 within that directory.

@stringbot
Copy link

Run brew link --overwrite postgresql93 (or brew link --overwrite --dry-run postgresql93) to install the client.
Then delete or move your existing /usr/local/var/postgres
Finally initdb /usr/local/var/postgres to re-initialize the db

@jro619
Copy link

jro619 commented Jun 26, 2017

brew install ./postgresql93.rb worked for me

@ddrscott
Copy link
Author

ddrscott commented Nov 3, 2017

Updating to use the bottle from https://github.com/petere/homebrew-postgresql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment