aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mysql.rb
diff options
context:
space:
mode:
authorNathaniel Talbott2009-09-02 17:31:27 +0800
committerMax Howell2009-09-14 20:33:46 +0100
commitadded50f10df32f329e55db1a0048e86bcf15854 (patch)
tree04126115761b47d2c58719ff0aa9e36e9c16b937 /Library/Formula/mysql.rb
parent2703702fdc0d63f6a18fa9ef8faaf7bbc14b7702 (diff)
downloadhomebrew-added50f10df32f329e55db1a0048e86bcf15854.tar.bz2
Better mysql server support
Patch mysql_safe so it will run non-privileged. Write out plist for managing mysqld with launchctl. Add instructions on setting up db and launchctl script. Signed-off-by: Max Howell <max@methylblue.com>
Diffstat (limited to 'Library/Formula/mysql.rb')
-rw-r--r--Library/Formula/mysql.rb42
1 files changed, 39 insertions, 3 deletions
diff --git a/Library/Formula/mysql.rb b/Library/Formula/mysql.rb
index 662d8320d..75bfb5539 100644
--- a/Library/Formula/mysql.rb
+++ b/Library/Formula/mysql.rb
@@ -18,6 +18,10 @@ class Mysql <Formula
]
end
+ def patches
+ {:p1 => "http://gist.github.com/raw/179616/bcbc9f185bbd353934c9379a253d23269c65170e/Diff"}
+ end
+
def install
ENV['CXXFLAGS'] = ENV['CXXFLAGS'].gsub "-fomit-frame-pointer", ""
ENV['CXXFLAGS'] += " -fno-omit-frame-pointer -felide-constructors"
@@ -28,6 +32,7 @@ class Mysql <Formula
"--without-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
+ "--localstatedir=#{var}",
"--with-plugins=innobase,myisam",
"--with-extra-charsets=complex",
"--with-plugins=innobase,myisam",
@@ -37,9 +42,7 @@ class Mysql <Formula
"--enable-local-infile",
"--enable-shared"]
- if ARGV.include? '--client-only'
- configure_args.push("--without-server")
- end
+ configure_args << "--without-server" if ARGV.include? '--client-only'
system "./configure", *configure_args
system "make install"
@@ -49,5 +52,38 @@ class Mysql <Formula
# save 66MB!
(prefix+'mysql-test').rmtree unless ARGV.include? '--with-tests'
+
+ var.mkpath
+
+ (prefix+'com.mysql.mysqld.plist').write startup_plist
+ end
+
+ def caveats
+ puts "Set up databases with `mysql_install_db`"
+ puts "Automatically load on login with "
+ puts " `launchctl load -w #{prefix}/com.mysql.mysqld.plist`"
+ end
+
+ 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>com.mysql.mysqld</string>
+ <key>Program</key>
+ <string>#{bin}/mysqld_safe</string>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>UserName</key>
+ <string>#{`whoami`}</string>
+ <key>WorkingDirectory</key>
+ <string>/usr/local</string>
+</dict>
+</plist>
+ EOPLIST
end
end