mariadb: port latest changes from mysql formula

Closes Homebrew/homebrew#20734.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Patrick Li 2013-06-24 17:09:20 +12:00 committed by Jack Nagel
parent 191e6c2cf7
commit 4e42abb3d2

View file

@ -38,19 +38,17 @@ class Mariadb < Formula
build 421
end
def patches
# fix build on Xcode only systems
DATA
end
def install
# Don't hard-code the libtool path. See:
# https://github.com/mxcl/homebrew/issues/20185
inreplace "cmake/libutils.cmake",
"COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}",
"COMMAND libtool -static -o ${TARGET_LOCATION}"
# 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
cmake_args = %W[
.
-DCMAKE_INSTALL_PREFIX=#{prefix}
@ -113,13 +111,30 @@ class Mariadb < Formula
end
ln_s "#{prefix}/support-files/mysql.server", bin
# Move mysqlaccess to libexec
mv "#{bin}/mysqlaccess", libexec
mv "#{bin}/mysqlaccess.conf", libexec
end
end
def post_install
# Make sure the var/mysql directory exists
(var+"mysql").mkpath
unless File.exist? "#{var}/mysql/mysql/user.frm"
ENV['TMPDIR'] = nil
system "#{bin}/mysql_install_db", '--verbose', "--user=#{ENV['USER']}",
"--basedir=#{prefix}", "--datadir=#{var}/mysql", "--tmpdir=/tmp"
end
end
def caveats; <<-EOS.undent
Set up databases with:
unset TMPDIR
mysql_install_db --user=\`whoami\` --basedir="$(brew --prefix mariadb)" --datadir=#{var}/mysql --tmpdir=/tmp
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To connect:
mysql -uroot
EOS
end
@ -134,8 +149,11 @@ class Mariadb < Formula
<true/>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
<string>#{HOMEBREW_PREFIX}/bin/mysqld_safe</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_prefix}/bin/mysqld_safe</string>
<string>--bind-address=127.0.0.1</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
@ -144,19 +162,10 @@ class Mariadb < Formula
</plist>
EOS
end
end
__END__
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 7c13df0..c82de4d 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -183,7 +183,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
- COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
+ COMMAND libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS}
)
ELSE()
test do
(prefix+'mysql-test').cd do
system './mysql-test-run.pl', 'status'
end
end
end