From f43eeaca36c3a0d0e3d87de89d830cd479e537a5 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 24 Jun 2013 17:09:20 +1200 Subject: mariadb: port latest changes from mysql formula Closes #20734. Signed-off-by: Jack Nagel --- Library/Formula/mariadb.rb | 65 ++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 28 deletions(-) (limited to 'Library/Formula') diff --git a/Library/Formula/mariadb.rb b/Library/Formula/mariadb.rb index 8e7ec8bf4..93ad9c084 100644 --- a/Library/Formula/mariadb.rb +++ b/Library/Formula/mariadb.rb @@ -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 Label #{plist_name} - Program - #{HOMEBREW_PREFIX}/bin/mysqld_safe + ProgramArguments + + #{opt_prefix}/bin/mysqld_safe + --bind-address=127.0.0.1 + RunAtLoad WorkingDirectory @@ -144,19 +162,10 @@ class Mariadb < Formula 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 -- cgit v1.2.3