From nobody Wed Sep 4 16:11:43 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WzSDH3gdPz5V9x3; Wed, 04 Sep 2024 16:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzSDH34p1z4gf8; Wed, 4 Sep 2024 16:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725466303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ATtXmLYWBo2533qiEgHZaQostnW/8x7fTPT7g6MCSiA=; b=cLLvf3rF6YXrmj2VcXDtp2/uDHlmB0uljNPRHq+hsYk9rETzLAt+V3qi6w9RNIgqIzPZZN y1I4S4vOxzeQqILDgTJVuXwCyxjz/a81uqPbW+xWGpswj6yxrp8ZOdATi7h2dbF3K4bCU8 r2FoCXbMD3Ato1wfgmqIZEr0uhxK0ab9FMNlGfKDhL7GNe90pBHIghAIY99VMgz7tOoiAH Ku47OYedUmM+xgJiCvjsoqFhrDx6pA+El2hvDfNhIV9gCTk34/9wR6z9z2saNulg+/s/Tz LYq0e2kf6UKQo/oX92HYKlL2LvuuuyknYbzzFHsUx6qjVnfsdvUWjdm6HvgIzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725466303; a=rsa-sha256; cv=none; b=vn8PKz09qae6lAQ/sOrZXDKa0WnUslWWFc43rHuuUg21l4OWUbRFgc+d2BRAugqSwckCiX 61ih4jOa71WEA4E76JHszaiwx6cHFx54Gh3X98/nDDnk8I3PvOeQ1GCKPEHYq59T8zNtS4 xRdttHFbqmmCuw23Nypx12cwqDg6xkCxU98rSu9YT5dPvDOPjy4RZAwpABA72BM7o4aiAa dI7/o6t2vVuZp3nkpZRxFLvXMLRh5iEwCAzfwhSFCFQ/kiF91A0kt4ETyRrfy61pYQ4wHI dAPAk0W10RbViVOsX7sxwP3b0hQ9MJGcANj+ubMbhPawUAKi/N+qqjw7ZPZFhQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725466303; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ATtXmLYWBo2533qiEgHZaQostnW/8x7fTPT7g6MCSiA=; b=ghJ3ix8lnMi4SZ05KkmlEJ9h8q7GSJTPhkcDA4dQIKe+xt6AgQC71Y+WuAaSV1w0CsHBeT 8Tv7UBaC/vNSc76xlfVbEg+15Mg2WglI+LwcfeVG2xfOIFqLbad8QlpR6uGO9n6F7cLMCq J2E+/ek7zpGrSwaUuwILifPF3qbZ/9A+sXAShhN4rumtvtxYBZjQhJ2uANdJkmycasaiN6 zf4E70792WcGyAhVvJ/WzbxJ4qY61ExwGwbtzUhEnbN/mEGg2YW5HkjLRcDvf1v/EZn/rT XNEKgg3Sakiur/6hWnZ1ylVCntewXGq8wpIfogs/siRYiprK8Zqot4Ep+PeW1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WzSDH2dt8zX6t; Wed, 4 Sep 2024 16:11:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484GBhAQ052592; Wed, 4 Sep 2024 16:11:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484GBhwn052589; Wed, 4 Sep 2024 16:11:43 GMT (envelope-from git) Date: Wed, 4 Sep 2024 16:11:43 GMT Message-Id: <202409041611.484GBhwn052589@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Oleksii Samorukov Subject: git: 1f28cb4002a8 - main - databases/xtrabackup84: new port to backup MySQL 8.4 database List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-main@freebsd.org Sender: owner-dev-commits-ports-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: samm X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f28cb4002a8698562b90c773b3c02d8d321ef9c Auto-Submitted: auto-generated The branch main has been updated by samm: URL: https://cgit.FreeBSD.org/ports/commit/?id=1f28cb4002a8698562b90c773b3c02d8d321ef9c commit 1f28cb4002a8698562b90c773b3c02d8d321ef9c Author: Oleksii Samorukov AuthorDate: 2024-09-04 16:08:39 +0000 Commit: Oleksii Samorukov CommitDate: 2024-09-04 16:10:40 +0000 databases/xtrabackup84: new port to backup MySQL 8.4 database Based on xtrabackup83 port, with corresponding changes, including: - usage of bundled boost - disable build on 32bit platforms (unsupported by vendor) - new patches from mysql-server84. --- databases/Makefile | 1 + databases/xtrabackup84/Makefile | 74 +++++++++++++++ databases/xtrabackup84/distinfo | 3 + databases/xtrabackup84/files/patch-CMakeLists.txt | 22 +++++ .../files/patch-cmake-install_layout.cmake | 11 +++ databases/xtrabackup84/files/patch-file_utils | 20 ++++ .../files/patch-include_my__stacktrace.h | 11 +++ .../files/patch-libs_mysql_serialization_archive.h | 19 ++++ ...sql_serialization_serializer__default__impl.hpp | 42 +++++++++ ...h-libs_mysql_serialization_serializer__impl.hpp | 22 +++++ databases/xtrabackup84/files/patch-llvm-15 | 28 ++++++ databases/xtrabackup84/files/patch-procps | 34 +++++++ databases/xtrabackup84/files/patch-protobuf | 10 ++ .../files/patch-sql_auth_sql__authorization.cc | 13 +++ .../files/patch-storage_innobase_include_srv0mon.h | 13 +++ .../patch-storage_innobase_include_ut0crc32.h | 12 +++ .../files/patch-storage_innobase_ut_crc32.cc | 104 +++++++++++++++++++++ .../patch-storage_innobase_xtrabackup_src_utils.cc | 59 ++++++++++++ ...h-storage_innobase_xtrabackup_xbcloud__osenv.sh | 15 +++ databases/xtrabackup84/pkg-descr | 4 + databases/xtrabackup84/pkg-plist | 9 ++ 21 files changed, 526 insertions(+) diff --git a/databases/Makefile b/databases/Makefile index 1107c8d731fa..fc6dff3e7ddc 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -1108,6 +1108,7 @@ SUBDIR += xrootd SUBDIR += xtrabackup80 SUBDIR += xtrabackup81 + SUBDIR += xtrabackup84 SUBDIR += zodb .include diff --git a/databases/xtrabackup84/Makefile b/databases/xtrabackup84/Makefile new file mode 100644 index 000000000000..36fd38ac1f15 --- /dev/null +++ b/databases/xtrabackup84/Makefile @@ -0,0 +1,74 @@ +PORTNAME= xtrabackup84 +PORTVERSION= 8.4.0 +DISTVERSIONSUFFIX= -1 +CATEGORIES= databases +MASTER_SITES= https://downloads.percona.com/downloads/Percona-XtraBackup-innovative-release/Percona-XtraBackup-8.4.0-1/source/tarball/:percona +DISTFILES= ${PPORTNAME}-${DVERSION}${EXTRACT_SUFX}:percona + +MAINTAINER= samm@FreeBSD.org +COMMENT= Open-source backup tool for InnoDB and XtraDB +WWW= https://www.percona.com/doc/percona-xtrabackup/ + +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/LICENSE + +# MySQL8.2+ supports only 64-bit platforms +NOT_FOR_ARCHS= armv6 armv7 i386 powerpc + +BUILD_DEPENDS= protobuf>=3.0:devel/protobuf \ + rapidjson>=1.1.0:devel/rapidjson \ + libevent>=2.1:devel/libevent +LIB_DEPENDS= libcurl.so:ftp/curl \ + libev.so:devel/libev \ + libgcrypt.so:security/libgcrypt \ + libgpg-error.so:security/libgpg-error \ + libicudata.so:devel/icu \ + libprotobuf-lite.so:devel/protobuf \ + libunwind.so:devel/libunwind \ + libzstd.so:archivers/zstd +RUN_DEPENDS= qpress:archivers/qpress + +USES= bison cmake compiler:c++14-lang cpe pkgconfig ssl +CPE_VENDOR= percona +CMAKE_ARGS= -DBUILD_CONFIG:STRING=xtrabackup_release \ + -DWITHOUT_COMPONENT_KEYRING_KMIP:STRING=yes \ + -DWITH_VERSION_CHECK=false + +.for component in EDITLINE ICU LIBEVENT PROTOBUF RAPIDJSON ZSTD +CMAKE_ARGS+= -DWITH_${component}:STRING=system +.endfor + +CONFLICTS_INSTALL= ${PORTNAME:C/.$//}* + +# Build fails without NDEBUG, so force it +CFLAGS+= -DNDEBUG -fPIC +CXXFLAGS+= -DNDEBUG -fPIC +CFLAGS_aarch64?= -march=armv8-a+crc+crypto + +DVERSION= ${PORTVERSION}${DISTVERSIONSUFFIX} +PPORTNAME= percona-xtrabackup +WRKSRC= ${WRKDIR}/${PPORTNAME}-${DVERSION} + +.include + +KEEP_EXTRA= lz4 zlib libbacktrace libcno boost unordered_dense + +post-patch: +.for d in storage/innobase/xtrabackup/src sql/protobuf + ${REINPLACE_CMD} 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/${d}/CMakeLists.txt +.endfor + +pre-configure: +.for dir in ${KEEP_EXTRA} + @${MV} ${WRKSRC}/extra/${dir} ${WRKDIR} +.endfor + @${RM} -r ${WRKSRC}/extra/* +.for dir in ${KEEP_EXTRA} + @${MV} ${WRKDIR}/${dir} ${WRKSRC}/extra +.endfor + +post-stage: + @${RM} -r ${STAGEDIR}${PREFIX}/docs ${STAGEDIR}${PREFIX}/man + @${RMDIR} ${STAGEDIR}${PREFIX}/lib/plugin/debug + +.include diff --git a/databases/xtrabackup84/distinfo b/databases/xtrabackup84/distinfo new file mode 100644 index 000000000000..6c72ea924b11 --- /dev/null +++ b/databases/xtrabackup84/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1725152102 +SHA256 (percona-xtrabackup-8.4.0-1.tar.gz) = d55caa8f8bfcc33ec299c22a16311fd9595b00c04543e0f7abde553e38e96e0b +SIZE (percona-xtrabackup-8.4.0-1.tar.gz) = 432545459 diff --git a/databases/xtrabackup84/files/patch-CMakeLists.txt b/databases/xtrabackup84/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..8152347c2ee0 --- /dev/null +++ b/databases/xtrabackup84/files/patch-CMakeLists.txt @@ -0,0 +1,22 @@ +--- CMakeLists.txt.orig 2023-10-19 12:05:28 UTC ++++ CMakeLists.txt +@@ -2094,8 +2094,6 @@ IF(WITH_PROTOBUF STREQUAL "bundled" OR WITH_FIDO STREQ + ENDIF() + ENDIF() + +-ADD_SUBDIRECTORY(extra/libkmip) +- + # + # Setup maintainer mode options by the end. Platform checks are + # not run with the warning options as to not perturb fragile checks +@@ -2345,10 +2343,6 @@ ENDIF() + + IF(ENABLE_GCOV) + INCLUDE(fastcov) +-ENDIF() +- +-IF(UNIX) +- ADD_SUBDIRECTORY(man) + ENDIF() + + IF(LINUX AND NOT WITHOUT_SERVER) diff --git a/databases/xtrabackup84/files/patch-cmake-install_layout.cmake b/databases/xtrabackup84/files/patch-cmake-install_layout.cmake new file mode 100644 index 000000000000..f5916ece2f0b --- /dev/null +++ b/databases/xtrabackup84/files/patch-cmake-install_layout.cmake @@ -0,0 +1,11 @@ +--- cmake/install_layout.cmake.orig 2023-10-19 12:05:28 UTC ++++ cmake/install_layout.cmake +@@ -159,7 +159,7 @@ SET(INSTALL_INFODIR_STANDALONE "docs") + # + SET(INSTALL_SHAREDIR_STANDALONE "share") + SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") +-SET(INSTALL_MYSQLTESTDIR_STANDALONE "xtrabackup-test") ++# SET(INSTALL_MYSQLTESTDIR_STANDALONE "xtrabackup-test") + SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") + # + SET(INSTALL_MYSQLDATADIR_STANDALONE "data") diff --git a/databases/xtrabackup84/files/patch-file_utils b/databases/xtrabackup84/files/patch-file_utils new file mode 100644 index 000000000000..a23aa72136d4 --- /dev/null +++ b/databases/xtrabackup84/files/patch-file_utils @@ -0,0 +1,20 @@ +--- storage/innobase/xtrabackup/src/file_utils.cc.orig 2023-11-24 17:33:10.000000000 +0700 ++++ storage/innobase/xtrabackup/src/file_utils.cc 2024-02-17 00:40:45.193255000 +0700 +@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Bos + + #include "file_utils.h" + #include +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined (__FreeBSD__) + #include + #else + #include +@@ -391,7 +391,7 @@ File open_fifo_for_read_with_timeout(const char *path, + } + + /* File was open, lets check its open on the other side */ +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__FreeBSD__) + struct timespec tm = {timeout, 0}; + int kqueue_fd = kqueue(); + if (kqueue_fd < 0) { diff --git a/databases/xtrabackup84/files/patch-include_my__stacktrace.h b/databases/xtrabackup84/files/patch-include_my__stacktrace.h new file mode 100644 index 000000000000..c9435e093fd5 --- /dev/null +++ b/databases/xtrabackup84/files/patch-include_my__stacktrace.h @@ -0,0 +1,11 @@ +--- include/my_stacktrace.h.orig 2024-04-10 06:26:28 UTC ++++ include/my_stacktrace.h +@@ -45,7 +45,7 @@ + _WIN32 - Windows + HAVE_EXT_BACKTRACE - Unixes without backtrace(3) + */ +-#if defined(HAVE_BACKTRACE) || defined(_WIN32) || defined(HAVE_EXT_BACKTRACE) ++#if (defined(HAVE_BACKTRACE) && (defined(__aarch64__) || defined(__amd64__))) || defined(_WIN32) || defined(HAVE_EXT_BACKTRACE) + #define HAVE_STACKTRACE 1 + void my_init_stacktrace(); + void my_print_stacktrace(const uchar *stack_bottom, ulong thread_stack); diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h b/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h new file mode 100644 index 000000000000..9c5c096c2b6b --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h @@ -0,0 +1,19 @@ +--- libs/mysql/serialization/archive.h.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/archive.h +@@ -81,14 +81,14 @@ class Archive { + /// @note To be implemented in Archive_derived_type + template + static std::size_t get_size(Type &&arg) { +- return Archive_derived_type::template get_size(std::forward(arg)); ++ return Archive_derived_type::template get_size<>(std::forward(arg)); + } + + /// @brief Returns archive size - size of data written to the archive + /// @return archive size - size of data written to the archive + /// @note To be implemented in Archive_derived_type + inline std::size_t get_size_written() const { +- return Archive_derived_type::template get_size_written(); ++ return Archive_derived_type::template get_size_written<>(); + } + + /// @brief Function returns maximum size of the Type diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp new file mode 100644 index 000000000000..43dd9792cd34 --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp @@ -0,0 +1,42 @@ +--- libs/mysql/serialization/serializer_default_impl.hpp.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/serializer_default_impl.hpp +@@ -233,7 +233,7 @@ std::size_t Serializer_default: + template + std::size_t Serializer_default::get_field_size( + const Field_type &field) { +- return Archive_concrete_type::template get_size( ++ return Archive_concrete_type::template get_size<>( + Field_wrapper(field)); + } + +@@ -473,7 +473,7 @@ std::size_t Serializer_default: + std::size_t calculated_size = 0; + bool is_provided = field_definition.run_encode_predicate(); + if (is_provided) { +- auto size_id_type = Archive_concrete_type::template get_size( ++ auto size_id_type = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(field_id)); + calculated_size = get_field_size( + field_definition.get_ref()) + +@@ -489,18 +489,18 @@ std::size_t Serializer_default: + bool skip_id) { + std::size_t serializable_overhead_type = 0; + if (skip_id == false) { +- serializable_overhead_type = Archive_concrete_type::template get_size( ++ serializable_overhead_type = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(field_id)); + } + auto serializable_size = serializable.template get_size_internal(); +- auto serializable_overhead_size = Archive_concrete_type::template get_size( ++ auto serializable_overhead_size = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(serializable_size)); + + Field_id_type last_non_ignorable_field_id = + find_last_non_ignorable_field_id(serializable); + + auto serializable_overhead_last_non_ignorable_field_id = +- Archive_concrete_type::template get_size( ++ Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(last_non_ignorable_field_id)); + return serializable_overhead_type + serializable_overhead_size + + serializable_overhead_last_non_ignorable_field_id + serializable_size; diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp new file mode 100644 index 000000000000..da31e03eb489 --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp @@ -0,0 +1,22 @@ +--- libs/mysql/serialization/serializer_impl.hpp.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/serializer_impl.hpp +@@ -51,8 +51,8 @@ Serializer::get + Serializer::get_size_field_def( + Field_id_type field_id, + const Field_definition &field_definition) { +- return Serializer_derived_type::template get_size_field_def(field_id, +- field_definition); ++ return Serializer_derived_type::template get_size_field_def<>( ++ field_id, field_definition); + } + + template +@@ -61,7 +61,7 @@ Serializer::get + Serializer::get_size_serializable( + Field_id_type field_id, const Serializable_concrete_type &serializable, + bool skip_id) { +- return Serializer_derived_type::template get_size_serializable( ++ return Serializer_derived_type::template get_size_serializable<>( + field_id, serializable, skip_id); + } + diff --git a/databases/xtrabackup84/files/patch-llvm-15 b/databases/xtrabackup84/files/patch-llvm-15 new file mode 100644 index 000000000000..0017d73b5902 --- /dev/null +++ b/databases/xtrabackup84/files/patch-llvm-15 @@ -0,0 +1,28 @@ +--- storage/innobase/include/ddl0impl.h.orig 2023-10-19 12:05:28 UTC ++++ storage/innobase/include/ddl0impl.h +@@ -118,14 +118,6 @@ struct Fetch_sequence : public Context::FTS::Sequence + + /** Physical row context. */ + struct Row { +- /** Constructor. */ +- Row() = default; +- +- Row(const Row &) = default; +- +- /** Destructor. */ +- ~Row() = default; +- + Row &operator=(const Row &) = default; + + /** Build a row from a raw record. +--- unittest/gunit/mysys_my_rdtsc-t.cc.orig 2023-10-19 12:05:28 UTC ++++ unittest/gunit/mysys_my_rdtsc-t.cc +@@ -145,7 +145,7 @@ TEST_F(RDTimeStampCounter, TestNanosecond) { + ulonglong t1 = my_timer_nanoseconds(); + ulonglong t2; + int i; +- int backward = 0; ++ int backward [[maybe_unused]] = 0; + int nonzero = 0; + + for (i = 0; i < LOOP_COUNT; i++) { diff --git a/databases/xtrabackup84/files/patch-procps b/databases/xtrabackup84/files/patch-procps new file mode 100644 index 000000000000..2604380ecf1e --- /dev/null +++ b/databases/xtrabackup84/files/patch-procps @@ -0,0 +1,34 @@ +--- storage/innobase/xtrabackup/src/CMakeLists.txt.orig 2024-08-08 12:30:27.000000000 +0200 ++++ storage/innobase/xtrabackup/src/CMakeLists.txt 2024-09-03 10:39:46.078261000 +0200 +@@ -19,12 +19,13 @@ + OPTION(WITH_VERSION_CHECK "Build with version check" ON) + + INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) ++INCLUDE_DIRECTORIES(%%PREFIX%%/include) + + FIND_GCRYPT() + +-IF(NOT APPLE) +- FIND_PROCPS() +-ENDIF() ++#IF(NOT APPLE) ++# FIND_PROCPS() ++#ENDIF() + + CHECK_TYPE_SIZE("unsigned long" SIZEOF_UNSIGNED_LONG) + +@@ -134,14 +135,6 @@ + ext::icu + crc + ) +- +-IF(NOT APPLE) +- IF(PROCPS_VERSION EQUAL 4) +- TARGET_LINK_LIBRARIES(xtrabackup proc2) +- ELSE() +- TARGET_LINK_LIBRARIES(xtrabackup procps) +- ENDIF() +-ENDIF() + + # We depend on protobuf because of the mysqlx plugin and replication. + IF(UNIX_INSTALL_RPATH_ORIGIN_PRIV_LIBDIR) diff --git a/databases/xtrabackup84/files/patch-protobuf b/databases/xtrabackup84/files/patch-protobuf new file mode 100644 index 000000000000..f1bd482d944a --- /dev/null +++ b/databases/xtrabackup84/files/patch-protobuf @@ -0,0 +1,10 @@ +--- sql/protobuf/CMakeLists.txt.orig 2023-11-24 17:33:10.000000000 +0700 ++++ sql/protobuf/CMakeLists.txt 2024-02-17 02:13:42.264307000 +0700 +@@ -21,6 +21,7 @@ + # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + INCLUDE(${CMAKE_SOURCE_DIR}/cmake/protobuf.cmake) ++INCLUDE_DIRECTORIES(%%PREFIX%%/include) + + SET(PROTOBUF_LITE_LIB_NAME rpl_protobuf_lite) + diff --git a/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc b/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc new file mode 100644 index 000000000000..95b8518d0a9a --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc @@ -0,0 +1,13 @@ +--- sql/auth/sql_authorization.cc.orig 2023-10-19 12:05:28 UTC ++++ sql/auth/sql_authorization.cc +@@ -7437,6 +7437,10 @@ bool operator==(const Role_id &a, const std::string &b + return tmp == b; + } + ++bool operator==(const Role_id &a, const LEX_CSTRING &b) { ++ return a == to_string(b); ++} ++ + bool operator==(const std::pair &a, const std::string &b) { + return a.first == b; + } diff --git a/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h b/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h new file mode 100644 index 000000000000..a0279de2a126 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h @@ -0,0 +1,13 @@ +--- storage/innobase/include/srv0mon.h.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/include/srv0mon.h +@@ -41,6 +41,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + /* Required for FreeBSD so that INT64_MAX is defined. */ + #define __STDC_LIMIT_MACROS + #endif /* __STDC_LIMIT_MACROS */ ++#ifdef __DragonFly__ ++/* The hack above doen't work for dragonfly, stdint.h already imported */ ++#include ++#endif + + #include + diff --git a/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h b/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h new file mode 100644 index 000000000000..b1b372a2d8c7 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h @@ -0,0 +1,12 @@ +--- storage/innobase/include/ut0crc32.h.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/include/ut0crc32.h +@@ -133,7 +133,9 @@ CRC32_DEFAULT + #endif /* CRC32_ARM64 */ + + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __FreeBSD__ + #include ++#endif /* __FreeBSD__ */ + #include + #endif /* CRC32_ARM64_DEFAULT */ + diff --git a/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc b/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc new file mode 100644 index 000000000000..4a2609cc1491 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc @@ -0,0 +1,104 @@ +--- storage/innobase/ut/crc32.cc.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/ut/crc32.cc +@@ -333,8 +333,25 @@ bool can_use_poly_mul() { return true; } + #endif /* CRC32_ARM64_APPLE */ + + #ifdef CRC32_ARM64_DEFAULT ++#ifdef __FreeBSD__ ++bool can_use_crc32() { ++ unsigned long capabilities; ++ ++ if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long))) ++ return false; ++ return capabilities & HWCAP_CRC32; ++} ++bool can_use_poly_mul() { ++ unsigned long capabilities; ++ ++ if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long))) ++ return false; ++ return capabilities & HWCAP_PMULL; ++} ++#else + bool can_use_crc32() { return getauxval(AT_HWCAP) & HWCAP_CRC32; } + bool can_use_poly_mul() { return getauxval(AT_HWCAP) & HWCAP_PMULL; } ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + + /** A helper template to statically unroll a loop with a fixed number of +@@ -443,25 +460,39 @@ uint64_t crc32_impl::update(uint64_t crc, uint64_t dat + + #ifdef CRC32_ARM64 + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, unsigned char data) { + return __crc32cb(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, uint16_t data) { + return __crc32ch(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, uint32_t data) { + return __crc32cw(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint64_t crc32_impl::update(uint64_t crc, uint64_t data) { + return (uint64_t)__crc32cd((uint32_t)crc, data); +@@ -508,7 +539,11 @@ template + } + template + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crypto"))) ++#else ++MY_ATTRIBUTE((target("crypto"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint64_t use_pclmul::polynomial_mul_rev(uint32_t rev_u) { + constexpr uint64_t flipped_w = flip_at_32(w); +@@ -751,7 +786,11 @@ MY_ATTRIBUTE((flatten)) + MY_ATTRIBUTE((flatten)) + #endif /* CRC32_ARM64_APPLE */ + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc+crypto"), flatten)) ++#else ++MY_ATTRIBUTE((target("crc,crypto"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_using_pclmul(const byte *data, size_t len) { + return crc32(0, data, len); +@@ -771,7 +810,11 @@ MY_ATTRIBUTE((flatten)) + MY_ATTRIBUTE((flatten)) + #endif /* CRC32_ARM64_APPLE */ + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"), flatten)) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_using_unrolled_loop_poly_mul(const byte *data, size_t len) { + return crc32(0, data, len); diff --git a/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc new file mode 100644 index 000000000000..dbc84f05a7e1 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc @@ -0,0 +1,59 @@ +--- storage/innobase/xtrabackup/src/utils.cc.orig 2023-10-19 12:05:28 UTC ++++ storage/innobase/xtrabackup/src/utils.cc +@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Bos + + #ifdef __APPLE__ + #include ++#endif ++#if defined(__APPLE__) || defined(__FreeBSD__) + #include + #else + #ifdef HAVE_PROCPS_V3 +@@ -113,12 +115,14 @@ unsigned long get_version_number(std::string version_s + return major * 10000 + minor * 100 + version; + } + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__FreeBSD__) + unsigned long host_total_memory() { + unsigned long total_mem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE); + return total_mem; + } ++#endif + ++#ifdef __APPLE__ + unsigned long host_free_memory() { + unsigned long total_mem = host_total_memory(); + int64_t used_mem; +@@ -139,6 +143,31 @@ unsigned long host_free_memory() { + return total_mem - (unsigned long)used_mem; + } + return 0; ++} ++#elif defined(__FreeBSD__) ++unsigned long host_free_memory() { ++ static int mib_free[2] = { -1, 0 }; ++ static int mib_inactive[2] = { -1, 0 }; ++ size_t miblen = sizeof(mib_free) / sizeof(mib_free[0]); ++ uint32_t free_pages, inactive_pages; ++ size_t sz = sizeof(free_pages); ++ ++ free_pages = inactive_pages = 0; ++ ++ if (mib_free[0] < 0 && ++ sysctlnametomib("vm.stats.vm.v_free_count", mib_free, &miblen) < 0) ++ mib_free[0] = 0; ++ if (mib_inactive[0] < 0 && ++ sysctlnametomib("vm.stats.vm.v_inactive_count", mib_inactive, &miblen) < 0) ++ mib_inactive[0] = 0; ++ ++ if (mib_free[0] && ++ sysctl(mib_free, 2, &free_pages, &sz, NULL, 0) < 0) ++ free_pages = 0; /* should not happen */ ++ if (mib_inactive[0] && sysctl(mib_inactive, 2, &inactive_pages, &sz, NULL, 0) < 0) ++ inactive_pages = 0; /* should not happen, too */ ++ ++ return (free_pages + inactive_pages) * sysconf(_SC_PAGESIZE); + } + #else + unsigned long host_total_memory() { diff --git a/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh new file mode 100644 index 000000000000..37b1e45afc66 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh @@ -0,0 +1,15 @@ +--- storage/innobase/xtrabackup/xbcloud_osenv.sh.orig 2020-08-28 21:02:32 UTC ++++ storage/innobase/xtrabackup/xbcloud_osenv.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Copyright (C) 2015 Percona LLC and/or its affiliates. + # This software comes with ABSOLUTELY NO WARRANTY. This is free software, +@@ -105,5 +105,5 @@ fi + + # do it + # shellcheck disable=SC2086,SC2048 +-${XBCLOUD_BIN} $* ${XBCLOUD_OS_ENV} ++${XBCLOUD_BIN} "$@" ${XBCLOUD_OS_ENV} + diff --git a/databases/xtrabackup84/pkg-descr b/databases/xtrabackup84/pkg-descr new file mode 100644 index 000000000000..da1655f57769 --- /dev/null +++ b/databases/xtrabackup84/pkg-descr @@ -0,0 +1,4 @@ +Percona XtraBackup is an open-source hot backup utility for MySQL that +doesn't lock your database during the backup. It can back up data from +InnoDB, XtraDB and MyISAM tables on MySQL/Percona Server/MariaDB +servers, and has many advanced features. diff --git a/databases/xtrabackup84/pkg-plist b/databases/xtrabackup84/pkg-plist new file mode 100644 index 000000000000..8128dd3b9dac --- /dev/null +++ b/databases/xtrabackup84/pkg-plist @@ -0,0 +1,9 @@ +bin/xbcloud +bin/xbcloud_osenv +bin/xbcrypt +bin/xbstream +bin/xtrabackup +lib/libmysqlservices.a +lib/plugin/component_keyring_file.so +lib/plugin/component_keyring_kms.so +lib/plugin/component_keyring_vault.so