percona-server 8.0.13-3

This commit is contained in:
Jaehoon You 2019-01-14 13:17:31 +09:00 committed by FX Coudert
parent 3eda207501
commit ad9da0c60a
3 changed files with 209 additions and 16 deletions

View file

@ -1,8 +1,8 @@
class PerconaServer < Formula
desc "Drop-in MySQL replacement"
homepage "https://www.percona.com"
url "https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.24-27/source/tarball/percona-server-5.7.24-27.tar.gz"
sha256 "999593afa241660bc7860264b46a826faf97d80d411966fade24084f47b249a0"
url "https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.13-3/source/tarball/percona-server-8.0.13-3.tar.gz"
sha256 "ab00626775b85ea506c1d992d66acee50f0bfbde54b830731f61652e87ff93da"
bottle do
sha256 "79938125efb509b03ae247a23198c65fb6684eb49be9336860b5a92b56931b5b" => :mojave
@ -16,10 +16,11 @@ class PerconaServer < Formula
end
depends_on "cmake" => :build
# https://github.com/Homebrew/homebrew-core/issues/1475
# Needs at least Clang 3.3, which shipped alongside Lion.
# Note: MySQL themselves don't support anything below El Capitan.
depends_on :macos => :lion
# Note: MySQL themselves don't support anything below Sierra.
depends_on :macos => :yosemite
depends_on "openssl"
conflicts_with "mariadb", "mysql", "mysql-cluster",
@ -29,9 +30,16 @@ class PerconaServer < Formula
conflicts_with "mariadb-connector-c",
:because => "both install plugins"
# https://bugs.mysql.com/bug.php?id=86711
# https://github.com/Homebrew/homebrew-core/pull/20538
fails_with :clang do
build 800
cause "Wrong inlining with Clang 8.0, see MySQL Bug #86711"
end
resource "boost" do
url "https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2"
sha256 "727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca"
url "https://downloads.sourceforge.net/project/boost/boost/1.67.0/boost_1_67_0.tar.bz2"
sha256 "2684c972994ee57fc5632e03bf044746f6eb45d4920c343937a465fd67a5adba"
end
# Where the database files should be located. Existing installs have them
@ -42,16 +50,11 @@ class PerconaServer < Formula
end
def install
# Set HAVE_MEMSET_S flag to fix compilation
# https://bugs.launchpad.net/percona-server/+bug/1741647
ENV.prepend "CPPFLAGS", "-DHAVE_MEMSET_S=1"
# https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
# -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`)
args = %W[
-DCOMPILATION_COMMENT=Homebrew
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DDEFAULT_CHARSET=utf8mb4
-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
-DINSTALL_DOCDIR=share/doc/#{name}
-DINSTALL_INCLUDEDIR=include/mysql
-DINSTALL_INFODIR=share/info
@ -60,8 +63,12 @@ class PerconaServer < Formula
-DINSTALL_PLUGINDIR=lib/plugin
-DMYSQL_DATADIR=#{datadir}
-DSYSCONFDIR=#{etc}
-DWITH_EDITLINE=system
-DWITH_SSL=yes
-DWITH_UNIT_TESTS=OFF
-DWITH_EMBEDDED_SERVER=ON
-DENABLED_LOCAL_INFILE=1
-DWITH_INNODB_MEMCACHED=ON
-DWITH_EDITLINE=system
]
# MySQL >5.7.x mandates Boost as a requirement to build & has a strict
@ -78,8 +85,6 @@ class PerconaServer < Formula
# https://bugs.launchpad.net/percona-server/+bug/1531446
args.concat %w[-DWITHOUT_TOKUDB=1]
args << "-DWITH_UNIT_TESTS=OFF"
system "cmake", ".", *std_cmake_args, *args
system "make"
system "make", "install"

View file

