Created
January 22, 2013 08:18
-
-
Save hadashiA/4592991 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'formula' | |
class Mysql40 < Formula | |
homepage 'http://mirror.provenscaling.com/mysql/community/source/4.0/' | |
url 'http://mirror.provenscaling.com/mysql/community/source/4.0/mysql-4.0.25.tar.gz' | |
version '4.0.25' | |
sha1 '65315c7659c75fcc9f3d9f749dbed26581f6da9c' | |
depends_on 'readline' | |
conflicts_with 'mysql', | |
:because => "install the same binaries." | |
conflicts_with 'mariadb', | |
:because => "mysql and mariadb install the same binaries." | |
conflicts_with 'percona-server', | |
:because => "mysql and percona-server install the same binaries." | |
conflicts_with 'mysql-cluster', | |
:because => "mysql and mysql-cluster install the same binaries." | |
def install | |
# Build without compiler or CPU specific optimization flags to facilitate | |
# compilation of gems and other software that queries `mysql-config`. | |
# ENV.minimal_optimization | |
# Make sure the var/mysql directory exists | |
(var+"mysql").mkpath | |
system "./configure", "--prefix=#{prefix}", | |
"--with-charset=ujis", | |
"--sysconfdir=#{etc}", "--datadir=#{var}", "--localstatedir=#{var}/mysql", | |
"--mandir=#{man}", "--infodir=#{info}", | |
"--without-readline" | |
system "make" | |
system "make install" | |
# ln_s prefix+'scripts/mysql_install_db', bin+'mysql_install_db' | |
system "cp -r ./support-files #{prefix}/support-files" | |
system "chmod +x #{prefix}/support-files/mysql.server" | |
# Fix up the control script and link into bin | |
inreplace "#{prefix}/support-files/mysql.server" do |s| | |
s.gsub!(/^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2") | |
# pidof can be replaced with pgrep from proctools on Mountain Lion | |
s.gsub!(/pidof/, 'pgrep') if MacOS.version >= :mountain_lion | |
end | |
ln_s "#{prefix}/support-files/mysql.server", bin | |
end | |
def patches | |
DATA | |
end | |
def caveats; <<-EOS.undent | |
Set up databases to run AS YOUR USER ACCOUNT with: | |
unset TMPDIR | |
mysql_install_db --verbose --user=`whoami` --basedir="/usr/local/opt/mysql40" --datadir=/usr/local/var/mysql --tmpdir=/tmp | |
To set up base tables in another folder, or use a different user to run | |
mysqld, view the help for mysqld_install_db: | |
mysql_install_db --help | |
To run as, for instance, user "mysql", you may need to `sudo`: | |
sudo mysql_install_db ...options... | |
A "/etc/my.cnf" from another install may interfere with a Homebrew-built | |
server starting up correctly. | |
To connect: | |
mysql -uroot | |
EOS | |
end | |
plist_options :manual => "mysql.server start" | |
def plist; <<-EOS.undent | |
<?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>#{plist_name}</string> | |
<key>Program</key> | |
<string>#{opt_prefix}/bin/mysqld_safe</string> | |
<key>RunAtLoad</key> | |
<true/> | |
<key>UserName</key> | |
<string>#{`whoami`.chomp}</string> | |
<key>WorkingDirectory</key> | |
<string>#{var}</string> | |
</dict> | |
</plist> | |
EOS | |
end | |
end | |
__END__ | |
diff --git a/include/my_global.h b/include/my_global.h | |
index e2a9766..368f36d 100644 | |
--- a/include/my_global.h | |
+++ b/include/my_global.h | |
@@ -344,8 +344,8 @@ int __void__; | |
/* Define some useful general macros */ | |
#if defined(__cplusplus) && defined(__GNUC__) | |
-#define max(a, b) ((a) >? (b)) | |
-#define min(a, b) ((a) <? (b)) | |
+#define max(a, b) ((a) > (b) ? (a) : (b)) | |
+#define min(a, b) ((a) < (b) ? (a) : (b)) | |
#elif !defined(max) | |
#define max(a, b) ((a) > (b) ? (a) : (b)) | |
#define min(a, b) ((a) < (b) ? (a) : (b)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment