From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql-connector-c/files/, dev-db/mysql-connector-c/
Date: Fri, 15 Jul 2022 07:10:14 +0000 (UTC) [thread overview]
Message-ID: <1657869007.0f7808b289d1eb16cef25c2de6411cc580b97c5c.sam@gentoo> (raw)
commit: 0f7808b289d1eb16cef25c2de6411cc580b97c5c
Author: brahmajit das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Fri Jul 15 05:52:59 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 07:10:07 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f7808b2
dev-db/mysql-connector-c: Use res_n* functions only on GLIBC
The issue occurs because the package tries to use the res_n* functions
(specifically res_ninit, res_nsearch and res_nclose) from resolv.h which
do not exist when using musl. So we are falling back to non-thread-safe
functions from resolv.h
Closes: https://bugs.gentoo.org/761352
Signed-off-by: brahmajit das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/26353
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../files/mysql-connector-c-8.0.27-res_n.patch | 49 ++++++++
.../mysql-connector-c-8.0.27-r1.ebuild | 123 +++++++++++++++++++++
2 files changed, 172 insertions(+)
diff --git a/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch b/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
new file mode 100644
index 000000000000..34961b8ad9e2
--- /dev/null
+++ b/dev-db/mysql-connector-c/files/mysql-connector-c-8.0.27-res_n.patch
@@ -0,0 +1,49 @@
+# Musl doesn't have res_n* functions so we are falling back to the not
+# thread safe ones. Patch made with help from developer Fabian Groffen
+# <grobian@gentoo.org>.
+#
+# Closes: https://bugs.gentoo.org/761352
+# See also: https://github.com/mysql/mysql-server/pull/385
+# See also: https://bugs.mysql.com/bug.php?id=106034
+--- a/libmysql/CMakeLists.txt
++++ b/libmysql/CMakeLists.txt
+@@ -423,6 +423,19 @@ IF(HAS_WARN_FLAG)
+ )
+ ENDIF()
+
++check_symbol_exists(res_ninit "resolv.h" HAVE_RES_NINIT_FUNCTION)
++check_symbol_exists(res_nsearch "resolv.h" HAVE_RES_NSEARCH_FUNCTION)
++check_symbol_exists(res_nclose "resolv.h" HAVE_RES_NCLOSE_FUNCTION)
++IF (HAVE_RES_NINIT_FUNCTION)
++ add_compile_definitions(HAVE_RES_NINIT)
++ENDIF(HAVE_RES_NINIT_FUNCTION)
++IF (HAVE_RES_NSEARCH_FUNCTION)
++ add_compile_definitions(HAVE_RES_NSEARCH)
++ENDIF(HAVE_RES_NSEARCH_FUNCTION)
++IF (HAVE_RES_NCLOSE_FUNCTION)
++ add_compile_definitions(HAVE_RES_NCLOSE)
++ENDIF(HAVE_RES_NCLOSE_FUNCTION)
++
+ # Verify that libmysql_api_test runs OK
+ ADD_CUSTOM_COMMAND(TARGET libmysql_api_test POST_BUILD
+ COMMAND libmysql_api_test
+--- a/libmysql/dns_srv.cc
++++ b/libmysql/dns_srv.cc
+@@ -37,6 +37,17 @@
+ #include <netdb.h>
+ #include <resolv.h>
+
++/* we don't have anything else but the non-thread-safe variants */
++#if !defined(HAVE_RES_NINIT)
++#define res_ninit(X) (void)X
++#endif
++#if !defined(HAVE_RES_NSEARCH)
++#define res_nsearch(X,D,I,S,B,L) res_search(D,I,S,B,L)
++#endif
++#if !defined(HAVE_RES_NCLOSE)
++#define res_nclose(X) (void)X
++#endif
++
+ // POSIX version
+
+ static bool get_dns_srv(Dns_srv_data &data, const char *dnsname, int &error) {
diff --git a/dev-db/mysql-connector-c/mysql-connector-c-8.0.27-r1.ebuild b/dev-db/mysql-connector-c/mysql-connector-c-8.0.27-r1.ebuild
new file mode 100644
index 000000000000..7058ba6c50ed
--- /dev/null
+++ b/dev-db/mysql-connector-c/mysql-connector-c-8.0.27-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+inherit cmake-multilib flag-o-matic
+
+# wrap the config script
+MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
+
+DESCRIPTION="C client library for MariaDB/MySQL"
+HOMEPAGE="https://dev.mysql.com/downloads/"
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="https://github.com/mysql/mysql-server.git"
+
+ inherit git-r3
+else
+ SRC_URI="https://dev.mysql.com/get/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${PV}.tar.gz"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+
+ S="${WORKDIR}/mysql-${PV}"
+fi
+
+LICENSE="GPL-2"
+SLOT="0/21"
+IUSE="ldap static-libs"
+
+RDEPEND="
+ >=app-arch/lz4-0_p131:=[${MULTILIB_USEDEP}]
+ app-arch/zstd:=[${MULTILIB_USEDEP}]
+ sys-libs/zlib:=[${MULTILIB_USEDEP}]
+ ldap? ( dev-libs/cyrus-sasl:=[${MULTILIB_USEDEP}] )
+ dev-libs/openssl:0=[${MULTILIB_USEDEP}]
+"
+DEPEND="${RDEPEND}"
+
+# Avoid file collisions, #692580
+RDEPEND+=" !<dev-db/mysql-5.6.45-r1"
+RDEPEND+=" !=dev-db/mysql-5.7.23*"
+RDEPEND+=" !=dev-db/mysql-5.7.24*"
+RDEPEND+=" !=dev-db/mysql-5.7.25*"
+RDEPEND+=" !=dev-db/mysql-5.7.26-r0"
+RDEPEND+=" !=dev-db/mysql-5.7.27-r0"
+RDEPEND+=" !<dev-db/percona-server-5.7.26.29-r1"
+
+DOCS=( README )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-8.0.22-always-build-decompress-utilities.patch
+ "${FILESDIR}"/${PN}-8.0.19-do-not-install-comp_err.patch
+ "${FILESDIR}"/${PN}-8.0.27-add-OpenSSL-3.0.0-support.patch
+ "${FILESDIR}"/${PN}-8.0.27-res_n.patch
+)
+
+src_prepare() {
+ sed -i -e 's/CLIENT_LIBS/CONFIG_CLIENT_LIBS/' "scripts/CMakeLists.txt" || die
+
+ # All these are for the server only.
+ # Disable rpm call which would trigger sandbox, #692368
+ sed -i \
+ -e '/MYSQL_CHECK_LIBEVENT/d' \
+ -e '/MYSQL_CHECK_RAPIDJSON/d' \
+ -e '/MYSQL_CHECK_ICU/d' \
+ -e '/MYSQL_CHECK_EDITLINE/d' \
+ -e '/MYSQL_CHECK_CURL/d' \
+ -e '/ADD_SUBDIRECTORY(man)/d' \
+ -e '/ADD_SUBDIRECTORY(share)/d' \
+ -e '/INCLUDE(cmake\/boost/d' \
+ -e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \
+ CMakeLists.txt || die
+
+ # Skip building clients
+ echo > client/CMakeLists.txt || die
+
+ # Forcefully disable auth plugin
+ if ! use ldap ; then
+ sed -i -e '/MYSQL_CHECK_SASL/d' CMakeLists.txt || die
+ echo > libmysql/authentication_ldap/CMakeLists.txt || die
+ fi
+
+ cmake_src_prepare
+}
+
+multilib_src_configure() {
+ CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+ # Code is now requiring C++17 due to https://github.com/mysql/mysql-server/commit/236ab55bedd8c9eacd80766d85edde2a8afacd08
+ append-cxxflags -std=c++17
+
+ local mycmakeargs=(
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO=-DNDEBUG
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-DNDEBUG
+ -DINSTALL_LAYOUT=RPM
+ -DINSTALL_LIBDIR=$(get_libdir)
+ -DWITH_DEFAULT_COMPILER_OPTIONS=OFF
+ -DENABLED_LOCAL_INFILE=ON
+ -DMYSQL_UNIX_ADDR="${EPREFIX}/run/mysqld/mysqld.sock"
+ -DWITH_LZ4=system
+ -DWITH_NUMA=OFF
+ -DWITH_SSL=system
+ -DWITH_ZLIB=system
+ -DWITH_ZSTD=system
+ -DLIBMYSQL_OS_OUTPUT_NAME=mysqlclient
+ -DSHARED_LIB_PATCH_VERSION="0"
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON
+ -DWITHOUT_SERVER=ON
+ )
+
+ cmake_src_configure
+}
+
+multilib_src_install_all() {
+ doman \
+ man/my_print_defaults.1 \
+ man/perror.1 \
+ man/zlib_decompress.1
+
+ if ! use static-libs ; then
+ find "${ED}" -name "*.a" -delete || die
+ fi
+}
next reply other threads:[~2022-07-15 7:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-15 7:10 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-27 12:54 [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql-connector-c/files/, dev-db/mysql-connector-c/ Petr Vaněk
2023-11-14 17:30 Andreas Sturmlechner
2022-03-03 21:22 David Seifert
2021-11-14 3:49 Thomas Deutschmann
2021-06-22 23:49 Thomas Deutschmann
2021-01-21 22:32 Thomas Deutschmann
2020-10-20 18:56 Thomas Deutschmann
2020-07-26 1:46 Thomas Deutschmann
2020-04-30 20:45 Thomas Deutschmann
2020-01-20 19:26 Thomas Deutschmann
2019-08-23 0:24 Thomas Deutschmann
2018-05-02 14:34 Brian Evans
2017-11-21 19:34 Brian Evans
2017-11-21 19:34 Brian Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1657869007.0f7808b289d1eb16cef25c2de6411cc580b97c5c.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox