167 lines
5.7 KiB
Ruby
167 lines
5.7 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://downloads.percona.com/downloads/Percona-XtraBackup-LATEST/Percona-XtraBackup-8.0.28-21/source/tarball/percona-xtrabackup-8.0.28-21.tar.gz"
|
|
sha256 "66d7f15f8e61d0231cbc814dff73fc6181ed9aa91d55b14a34a5b32b63e8ca02"
|
|
revision 1
|
|
|
|
livecheck do
|
|
url "https://www.percona.com/downloads/Percona-XtraBackup-LATEST/"
|
|
regex(/value=.*?Percona-XtraBackup[._-]v?(\d+(?:\.\d+)+-\d+)["' >]/i)
|
|
end
|
|
|
|
bottle do
|
|
sha256 arm64_monterey: "2aa0d6fd7ae0854714674b6f16d7963a6c023a2f0cd081768f231a761d0b8e48"
|
|
sha256 arm64_big_sur: "322068c296b1db9f345f793f5cb99e4dcc7a8ed7fecc681f637470f45ff5b358"
|
|
sha256 monterey: "1a1918124e461ac889b4226ae2c8d372ef0dd0bd8cd4e253060950aee4e60d9a"
|
|
sha256 big_sur: "8bd4284d307c64fc6970119c4e38cdf25b773957c3571ea2e09e58a354b3d780"
|
|
sha256 catalina: "d21e75d7d40e9e5ad766fc3b688088eb44e25e90f1ee58f1e6fb6199791f9099"
|
|
sha256 x86_64_linux: "7df1c67b75fdb808f8e9f10044657d21ce46c076e8e058c3cafe6955e5b8bc13"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "sphinx-doc" => :build
|
|
depends_on "icu4c"
|
|
depends_on "libev"
|
|
depends_on "libevent"
|
|
depends_on "libfido2"
|
|
depends_on "libgcrypt"
|
|
depends_on "lz4"
|
|
depends_on "mysql-client"
|
|
depends_on "openssl@1.1"
|
|
depends_on "protobuf"
|
|
depends_on "zstd"
|
|
|
|
uses_from_macos "vim" => :build # needed for xxd
|
|
uses_from_macos "curl"
|
|
uses_from_macos "cyrus-sasl"
|
|
uses_from_macos "libedit"
|
|
uses_from_macos "perl"
|
|
uses_from_macos "zlib"
|
|
|
|
on_linux do
|
|
depends_on "patchelf" => :build
|
|
depends_on "gcc" # Requires GCC 7.1 or later
|
|
depends_on "libaio"
|
|
end
|
|
|
|
conflicts_with "percona-server", because: "both install a `kmip.h`"
|
|
|
|
fails_with :gcc do
|
|
version "6"
|
|
cause "The build requires GCC 7.1 or later."
|
|
end
|
|
|
|
# Should be installed before DBD::mysql
|
|
resource "Devel::CheckLib" do
|
|
url "https://cpan.metacpan.org/authors/id/M/MA/MATTN/Devel-CheckLib-1.14.tar.gz"
|
|
sha256 "f21c5e299ad3ce0fdc0cb0f41378dca85a70e8d6c9a7599f0e56a957200ec294"
|
|
end
|
|
|
|
# This is not part of the system Perl on Linux and on macOS since Mojave
|
|
resource "DBI" do
|
|
url "https://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.643.tar.gz"
|
|
sha256 "8a2b993db560a2c373c174ee976a51027dd780ec766ae17620c20393d2e836fa"
|
|
end
|
|
|
|
resource "DBD::mysql" do
|
|
url "https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/DBD-mysql-4.050.tar.gz"
|
|
sha256 "4f48541ff15a0a7405f76adc10f81627c33996fbf56c95c26c094444c0928d78"
|
|
end
|
|
|
|
# https://github.com/percona/percona-xtrabackup/blob/percona-xtrabackup-#{version}/cmake/boost.cmake
|
|
resource "boost" do
|
|
url "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2"
|
|
sha256 "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402"
|
|
end
|
|
|
|
# Fix CMake install error with manpages.
|
|
# https://github.com/percona/percona-xtrabackup/pull/1266
|
|
patch do
|
|
url "https://github.com/percona/percona-xtrabackup/commit/1d733eade782dd9fdf8ef66b9e9cb9e00f572606.patch?full_index=1"
|
|
sha256 "9b38305b4e4bae23b085b3ef9cb406451fa3cc14963524e95fc1e6cbf761c7cf"
|
|
end
|
|
|
|
# Fix libfibo2 finding; fix unneeded coping of openssl@1.1 libs
|
|
# Remove in the next version (8.0.29)
|
|
patch do
|
|
url "https://github.com/mysql/mysql-server/commit/4498aef6d4a1fd266cdbddcce60965e3cb12fe1a.patch?full_index=1"
|
|
sha256 "09246d7f3a141adfc616bafb83f927648865eeb613f0726514fcb0aa6815d98b"
|
|
end
|
|
|
|
def install
|
|
# Disable ABI checking
|
|
inreplace "cmake/abi_check.cmake", "RUN_ABI_CHECK 1", "RUN_ABI_CHECK 0" if OS.linux?
|
|
|
|
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=
|
|
-DWITH_SYSTEM_LIBS=ON
|
|
-DWITH_EDITLINE=system
|
|
-DWITH_FIDO=system
|
|
-DWITH_ICU=system
|
|
-DWITH_LIBEVENT=system
|
|
-DWITH_LZ4=system
|
|
-DWITH_PROTOBUF=system
|
|
-DWITH_SSL=system
|
|
-DOPENSSL_ROOT_DIR=#{Formula["openssl@1.1"].opt_prefix}
|
|
-DWITH_ZLIB=system
|
|
-DWITH_ZSTD=system
|
|
]
|
|
|
|
(buildpath/"boost").install resource("boost")
|
|
cmake_args << "-DWITH_BOOST=#{buildpath}/boost"
|
|
|
|
cmake_args.concat std_cmake_args
|
|
|
|
# Remove conflicting manpages
|
|
rm (Dir["man/*"] - ["man/CMakeLists.txt"])
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *cmake_args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
# remove conflicting library that is already installed by mysql
|
|
rm lib/"libmysqlservices.a"
|
|
|
|
ENV.prepend_create_path "PERL5LIB", buildpath/"build_deps/lib/perl5"
|
|
|
|
resource("Devel::CheckLib").stage do
|
|
system "perl", "Makefile.PL", "INSTALL_BASE=#{buildpath}/build_deps"
|
|
system "make", "install"
|
|
end
|
|
|
|
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
|
|
|
|
# This is not part of the system Perl on Linux and on macOS since Mojave
|
|
if OS.linux? || 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: libexec/"lib/perl5")
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/xtrabackup --version 2>&1")
|
|
|
|
mkdir "backup"
|
|
output = shell_output("#{bin}/xtrabackup --target-dir=backup --backup 2>&1", 1)
|
|
assert_match "Failed to connect to MySQL server", output
|
|
end
|
|
end
|