2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-01 01:22:29 +00:00
|
|
|
|
|
|
|
class Postgresql <Formula
|
|
|
|
@homepage='http://www.postgresql.org/'
|
2009-11-09 22:22:55 +00:00
|
|
|
@url='http://ftp3.de.postgresql.org/pub/Mirrors/ftp.postgresql.org/source/v8.4.1/postgresql-8.4.1.tar.bz2'
|
2009-10-25 18:25:03 +00:00
|
|
|
@md5='f2015af17bacbbfe140daf0d1067f9c9'
|
2009-10-29 19:47:57 +00:00
|
|
|
|
2009-10-05 20:27:37 +00:00
|
|
|
depends_on 'readline'
|
2009-12-31 02:04:13 +00:00
|
|
|
depends_on 'libxml2' if MACOS_VERSION < 10.6
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-12-04 10:48:21 +00:00
|
|
|
aka 'postgres'
|
|
|
|
|
2009-09-01 01:22:29 +00:00
|
|
|
def install
|
2009-12-05 18:39:13 +00:00
|
|
|
ENV.libxml2 # wouldn't compile for justinlilly otherwise
|
|
|
|
|
2009-09-01 01:22:29 +00:00
|
|
|
configure_args = [
|
2009-09-23 18:00:02 +00:00
|
|
|
"--enable-thread-safety",
|
2009-09-01 01:22:29 +00:00
|
|
|
"--with-bonjour",
|
|
|
|
"--with-python",
|
|
|
|
"--with-perl",
|
|
|
|
"--with-gssapi",
|
|
|
|
"--with-krb5",
|
|
|
|
"--with-openssl",
|
|
|
|
"--with-libxml",
|
|
|
|
"--with-libxslt",
|
|
|
|
"--prefix=#{prefix}",
|
2009-10-05 20:27:37 +00:00
|
|
|
"--disable-debug",
|
2009-09-01 01:22:29 +00:00
|
|
|
]
|
|
|
|
|
2009-10-02 22:46:27 +00:00
|
|
|
if MACOS_VERSION >= 10.6 && Hardware.is_64_bit?
|
|
|
|
configure_args << "ARCHFLAGS='-arch x86_64'"
|
|
|
|
end
|
|
|
|
|
|
|
|
# Fails on Core Duo with O4 and O3
|
|
|
|
if Hardware.intel_family == :core
|
|
|
|
ENV.O2
|
2009-09-23 18:00:02 +00:00
|
|
|
end
|
|
|
|
|
2009-09-01 01:22:29 +00:00
|
|
|
system "./configure", *configure_args
|
|
|
|
system "make install"
|
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
(prefix+'org.postgresql.postgres.plist').write startup_plist
|
2009-09-01 01:22:29 +00:00
|
|
|
end
|
|
|
|
|
2009-09-23 18:00:02 +00:00
|
|
|
def skip_clean? path
|
|
|
|
# NOTE at some point someone should tweak this so it only skips clean
|
|
|
|
# for the bits that break the build otherwise
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS
|
2009-10-01 04:49:34 +00:00
|
|
|
If this is your first install, create a database with:
|
|
|
|
#{HOMEBREW_PREFIX}/bin/initdb #{HOMEBREW_PREFIX}/var/postgres
|
2009-09-26 05:49:03 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
Automatically load on login with:
|
|
|
|
launchctl load -w #{prefix}/org.postgresql.postgres.plist
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
Or start manually with:
|
|
|
|
#{HOMEBREW_PREFIX}/bin/pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres -l #{HOMEBREW_PREFIX}/var/postgres/server.log start
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
And stop with:
|
|
|
|
#{HOMEBREW_PREFIX}/bin/pg_ctl -D #{HOMEBREW_PREFIX}/var/postgres stop -s -m fast
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
If you want to install the postgres gem, include ARCHFLAGS in the gem install
|
|
|
|
to avoid issues:
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
env ARCHFLAGS="-arch x86_64" gem install postgres
|
2009-09-01 01:22:29 +00:00
|
|
|
|
2009-10-01 04:49:34 +00:00
|
|
|
To install gems without sudo, see the Homebrew wiki.
|
2009-09-01 01:22:29 +00:00
|
|
|
EOS
|
|
|
|
end
|
2009-10-01 04:49:34 +00:00
|
|
|
|
|
|
|
def startup_plist
|
|
|
|
return <<-EOPLIST
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>KeepAlive</key>
|
|
|
|
<true/>
|
|
|
|
<key>Label</key>
|
|
|
|
<string>org.postgresql.postgres</string>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{HOMEBREW_PREFIX}/bin/postgres</string>
|
|
|
|
<string>-D</string>
|
|
|
|
<string>#{HOMEBREW_PREFIX}/var/postgres</string>
|
|
|
|
<string>-r</string>
|
|
|
|
<string>#{HOMEBREW_PREFIX}/var/postgres/server.log</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>UserName</key>
|
|
|
|
<string>#{`whoami`}</string>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
|
|
|
end
|
2009-09-01 01:22:29 +00:00
|
|
|
end
|