homebrew-core/Formula/percona-xtrabackup.rb
2019-11-18 11:34:52 +01:00

86 lines
2.9 KiB
Ruby

class PerconaXtrabackup < Formula
desc "Open source hot backup tool for InnoDB and XtraDB databases"
homepage "https://www.percona.com/software/mysql-database/percona-xtrabackup"
url "https://www.percona.com/downloads/XtraBackup/Percona-XtraBackup-2.4.14/source/tarball/percona-xtrabackup-2.4.14.tar.gz"
sha256 "4dffa6986aef358675b318b3b9f4a9b8df48e8fc4987ad2469bba1b186b47662"
revision 3
bottle do
sha256 "668e937c8b5bfd4494325f3fb1cad14dca148c572002f4701a8c74e1a7333247" => :catalina
sha256 "9c9b799666a1f0ce3a56d86b01989370a0717aa62497241528005c13f2a2dc01" => :mojave
sha256 "1776bd19664d4e423558bde7d5c9260ef6859220f7fe5a287f802ee25f1eeba8" => :high_sierra
end
depends_on "cmake" => :build
depends_on "sphinx-doc" => :build
depends_on "libev"
depends_on "libgcrypt"
depends_on "mysql-client"
depends_on "openssl@1.1"
resource "DBI" do
url "https://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.641.tar.gz"
sha256 "5509e532cdd0e3d91eda550578deaac29e2f008a12b64576e8c261bb92e8c2c1"
end
resource "DBD::mysql" do
url "https://cpan.metacpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.046.tar.gz"
sha256 "6165652ec959d05b97f5413fa3dff014b78a44cf6de21ae87283b28378daf1f7"
end
resource "boost" do
url "https://downloads.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2"
sha256 "727a932322d94287b62abb1bd2d41723eec4356a7728909e38adb65ca25241ca"
end
def install
cmake_args = %w[
-DBUILD_CONFIG=xtrabackup_release
-DCOMPILATION_COMMENT=Homebrew
-DINSTALL_PLUGINDIR=lib/percona-xtrabackup/plugin
-DINSTALL_MANDIR=share/man
-DWITH_MAN_PAGES=ON
-DINSTALL_MYSQLTESTDIR=
-DCMAKE_CXX_FLAGS="-DBOOST_NO_CXX11_HDR_ARRAY"
]
# macOS has this value empty by default.
# See https://bugs.python.org/issue18378#msg215215
ENV["LC_ALL"] = "en_US.UTF-8"
# 1.59.0 specifically required. Detailed in cmake/boost.cmake
(buildpath/"boost_1_59_0").install resource("boost")
cmake_args << "-DWITH_BOOST=#{buildpath}/boost_1_59_0"
cmake_args.concat std_cmake_args
system "cmake", *cmake_args
system "make"
system "make", "install"
share.install "share/man"
# remove conflicting library that is already installed by mysql
rm lib/"libmysqlservices.a"
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
# In Mojave, this is not part of the system Perl anymore
if MacOS.version >= :mojave
resource("DBI").stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
end
resource("DBD::mysql").stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
end
test do
assert_match version.to_s, shell_output("#{bin}/xtrabackup --version 2>&1")
end
end