homebrew-core/Formula/percona-xtrabackup.rb
2016-09-30 19:52:45 -04:00

81 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.4/source/tarball/percona-xtrabackup-2.4.4.tar.gz"
sha256 "e3ec54eb468482503bccdd1619136e798798086042e9eb7c6daa2fb9b78783a3"
bottle do
sha256 "a5fb5e87d082fe05196154b2acdb2c5f9960038819628a087d03d32d48cddd50" => :sierra
sha256 "79fd5cdb7b84795494caf58949bddf8abbbb05eff009d1e56ee31c577ae24a5d" => :el_capitan
sha256 "c7f56675e64d5f222ab33cb071c5edba7ca384332ecb8f7933566eb55b0261c8" => :yosemite
sha256 "6618802f70e5491736d5a436b74c74f2bf58db9375feee35ec274cb1f8acbba7" => :mavericks
end
option "without-docs", "Build without man pages (which requires python-sphinx)"
option "without-mysql", "Build without bundled Perl DBD::mysql module, to use the database of your choice."
depends_on "cmake" => :build
depends_on "sphinx-doc" => :build if build.with? "docs"
depends_on :mysql => :recommended
depends_on "libev"
depends_on "libgcrypt"
depends_on "openssl"
resource "DBD::mysql" do
url "https://cpan.metacpan.org/authors/id/M/MI/MICHIELB/DBD-mysql-4.035.tar.gz"
mirror "http://search.cpan.org/CPAN/authors/id/M/MI/MICHIELB/DBD-mysql-4.035.tar.gz"
sha256 "b7eca365ea16bcf4c96c2fc0221304ff9c4995e7a551886837804a8f66b61937"
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
]
if build.with? "docs"
cmake_args.concat %W[
-DWITH_MAN_PAGES=ON
-DINSTALL_MANDIR=share/man
]
# OSX has this value empty by default.
# See https://bugs.python.org/issue18378#msg215215
ENV["LC_ALL"] = "en_US.UTF-8"
else
cmake_args << "-DWITH_MAN_PAGES=OFF"
end
# 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" if build.with? "docs"
rm_rf prefix/"xtrabackup-test" # Remove unnecessary files
if build.with? "mysql"
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
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
end
test do
assert_match version.to_s, shell_output("#{bin}/xtrabackup --version 2>&1")
end
end