11class Postgresql < Formula
22 desc "Object-relational database system"
33 homepage "https://www.postgresql.org/"
4- url "https://ftp.postgresql.org/pub/source/v9.5.2/postgresql-9.5.2.tar.bz2"
5- sha256 "f8d132e464506b551ef498719f18cfe9d777709c7a1589dc360afc0b20e47c41"
4+ url "https://ftp.postgresql.org/pub/source/v9.6.2/postgresql-9.6.2.tar.bz2"
5+ sha256 "0187b5184be1c09034e74e44761505e52357248451b0c854dddec6c231fe50c9"
6+
7+ head "https://github.com/postgres/postgres.git"
68
79 bottle do
8- revision 1
9- sha256 "12bc2c22b06aaa82f577c14a667805a6e8aed9065a3a376e324393afdf6b62f0" => :el_capitan
10- sha256 "5e7ee10a23edb6ee985f49a969894133939a20eaeee2f2841cb8be82c2f79c74" => :yosemite
11- sha256 "e6673530167899750d5f2eaaebe53e7ff8b10caada449aef39d66a1af39cfe49" => :mavericks
10+ sha256 "75795830b5d1ed481cd21e91e1c74e03a49d51e521a6cf7b167d1976cbf515dd" => :sierra
11+ sha256 "df15dfcfc4672767a739012565d52990198a121cdaaa4ca986c1cd7ecddd69d9" => :el_capitan
12+ sha256 "fb64a01714c6abf4509eddf6f3011d774987c6f322fde0bb35c0b476acf3eb19" => :yosemite
1213 end
1314
14- option "32-bit"
1515 option "without-perl" , "Build without Perl support"
1616 option "without-tcl" , "Build without Tcl support"
1717 option "with-dtrace" , "Build with DTrace support"
@@ -23,8 +23,13 @@ class Postgresql < Formula
2323 depends_on "openssl"
2424 depends_on "readline"
2525 depends_on "libxml2" if MacOS . version <= :leopard # Leopard libxml is too old
26+
27+ option "with-python" , "Enable PL/Python2"
2628 depends_on :python => :optional
2729
30+ option "with-python3" , "Enable PL/Python3 (incompatible with --with-python)"
31+ depends_on :python3 => :optional
32+
2833 conflicts_with "postgres-xc" ,
2934 :because => "postgresql and postgres-xc install the same binaries."
3035
@@ -34,7 +39,8 @@ class Postgresql < Formula
3439 end
3540
3641 def install
37- ENV . libxml2 if MacOS . version >= :snow_leopard
42+ # avoid adding the SDK library directory to the linker search path
43+ ENV [ "XML2_CONFIG" ] = "xml2-config --exec-prefix=/usr"
3844
3945 ENV . prepend "LDFLAGS" , "-L#{ Formula [ "openssl" ] . opt_lib } -L#{ Formula [ "readline" ] . opt_lib } "
4046 ENV . prepend "CPPFLAGS" , "-I#{ Formula [ "openssl" ] . opt_include } -I#{ Formula [ "readline" ] . opt_include } "
@@ -56,9 +62,17 @@ def install
5662 --with-libxslt
5763 ]
5864
59- args << "--with-python" if build . with? "python"
6065 args << "--with-perl" if build . with? "perl"
6166
67+ which_python = nil
68+ if build . with? ( "python" ) && build . with? ( "python3" )
69+ odie "Cannot provide both --with-python and --with-python3"
70+ elsif build . with? ( "python" ) || build . with? ( "python3" )
71+ args << "--with-python"
72+ which_python = which ( build . with? ( "python" ) ? "python" : "python3" )
73+ end
74+ ENV [ "PYTHON" ] = which_python
75+
6276 # The CLT is required to build Tcl support on 10.7 and 10.8 because
6377 # tclConfig.sh is not part of the SDK
6478 if build . with? ( "tcl" ) && ( MacOS . version >= :mavericks || MacOS ::CLT . installed? )
@@ -72,10 +86,6 @@ def install
7286 args << "--enable-dtrace" if build . with? "dtrace"
7387 args << "--with-uuid=e2fs"
7488
75- if build . build_32_bit?
76- ENV . append %w[ CFLAGS LDFLAGS ] , "-arch #{ Hardware ::CPU . arch_32_bit } "
77- end
78-
7989 system "./configure" , *args
8090 system "make"
8191 system "make" , "install-world" , "datadir=#{ pkgshare } " ,
@@ -84,6 +94,7 @@ def install
8494 end
8595
8696 def post_install
97+ ( var /"log" ) . mkpath
8798 ( var /"postgres" ) . mkpath
8899 unless File . exist? "#{ var } /postgres/PG_VERSION"
89100 system "#{ bin } /initdb" , "#{ var } /postgres"
@@ -96,17 +107,17 @@ def caveats; <<-EOS.undent
96107 https://github.com/Homebrew/homebrew/issues/2510
97108
98109 To migrate existing data from a previous major version (pre-9.0) of PostgreSQL, see:
99- https://www.postgresql.org/docs/9.5 /static/upgrading.html
110+ https://www.postgresql.org/docs/9.6 /static/upgrading.html
100111
101- To migrate existing data from a previous minor version (9.0-9.4 ) of PosgresSQL , see:
102- https://www.postgresql.org/docs/9.5 /static/pgupgrade.html
112+ To migrate existing data from a previous minor version (9.0-9.6 ) of PostgreSQL , see:
113+ https://www.postgresql.org/docs/9.6 /static/pgupgrade.html
103114
104115 You will need your previous PostgreSQL installation from brew to perform `pg_upgrade`.
105116 Do not run `brew cleanup postgresql` until you have performed the migration.
106117 EOS
107118 end
108119
109- plist_options :manual => "postgres -D #{ HOMEBREW_PREFIX } /var/postgres"
120+ plist_options :manual => "pg_ctl -D #{ HOMEBREW_PREFIX } /var/postgres start "
110121
111122 def plist ; <<-EOS . undent
112123 <?xml version="1.0" encoding="UTF-8"?>
@@ -122,15 +133,13 @@ def plist; <<-EOS.undent
122133 <string>#{ opt_bin } /postgres</string>
123134 <string>-D</string>
124135 <string>#{ var } /postgres</string>
125- <string>-r</string>
126- <string>#{ var } /postgres/server.log</string>
127136 </array>
128137 <key>RunAtLoad</key>
129138 <true/>
130139 <key>WorkingDirectory</key>
131140 <string>#{ HOMEBREW_PREFIX } </string>
132141 <key>StandardErrorPath</key>
133- <string>#{ var } /postgres/server .log</string>
142+ <string>#{ var } /log/postgres .log</string>
134143 </dict>
135144 </plist>
136145 EOS
0 commit comments