@ -0,0 +1,188 @@
class PerconaServerAT57 < Formula
desc "Drop-in MySQL replacement"
homepage "https://www.percona.com"
url "https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.24-27/source/tarball/percona-server-5.7.24-27.tar.gz"
sha256 "999593afa241660bc7860264b46a826faf97d80d411966fade24084f47b249a0"
bottle do
sha256 "79938125efb509b03ae247a23198c65fb6684eb49be9336860b5a92b56931b5b" => :mojave
sha256 "31d1745e94bc82f5fc8d2c677052a323f1dc76fdebe2369a6e23e583e48cc9ad" => :high_sierra
sha256 "1d6ad1ff891982cee38d7886df5dc99f907a802287a6bddb56c55c552dfcb430" => :sierra
end
pour_bottle? do
reason "The bottle needs a var/mysql datadir (yours is var/percona)."
satisfy { datadir == var/"mysql" }
end
keg_only :versioned_formula
depends_on "cmake" => :build
# https://github.com/Homebrew/homebrew-core/issues/1475
# Needs at least Clang 3.3, which shipped alongside Lion.
# Note: MySQL themselves don't support anything below El Capitan.
depends_on :macos => :lion
depends_on "openssl"
conflicts_with "mariadb", "mysql", "mysql-cluster",
:because => "percona, mariadb, and mysql install the same binaries."
conflicts_with "mysql-connector-c",
:because => "both install MySQL client libraries"
conflicts_with "mariadb-connector-c",
:because => "both install plugins"
resource "boost" do
url "https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2"
sha256 "727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca"
end
# Where the database files should be located. Existing installs have them
# under var/percona, but going forward they will be under var/mysql to be
# shared with the mysql and mariadb formulae.
def datadir
@datadir ||= (var/"percona").directory? ? var/"percona" : var/"mysql"
end
def install
# Set HAVE_MEMSET_S flag to fix compilation
# https://bugs.launchpad.net/percona-server/+bug/1741647
ENV.prepend "CPPFLAGS", "-DHAVE_MEMSET_S=1"
# https://dev.mysql.com/doc/refman/5.7/en/source-configuration-options.html
# -DINSTALL_* are relative to `CMAKE_INSTALL_PREFIX` (`prefix`)
args = %W[
-DCOMPILATION_COMMENT=Homebrew
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DINSTALL_DOCDIR=share/doc/#{name}
-DINSTALL_INCLUDEDIR=include/mysql
-DINSTALL_INFODIR=share/info
-DINSTALL_MANDIR=share/man
-DINSTALL_MYSQLSHAREDIR=share/mysql
-DINSTALL_PLUGINDIR=lib/plugin
-DMYSQL_DATADIR=#{datadir}
-DSYSCONFDIR=#{etc}
-DWITH_EDITLINE=system
-DWITH_SSL=yes
]
# MySQL >5.7.x mandates Boost as a requirement to build & has a strict
# version check in place to ensure it only builds against expected release.
# This is problematic when Boost releases don't align with MySQL releases.
(buildpath/"boost").install resource("boost")
args << "-DWITH_BOOST=#{buildpath}/boost"
# Percona MyRocks does not compile on macOS
# https://bugs.launchpad.net/percona-server/+bug/1741639
args.concat %w[-DWITHOUT_ROCKSDB=1]
# TokuDB does not compile on macOS
# https://bugs.launchpad.net/percona-server/+bug/1531446
args.concat %w[-DWITHOUT_TOKUDB=1]
args << "-DWITH_UNIT_TESTS=OFF"
system "cmake", ".", *std_cmake_args, *args
system "make"
system "make", "install"
(prefix/"mysql-test").cd do
system "./mysql-test-run.pl", "status", "--vardir=#{Dir.mktmpdir}"
end
# Remove the tests directory
rm_rf prefix/"mysql-test"
# Don't create databases inside of the prefix!
# See: https://github.com/Homebrew/homebrew/issues/4975
rm_rf prefix/"data"
# Fix up the control script and link into bin.
inreplace "#{prefix}/support-files/mysql.server",
/^(PATH=".*)(")/,
"\\1:#{HOMEBREW_PREFIX}/bin\\2"
bin.install_symlink prefix/"support-files/mysql.server"
# Install my.cnf that binds to 127.0.0.1 by default
(buildpath/"my.cnf").write <<~EOS
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
EOS
etc.install "my.cnf"
end
def post_install
# Make sure the datadir exists
datadir.mkpath
unless (datadir/"mysql/user.frm").exist?
ENV["TMPDIR"] = nil
system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{datadir}", "--tmpdir=/tmp"
end
end
def caveats
s = <<~EOS
We've installed your MySQL database without a root password. To secure it run:
mysql_secure_installation
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -uroot
EOS
if my_cnf = ["/etc/my.cnf", "/etc/mysql/my.cnf"].find { |x| File.exist? x }
s += <<~EOS
A "#{my_cnf}" from another install may interfere with a Homebrew-built
server starting up correctly.
EOS
end
s
end
plist_options :manual => "mysql.server start"
def plist; <<~EOS
<?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>ProgramArguments</key>
<array>
<string>#{opt_bin}/mysqld_safe</string>
<string>--datadir=#{datadir}</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{datadir}</string>
</dict>
</plist>
EOS
end
test do
begin
# Expects datadir to be a completely clean dir, which testpath isn't.
dir = Dir.mktmpdir
system bin/"mysqld", "--initialize-insecure", "--user=#{ENV["USER"]}",
"--basedir=#{prefix}", "--datadir=#{dir}", "--tmpdir=#{dir}"
pid = fork do
exec bin/"mysqld", "--bind-address=127.0.0.1", "--datadir=#{dir}"
end
sleep 2
output = shell_output("curl 127.0.0.1:3306")
output.force_encoding("ASCII-8BIT") if output.respond_to?(:force_encoding)
assert_match version.to_s, output
ensure
Process.kill(9, pid)
Process.wait(pid)
end
end
end