From 0db341d5dd76923e3dc0daffbf15ac20b18349b2 Mon Sep 17 00:00:00 2001 From: SideReel Date: Fri, 14 Jun 2013 12:06:48 -0700 Subject: [PATCH] mysql v5.6.10 --- files/brews/mysql.rb | 167 +++++++++++++++++++++++++++---------------- manifests/init.pp | 4 +- 2 files changed, 107 insertions(+), 64 deletions(-) diff --git a/files/brews/mysql.rb b/files/brews/mysql.rb index e7fa13a..1ae24c7 100644 --- a/files/brews/mysql.rb +++ b/files/brews/mysql.rb @@ -1,39 +1,51 @@ require 'formula' class Mysql < Formula - homepage 'http://dev.mysql.com/doc/refman/5.5/en/' - url 'http://downloads.mysql.com/archives/mysql-5.5/mysql-5.5.20.tar.gz' - sha1 'd5066327c41ac5a338ca0bb748e50bc4e1902442' - version '5.5.20-boxen2' + homepage 'http://dev.mysql.com/doc/refman/5.6/en/' + url 'http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz/from/http://cdn.mysql.com/' + version '5.6.10-boxen3' + sha1 'f37979eafc241a0ebeac9548cb3f4113074271b7' + + bottle do + sha1 'e07b9a207364b6e020fc96f49116b58d33d0eb78' => :mountain_lion + sha1 'b9b38e2ed705a3fcd79bb549f32e49b455f31917' => :lion + sha1 '30978684ee72c4dfb0b20263331b0c93972b3092' => :snow_leopard + end depends_on 'cmake' => :build - depends_on 'pidof' + depends_on 'pidof' unless MacOS.version >= :mountain_lion + + option :universal + option 'with-tests', 'Build with unit tests' + option 'with-embedded', 'Build the embedded server' + option 'with-libedit', 'Compile with editline wrapper instead of readline' + option 'with-archive-storage-engine', 'Compile with the ARCHIVE storage engine enabled' + option 'with-blackhole-storage-engine', 'Compile with the BLACKHOLE storage engine enabled' + option 'enable-local-infile', 'Build with local infile loading support' + option 'enable-memcached', 'Enable innodb-memcached support' + option 'enable-debug', 'Build with debug support' + + 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." + + env :std if build.universal? fails_with :llvm do build 2326 cause "https://github.com/mxcl/homebrew/issues/issue/144" end - skip_clean :all # So "INSTALL PLUGIN" can work. - - def options - [ - ['--with-tests', "Build with unit tests."], - ['--with-embedded', "Build the embedded server."], - ['--with-archive-storage-engine', "Compile with the ARCHIVE storage engine enabled"], - ['--with-blackhole-storage-engine', "Compile with the BLACKHOLE storage engine enabled"], - ['--universal', "Make mysql a universal binary"], - ['--enable-local-infile', "Build with local infile loading support"] - ] - end - - # Remove optimization flags from `mysql_config --cflags` - # This facilitates easy compilation of gems using a brewed mysql - # CMake patch needed for CMake 2.8.8. - # Reported here: http://bugs.mysql.com/bug.php?id=65050 - def patches; DATA; end - 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 + args = [".", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DMYSQL_DATADIR=/opt/boxen/data/mysql", @@ -48,26 +60,35 @@ def install "-DSYSCONFDIR=#{etc}"] # To enable unit testing at build, we need to download the unit testing suite - if ARGV.include? '--with-tests' + if build.include? 'with-tests' args << "-DENABLE_DOWNLOADS=ON" else args << "-DWITH_UNIT_TESTS=OFF" end # Build the embedded server - args << "-DWITH_EMBEDDED_SERVER=ON" if ARGV.include? '--with-embedded' + args << "-DWITH_EMBEDDED_SERVER=ON" if build.include? 'with-embedded' + + # Compile with readline unless libedit is explicitly chosen + args << "-DWITH_READLINE=yes" unless build.include? 'with-libedit' # Compile with ARCHIVE engine enabled if chosen - args << "-DWITH_ARCHIVE_STORAGE_ENGINE=1" if ARGV.include? '--with-archive-storage-engine' + args << "-DWITH_ARCHIVE_STORAGE_ENGINE=1" if build.include? 'with-archive-storage-engine' # Compile with BLACKHOLE engine enabled if chosen - args << "-DWITH_BLACKHOLE_STORAGE_ENGINE=1" if ARGV.include? '--with-blackhole-storage-engine' + args << "-DWITH_BLACKHOLE_STORAGE_ENGINE=1" if build.include? 'with-blackhole-storage-engine' # Make universal for binding to universal applications - args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if ARGV.build_universal? + args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if build.universal? # Build with local infile loading support - args << "-DENABLED_LOCAL_INFILE=1" if ARGV.include? '--enable-local-infile' + args << "-DENABLED_LOCAL_INFILE=1" if build.include? 'enable-local-infile' + + # Build with memcached support + args << "-DWITH_INNODB_MEMCACHED=1" if build.include? 'enable-memcached' + + # Build with debug support + args << "-DWITH_DEBUG=1" if build.include? 'enable-debug' system "cmake", *args system "make" @@ -82,39 +103,61 @@ def install # 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 + + # Move mysqlaccess to libexec + mv "#{bin}/mysqlaccess", libexec + mv "#{bin}/mysqlaccess.conf", libexec end -end -__END__ -diff --git a/scripts/mysql_config.sh b/scripts/mysql_config.sh -index 9296075..70c18db 100644 ---- a/scripts/mysql_config.sh -+++ b/scripts/mysql_config.sh -@@ -137,7 +137,9 @@ for remove in DDBUG_OFF DSAFE_MUTEX DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \ - DEXTRA_DEBUG DHAVE_purify O 'O[0-9]' 'xO[0-9]' 'W[-A-Za-z]*' \ - 'mtune=[-A-Za-z0-9]*' 'mcpu=[-A-Za-z0-9]*' 'march=[-A-Za-z0-9]*' \ - Xa xstrconst "xc99=none" AC99 \ -- unroll2 ip mp restrict -+ unroll2 ip mp restrict \ -+ mmmx 'msse[0-9.]*' 'mfpmath=sse' w pipe 'fomit-frame-pointer' 'mmacosx-version-min=10.[0-9]' \ -+ aes Os - do - # The first option we might strip will always have a space before it because - # we set -I$pkgincludedir as the first option -diff --git a/configure.cmake b/configure.cmake -index c3cc787..6193481 100644 ---- a/configure.cmake -+++ b/configure.cmake -@@ -149,7 +149,9 @@ IF(UNIX) - SET(CMAKE_REQUIRED_LIBRARIES - ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) - -- LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) -+ IF(CMAKE_REQUIRED_LIBRARIES) -+ LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) -+ ENDIF() - LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT}) - - OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF) + 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 + 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 + + + + + KeepAlive + + Label + #{plist_name} + Program + #{opt_prefix}/bin/mysqld_safe + RunAtLoad + + WorkingDirectory + #{var} + + + EOS + end + + test do + (prefix+'mysql-test').cd do + system './mysql-test-run.pl', 'status' + end + end +end diff --git a/manifests/init.pp b/manifests/init.pp index b7ea45a..32c5508 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -42,7 +42,7 @@ } package { 'boxen/brews/mysql': - ensure => '5.5.20-boxen2', + ensure => '5.6.10-boxen3', notify => Service['dev.mysql'] } @@ -56,7 +56,7 @@ exec { 'init-mysql-db': command => "mysql_install_db \ --verbose \ - --basedir=${boxen::config::homebrewdir} \ + --basedir=/opt/boxen/homebrew/Cellar/mysql/5.6.10-boxen3 \ --datadir=${mysql::config::datadir} \ --tmpdir=/tmp", creates => "${mysql::config::datadir}/mysql",