public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/
@ 2018-04-22  1:10 Brian Evans
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Evans @ 2018-04-22  1:10 UTC (permalink / raw
  To: gentoo-commits

commit:     2d09ba7465ce45ce75eb647f0c953e0b23cd6907
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 22 00:51:22 2018 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Sun Apr 22 01:10:04 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2d09ba74

dev-db/mysql: Version bump for 5.7.22

Closes: https://bugs.gentoo.org/567590
Package-Manager: Portage-2.3.31, Repoman-2.3.9

 dev-db/mysql/Manifest                   |   2 +
 dev-db/mysql/files/my.cnf-5.7           |   3 +
 dev-db/mysql/files/my.cnf.distro-client |  21 +
 dev-db/mysql/files/my.cnf.distro-server |  28 ++
 dev-db/mysql/metadata.xml               |   1 +
 dev-db/mysql/mysql-5.7.22.ebuild        | 843 ++++++++++++++++++++++++++++++++
 6 files changed, 898 insertions(+)

diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
index 88a5fda98ef..1898552af52 100644
--- a/dev-db/mysql/Manifest
+++ b/dev-db/mysql/Manifest
@@ -5,7 +5,9 @@ DIST mysql-5.6.37.tar.gz 32200158 BLAKE2B be64aca7e3a831fbdb737a6628e87dcea195bf
 DIST mysql-5.6.38.tar.gz 32197625 BLAKE2B 5edd6d05e562568d2418edd81c6822b397103013e92beacc00964401c6df67f8a934f05b57c6679aa25a49ef6db2e4a06056f3f1850e0f2afe4de895c7b8f686 SHA512 8144aec822f053fbdfa11ae542e96d3e7da93552b60ed131f041ec4832f48c95025b322340a2e90a82c18b6ee6bfd708f209735f82e37532198245aad697b93d
 DIST mysql-5.6.39.tar.gz 32110958 BLAKE2B 2f279c6745bc995c860bb4f2868409136e112cc8b9fb0c04fa7673bb6d5612f3ef6d3462666de736d6e7fe5439275ab49908a6609175d1cb8c096d5db5ecb59c SHA512 e1e60854c82d71f9600bf611df964f441815d9d0f896134110a749b29fe340fa216d7c89f4da63d492929565f19a2502463549b8c8c038c658e0be8409a3ffb5
 DIST mysql-5.6.40.tar.gz 32083035 BLAKE2B efcc078341bae239df28ac0504111aa34926885ae47edb5011352b56552a5a3abd1f824f8cbdc23d8d667592b8f5510946ef18c3efa61865dbbc7f4bb8a2d4a0 SHA512 c8e458b4cd34cae87f1b088ed2188bd00de8cdc42709d5964e82fa2e4aaecfc12a75ae006c54ffa0d3d286fbdef9704d0cbb83436437d5705fb8921d960e758c
+DIST mysql-boost-5.7.22.tar.gz 48985783 BLAKE2B 208d684e038366824de4bfbe87b6761f91d05fc5cd46cfa89eb627025fb726efe2d7a08a8ce252fed369e399d2d4921bb93c446a296b617320c53ce351fc17c2 SHA512 186c9e9735114e312c65531c70e6b0b9b48b0fe14384b7a6ebfac2c1f91c3f4ac223d06e27a424fc75f57e0aaf2f74d6a8411a8ab9c6fed45c499068d0f1dc2a
 DIST mysql-extras-20170302-1359Z.tar.bz2 306816 BLAKE2B 7ac3d79f265916306ba8dd0a8ac16f5c4673baf9f910e21aedcc460b028fee674faabad470984e4830256f6218a7c61f31f6155e808d8a2dd4772a1c8bb72d3d SHA512 2c096c68e0d545c98fb5520f92b9e85f6bbc910853793f60f0e67979ee927410bbecadece3400364fdc2b5682f9105664f6a2de8fa0ee1818fb266e063e82869
 DIST mysql-extras-20170719-1335Z.tar.bz2 311350 BLAKE2B 4ee604de76d9da004c7cb9f84e7e4112c0cdab3b18a82923ad5bcb880377813f85e369697d84b37ed2fd9cd26b160d4616bfb7d1dba3bfe0b6bbc296e0edd5ea SHA512 3450725b4cdcf1e330aee775c1c169510bd7f06f19b874a3e94203227d393b136165eca1e77270bfc37c534f4120aeeeb3df8fbd71704312836b79a99d81a122
 DIST mysql-extras-20171121-1518Z.tar.bz2 313539 BLAKE2B c397fdf7ffb3fcbcecda20933e18234062a9500dcf4031e9b17131e2a1f23dca7535ed33ff541fc075eb9995c67a9a8fd7261d7524dd42d8d333543c368b4c15 SHA512 dd0d4a00c0ed710e786d157a73f02c6f555ab7a68e57014d958627096a4245a0b45d22ec860dc5389002d106554e80166661c0b6ddcadff1f737e3fa195badda
 DIST mysql-extras-20180214-0024Z.tar.bz2 316686 BLAKE2B a893e2975a8062ab236f642d158a7833656942adb31d467b784a9224e7dd87872c3784bb29e93b620a58cd9a835d65248f1a817cdbafa574b5949e2b4262108a SHA512 ad0e81695a70954ad107fe104f9140be24e53d499aed6c123e68e1a062ec5cc90c70f6272fdc014e567794e331301e656ba01b22c2c7a1afaf11e14a9190fb0b
+DIST mysql-extras-20180312-2011Z.tar.bz2 319047 BLAKE2B 1da22a0c763a85a6350122c0c56aef4999279c1ef7cf99bcec28348acc83964eb257bb4340c1a21bdcd3b1eb024b23fa62879bed8679c410d847324cb7e24b82 SHA512 b0aa9fc8fbc050451ef147cee99b00cf10d34a71641837821e78655241f7d79a94fe2efb4cef9a23fe9741e08ada2fc0b58ef3b3663752bc567babfbcaa547c8

diff --git a/dev-db/mysql/files/my.cnf-5.7 b/dev-db/mysql/files/my.cnf-5.7
new file mode 100644
index 00000000000..571ebf07a76
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf-5.7
@@ -0,0 +1,3 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file.
+
+!includedir @GENTOO_PORTAGE_EPREFIX@/etc/mysql/mysql.d

diff --git a/dev-db/mysql/files/my.cnf.distro-client b/dev-db/mysql/files/my.cnf.distro-client
new file mode 100644
index 00000000000..8bf18363430
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf.distro-client
@@ -0,0 +1,21 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-client.cnf: The global mysql configuration file.
+
+# The following options will be passed to all MySQL clients
+[client]
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+character-sets-dir				= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+default-character-set=utf8
+
+[mysql]
+# uncomment the next directive if you are not familiar with SQL
+#safe-updates
+
+[mysqldump]
+quick
+max_allowed_packet			= 16M
+
+[myisamchk]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+
+[myisampack]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets

diff --git a/dev-db/mysql/files/my.cnf.distro-server b/dev-db/mysql/files/my.cnf.distro-server
new file mode 100644
index 00000000000..d4ed30c1f08
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf.distro-server
@@ -0,0 +1,28 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-server.cnf: The global mysql configuration file.
+
+# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
+[mysqld]
+character-set-server				= utf8
+user						= mysql
+port						= 3306
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+pid-file					= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysql.pid
+log-error					= @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
+basedir						= @GENTOO_PORTAGE_EPREFIX@/usr
+datadir						= @DATADIR@
+skip-external-locking
+lc_messages_dir					= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
+#Set this to your desired error message language
+lc_messages					= en_US
+
+# security:
+# using "localhost" in connects uses sockets by default
+# skip-networking
+bind-address					= 127.0.0.1
+
+log-bin
+server-id					= 1
+
+# point the following paths to different dedicated disks
+tmpdir						= @GENTOO_PORTAGE_EPREFIX@/tmp/
+#log-update					= @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname

diff --git a/dev-db/mysql/metadata.xml b/dev-db/mysql/metadata.xml
index 83ee85b777f..82e3cca3197 100644
--- a/dev-db/mysql/metadata.xml
+++ b/dev-db/mysql/metadata.xml
@@ -11,6 +11,7 @@ dev-db/mysql
 dev-db/mariadb
 -->
 <use>
+  <flag name="client-libs">Build the client libraries from the server package instead of the C Connector packages (not recommended)</flag>
   <flag name="cluster">Add support for NDB clustering (deprecated)</flag>
   <flag name="community">Enables the community features from upstream.</flag>
   <flag name="embedded">Build embedded server (libmysqld)</flag>

diff --git a/dev-db/mysql/mysql-5.7.22.ebuild b/dev-db/mysql/mysql-5.7.22.ebuild
new file mode 100644
index 00000000000..5e447c16666
--- /dev/null
+++ b/dev-db/mysql/mysql-5.7.22.ebuild
@@ -0,0 +1,843 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+MY_EXTRAS_VER="20180312-2011Z"
+
+CMAKE_MAKEFILE_GENERATOR=emake
+
+# Keeping eutils in EAPI=6 for emktemp in pkg_config
+
+inherit eutils flag-o-matic prefix toolchain-funcs \
+	user cmake-utils multilib-minimal
+
+SRC_URI="http://cdn.mysql.com/Downloads/MySQL-5.7/${PN}-boost-${PV}.tar.gz
+	https://cdn.mysql.com/archives/mysql-5.7/mysql-boost-${PV}.tar.gz
+	http://downloads.mysql.com/archives/MySQL-5.7/${PN}-boost-${PV}.tar.gz"
+
+# Gentoo patches to MySQL
+if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
+	SRC_URI="${SRC_URI}
+		mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
+		https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
+fi
+
+HOMEPAGE="https://www.mysql.com/"
+DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
+LICENSE="GPL-2"
+SLOT="0/18"
+IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux
+	+server static static-libs systemtap tcmalloc test yassl"
+
+# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
+RESTRICT="libressl? ( test )"
+
+REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
+
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
+	inherit git-r3
+	EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
+	EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
+	EGIT_CLONE_TYPE=shallow
+	MY_PATCH_DIR="${WORKDIR}/mysql-extras"
+else
+	MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
+fi
+
+PATCHES=(
+	"${MY_PATCH_DIR}"/20001_all_fix-minimal-build-cmake-mysql-5.7.patch
+	"${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.7.patch
+#	"${MY_PATCH_DIR}"/20008_all_mysql-tzinfo-symlink-5.7.6.patch
+	"${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.7.10.patch
+	"${MY_PATCH_DIR}"/20018_all_mysql-5.7.21-without-clientlibs-tools.patch
+)
+
+# Be warned, *DEPEND are version-dependant
+# These are used for both runtime and compiletime
+# MULTILIB_USEDEP only set for libraries used by the client library
+COMMON_DEPEND="
+	kernel_linux? (
+		sys-process/procps:0=
+		dev-libs/libaio:0=
+	)
+	net-misc/curl
+	>=sys-apps/sed-4
+	>=sys-apps/texinfo-4.7-r1
+	jemalloc? ( dev-libs/jemalloc:0= )
+	tcmalloc? ( dev-util/google-perftools:0= )
+	systemtap? ( >=dev-util/systemtap-1.3:0= )
+	!yassl? (
+		client-libs? (
+			!libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
+			libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
+		)
+		!client-libs? (
+			!libressl? ( >=dev-libs/openssl-1.0.0:0= )
+			libressl? ( dev-libs/libressl:0= )
+		)
+	)
+	client-libs? ( >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?] )
+	!client-libs? ( >=sys-libs/zlib-1.2.3:0= )
+	sys-libs/ncurses:0=
+	server? (
+		>=app-arch/lz4-0_p131:=
+		>=dev-libs/boost-1.65.0:=
+		numa? ( sys-process/numactl )
+	)
+"
+DEPEND="virtual/yacc
+	static? ( sys-libs/ncurses[static-libs] )
+	|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
+	${COMMON_DEPEND}"
+RDEPEND="selinux? ( sec-policy/selinux-mysql )
+	abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] )
+	client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
+	!dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
+	server? ( !prefix? ( dev-db/mysql-init-scripts ) )
+	${COMMON_DEPEND}
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
+	!client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )"
+
+pkg_setup() {
+	if [[ ${MERGE_TYPE} != binary ]] ; then
+		local GCC_MAJOR_SET=$(gcc-major-version)
+		local GCC_MINOR_SET=$(gcc-minor-version)
+		# Bug 565584.  InnoDB now requires atomic functions introduced with gcc-4.7 on
+		# non x86{,_64} arches
+		if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
+			${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
+			eerror "${PN} needs to be built with gcc-4.7 or later."
+			eerror "Please use gcc-config to switch to gcc-4.7 or later version."
+			die
+		fi
+	fi
+	if has test ${FEATURES} && \
+		use server && ! has userpriv ${FEATURES} ; then
+			eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+	fi
+
+	# This should come after all of the die statements
+	enewgroup mysql 60 || die "problem adding 'mysql' group"
+	enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
+}
+
+pkg_preinst() {
+	# Here we need to see if the implementation switched client libraries
+	# We check if this is a new instance of the package and a client library already exists
+	local SHOW_ABI_MESSAGE libpath
+	if use client-libs && [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
+		libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
+		elog "Due to ABI changes when switching between different client libraries,"
+		elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
+		elog "Please run: revdep-rebuild --library ${libpath}"
+		ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
+	fi
+}
+
+pkg_postinst() {
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Create log directory securely if it does not exist
+	[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
+
+	if use server ; then
+		if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+			einfo
+			elog "You might want to run:"
+			elog "\"emerge --config =${CATEGORY}/${PF}\""
+			elog "if this is a new install."
+			elog
+			elog "If you are switching server implentations, you should run the"
+			elog "mysql_upgrade tool."
+			einfo
+		else
+			einfo
+			elog "If you are upgrading major versions, you should run the"
+			elog "mysql_upgrade tool."
+			einfo
+		fi
+	fi
+
+	# Note about configuration change
+	einfo
+	elog "This version of mysql reorganizes the configuration from a single my.cnf"
+	elog "to several files in /etc/mysql/${PN}.d."
+	elog "Please backup any changes you made to /etc/mysql/my.cnf"
+	elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
+	elog "You may have as many files as needed and they are read alphabetically."
+	elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
+	einfo
+}
+
+src_unpack() {
+	unpack ${A}
+	# Grab the patches
+	[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
+
+	mv -f "${WORKDIR}/${P}" "${S}" || die
+}
+
+src_prepare() {
+	if use jemalloc ; then
+		echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
+	fi
+	if use tcmalloc; then
+		echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
+	fi
+	# Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
+	if [[ -d "${S}/support-files/SELinux" ]] ; then
+		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
+	fi
+
+	if use libressl ; then
+		sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
+			"${S}/cmake/ssl.cmake" || die
+	fi
+
+	cmake-utils_src_prepare
+}
+
+src_configure(){
+	# bug 508724 mariadb cannot use ld.gold
+	tc-ld-disable-gold
+	# Bug #114895, bug #110149
+	filter-flags "-O" "-O[01]"
+
+	append-cxxflags -felide-constructors
+
+	# bug #283926, with GCC4.4, this is required to get correct behavior.
+	append-flags -fno-strict-aliasing
+
+	if use client-libs ; then
+		multilib-minimal_src_configure
+	else
+		multilib_src_configure
+	fi
+}
+
+multilib_src_configure() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if ! multilib_is_native_abi && ! use client-libs ; then
+		return
+	fi
+
+	CMAKE_BUILD_TYPE="RelWithDebInfo"
+
+	# debug hack wrt #497532
+	mycmakeargs=(
+		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
+		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+		-DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+		-DSYSCONFDIR="${EPREFIX}/etc/mysql"
+		-DINSTALL_BINDIR=bin
+		-DINSTALL_DOCDIR=share/doc/${PF}
+		-DINSTALL_DOCREADMEDIR=share/doc/${PF}
+		-DINSTALL_INCLUDEDIR=include/mysql
+		-DINSTALL_INFODIR=share/info
+		-DINSTALL_LIBDIR=$(get_libdir)
+		-DINSTALL_MANDIR=share/man
+		-DINSTALL_MYSQLSHAREDIR=share/mysql
+		-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
+		-DINSTALL_SCRIPTDIR=share/mysql/scripts
+		-DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+		-DINSTALL_SBINDIR=sbin
+		-DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
+		-DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
+		-DWITH_UNIT_TESTS=$(usex test ON OFF)
+		### TODO: make this system but issues with UTF-8 prevent it
+		-DWITH_EDITLINE=bundled
+		-DWITH_ZLIB=system
+		-DWITH_LIBWRAP=0
+		-DENABLED_LOCAL_INFILE=1
+		-DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+		-DWITH_DEFAULT_COMPILER_OPTIONS=0
+		-DWITH_DEFAULT_FEATURE_SET=0
+		# The build forces this to be defined when cross-compiling.  We pass it
+		# all the time for simplicity and to make sure it is actually correct.
+		-DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+		-DWITH_RAPID=OFF
+		-DWITH_LIBEVENT=NO
+		-DWITH_CURL=system
+	)
+	if use test ; then
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
+	else
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+	fi
+
+	if ! use yassl ; then
+		mycmakeargs+=( -DWITH_SSL=system )
+	else
+		mycmakeargs+=( -DWITH_SSL=bundled )
+	fi
+
+	if ! use client-libs ; then
+		mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
+	fi
+
+	# bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
+	# systemtap only works on native ABI  bug 530132
+	if multilib_is_native_abi; then
+		mycmakeargs+=(
+			-DENABLE_DTRACE=$(usex systemtap)
+		)
+	else
+		mycmakeargs+=(
+			-DWITHOUT_TOOLS=1
+			-DWITH_READLINE=1
+			-DENABLE_DTRACE=0
+		)
+	fi
+
+	if multilib_is_native_abi && use server ; then
+
+		mycmakeargs+=(
+			-DWITH_BOOST="${S}/boost"
+			-DWITH_LZ4=system
+			-DWITH_NUMA=$(usex numa ON OFF)
+		)
+
+		if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
+			ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+			ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+			ewarn "You MUST file bugs without these variables set."
+
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+				-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+			)
+
+		elif ! use latin1 ; then
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=utf8
+				-DDEFAULT_COLLATION=utf8_general_ci
+			)
+		else
+			mycmakeargs+=(
+				-DDEFAULT_CHARSET=latin1
+				-DDEFAULT_COLLATION=latin1_swedish_ci
+			)
+		fi
+		mycmakeargs+=(
+			-DEXTRA_CHARSETS=all
+			-DDISABLE_SHARED=$(usex static YES NO)
+			-DWITH_DEBUG=$(usex debug)
+			-DWITH_EMBEDDED_SERVER=OFF
+			-DENABLED_PROFILING=$(usex profiling)
+		)
+
+		if use static; then
+			mycmakeargs+=( -DWITH_PIC=1 )
+		fi
+
+		if use jemalloc || use tcmalloc ; then
+			mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
+		fi
+
+		# Storage engines
+		mycmakeargs+=(
+			-DWITH_EXAMPLE_STORAGE_ENGINE=0
+			-DWITH_ARCHIVE_STORAGE_ENGINE=1
+			-DWITH_BLACKHOLE_STORAGE_ENGINE=1
+			-DWITH_CSV_STORAGE_ENGINE=1
+			-DWITH_HEAP_STORAGE_ENGINE=1
+			-DWITH_INNOBASE_STORAGE_ENGINE=1
+			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
+			-DWITH_MYISAM_STORAGE_ENGINE=1
+			-DWITH_PARTITION_STORAGE_ENGINE=1
+			-DWITH_INNODB_MEMCACHED=0
+		)
+
+	else
+		mycmakeargs+=(
+			-DWITHOUT_SERVER=1
+			-DWITH_EMBEDDED_SERVER=OFF
+			-DEXTRA_CHARSETS=none
+		)
+	fi
+
+	cmake-utils_src_configure
+}
+
+src_compile() {
+	if use client-libs ; then
+		multilib-minimal_src_compile
+	else
+		multilib_src_compile
+	fi
+}
+
+multilib_src_compile() {
+	cmake-utils_src_compile
+}
+
+src_install() {
+	local MULTILIB_WRAPPED_HEADERS
+	local MULTILIB_CHOST_TOOLS
+	if use client-libs ; then
+		# headers with ABI specific data
+		MULTILIB_WRAPPED_HEADERS=(
+			/usr/include/mysql/server/my_config.h
+			/usr/include/mysql/server/mysql_version.h )
+
+		# wrap the config scripts
+		MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
+		multilib-minimal_src_install
+	else
+		multilib_src_install
+		multilib_src_install_all
+	fi
+}
+
+# Intentionally override eclass function
+multilib_src_install() {
+
+	cmake-utils_src_install
+
+	# Kill old libmysqclient_r symlinks if they exist.  Time to fix what depends on them.
+	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
+}
+
+multilib_src_install_all() {
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Convenience links
+	einfo "Making Convenience links for mysqlcheck multi-call binary"
+	dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+	dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+	dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+	# INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+	if [[ -d "${ED}/usr/data" ]] ; then
+		rm -Rf "${ED}/usr/data" || die
+	fi
+
+	# Unless they explicitly specific USE=test, then do not install the
+	# testsuite. It DOES have a use to be installed, esp. when you want to do a
+	# validation of your database configuration after tuning it.
+	if ! use test ; then
+		rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
+	fi
+
+	# Configuration stuff
+	einfo "Building default configuration ..."
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+	[[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+	cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
+	eprefixify "${TMPDIR}/my.cnf"
+	doins "${TMPDIR}/my.cnf"
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
+	cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+	eprefixify "${TMPDIR}/50-distro-client.cnf"
+	doins "${TMPDIR}/50-distro-client.cnf"
+
+	if use server ; then
+		mycnf_src="my.cnf.distro-server"
+		sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+			"${FILESDIR}/${mycnf_src}" \
+			> "${TMPDIR}/my.cnf.ok" || die
+		if use prefix ; then
+			sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+				"${TMPDIR}/my.cnf.ok" || die
+		fi
+		if use latin1 ; then
+			sed -i \
+				-e "/character-set/s|utf8|latin1|g" \
+				"${TMPDIR}/my.cnf.ok" || die
+		fi
+		eprefixify "${TMPDIR}/my.cnf.ok"
+		newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+		einfo "Including support files and sample configurations"
+		docinto "support-files"
+		local script
+		for script in \
+			"${S}"/support-files/magic
+		do
+			[[ -f "$script" ]] && dodoc "${script}"
+		done
+
+		docinto "scripts"
+		for script in "${S}"/scripts/mysql* ; do
+			[[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
+		done
+	fi
+
+	#Remove mytop if perl is not selected
+	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
+}
+
+# Official test instructions:
+# USE='perl server static-libs' \
+# FEATURES='test userpriv -usersandbox' \
+# ebuild mysql-X.X.XX.ebuild \
+# digest clean package
+src_test() {
+
+	_disable_test() {
+		local rawtestname reason
+		rawtestname="${1}" ; shift
+		reason="${@}"
+		ewarn "test '${rawtestname}' disabled: '${reason}'"
+		echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
+	}
+
+	local TESTDIR="${BUILD_DIR}/mysql-test"
+	local retstatus_unit
+	local retstatus_tests
+
+	if ! use server ; then
+		einfo "Skipping server tests due to minimal build."
+		return 0
+	fi
+
+	# Bug #213475 - MySQL _will_ object strenously if your machine is named
+	# localhost. Also causes weird failures.
+	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+	if [[ $UID -eq 0 ]]; then
+		die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+	fi
+	has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
+
+	einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
+
+	# Run CTest (test-units)
+	cmake-utils_src_test
+	retstatus_unit=$?
+
+	# Ensure that parallel runs don't die
+	export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+	# Enable parallel testing, auto will try to detect number of cores
+	# You may set this by hand.
+	# The default maximum is 8 unless MTR_MAX_PARALLEL is increased
+	export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
+
+	# create directories because mysqladmin might run out of order
+	mkdir -p "${T}"/var-tests{,/log} || die
+
+	# Run mysql tests
+	pushd "${TESTDIR}" > /dev/null || die
+
+	touch "${T}/disabled.def"
+	# These are failing in MySQL 5.7 for now and are believed to be
+	# false positives:
+	#
+	local t
+
+	for t in auth_sec.keyring_udf federated.federated_plugin ; do
+			_disable_test  "$t" "False positives in Gentoo"
+	done
+
+	# run mysql-test tests
+	perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
+	retstatus_tests=$?
+
+	popd > /dev/null || die
+
+	# Cleanup is important for these testcases.
+	pkill -9 -f "${S}/ndb" 2>/dev/null
+	pkill -9 -f "${S}/sql" 2>/dev/null
+
+	local failures=""
+	[[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
+	[[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
+
+	[[ -z "$failures" ]] || die "Test failures: $failures"
+	einfo "Tests successfully completed"
+}
+
+mysql_init_vars() {
+	MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
+	MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+	MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+	MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+
+	if [[ -z "${MY_DATADIR}" ]] ; then
+		MY_DATADIR=""
+		if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
+			MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
+				| sed -ne '/datadir/s|^--datadir=||p' \
+				| tail -n1`
+			if [[ -z "${MY_DATADIR}" ]] ; then
+				MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
+				| sed -e 's/.*=\s*//' \
+				| tail -n1`
+			fi
+		fi
+		if [[ -z "${MY_DATADIR}" ]] ; then
+			MY_DATADIR="${MY_LOCALSTATEDIR}"
+			einfo "Using default MY_DATADIR"
+		fi
+		elog "MySQL MY_DATADIR is ${MY_DATADIR}"
+
+		if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
+			if [[ -e "${MY_DATADIR}" ]] ; then
+				# If you get this and you're wondering about it, see bug #207636
+				elog "MySQL datadir found in ${MY_DATADIR}"
+				elog "A new one will not be created."
+				PREVIOUS_DATADIR="yes"
+			else
+				PREVIOUS_DATADIR="no"
+			fi
+			export PREVIOUS_DATADIR
+		fi
+	else
+		if [[ ${EBUILD_PHASE} == "config" ]]; then
+			local new_MY_DATADIR
+			new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
+				| sed -ne '/datadir/s|^--datadir=||p' \
+				| tail -n1`
+
+			if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
+				ewarn "MySQL MY_DATADIR has changed"
+				ewarn "from ${MY_DATADIR}"
+				ewarn "to ${new_MY_DATADIR}"
+				MY_DATADIR="${new_MY_DATADIR}"
+			fi
+		fi
+	fi
+
+	export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+	export MY_LOCALSTATEDIR MY_LOGDIR
+	export MY_DATADIR
+}
+
+pkg_config() {
+	_getoptval() {
+		local mypd="${EROOT}"/usr/bin/my_print_defaults
+		local section="$1"
+		local flag="--${2}="
+		local extra_options="${3}"
+		"${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
+	}
+	local old_MY_DATADIR="${MY_DATADIR}"
+	local old_HOME="${HOME}"
+	# my_print_defaults needs to read stuff in $HOME/.my.cnf
+	export HOME=${EPREFIX}/root
+
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	[[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
+	if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
+		die "Minimal builds do NOT include the MySQL server"
+	fi
+
+	if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
+		local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
+		MY_DATADIR_s="${MY_DATADIR_s%%/}"
+		local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
+		old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
+
+		if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
+			if [[ -d "${MY_DATADIR_s}" ]]; then
+				ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
+				ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
+			else
+				elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
+				mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
+				|| die "Moving MY_DATADIR failed"
+			fi
+		else
+			ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
+			if [[ -d "${MY_DATADIR_s}" ]]; then
+				ewarn "Attempting to use ${MY_DATADIR_s}"
+			else
+				eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
+				die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
+			fi
+		fi
+	fi
+
+	local pwd1="a"
+	local pwd2="b"
+	local maxtry=15
+
+	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
+		local tmp_mysqld_password_source=
+
+		for tmp_mysqld_password_source in mysql client; do
+			einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+			if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
+				if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
+					ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+					MYSQL_ROOT_PASSWORD=
+					continue
+				fi
+
+				einfo "Found password in '${tmp_mysqld_password_source}' section!"
+				break
+			fi
+		done
+
+		# Sometimes --show is required to display passwords in some implementations of my_print_defaults
+		if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+		fi
+
+		unset tmp_mysqld_password_source
+	fi
+	MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
+	# These are dir+prefix
+	MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
+	MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+	MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
+	MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+
+	if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
+		einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
+		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
+	fi
+	if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
+		einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
+		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
+	fi
+	if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
+		einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
+		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
+	fi
+
+	if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
+		ewarn "You have already a MySQL database in place."
+		ewarn "(${ROOT}/${MY_DATADIR}/*)"
+		ewarn "Please rename or delete it if you wish to replace it."
+		die "MySQL database already exists!"
+	fi
+
+	# Bug #213475 - MySQL _will_ object strenously if your machine is named
+	# localhost. Also causes weird failures.
+	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
+
+		einfo "Please provide a password for the mysql 'root' user now"
+		einfo "or through the ${HOME}/.my.cnf file."
+		ewarn "Avoid [\"'\\_%] characters in the password"
+		read -rsp "    >" pwd1 ; echo
+
+		einfo "Retype the password"
+		read -rsp "    >" pwd2 ; echo
+
+		if [[ "x$pwd1" != "x$pwd2" ]] ; then
+			die "Passwords are not the same"
+		fi
+		MYSQL_ROOT_PASSWORD="${pwd1}"
+		unset pwd1 pwd2
+	fi
+
+	local options
+	local sqltmp="$(emktemp)"
+
+	# Fix bug 446200. Don't reference host my.cnf, needs to come first,
+	# see http://bugs.mysql.com/bug.php?id=31312
+	use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
+
+	# Figure out which options we need to disable to do the setup
+	local helpfile="${TMPDIR}/mysqld-help"
+	"${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+	for opt in grant-tables host-cache name-resolve networking slave-start \
+		federated ssl log-bin relay-log slow-query-log external-locking \
+		log-slave-updates \
+		; do
+		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+		egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
+	done
+
+	einfo "Creating the mysql database and setting proper permissions on it ..."
+
+	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
+	PID_DIR="${EROOT}/var/run/mysqld"
+	if [[ ! -d "${PID_DIR}" ]]; then
+		install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
+	fi
+
+	if [[ ! -d "${MY_DATADIR}" ]]; then
+		install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
+	fi
+
+	pushd "${TMPDIR}" &>/dev/null || die
+
+	# Filling timezones, see
+	# http://dev.mysql.com/doc/mysql/en/time-zone-support.html
+	"${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
+
+	# --initialize-insecure will not set root password
+	# --initialize would set a random one in the log which we don't need as we set it ourselves
+	local cmd=( "${EROOT}usr/sbin/mysqld" "--initialize-insecure" "--init-file='${sqltmp}'" )
+	cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
+	einfo "Command: ${cmd[*]}"
+	su -s /bin/sh -c "${cmd[*]}" mysql \
+		>"${TMPDIR}"/mysql_install_db.log 2>&1
+	if [ $? -ne 0 ]; then
+		grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
+		die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
+	fi
+	popd &>/dev/null || die
+	[[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
+	|| die "MySQL databases not installed"
+
+	use prefix || options="${options} --user=mysql"
+
+	local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
+	local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
+	local mysqld="${EROOT}/usr/sbin/mysqld \
+		${options} \
+		$(use prefix || echo --user=mysql) \
+		--log-warnings=0 \
+		--basedir=${EROOT}/usr \
+		--datadir=${ROOT}/${MY_DATADIR} \
+		--max_allowed_packet=8M \
+		--net_buffer_length=16K \
+		--socket=${socket} \
+		--pid-file=${pidfile}
+		--tmpdir=${ROOT}/${MYSQL_TMPDIR}"
+	#einfo "About to start mysqld: ${mysqld}"
+	ebegin "Starting mysqld"
+	einfo "Command ${mysqld}"
+	${mysqld} &
+	rc=$?
+	while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
+		maxtry=$((${maxtry}-1))
+		echo -n "."
+		sleep 1
+	done
+	eend $rc
+
+	if ! [[ -S "${socket}" ]]; then
+		die "Completely failed to start up mysqld with: ${mysqld}"
+	fi
+
+	ebegin "Setting root password"
+	# Do this from memory, as we don't want clear text passwords in temp files
+	local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
+	"${EROOT}/usr/bin/mysql" \
+		"--socket=${socket}" \
+		-hlocalhost \
+		-e "${sql}"
+	eend $?
+
+	# Stop the server and cleanup
+	einfo "Stopping the server ..."
+	kill $(< "${pidfile}" )
+	rm -f "${sqltmp}"
+	wait %1
+	einfo "Done"
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/
@ 2019-08-02 16:04 Thomas Deutschmann
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Deutschmann @ 2019-08-02 16:04 UTC (permalink / raw
  To: gentoo-commits

commit:     e3ccd5cdcf12217d37448a857929c6ee28b7b0e4
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  2 15:56:14 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug  2 16:04:04 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e3ccd5cd

dev-db/mysql: update ebuild draft

- Add USE=router to control building of MySQL router program

- Add GLEP 81 support

- Use USE=ssl logic from dev-db/mysql-connector-c (=use bundled
  WolfSSL when no system SSL is used)

- Don't install perror and zlib_decompress man pages (these are
  client tools, i.e. should be installed via dev-db/mysql-connector-c
  package)

- Use CMAKE_POSITION_INDEPENDENT_CODE=ON

- Provide own config files for MySQL v8.0 (mainly because of new
  default charset)

- Update LibreSSL patch

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 dev-db/mysql/Manifest                              |  2 +-
 dev-db/mysql/files/my.cnf-8.0.distro-client        | 21 +++++++
 dev-db/mysql/files/my.cnf-8.0.distro-server        | 28 +++++++++
 dev-db/mysql/metadata.xml                          |  1 +
 ...-8.0.17_pre.ebuild => mysql-8.0.17_pre1.ebuild} | 72 ++++++++++++----------
 5 files changed, 90 insertions(+), 34 deletions(-)

diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
index d07218b8b2b..e62e6cdd338 100644
--- a/dev-db/mysql/Manifest
+++ b/dev-db/mysql/Manifest
@@ -17,4 +17,4 @@ DIST mysql-extras-20181111-2314Z.tar.bz2 329013 BLAKE2B fa928b699ef0e6f092e028fc
 DIST mysql-extras-20190303-1852Z.tar.bz2 331026 BLAKE2B ee033fce8f1b6a58f1f690710fb9709a585cd45564b35e71d4f840a3a7f83a5d80f53c24236c9976319abd89c68c62c74a7111517f1b9721d3cbd0898bf0dd8d SHA512 30361a0b848ed27f9170b1116458a9bc13b1b585c5fa1933c99927541c31e9bda4008b0563f2fc7db286f998089ebebf1fe3f18fce7a45e62acbf769ac62d8c1
 DIST mysql-extras-20190524-1046Z.tar.bz2 331517 BLAKE2B e6d48e34b0a7f7176de8740971f8151923beb20a520df73c22d44005059ef6779ad5aa8437e30018b9bbfe1d6d69043cbd8522b6f3662746205193b44372a6b3 SHA512 2f7238578f3aabd1701e1c54da36bc0100c9479871e3c77b22131fd6cde865037307f93b3343ea5e52251c45ef35cdc52cc2dec5a26d44fd41700598282c5c2c
 DIST mysql-extras-20190604-1109Z.tar.bz2 331780 BLAKE2B 48b6f6ff36818ba3d1d9c0580b0ff5e2343d92a42ee78b6804841d7c4f511adcdc3d5cd0590f769f308ca52e271c07cb34219450f9b86e918ddcd0a4b956e18e SHA512 19a85ba5a4c2de1688f39feb6ce1c1802e4d886436dc02afe1ba508b91365a0ac67d668cf7126588145ee55641992ad71b0d094246a94c89065876b9bb897425
-DIST mysql-extras-20190802-0031Z.tar.bz2 332871 BLAKE2B 233b25bc0f3fb215c273210f688a9864fe98ace95859d5e5e530d7f9a77a1fa08bdb0ef773fa8db3858b512479e0b13fcbc3cc5bea3ece695393a9db02e3babf SHA512 b74a9058f5ee439cac7063844b2a462e3b0ce6f906198bbb2aa966b93bfc2fb060d1d68cb4c0aafc4d1100338e48befcc53f4f5f74fa59aca305eee5882a971b
+DIST mysql-extras-20190802-1549Z.tar.bz2 335077 BLAKE2B c4c4e38d30c9e4e02cdbcf4117f020e044374370bf32f6e013aa37ae6794445f3ef12e46abbdb5fefd85a68fe5af6b417363012a64d1fd97d79d478bb4b3749d SHA512 5c19a9ce9fe0d95788cc25fed0c2f987b46fa85accf7440a569066f4ac1b9f8522a0855fa884a128d7ccee17fecc25f4b16a16b3cd962c39f3670819eef2f6dc

diff --git a/dev-db/mysql/files/my.cnf-8.0.distro-client b/dev-db/mysql/files/my.cnf-8.0.distro-client
new file mode 100644
index 00000000000..5325c1a6d8f
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf-8.0.distro-client
@@ -0,0 +1,21 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-client.cnf: The global mysql configuration file.
+
+# The following options will be passed to all MySQL clients
+[client]
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+character-sets-dir				= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+loose-default-character-set			= utf8mb4
+
+[mysql]
+# uncomment the next directive if you are not familiar with SQL
+#safe-updates
+
+[mysqldump]
+quick
+max_allowed_packet			= 16M
+
+[myisamchk]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
+
+[myisampack]
+character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets

diff --git a/dev-db/mysql/files/my.cnf-8.0.distro-server b/dev-db/mysql/files/my.cnf-8.0.distro-server
new file mode 100644
index 00000000000..248c68e393a
--- /dev/null
+++ b/dev-db/mysql/files/my.cnf-8.0.distro-server
@@ -0,0 +1,28 @@
+# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/50-distro-server.cnf: The global mysql configuration file.
+
+# add a section [mysqld-8.0] for specific configurations
+[mysqld]
+character-set-server				= utf8mb4
+user						= mysql
+port						= 3306
+socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
+pid-file					= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysql.pid
+log-error					= @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
+basedir						= @GENTOO_PORTAGE_EPREFIX@/usr
+datadir						= @DATADIR@
+skip-external-locking
+lc_messages_dir					= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
+#Set this to your desired error message language
+lc_messages					= en_US
+
+# security:
+# using "localhost" in connects uses sockets by default
+# skip-networking
+bind-address					= 127.0.0.1
+
+log-bin
+server-id					= 1
+
+# point the following paths to different dedicated disks
+tmpdir						= @GENTOO_PORTAGE_EPREFIX@/tmp/
+#log-update					= @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname

diff --git a/dev-db/mysql/metadata.xml b/dev-db/mysql/metadata.xml
index d3fabed9ef6..e231245763e 100644
--- a/dev-db/mysql/metadata.xml
+++ b/dev-db/mysql/metadata.xml
@@ -19,6 +19,7 @@ dev-db/mariadb
   <flag name="libressl">Enable SSL connections and crypto functions using <pkg>dev-libs/libressl</pkg></flag>
   <flag name="numa">Enable NUMA support using <pkg>sys-process/numactl</pkg> (NUMA kernel support is also required)</flag>
   <flag name="profiling">Add support for statement profiling (requires USE=community).</flag>
+  <flag name="router">Build the MySQL router program</flag>
   <flag name="server">Build the server program</flag>
   <flag name="systemtap">Build support for profiling and tracing using <pkg>dev-util/systemtap</pkg></flag>
   <flag name="test">Install upstream testsuites for end use.</flag>

diff --git a/dev-db/mysql/mysql-8.0.17_pre.ebuild b/dev-db/mysql/mysql-8.0.17_pre1.ebuild
similarity index 96%
rename from dev-db/mysql/mysql-8.0.17_pre.ebuild
rename to dev-db/mysql/mysql-8.0.17_pre1.ebuild
index b00696209cb..bc4fb0cad0c 100644
--- a/dev-db/mysql/mysql-8.0.17_pre.ebuild
+++ b/dev-db/mysql/mysql-8.0.17_pre1.ebuild
@@ -2,16 +2,16 @@
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="7"
-MY_EXTRAS_VER="20190802-0031Z"
+MY_EXTRAS_VER="20190802-1549Z"
 
 CMAKE_MAKEFILE_GENERATOR=emake
 
 # Keeping eutils in EAPI=6 for emktemp in pkg_config
 
 inherit cmake-utils eutils flag-o-matic linux-info \
-	prefix toolchain-funcs user
+	prefix toolchain-funcs
 
-MY_PV="${PV//_pre}"
+MY_PV="${PV//_pre*}"
 MY_P="${PN}-${MY_PV}"
 
 S="${WORKDIR}/${PN}-${MY_PV}"
@@ -32,7 +32,7 @@ DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
 LICENSE="GPL-2"
 SLOT="0/21"
 IUSE="cjk cracklib debug experimental jemalloc latin1 libressl numa +perl profiling
-	selinux static static-libs tcmalloc test"
+	router selinux ssl static tcmalloc test"
 
 # Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
 RESTRICT="libressl? ( test )"
@@ -74,10 +74,8 @@ COMMON_DEPEND="net-misc/curl:=
 	>=app-arch/lz4-0_p131:=
 	dev-libs/libedit
 	cjk? ( app-text/mecab:= )
-	experimental? (
-		dev-libs/libevent:=
-		net-libs/libtirpc:=
-	)
+	dev-libs/libevent:=
+	net-libs/libtirpc:=
 	numa? ( sys-process/numactl )
 	>=sys-libs/zlib-1.2.3:0=
 	jemalloc? ( dev-libs/jemalloc:0= )
@@ -86,8 +84,10 @@ COMMON_DEPEND="net-misc/curl:=
 		sys-process/procps:0=
 	)
 	tcmalloc? ( dev-util/google-perftools:0= )
-	!libressl? ( >=dev-libs/openssl-1.0.0:0= )
-	libressl? ( dev-libs/libressl:0= )
+	ssl? (
+		!libressl? ( >=dev-libs/openssl-1.0.0:0= )
+		libressl? ( dev-libs/libressl:0= )
+	)
 "
 DEPEND="${COMMON_DEPEND}
 	|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
@@ -95,12 +95,18 @@ DEPEND="${COMMON_DEPEND}
 	dev-libs/libevent
 	experimental? ( net-libs/rpcsvc-proto )
 	static? ( sys-libs/ncurses[static-libs] )
-	test? ( dev-perl/JSON )
+	test? (
+		acct-group/mysql acct-user/mysql
+		dev-perl/JSON
+	)
 "
 RDEPEND="${COMMON_DEPEND}
 	!dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
 	selinux? ( sec-policy/selinux-mysql )
-	!prefix? ( dev-db/mysql-init-scripts )
+	!prefix? (
+		acct-group/mysql acct-user/mysql
+		dev-db/mysql-init-scripts
+	)
 "
 # For other stuff to bring us in
 # dev-perl/DBD-mysql is needed by some scripts installed by MySQL
@@ -229,19 +235,12 @@ src_prepare() {
 		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
 	fi
 
-	## Remove bundled libs so we cannot accidentally use them
-	## We keep extra/lz4 directory because we use extra/lz4/xxhash.c via sql/CMakeLists.txt:394
-	#rm -rv \
-	#	"${S}"/extra/libevent \
-	#	"${S}"/extra/zlib \
-	#	|| die
-
-	if use libressl ; then
-		sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
-			"${S}/cmake/ssl.cmake" || die
-	fi
+	# man pages for client-lib tools we don't install
+	rm \
+		man/perror.1 \
+		man/zlib_decompress.1 \
+		|| die
 
-	#sed -i 's~ADD_SUBDIRECTORY(storage/ndb)~~' CMakeLists.txt || die
 	cmake-utils_src_prepare
 }
 
@@ -249,9 +248,7 @@ src_configure(){
 	# Bug #114895, bug #110149
 	filter-flags "-O" "-O[01]"
 
-	append-cflags -fPIC
-
-	append-cxxflags -felide-constructors -fPIC
+	append-cxxflags -felide-constructors
 
 	# bug #283926, with GCC4.4, this is required to get correct behavior.
 	append-flags -fno-strict-aliasing
@@ -282,6 +279,7 @@ src_configure(){
 		### TODO: make this system but issues with UTF-8 prevent it
 		-DWITH_EDITLINE=system
 		-DWITH_ZLIB=system
+		-DWITH_SSL=$(usex ssl system wolfssl)
 		-DWITH_LIBWRAP=0
 		-DENABLED_LOCAL_INFILE=1
 		-DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
@@ -290,8 +288,10 @@ src_configure(){
 		# The build forces this to be defined when cross-compiling. We pass it
 		# all the time for simplicity and to make sure it is actually correct.
 		-DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
+		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
 		-DWITH_CURL=system
 		-DWITH_BOOST="${S}/boost"
+		-DWITH_ROUTER=$(usex router ON OFF)
 	)
 	if use test ; then
 		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
@@ -299,8 +299,6 @@ src_configure(){
 		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
 	fi
 
-	mycmakeargs+=( -DWITH_SSL=system )
-
 	mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
 
 	# client/mysql.cc:1131:16: error: redefinition of ‘struct _hist_entry’
@@ -318,7 +316,6 @@ src_configure(){
 		-DWITH_PROTOBUF=bundled
 		-DWITH_MECAB=$(usex cjk system OFF)
 		-DWITH_NUMA=$(usex numa ON OFF)
-		-DWITH_RAPID=$(usex experimental ON OFF)
 		# Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
 		-DWITH_RAPIDJSON=bundled
 	)
@@ -548,11 +545,11 @@ src_install() {
 	eprefixify "${TMPDIR}/my.cnf"
 	doins "${TMPDIR}/my.cnf"
 	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
-	cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+	cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
 	eprefixify "${TMPDIR}/50-distro-client.cnf"
 	doins "${TMPDIR}/50-distro-client.cnf"
 
-	mycnf_src="my.cnf.distro-server"
+	mycnf_src="my.cnf-8.0.distro-server"
 	sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
 		"${FILESDIR}/${mycnf_src}" \
 		> "${TMPDIR}/my.cnf.ok" || die
@@ -564,7 +561,7 @@ src_install() {
 
 	if use latin1 ; then
 		sed -i \
-			-e "/character-set/s|utf8|latin1|g" \
+			-e "/character-set/s|utf8mb4|latin1|g" \
 			"${TMPDIR}/my.cnf.ok" || die
 	fi
 
@@ -575,6 +572,15 @@ src_install() {
 	#Remove mytop if perl is not selected
 	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
 
+	if use router ; then
+		rm -rf \
+			"${ED}/usr/LICENSE.router" \
+			"${ED}/usr/README.router" \
+			"${ED}/usr/run" \
+			"${ED}/usr/var" \
+			|| die
+	fi
+
 	# Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
 	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
 }


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/
@ 2019-08-30 16:08 Brian Evans
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Evans @ 2019-08-30 16:08 UTC (permalink / raw
  To: gentoo-commits

commit:     84cae3b3ad487ca364ea2ce1f7c2139abbe03ed8
Author:     Brian Evans <grknight <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 30 16:06:43 2019 +0000
Commit:     Brian Evans <grknight <AT> gentoo <DOT> org>
CommitDate: Fri Aug 30 16:06:43 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84cae3b3

dev-db/mysql: Drop old 5.5 version

Package-Manager: Portage-2.3.73, Repoman-2.3.17
Signed-off-by: Brian Evans <grknight <AT> gentoo.org>

 dev-db/mysql/Manifest            |   2 -
 dev-db/mysql/files/my.cnf-5.5    | 147 --------
 dev-db/mysql/metadata.xml        |   1 -
 dev-db/mysql/mysql-5.5.62.ebuild | 797 ---------------------------------------
 4 files changed, 947 deletions(-)

diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
index 17e28b6146c..ef3ead138dc 100644
--- a/dev-db/mysql/Manifest
+++ b/dev-db/mysql/Manifest
@@ -1,9 +1,7 @@
-DIST mysql-5.5.62.tar.gz 21111902 BLAKE2B f1cbb1c6b4dfac11c2c517a57a5c6216ce43766cc247b3c9b387326a7f6446cbc21ddb42bd95afa658c3b0ed2568a29563ceea248c6ec63364ce210119d39cc2 SHA512 1080a3989c20bbbfe98739f99dacd183f2087ceee5147845852144240386808568af4c908ecdbccdcb6114000ab760ed7257492834d50018eff9520260fd91ce
 DIST mysql-5.6.44.tar.gz 32531507 BLAKE2B 28fbf49f699eb9f43223ffa186671b119d16016274cc7192db232b85c58123a61154e37193b9b7145c6a650b80b5f6cf838529bc2bc5ea9c78c0dbc39de834d3 SHA512 65ace1c803773ca6c8759d171c09bc93c7d61b8e3208ac9905f82e99087622c9dcca602d2da217741dc62fc6eabe9108ebc7f31facd26705072eae65fcc37077
 DIST mysql-5.6.45.tar.gz 32525559 BLAKE2B 3c629aed1de808acdea6654c7413e6851507c9c5be939ca4b4f5e2796da317e9b518a749bfc03d2b0ef05bd604b39f72e24b751076b9f206b462d21fa5db4f50 SHA512 f9d8bb72e96cc83f1064fe7df2e5fe8317ca9d44c4e776cf7827a61292fbcfccec716806c80d565958383d78fef93a19d61c726687b57680d5f93299291ff168
 DIST mysql-boost-5.7.26.tar.gz 51098338 BLAKE2B 1263cd75814a7293b26b0f44fd2b7d20d983f3c6a62725df9515ecac2ef252f6644810cb4bf0d6f36b98e55317f1c67ea7541228cb38d896dfedc476a5755f26 SHA512 a5f9871dc5a8e5fffc1467c3dd542533a63fe553c029120475f8fd5530d884c76ab0c33ad260daf317faf318ccef01464f6ac2dc3468efceb6bf2b6c06c54cfd
 DIST mysql-boost-5.7.27.tar.gz 51436383 BLAKE2B 6db64ab5fa659aae9baa3725a0de9465e48c37618ffd69f34809880c06a00ce55dce77f507810c6fa52d86901facfa42d3d1bd8db1914a779fbc88a69be82497 SHA512 573f4555f3d62bcd3dc2228bcfba023518d462bb6689114a3505ccf7c7c3061d2775a8e7a37ec3c8b9dea6e8fbc56ba599610f237abc38cedff58e75799bdc52
 DIST mysql-boost-8.0.17.tar.gz 189322239 BLAKE2B f9f46e5fdc3e9869b203626bc09edfbcdbabcd68eba43f9c6a33b9a52cffb3a32f39704c6d22a66899aac16fa2efb271c5dc7af7522768b45542ac8dc615cd8a SHA512 a278ee263670cb1f79d67c4b87c4b88632569c3b20a4297a6e77d550155db20902f22992ea851cf59ea523bb97d5e08707e3457f71a678e9f1ac2fa4ca5b7a2d
-DIST mysql-extras-20180804-2323Z.tar.bz2 322215 BLAKE2B cca9e502e375bf43473335868517f6c450fc7bcf03e55de5a294c8bdcfcac2bb783dec09bbb3b6c30a561ba7e3a943543c017e2d42b61d466e699acdef4c0231 SHA512 efd9d416f394cc61b977ab76f05ab3acc5803ff8bdee8e1dbc65cc5b3f07e4f9742140d9586c028908b10fcc44f21c98ebffdebcc5c3578acbe05b07526bcb3d
 DIST mysql-extras-20190817-0024Z.tar.bz2 337793 BLAKE2B dfd51a708654aff5bdbbaf2acad7ef966869a8e3adcba544ee15f217d2ba942827445841e73981bccc6c1f145b6225bfa7245114219f0cf52f0dfb85494a6830 SHA512 c2ff81be1c55636f0a2700033af030149f312f0383217054a4b8c65aef174626299fcb4539eaae967ea7d096a5bb09f5b5122dce344b44b0a135d886ba0fdf28
 DIST mysql-extras-20190822-1908Z.tar.bz2 338830 BLAKE2B bc197f8e541206548d8982814e82e028d699ba9c41aec8d5191bcc46581f7880ed2741dbe2206fde44a5e8d8d54bbcf40efbd0709b357636c4c8fdb2ccc3a7bb SHA512 be469e55f7e9966638600d6836a44258c74e5600240fafe2d79eaeebe7d1695b043678184b5d18ee9946f28154bc2529586a7f860b510180a30c82454ed575c8

diff --git a/dev-db/mysql/files/my.cnf-5.5 b/dev-db/mysql/files/my.cnf-5.5
deleted file mode 100644
index 83b9aaab2ec..00000000000
--- a/dev-db/mysql/files/my.cnf-5.5
+++ /dev/null
@@ -1,147 +0,0 @@
-# @GENTOO_PORTAGE_EPREFIX@/etc/mysql/my.cnf: The global mysql configuration file.
-
-# The following options will be passed to all MySQL clients
-[client]
-#password					= your_password
-port						= 3306
-socket						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
-
-[mysql]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[mysqladmin]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[mysqlcheck]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[mysqldump]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[mysqlimport]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[mysqlshow]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-default-character-set=utf8
-
-[myisamchk]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-
-[myisampack]
-character-sets-dir=@GENTOO_PORTAGE_EPREFIX@/usr/share/mysql/charsets
-
-# use [safe_mysqld] with mysql-3
-[mysqld_safe]
-err-log						= @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysql.err
-
-# add a section [mysqld-4.1] or [mysqld-5.0] for specific configurations
-[mysqld]
-character-set-server		= utf8
-user 						= mysql
-port 						= 3306
-socket 						= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.sock
-pid-file 					= @GENTOO_PORTAGE_EPREFIX@/var/run/mysqld/mysqld.pid
-log-error 					= @GENTOO_PORTAGE_EPREFIX@/var/log/mysql/mysqld.err
-basedir 					= @GENTOO_PORTAGE_EPREFIX@/usr
-datadir 					= @DATADIR@
-skip-external-locking
-key_buffer_size					= 16M
-max_allowed_packet 			= 1M
-table_open_cache 			= 64
-sort_buffer_size 			= 512K
-net_buffer_length 			= 8K
-read_buffer_size 			= 256K
-read_rnd_buffer_size 		= 512K
-myisam_sort_buffer_size 	= 8M
-lc_messages_dir			= @GENTOO_PORTAGE_EPREFIX@/usr/share/mysql
-#Set this to your desired error message language
-lc_messages			= en_US
-
-# security:
-# using "localhost" in connects uses sockets by default
-# skip-networking
-bind-address				= 127.0.0.1
-
-log-bin
-server-id 					= 1
-
-# point the following paths to different dedicated disks
-tmpdir 						= @GENTOO_PORTAGE_EPREFIX@/tmp/
-#log-update 				= @GENTOO_PORTAGE_EPREFIX@/path-to-dedicated-directory/hostname
-
-# you need the debug USE flag enabled to use the following directives,
-# if needed, uncomment them, start the server and issue 
-# #tail -f @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.trace
-# this will show you *exactly* what's happening in your server ;)
-
-#log						= @GENTOO_PORTAGE_EPREFIX@/tmp/mysqld.sql
-#gdb
-#debug						= d:t:i:o,/tmp/mysqld.trace
-#one-thread
-
-# the following is the InnoDB configuration
-# if you wish to disable innodb instead
-# uncomment just the next line
-#skip-innodb
-#
-# the rest of the innodb config follows:
-# don't eat too much memory, we're trying to be safe on 64Mb boxes
-# you might want to bump this up a bit on boxes with more RAM
-innodb_buffer_pool_size = 16M
-# this is the default, increase it if you have lots of tables
-innodb_additional_mem_pool_size = 2M
-#
-# i'd like to use @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/innodb, but that is seen as a database :-(
-# and upstream wants things to be under @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/, so that's the route
-# we have to take for the moment
-#innodb_data_home_dir		= @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
-#innodb_log_group_home_dir	= @GENTOO_PORTAGE_EPREFIX@/var/lib/mysql/
-# you may wish to change this size to be more suitable for your system
-# the max is there to avoid run-away growth on your machine
-innodb_data_file_path = ibdata1:10M:autoextend:max:128M
-# we keep this at around 25% of of innodb_buffer_pool_size
-# sensible values range from 1MB to (1/innodb_log_files_in_group*innodb_buffer_pool_size)
-innodb_log_file_size = 5M
-# this is the default, increase it if you have very large transactions going on
-innodb_log_buffer_size = 8M
-# this is the default and won't hurt you
-# you shouldn't need to tweak it
-innodb_log_files_in_group=2
-# see the innodb config docs, the other options are not always safe
-innodb_flush_log_at_trx_commit = 1
-innodb_lock_wait_timeout = 50
-innodb_file_per_table
-
-# Uncomment this to get FEDERATED engine support
-#plugin-load=federated=ha_federated.so
-#loose-federated
-
-[mysqldump]
-quick
-max_allowed_packet 			= 16M
-
-[mysql]
-# uncomment the next directive if you are not familiar with SQL
-#safe-updates
-
-[isamchk]
-key_buffer_size				= 20M
-sort_buffer_size 			= 20M
-read_buffer 				= 2M
-write_buffer 				= 2M
-
-[myisamchk]
-key_buffer_size				= 20M
-sort_buffer_size 			= 20M
-read_buffer_size			= 2M
-write_buffer_size			= 2M
-
-[mysqlhotcopy]
-interactive-timeout
-

diff --git a/dev-db/mysql/metadata.xml b/dev-db/mysql/metadata.xml
index e231245763e..e4197ced880 100644
--- a/dev-db/mysql/metadata.xml
+++ b/dev-db/mysql/metadata.xml
@@ -14,7 +14,6 @@ dev-db/mariadb
   <flag name="cjk">Add CJK support for InnoDB fulltext search using <pkg>app-text/mecab</pkg></flag>
   <flag name="client-libs">Build the client libraries from the server package instead of the C Connector packages (not recommended)</flag>
   <flag name="experimental">Build experimental features aka "rapid" plugins</flag>
-  <flag name="extraengine">Add support for alternative storage engines (Archive, CSV, Blackhole, Federated(X), Partition)</flag>
   <flag name="latin1">Use LATIN1 encoding instead of UTF8</flag>
   <flag name="libressl">Enable SSL connections and crypto functions using <pkg>dev-libs/libressl</pkg></flag>
   <flag name="numa">Enable NUMA support using <pkg>sys-process/numactl</pkg> (NUMA kernel support is also required)</flag>

diff --git a/dev-db/mysql/mysql-5.5.62.ebuild b/dev-db/mysql/mysql-5.5.62.ebuild
deleted file mode 100644
index cb229697802..00000000000
--- a/dev-db/mysql/mysql-5.5.62.ebuild
+++ /dev/null
@@ -1,797 +0,0 @@
-# Copyright 1999-2018 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="6"
-MY_EXTRAS_VER="20180804-2323Z"
-SUBSLOT="18"
-
-# Keeping eutils in EAPI=6 for emktemp in pkg_config
-
-inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build
-
-SRC_URI="https://cdn.mysql.com/Downloads/MySQL-5.5/${P}.tar.gz
-	https://downloads.mysql.com/archives/MySQL-5.5/${P}.tar.gz"
-# Gentoo patches to MySQL
-if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
-	SRC_URI="${SRC_URI}
-		mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
-		https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
-		https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
-		https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
-		https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
-fi
-
-HOMEPAGE="https://mysql.com/"
-DESCRIPTION="An enhanced, drop-in replacement for MySQL"
-LICENSE="GPL-2"
-SLOT="0/${SUBSLOT:-0}"
-IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl
-	+perl profiling selinux +server	static static-libs systemtap tcmalloc
-	test yassl"
-
-# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
-RESTRICT="!bindist? ( bindist ) libressl? ( test )"
-
-REQUIRED_USE="?? ( tcmalloc jemalloc )
-	static? ( yassl )"
-
-KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
-
-# Shorten the path because the socket path length must be shorter than 107 chars
-# and we will run a mysql server during test phase
-S="${WORKDIR}/mysql"
-
-if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
-	MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
-	inherit git-r3
-	EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
-	EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
-	EGIT_CLONE_TYPE=shallow
-else
-	MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
-fi
-
-PATCHES=(
-	"${MY_PATCH_DIR}/01050_all_mysql_config_cleanup-5.5.patch"
-	"${MY_PATCH_DIR}/02040_all_embedded-library-shared-5.5.10.patch"
-	"${MY_PATCH_DIR}/20001_all_fix-minimal-build-cmake-mysql-5.5.41.patch"
-	"${MY_PATCH_DIR}/20002_all_mysql-va-list.patch"
-	"${MY_PATCH_DIR}/20006_all_cmake_elib-mysql-5.5.53.patch"
-	"${MY_PATCH_DIR}/20007_all_cmake-debug-werror-5.6.22.patch"
-	"${MY_PATCH_DIR}/20008_all_mysql-tzinfo-symlink-5.6.37.patch"
-	"${MY_PATCH_DIR}/20009_all_mysql_myodbc_symbol_fix-5.5.38.patch"
-	"${MY_PATCH_DIR}/20018_all_mysql-5.5.60-without-clientlibs-tools.patch"
-	"${MY_PATCH_DIR}/20027_all_mysql-5.5-perl5.26-includes.patch"
-)
-
-# Be warned, *DEPEND are version-dependant
-# These are used for both runtime and compiletime
-COMMON_DEPEND="
-	kernel_linux? (
-		sys-process/procps:0=
-		dev-libs/libaio:0=
-	)
-	>=sys-apps/sed-4
-	>=sys-apps/texinfo-4.7-r1
-	jemalloc? ( dev-libs/jemalloc:0= )
-	tcmalloc? ( dev-util/google-perftools:0= )
-	systemtap? ( >=dev-util/systemtap-1.3:0= )
-	!yassl? (
-		!libressl? ( dev-libs/openssl:0= !>=dev-libs/openssl-1.1 )
-		libressl? ( dev-libs/libressl:0= )
-	)
-	>=sys-libs/zlib-1.2.3:0=
-	sys-libs/ncurses:0=
-	!bindist? (
-		>=sys-libs/readline-4.1:0=
-	)
-	!client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
-"
-DEPEND="virtual/yacc
-	static? ( sys-libs/ncurses[static-libs] )
-	|| ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
-	${COMMON_DEPEND}"
-RDEPEND="selinux? ( sec-policy/selinux-mysql )
-	client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
-	!dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
-	server? ( !prefix? ( dev-db/mysql-init-scripts ) )
-	${COMMON_DEPEND}
-	perl? ( !dev-db/mytop
-		virtual/perl-Getopt-Long
-		dev-perl/TermReadKey
-		virtual/perl-Term-ANSIColor
-		virtual/perl-Time-HiRes )
-"
-# For other stuff to bring us in
-# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
-PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
-
-pkg_setup() {
-	if [[ ${MERGE_TYPE} != binary ]] ; then
-		local GCC_MAJOR_SET=$(gcc-major-version)
-		local GCC_MINOR_SET=$(gcc-minor-version)
-		# Bug 565584.  InnoDB now requires atomic functions introduced with gcc-4.7 on
-		# non x86{,_64} arches
-		if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
-			${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
-			eerror "${PN} needs to be built with gcc-4.7 or later."
-			eerror "Please use gcc-config to switch to gcc-4.7 or later version."
-			die
-		fi
-	fi
-	if has test ${FEATURES} && \
-		use server && ! has userpriv ${FEATURES} ; then
-			eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
-	fi
-
-	# This should come after all of the die statements
-	enewgroup mysql 60 || die "problem adding 'mysql' group"
-	enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
-}
-
-pkg_postinst() {
-	# Make sure the vars are correctly initialized
-	mysql_init_vars
-
-	# Create log directory securely if it does not exist
-	[[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
-
-	if use server ; then
-		if [[ -z "${REPLACING_VERSIONS}" ]] ; then
-			einfo
-			elog "You might want to run:"
-			elog "\"emerge --config =${CATEGORY}/${PF}\""
-			elog "if this is a new install."
-			elog
-			elog "If you are switching server implentations, you should run the"
-			elog "mysql_upgrade tool."
-			einfo
-		else
-			einfo
-			elog "If you are upgrading major versions, you should run the"
-			elog "mysql_upgrade tool."
-			einfo
-		fi
-
-		einfo
-		elog "Be sure to edit the my.cnf file to activate your cluster settings."
-		elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
-		elog "The first time the cluster is activated, you should add"
-		elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
-		elog "This option should then be removed for subsequent starts."
-		einfo
-	fi
-}
-
-src_unpack() {
-	unpack ${A}
-	# Grab the patches
-	[[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
-
-	mv -f "${WORKDIR%/}/${P}" "${S}" || die
-}
-
-src_prepare() {
-	_disable_engine() {
-		echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
-	}
-
-	_disable_plugin() {
-		echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
-	}
-
-	if use tcmalloc; then
-		echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
-	fi
-
-	if use jemalloc; then
-		echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
-	fi
-
-	# Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
-	if [[ -d "${S}/support-files/SELinux" ]] ; then
-		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
-	fi
-
-	if use libressl ; then
-		sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
-			"${S}/cmake/ssl.cmake" || die
-	fi
-
-	local plugin
-	local server_plugins=( semisync )
-	local test_plugins=( audit_null daemon_example fulltext )
-	if ! use server; then # These plugins are for the server
-		for plugin in "${server_plugins[@]}" ; do
-			_disable_plugin "${plugin}"
-		done
-	fi
-
-	if ! use test; then # These plugins are only used during testing
-		for plugin in "${test_plugins[@]}" ; do
-			_disable_plugin "${plugin}"
-		done
-	fi
-
-	# Don't build example
-	_disable_engine example
-	_disable_engine ndb
-
-	cmake-utils_src_prepare
-}
-
-src_configure(){
-	# Bug #114895, bug #110149
-	filter-flags "-O" "-O[01]"
-
-	append-cxxflags -felide-constructors
-
-	# bug #283926, with GCC4.4, this is required to get correct behavior.
-	append-flags -fno-strict-aliasing
-
-	CMAKE_BUILD_TYPE="RelWithDebInfo"
-
-	# debug hack wrt #497532
-	mycmakeargs=(
-		-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
-		-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
-		-DCMAKE_INSTALL_PREFIX="${EPREFIX%/}/usr"
-		-DDEFAULT_SYSCONFDIR="${EPREFIX%/}/etc/mysql"
-		-DINSTALL_BINDIR=bin
-		-DINSTALL_DOCDIR=share/doc/${PF}
-		-DINSTALL_DOCREADMEDIR=share/doc/${PF}
-		-DINSTALL_INCLUDEDIR=include/mysql
-		-DINSTALL_INFODIR=share/info
-		-DINSTALL_LIBDIR=$(get_libdir)
-		-DINSTALL_MANDIR=share/man
-		-DINSTALL_MYSQLSHAREDIR=share/mysql
-		-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
-		-DINSTALL_SCRIPTDIR=share/mysql/scripts
-		-DINSTALL_MYSQLDATADIR="${EPREFIX%/}/var/lib/mysql"
-		-DINSTALL_SBINDIR=sbin
-		-DINSTALL_SUPPORTFILESDIR="${EPREFIX%/}/usr/share/mysql"
-		-DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
-		-DWITH_UNIT_TESTS=$(usex test ON OFF)
-		-DWITH_ZLIB=system
-		-DENABLED_LOCAL_INFILE=1
-		-DMYSQL_UNIX_ADDR="${EPREFIX%/}/var/run/mysqld/mysqld.sock"
-		# The build forces this to be defined when cross-compiling.  We pass it
-		# all the time for simplicity and to make sure it is actually correct.
-		-DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
-		-DWITHOUT_CLIENTLIBS=YES
-		-DWITH_READLINE=$(usex bindist 1 0)
-		-DENABLE_DTRACE=$(usex systemtap)
-	)
-	if use test ; then
-		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
-	else
-		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
-	fi
-
-	if ! use yassl ; then
-		mycmakeargs+=( -DWITH_SSL=system )
-	else
-		mycmakeargs+=( -DWITH_SSL=bundled )
-	fi
-
-	if use server ; then
-
-		# Federated{,X} must be treated special otherwise they will not be built as plugins
-		if ! use extraengine ; then
-			mycmakeargs+=(
-				-DWITHOUT_FEDERATED_STORAGE_ENGINE=1
-				-DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 )
-		fi
-
-		if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
-			ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
-			ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
-			ewarn "You MUST file bugs without these variables set."
-
-			mycmakeargs+=(
-				-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
-				-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
-			)
-
-		elif ! use latin1 ; then
-			mycmakeargs+=(
-				-DDEFAULT_CHARSET=utf8
-				-DDEFAULT_COLLATION=utf8_general_ci
-			)
-		else
-			mycmakeargs+=(
-				-DDEFAULT_CHARSET=latin1
-				-DDEFAULT_COLLATION=latin1_swedish_ci
-			)
-		fi
-		mycmakeargs+=(
-			-DINSTALL_SQLBENCHDIR=share/mysql
-			-DEXTRA_CHARSETS=all
-			-DDISABLE_SHARED=$(usex static YES NO)
-			-DWITH_EMBEDDED_SERVER=OFF
-		)
-
-		if use profiling ; then
-			# Setting to OFF doesn't work: Once set, profiling options will be added
-			# to `mysqld --help` output via sql/sys_vars.cc causing
-			# "main.mysqld--help-notwin" test to fail
-			mycmakeargs+=( -DENABLED_PROFILING=ON )
-		fi
-
-		if use static; then
-			mycmakeargs+=( -DWITH_PIC=1 )
-		fi
-
-		# Storage engines
-		mycmakeargs+=(
-			-DWITH_ARCHIVE_STORAGE_ENGINE=1
-			-DWITH_BLACKHOLE_STORAGE_ENGINE=1
-			-DWITH_CSV_STORAGE_ENGINE=1
-			-DWITH_HEAP_STORAGE_ENGINE=1
-			-DWITH_INNOBASE_STORAGE_ENGINE=1
-			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
-			-DWITH_MYISAM_STORAGE_ENGINE=1
-			-DWITH_PARTITION_STORAGE_ENGINE=1
-		)
-
-	else
-		mycmakeargs+=(
-			-DWITHOUT_SERVER=1
-			-DEXTRA_CHARSETS=none
-			-DINSTALL_SQLBENCHDIR=
-		)
-	fi
-
-	cmake-utils_src_configure
-}
-
-src_compile() {
-	cmake-utils_src_compile
-}
-
-src_install() {
-	cmake-utils_src_install
-
-	# Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
-	if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then
-		rm "${ED%/}/usr/include/mysql/server/private/config.h" || die
-	fi
-
-	# Make sure the vars are correctly initialized
-	mysql_init_vars
-
-	# Convenience links
-	einfo "Making Convenience links for mysqlcheck multi-call binary"
-	dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
-	dosym "mysqlcheck" "/usr/bin/mysqlrepair"
-	dosym "mysqlcheck" "/usr/bin/mysqloptimize"
-
-	# INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
-	if [[ -d "${ED%/}/usr/data" ]] ; then
-		rm -Rf "${ED%/}/usr/data" || die
-	fi
-
-	# Unless they explicitly specific USE=test, then do not install the
-	# testsuite. It DOES have a use to be installed, esp. when you want to do a
-	# validation of your database configuration after tuning it.
-	if ! use test ; then
-		rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test"
-	fi
-
-	# Configuration stuff
-	einfo "Building default configuration ..."
-	insinto "${MY_SYSCONFDIR#${EPREFIX}}"
-	[[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
-	local mycnf_src="my.cnf-5.5"
-	sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
-		"${FILESDIR%/}/${mycnf_src}" \
-		> "${TMPDIR%/}/my.cnf.ok" || die
-	use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
-	if use latin1 ; then
-		sed -i \
-			-e "/character-set/s|utf8|latin1|g" \
-			"${TMPDIR%/}/my.cnf.ok" || die
-	fi
-	eprefixify "${TMPDIR%/}/my.cnf.ok"
-	newins "${TMPDIR}/my.cnf.ok" my.cnf
-
-	if use server ; then
-		einfo "Including support files and sample configurations"
-		docinto "support-files"
-		local script
-		for script in \
-			"${S%/}"/support-files/magic
-		do
-			[[ -f "$script" ]] && dodoc "${script}"
-		done
-
-		docinto "scripts"
-		for script in "${S%/}"/scripts/mysql* ; do
-			[[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
-		done
-	fi
-
-	#Remove mytop if perl is not selected
-	[[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop"
-}
-
-# Official test instructions:
-# USE='extraengine perl server' \
-# FEATURES='test userpriv -usersandbox' \
-# ebuild mysql-X.X.XX.ebuild \
-# digest clean package
-src_test() {
-
-	_disable_test() {
-		local rawtestname reason
-		rawtestname="${1}" ; shift
-		reason="${@}"
-		ewarn "test '${rawtestname}' disabled: '${reason}'"
-		echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
-	}
-
-	local TESTDIR="${BUILD_DIR}/mysql-test"
-	local retstatus_unit
-	local retstatus_tests
-
-	if ! use server ; then
-		einfo "Skipping server tests due to minimal build."
-		return 0
-	fi
-
-	# Bug #213475 - MySQL _will_ object strenously if your machine is named
-	# localhost. Also causes weird failures.
-	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
-	if [[ $UID -eq 0 ]]; then
-		die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
-	fi
-	has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
-
-	einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
-
-	# Run CTest (test-units)
-	cmake-utils_src_test
-	retstatus_unit=$?
-
-	# Ensure that parallel runs don't die
-	export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
-	# Enable parallel testing, auto will try to detect number of cores
-	# You may set this by hand.
-	# The default maximum is 8 unless MTR_MAX_PARALLEL is increased
-	export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
-
-	# create directories because mysqladmin might run out of order
-	mkdir -p "${T}"/var-tests{,/log} || die
-
-	# Run mysql tests
-	pushd "${TESTDIR}" > /dev/null || die
-
-	touch "${T}/disabled.def"
-	# These are failing in MySQL 5.5 for now and are believed to be
-	# false positives:
-	#
-	# main.mysql_client_test, main.mysql_client_test_nonblock
-	# main.mysql_client_test_comp:
-	# segfaults at random under Portage only, suspect resource limits.
-
-	local t
-	for t in federated.federated_plugin \
-		main.mysql_client_test main.mysql_client_test_nonblock \
-		main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam \
-		main.mysqlhotcopy_archive main.mysqlhotcopy_myisam main.openssl_1 \
-		rpl.rpl_semi_sync_uninstall_plugin ; do
-			_disable_test  "$t" "False positives in Gentoo"
-	done
-
-	if ! use client-libs ; then
-		_disable_test main.plugin_auth "Needs client libraries built"
-	fi
-
-	# run mysql-test tests
-	perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
-	retstatus_tests=$?
-
-	popd > /dev/null || die
-
-	# Cleanup is important for these testcases.
-	pkill -9 -f "${S}/ndb" 2>/dev/null
-	pkill -9 -f "${S}/sql" 2>/dev/null
-
-	local failures=""
-	[[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
-	[[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
-
-	[[ -z "$failures" ]] || die "Test failures: $failures"
-	einfo "Tests successfully completed"
-}
-
-mysql_init_vars() {
-	MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
-	MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
-	MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
-	MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
-
-	if [[ -z "${MY_DATADIR}" ]] ; then
-		MY_DATADIR=""
-		if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
-			MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
-				| sed -ne '/datadir/s|^--datadir=||p' \
-				| tail -n1`
-			if [[ -z "${MY_DATADIR}" ]] ; then
-				MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
-				| sed -e 's/.*=\s*//' \
-				| tail -n1`
-			fi
-		fi
-		if [[ -z "${MY_DATADIR}" ]] ; then
-			MY_DATADIR="${MY_LOCALSTATEDIR}"
-			einfo "Using default MY_DATADIR"
-		fi
-		elog "MySQL MY_DATADIR is ${MY_DATADIR}"
-
-		if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
-			if [[ -e "${MY_DATADIR}" ]] ; then
-				# If you get this and you're wondering about it, see bug #207636
-				elog "MySQL datadir found in ${MY_DATADIR}"
-				elog "A new one will not be created."
-				PREVIOUS_DATADIR="yes"
-			else
-				PREVIOUS_DATADIR="no"
-			fi
-			export PREVIOUS_DATADIR
-		fi
-	else
-		if [[ ${EBUILD_PHASE} == "config" ]]; then
-			local new_MY_DATADIR
-			new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
-				| sed -ne '/datadir/s|^--datadir=||p' \
-				| tail -n1`
-
-			if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
-				ewarn "MySQL MY_DATADIR has changed"
-				ewarn "from ${MY_DATADIR}"
-				ewarn "to ${new_MY_DATADIR}"
-				MY_DATADIR="${new_MY_DATADIR}"
-			fi
-		fi
-	fi
-
-	export MY_SHAREDSTATEDIR MY_SYSCONFDIR
-	export MY_LOCALSTATEDIR MY_LOGDIR
-	export MY_DATADIR
-}
-
-pkg_config() {
-	_getoptval() {
-		local mypd="${EROOT}"/usr/bin/my_print_defaults
-		local section="$1"
-		local flag="--${2}="
-		local extra_options="${3}"
-		"${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
-	}
-	local old_MY_DATADIR="${MY_DATADIR}"
-	local old_HOME="${HOME}"
-	# my_print_defaults needs to read stuff in $HOME/.my.cnf
-	export HOME=${EPREFIX}/root
-
-	# Make sure the vars are correctly initialized
-	mysql_init_vars
-
-	[[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
-	if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
-		die "Minimal builds do NOT include the MySQL server"
-	fi
-
-	if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
-		local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
-		MY_DATADIR_s="${MY_DATADIR_s%%/}"
-		local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
-		old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
-
-		if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
-			if [[ -d "${MY_DATADIR_s}" ]]; then
-				ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
-				ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
-			else
-				elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
-				mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
-				|| die "Moving MY_DATADIR failed"
-			fi
-		else
-			ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
-			if [[ -d "${MY_DATADIR_s}" ]]; then
-				ewarn "Attempting to use ${MY_DATADIR_s}"
-			else
-				eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
-				die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
-			fi
-		fi
-	fi
-
-	local pwd1="a"
-	local pwd2="b"
-	local maxtry=15
-
-	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
-		local tmp_mysqld_password_source=
-
-		for tmp_mysqld_password_source in mysql client; do
-			einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
-			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
-			if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
-				if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
-					ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
-					MYSQL_ROOT_PASSWORD=
-					continue
-				fi
-
-				einfo "Found password in '${tmp_mysqld_password_source}' section!"
-				break
-			fi
-		done
-
-		# Sometimes --show is required to display passwords in some implementations of my_print_defaults
-		if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
-			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
-		fi
-
-		unset tmp_mysqld_password_source
-	fi
-	MYSQL_TMPDIR="$(_getoptval mysqld tmpdir)"
-	# These are dir+prefix
-	MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log)"
-	MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
-	MYSQL_LOG_BIN="$(_getoptval mysqld log-bin)"
-	MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
-
-	if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
-		einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
-		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
-	fi
-	if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
-		einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
-		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
-	fi
-	if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
-		einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
-		install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
-	fi
-
-	if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
-		ewarn "You have already a MySQL database in place."
-		ewarn "(${ROOT}/${MY_DATADIR}/*)"
-		ewarn "Please rename or delete it if you wish to replace it."
-		die "MySQL database already exists!"
-	fi
-
-	# Bug #213475 - MySQL _will_ object strenously if your machine is named
-	# localhost. Also causes weird failures.
-	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
-
-	if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
-
-		einfo "Please provide a password for the mysql 'root' user now"
-		einfo "or through the ${HOME}/.my.cnf file."
-		ewarn "Avoid [\"'\\_%] characters in the password"
-		read -rsp "    >" pwd1 ; echo
-
-		einfo "Retype the password"
-		read -rsp "    >" pwd2 ; echo
-
-		if [[ "x$pwd1" != "x$pwd2" ]] ; then
-			die "Passwords are not the same"
-		fi
-		MYSQL_ROOT_PASSWORD="${pwd1}"
-		unset pwd1 pwd2
-	fi
-
-	local options
-	local sqltmp="$(emktemp)"
-
-	# Fix bug 446200. Don't reference host my.cnf, needs to come first,
-	# see http://bugs.mysql.com/bug.php?id=31312
-	use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
-
-	# Figure out which options we need to disable to do the setup
-	local helpfile="${TMPDIR}/mysqld-help"
-	"${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
-	for opt in grant-tables host-cache name-resolve networking slave-start \
-		federated ssl log-bin relay-log slow-query-log external-locking \
-		log-slave-updates \
-		; do
-		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
-		egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
-	done
-
-	einfo "Creating the mysql database and setting proper permissions on it ..."
-
-	# Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
-	PID_DIR="${EROOT}/var/run/mysqld"
-	if [[ ! -d "${PID_DIR}" ]]; then
-		install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
-	fi
-
-	if [[ ! -d "${MY_DATADIR}" ]]; then
-		install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
-	fi
-
-	pushd "${TMPDIR}" &>/dev/null || die
-
-	# Filling timezones, see
-	# http://dev.mysql.com/doc/mysql/en/time-zone-support.html
-	"${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
-
-	local cmd=( "${EROOT}usr/share/mysql/scripts/mysql_install_db" )
-	[[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
-	cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
-	einfo "Command: ${cmd[*]}"
-	su -s /bin/sh -c "${cmd[*]}" mysql \
-		>"${TMPDIR}"/mysql_install_db.log 2>&1
-	if [ $? -ne 0 ]; then
-		grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
-		die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
-	fi
-	popd &>/dev/null || die
-	[[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
-	|| die "MySQL databases not installed"
-
-	use prefix || options="${options} --user=mysql"
-
-	local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
-	local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
-	local mysqld="${EROOT}/usr/sbin/mysqld \
-		${options} \
-		--log-warnings=0 \
-		--basedir=${EROOT}/usr \
-		--datadir=${ROOT}/${MY_DATADIR} \
-		--max_allowed_packet=8M \
-		--net_buffer_length=16K \
-		--socket=${socket} \
-		--pid-file=${pidfile} \
-		--tmpdir=${ROOT}/${MYSQL_TMPDIR}"
-	#einfo "About to start mysqld: ${mysqld}"
-	ebegin "Starting mysqld"
-	einfo "Command ${mysqld}"
-	${mysqld} &
-	rc=$?
-	while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
-		maxtry=$((${maxtry}-1))
-		echo -n "."
-		sleep 1
-	done
-	eend $rc
-
-	if ! [[ -S "${socket}" ]]; then
-		die "Completely failed to start up mysqld with: ${mysqld}"
-	fi
-
-	ebegin "Setting root password"
-	# Do this from memory, as we don't want clear text passwords in temp files
-	local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
-	"${EROOT}/usr/bin/mysql" \
-		"--socket=${socket}" \
-		-hlocalhost \
-		-e "${sql}"
-	eend $?
-
-	if [[ -n "${sqltmp}" ]] ; then
-		ebegin "Loading \"zoneinfo\", this step may require a few seconds"
-		"${EROOT}/usr/bin/mysql" \
-			"--socket=${socket}" \
-			-hlocalhost \
-			-uroot \
-			--password="${MYSQL_ROOT_PASSWORD}" \
-			mysql < "${sqltmp}"
-		rc=$?
-		eend $?
-		[[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
-	fi
-
-	# Stop the server and cleanup
-	einfo "Stopping the server ..."
-	kill $(< "${pidfile}" )
-	rm -f "${sqltmp}"
-	wait %1
-	einfo "Done"
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/
@ 2022-06-17 22:50 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2022-06-17 22:50 UTC (permalink / raw
  To: gentoo-commits

commit:     90b072cf17b8ac2f45434a430f029887683c4649
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 17 22:31:56 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 17 22:49:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90b072cf

dev-db/mysql: fix build with GCC 12

Bug: https://bugs.gentoo.org/840990
Closes: https://bugs.gentoo.org/852737
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{mysql-8.0.27-gcc-12.patch => mysql-8.0.27-gcc12.patch}  | 12 ++++++++++++
 dev-db/mysql/mysql-8.0.27.ebuild                             |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/dev-db/mysql/files/mysql-8.0.27-gcc-12.patch b/dev-db/mysql/files/mysql-8.0.27-gcc12.patch
similarity index 59%
rename from dev-db/mysql/files/mysql-8.0.27-gcc-12.patch
rename to dev-db/mysql/files/mysql-8.0.27-gcc12.patch
index fce8d5040c84..f4ecb59273a6 100644
--- a/dev-db/mysql/files/mysql-8.0.27-gcc-12.patch
+++ b/dev-db/mysql/files/mysql-8.0.27-gcc12.patch
@@ -1,4 +1,5 @@
 https://bugs.gentoo.org/840990
+https://bugs.gentoo.org/852737
 --- a/client/logger.cc
 +++ b/client/logger.cc
 @@ -27,6 +27,7 @@
@@ -19,3 +20,14 @@ https://bugs.gentoo.org/840990
  #include <sstream>
  
  #include <m_string.h>
+
+--- a/router/src/harness/include/mysql/harness/net_ts/executor.h
++++ b/router/src/harness/include/mysql/harness/net_ts/executor.h
+@@ -35,6 +35,7 @@
+ #include <stdexcept>  // logic_error
+ #include <thread>
+ #include <type_traits>  // decay_t, enable_if
++#include <utility>
+ #include <unordered_map>
+ 
+ #include "my_compiler.h"

diff --git a/dev-db/mysql/mysql-8.0.27.ebuild b/dev-db/mysql/mysql-8.0.27.ebuild
index 18c7bf808582..18dda6ee1678 100644
--- a/dev-db/mysql/mysql-8.0.27.ebuild
+++ b/dev-db/mysql/mysql-8.0.27.ebuild
@@ -170,7 +170,7 @@ src_unpack() {
 
 src_prepare() {
 	eapply "${WORKDIR}"/mysql-patches
-	eapply "${FILESDIR}"/${PN}-8.0.27-gcc-12.patch
+	eapply "${FILESDIR}"/${PN}-8.0.27-gcc12.patch
 
 	# Avoid rpm call which would trigger sandbox, #692368
 	sed -i \


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/
@ 2024-04-24 18:18 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2024-04-24 18:18 UTC (permalink / raw
  To: gentoo-commits

commit:     e77068420194bc44cab11a3be2ddfdf0020833e0
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Thu Jan 25 06:02:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Apr 24 18:17:23 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7706842

dev-db/mysql: add 8.0.36

- --max-test-fail=0 and 40h suite timeout so that tests dont bail out early.

Bug: https://bugs.gentoo.org/922808
Bug: https://bugs.gentoo.org/923649
Signed-off-by: Alfred Wingate <parona <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/35002
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-db/mysql/Manifest                              |    2 +
 .../mysql/files/mysql-8.0.36-boost-clang-fix.patch |   76 ++
 dev-db/mysql/mysql-8.0.36.ebuild                   | 1271 ++++++++++++++++++++
 3 files changed, 1349 insertions(+)

diff --git a/dev-db/mysql/Manifest b/dev-db/mysql/Manifest
index 0672320ea6b4..3efcb891c8b1 100644
--- a/dev-db/mysql/Manifest
+++ b/dev-db/mysql/Manifest
@@ -2,8 +2,10 @@ DIST mysql-5.7.36-patches-01.tar.xz 6396 BLAKE2B ed9783f207d40fc220992c4193bdd8e
 DIST mysql-8.0.27-patches-03.tar.xz 9864 BLAKE2B 03136477a97a5bff0c5f1cbc7921a77d9b36e148e94f80463f00f0efd1a6859af4595f9cf15aa492bce043fdc9d6c6328bd64102f8b0127eacbc7795b1785ecb SHA512 8c00c8fef2b01389f59138eaa29399d8a9ce7930b6bdfb7689d1d7bf14a32fbb10a2b8dbe91933b805899ef3af0cf0bda704d4be14249991b381054bcc496058
 DIST mysql-8.0.31-patches-01.tar.xz 5464 BLAKE2B c067bf311c83d4aa0f48d56621997bc58820fa0b41bd708eae04b0b54b89d549c5c1b84ca93adcbbdcb008199510ea667a12b1bcd44bf6b6df02062b4551d0a2 SHA512 95af6bb5aa0c407f0a1014f33523608b0df0797fd7fbdbba8a19985258a7c04788d7587c8f67cd1745284522c58297931c8827e31f77e8c89baaeff71a5e0ddc
 DIST mysql-8.0.34-patches-01.tar.xz 9304 BLAKE2B e80dd1fab00fb183e0b980763a9b6c3b879357b776b2acc9709527e5d6e2549f801835936433e55fcde2820201edb3dead5d95f31ef617ef9542d2a0bd95efca SHA512 1ac196d609fabd9c978bc8dd3564a45f0d681c292215d8979604d7e402c622d70a1c66ed191ded081c597042298c43154a9bb09bb4566e7fe97991f67d91d999
+DIST mysql-8.0.36-patches-01.tar.xz 10768 BLAKE2B d9b9c6f170e08eee249bbef77713116ad2f1bd05d638f908011c8be406548b9a87a5189d440147c76ac8aef8058d3fdf25d754191a52fef786812ddd6a2409dd SHA512 3f6af0f17e2ded2ec5cc9b0001062bda061e51a17f4f2d1f1fb604590de026a70bd21cecdff28e05adb1b89356fec1c1b33bc9c848e8a20186412d8547452305
 DIST mysql-boost-5.7.41.tar.gz 53266489 BLAKE2B 7201d6c53cf711bd121464fc85260e1799f7195f45706b91f3cb8d605fe2bd2639d532b4045a336645a553d9b0b1131cc45140a19483902e5dc37d3e2479b6f5 SHA512 88e1cc4864616ed92880a3f02285763aac2ddfc1cdeeff07e1502c97bbdfd31c9ed9d02f8f6381a352857a85241e4e4eb6bc0d978e3928a68ef49362f670482a
 DIST mysql-boost-8.0.27.tar.gz 292184025 BLAKE2B 177209f3c62b0326ca9d021c751a701dec84c1b15c946ab0a68b1b4cf0620468eb3a1df77a918284007a0fde1aaa6a9767d0baed57936612813ef583df51c35e SHA512 6ef2426c0bee46bdf8e2fa5cb159d5ae19f0bed4f7c9bea9b33e0dd922b568c3c68ca063dcbcd7ea6904aaea31877c10064ea10b4bc63fb40d9f31778e3a7891
 DIST mysql-boost-8.0.31.tar.gz 334504577 BLAKE2B 0506472c732351a1055be9bbd81212e95280ae464af95cb5b579777dd8fad4634b099fa2830c3095066daf8c586f1d8cd2316e7268fb0d2577dd706c595c9102 SHA512 87b1678de8c2fd640fd6f3ae58266ea63fe240578330e3296d0e5fc209bbe9b0c22996214b6ca4cce8c0d9cc2f9897f4e6723d835b33fc4342983c82929c3d96
 DIST mysql-boost-8.0.32.tar.gz 436207624 BLAKE2B 8a75fd6fe12d4f870622b3386118737b8f17d116df625ef6187647c870d456823543e0a1e9aa05fff53313c3872df1df23add2508ec735bb7972718fc1e90539 SHA512 937e0d0350cb583bb4de15b080f08ed92b253a6d7c09f13a028855dae154fc84f0c95fb082b818b2fa6fa792cd2d9db8d7dc7a20a2a0d3d2b6839fbd2c821b44
 DIST mysql-boost-8.0.34.tar.gz 439550780 BLAKE2B f50701b7e97e6cec21d6ce0f80f07a8df68a14c637a67841c06f578be8ed01d216dcb3b859a29f1befd4223b99e60675d6fa70f4b227bf6af81804e2c43161d4 SHA512 e5e79ac6870c214cf62c8e2830106d60e09d2e6df30654b84bb5d26864b4eabe777468a223e6ee4c1e22b7f6ec086c73e85e3f4c1fa66912b0e59b606ab46cd6
+DIST mysql-boost-8.0.36.tar.gz 438154682 BLAKE2B 066c9dd7f2804ad29808c3bfcf5eae53466f7c40cf1386a9c1f26a0b45dcc3eda8d9618de36e8008e5e4d58b726d6c8ca85aec8d1eda8981f5a49e495b32f046 SHA512 a6c1c009a322b7e7aa2aa607573060414c847c77d48f44a24058ffb89673621f2ebbcc1a4448fa841a87ff721159cc8eaf44a57721c7dc233c130691c16a9d4a

diff --git a/dev-db/mysql/files/mysql-8.0.36-boost-clang-fix.patch b/dev-db/mysql/files/mysql-8.0.36-boost-clang-fix.patch
new file mode 100644
index 000000000000..31a2946a41ed
--- /dev/null
+++ b/dev-db/mysql/files/mysql-8.0.36-boost-clang-fix.patch
@@ -0,0 +1,76 @@
+From 50a1eae942effb0a9b90724323ef8f2a67e7984a Mon Sep 17 00:00:00 2001
+From: Peter Dimov <pdimov@gmail.com>
+Date: Wed, 16 Nov 2022 10:43:31 +0200
+Subject: [PATCH] Change mpl::integral_c to boost::integral_constant to avoid
+ Clang 16 errors when constructing out of range enums (refs #24,
+ https://github.com/boostorg/mpl/issues/69)
+
+--- a/boost/boost_1_77_0/boost/numeric/conversion/detail/int_float_mixture.hpp
++++ b/boost/boost_1_77_0/boost/numeric/conversion/detail/int_float_mixture.hpp
+@@ -16,15 +16,15 @@
+ #include "boost/numeric/conversion/int_float_mixture_enum.hpp"
+ #include "boost/numeric/conversion/detail/meta.hpp"
+ 
+-#include "boost/mpl/integral_c.hpp"
++#include "boost/type_traits/integral_constant.hpp"
+ 
+ namespace boost { namespace numeric { namespace convdetail
+ {
+   // Integral Constants for 'IntFloatMixture'
+-  typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
+-  typedef mpl::integral_c<int_float_mixture_enum, integral_to_float>    int2float_c ;
+-  typedef mpl::integral_c<int_float_mixture_enum, float_to_integral>    float2int_c ;
+-  typedef mpl::integral_c<int_float_mixture_enum, float_to_float>       float2float_c ;
++  typedef boost::integral_constant<int_float_mixture_enum, integral_to_integral> int2int_c ;
++  typedef boost::integral_constant<int_float_mixture_enum, integral_to_float>    int2float_c ;
++  typedef boost::integral_constant<int_float_mixture_enum, float_to_integral>    float2int_c ;
++  typedef boost::integral_constant<int_float_mixture_enum, float_to_float>       float2float_c ;
+ 
+   // Metafunction:
+   //
+--- a/boost/boost_1_77_0/boost/numeric/conversion/detail/sign_mixture.hpp
++++ b/boost/boost_1_77_0/boost/numeric/conversion/detail/sign_mixture.hpp
+@@ -16,15 +16,15 @@
+ #include "boost/numeric/conversion/sign_mixture_enum.hpp"
+ #include "boost/numeric/conversion/detail/meta.hpp"
+ 
+-#include "boost/mpl/integral_c.hpp"
++#include "boost/type_traits/integral_constant.hpp"
+ 
+ namespace boost { namespace numeric { namespace convdetail
+ {
+   // Integral Constants for 'SignMixture'
+-  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
+-  typedef mpl::integral_c<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
+-  typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
+-  typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
++  typedef boost::integral_constant<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
++  typedef boost::integral_constant<sign_mixture_enum, signed_to_signed>     sig2sig_c ;
++  typedef boost::integral_constant<sign_mixture_enum, signed_to_unsigned>   sig2unsig_c ;
++  typedef boost::integral_constant<sign_mixture_enum, unsigned_to_signed>   unsig2sig_c ;
+ 
+   // Metafunction:
+   //
+--- a/boost/boost_1_77_0/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
++++ b/boost/boost_1_77_0/boost/numeric/conversion/detail/udt_builtin_mixture.hpp
+@@ -15,15 +15,15 @@
+ #include "boost/numeric/conversion/udt_builtin_mixture_enum.hpp"
+ #include "boost/numeric/conversion/detail/meta.hpp"
+ 
+-#include "boost/mpl/integral_c.hpp"
++#include "boost/type_traits/integral_constant.hpp"
+ 
+ namespace boost { namespace numeric { namespace convdetail
+ {
+   // Integral Constants for 'UdtMixture'
+-  typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
+-  typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
+-  typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
+-  typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
++  typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
++  typedef boost::integral_constant<udt_builtin_mixture_enum, builtin_to_udt>     builtin2udt_c ;
++  typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_builtin>     udt2builtin_c ;
++  typedef boost::integral_constant<udt_builtin_mixture_enum, udt_to_udt>         udt2udt_c ;
+ 
+   // Metafunction:
+   //

diff --git a/dev-db/mysql/mysql-8.0.36.ebuild b/dev-db/mysql/mysql-8.0.36.ebuild
new file mode 100644
index 000000000000..91b033ef3d2f
--- /dev/null
+++ b/dev-db/mysql/mysql-8.0.36.ebuild
@@ -0,0 +1,1271 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit check-reqs cmake edo flag-o-matic linux-info multiprocessing prefix
+
+MY_PV="${PV//_pre*}"
+MY_P="${PN}-${MY_PV}"
+
+# Patch version
+PATCH_SET=( https://github.com/parona-source/mysql-server/releases/download/mysql-8.0.36-patches-01/mysql-8.0.36-patches-01.tar.xz )
+
+DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
+HOMEPAGE="https://www.mysql.com/"
+SRC_URI="https://cdn.mysql.com/Downloads/MySQL-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz"
+SRC_URI+=" https://cdn.mysql.com/archives/mysql-$(ver_cut 1-2)/mysql-boost-${MY_PV}.tar.gz"
+SRC_URI+=" https://downloads.mysql.com/archives/MySQL-$(ver_cut 1-2)/${PN}-boost-${MY_PV}.tar.gz"
+SRC_URI+=" ${PATCH_SET[@]}"
+# Shorten the path because the socket path length must be shorter than 107 chars
+# and we will run a mysql server during test phase
+S="${WORKDIR}/mysql"
+
+LICENSE="GPL-2"
+SLOT="8.0"
+# -ppc for bug #761715
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips -ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
+IUSE="cjk cracklib debug jemalloc latin1 numa +perl profiling router selinux +server tcmalloc test"
+RESTRICT="!test? ( test )"
+
+REQUIRED_USE="?? ( tcmalloc jemalloc )
+	cjk? ( server )
+	jemalloc? ( server )
+	numa? ( server )
+	profiling? ( server )
+	router? ( server )
+	tcmalloc? ( server )"
+
+# Be warned, *DEPEND are version-dependent
+# These are used for both runtime and compiletime
+COMMON_DEPEND="
+	>=app-arch/lz4-1.9.4:=
+	>=app-arch/zstd-1.2.0:=
+	>=dev-libs/openssl-1.0.0:=
+	sys-libs/ncurses:=
+	>=sys-libs/zlib-1.2.13:=
+	server? (
+		dev-libs/icu:=
+		dev-libs/libevent:=[ssl,threads(+)]
+		net-libs/libtirpc:=
+		cjk? ( app-text/mecab:= )
+		jemalloc? ( dev-libs/jemalloc:= )
+		kernel_linux? (
+			dev-libs/libaio:=
+			sys-process/procps
+		)
+		numa? ( sys-process/numactl )
+		tcmalloc? ( dev-util/google-perftools:= )
+	)
+"
+
+# https://bugs.gentoo.org/623962
+# tests set TZ for tests leading to failures on musl if sys-libs/timezone-data isnt installed
+DEPEND="
+	${COMMON_DEPEND}
+	app-alternatives/yacc
+	server? ( net-libs/rpcsvc-proto )
+	test? (
+		acct-group/mysql acct-user/mysql
+		dev-perl/Expect
+		dev-perl/JSON
+		sys-libs/timezone-data
+	)
+"
+RDEPEND="
+	${COMMON_DEPEND}
+	!dev-db/mariadb
+	!dev-db/mariadb-galera
+	!dev-db/percona-server
+	!dev-db/mysql-cluster
+	!dev-db/mysql:0
+	!dev-db/mysql:5.7
+	selinux? ( sec-policy/selinux-mysql )
+	!prefix? (
+		acct-group/mysql acct-user/mysql
+		dev-db/mysql-init-scripts
+	)
+"
+# For other stuff to bring us in
+# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
+PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
+
+PATCHES=(
+	"${WORKDIR}"/mysql-patches
+	# Needed due to bundled boost-1.77, this fix is included in boost-1.81
+	"${FILESDIR}"/mysql-8.0.36-boost-clang-fix.patch
+)
+
+mysql_init_vars() {
+	: ${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
+	: ${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
+	: ${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
+	: ${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
+	MY_DATADIR="${MY_LOCALSTATEDIR}"
+
+	export MY_SHAREDSTATEDIR MY_SYSCONFDIR
+	export MY_LOCALSTATEDIR MY_LOGDIR
+	export MY_DATADIR
+}
+
+pkg_pretend() {
+	if [[ ${MERGE_TYPE} != binary ]] ; then
+		if use server ; then
+			CHECKREQS_DISK_BUILD="3G"
+
+			if has test ${FEATURES} ; then
+				CHECKREQS_DISK_BUILD="10G"
+
+				if use elibc_musl; then
+					# <parona@protonmail.com> i've seen it take 17GB on musl with FEATURES="test" USE="perl server"
+					CHECKREQS_DISK_BUILD="18G"
+				fi
+			fi
+
+			check-reqs_pkg_pretend
+		fi
+	fi
+}
+
+pkg_setup() {
+	if [[ ${MERGE_TYPE} != binary ]] ; then
+		CHECKREQS_DISK_BUILD="3G"
+
+		if has test ${FEATURES} ; then
+			CHECKREQS_DISK_BUILD="10G"
+
+			if use elibc_musl; then
+				# <parona@protonmail.com> i've seen it take 17GB on musl with FEATURES="test" USE="perl server"
+				CHECKREQS_DISK_BUILD="18G"
+			fi
+
+			# Bug #213475 - MySQL _will_ object strenuously if your machine is named
+			# localhost. Also causes weird failures.
+			[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+			if ! has userpriv ${FEATURES} ; then
+				die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
+			fi
+
+			local aio_max_nr=$(sysctl -n fs.aio-max-nr 2>/dev/null)
+			if [[ -z "${aio_max_nr}" || ${aio_max_nr} -lt 250000 ]] ; then
+				die "FEATURES=test will require fs.aio-max-nr=250000 at minimum!"
+			fi
+
+			if use latin1 ; then
+				# Upstream only supports tests with default charset
+				die "Testing with USE=latin1 is not supported."
+			fi
+		fi
+
+		if use kernel_linux && use numa ; then
+			linux-info_get_any_version
+
+			local CONFIG_CHECK="~NUMA"
+
+			local WARNING_NUMA="This package expects NUMA support in kernel which this system does not have at the moment;"
+			WARNING_NUMA+=" Either expect runtime errors, enable NUMA support in kernel or rebuild the package without NUMA support"
+
+			check_extra_config
+		fi
+
+		use server && check-reqs_pkg_setup
+	fi
+}
+
+src_unpack() {
+	unpack ${A}
+
+	mv -f "${WORKDIR}/${MY_P}" "${S}" || die
+}
+
+src_prepare() {
+	# Avoid rpm call which would trigger sandbox, #692368
+	sed -i \
+		-e 's/MY_RPM rpm/MY_RPM rpmNOTEXISTENT/' \
+		CMakeLists.txt || die
+
+	# Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
+	if [[ -d "${S}/support-files/SELinux" ]] ; then
+		echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
+	fi
+
+	# Remove man pages for client-lib tools we don't install
+	rm \
+		man/my_print_defaults.1 \
+		man/perror.1 \
+		man/zlib_decompress.1 \
+		|| die
+
+	cmake_src_prepare
+}
+
+src_configure() {
+	# Bug #114895, bug #110149
+	filter-flags "-O" "-O[01]"
+
+	# Code is now requiring C++17 due to https://github.com/mysql/mysql-server/commit/236ab55bedd8c9eacd80766d85edde2a8afacd08
+	append-cxxflags -std=c++17
+
+	if has sandbox ${FEATURES} ; then
+		# bug #823656
+		append-cppflags -DGTEST_NO_DEATH_TEST=1
+	fi
+
+	local mycmakeargs=(
+		-Wno-dev # less noise
+
+		-DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
+		-DSYSCONFDIR="${EPREFIX}/etc/mysql"
+
+		-DINSTALL_BINDIR=bin
+		-DINSTALL_DOCDIR=share/doc/${PF}
+		-DINSTALL_DOCREADMEDIR=share/doc/${PF}
+		-DINSTALL_INCLUDEDIR=include/mysql
+		-DINSTALL_INFODIR=share/info
+		-DINSTALL_LIBDIR=$(get_libdir)
+		-DINSTALL_MANDIR=share/man
+		-DINSTALL_MYSQLSHAREDIR=share/mysql
+		-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
+		-DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
+		-DINSTALL_SBINDIR=sbin
+		-DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
+
+		-DROUTER_INSTALL_LOGROTATEDIR="${EPREFIX}/etc/logrotate.d"
+		-DROUTER_INSTALL_DOCDIR="share/doc/${PF}"
+
+		-DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
+		-DWITH_UNIT_TESTS=$(usex test ON OFF)
+
+		# Enables -Werror
+		-DMYSQL_MAINTAINER_MODE=OFF
+
+		# Causes issues on musl bug #922808
+		-DWITH_BUILD_ID=OFF
+
+		# Using bundled editline to get CTRL+C working
+		-DWITH_EDITLINE=bundled
+		-DWITH_ZLIB=system
+		-DWITH_SSL=system
+		-DWITH_LIBWRAP=0
+		-DENABLED_LOCAL_INFILE=1
+		-DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
+		-DWITH_DEFAULT_COMPILER_OPTIONS=0
+		-DCMAKE_POSITION_INDEPENDENT_CODE=ON
+
+		-DWITH_CURL=system
+		-DWITH_BOOST="${S}/boost"
+		-DWITH_ROUTER=$(usex router ON OFF)
+	)
+
+	if use debug; then
+		# Debug build type used extensively to add preprocessor definitions
+		local -x CMAKE_BUILD_TYPE="Debug"
+	else
+		# debug hack wrt #497532
+		mycmakeargs+=(
+			-DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )"
+			-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usev !debug '-DNDEBUG' )"
+		)
+	fi
+
+	if tc-is-lto ; then
+		mycmakeargs+=( -DWITH_LTO=ON )
+	else
+		mycmakeargs+=( -DWITH_LTO=OFF )
+	fi
+
+	if use test ; then
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
+	else
+		mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
+	fi
+
+	mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
+
+	mycmakeargs+=(
+		-DWITH_ICU=system
+		-DWITH_LZ4=system
+		# Our dev-libs/rapidjson doesn't carry necessary fixes for std::regex
+		-DWITH_RAPIDJSON=bundled
+		-DWITH_ZSTD=system
+	)
+
+	if [[ -n "${MYSQL_DEFAULT_CHARSET}" && -n "${MYSQL_DEFAULT_COLLATION}" ]] ; then
+		ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
+		ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
+		ewarn "You MUST file bugs without these variables set."
+		ewarn "Tests will probably fail!"
+
+		mycmakeargs+=(
+			-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
+			-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
+		)
+	elif use latin1 ; then
+		mycmakeargs+=(
+			-DDEFAULT_CHARSET=latin1
+			-DDEFAULT_COLLATION=latin1_swedish_ci
+		)
+	else
+		mycmakeargs+=(
+			-DDEFAULT_CHARSET=utf8mb4
+			-DDEFAULT_COLLATION=utf8mb4_0900_ai_ci
+		)
+	fi
+
+	if use server ; then
+		mycmakeargs+=(
+			-DWITH_EXTRA_CHARSETS=all
+			-DWITH_DEBUG=$(usex debug)
+			-DWITH_MECAB=$(usex cjk system OFF)
+			-DWITH_LIBEVENT=system
+			# Cannot handle protobuf >23 bug #912797
+			-DWITH_PROTOBUF=bundled
+			-DWITH_NUMA=$(usex numa ON OFF)
+		)
+
+		if use jemalloc ; then
+			mycmakeargs+=( -DWITH_JEMALLOC=ON )
+		elif use tcmalloc ; then
+			mycmakeargs+=( -DWITH_TCMALLOC=ON )
+		fi
+
+		if use profiling ; then
+			# Setting to OFF doesn't work: Once set, profiling options will be added
+			# to `mysqld --help` output via sql/sys_vars.cc causing
+			# "main.mysqld--help-notwin" test to fail
+			mycmakeargs+=( -DENABLED_PROFILING=ON )
+		fi
+
+		# Storage engines
+		mycmakeargs+=(
+			-DWITH_EXAMPLE_STORAGE_ENGINE=0
+			-DWITH_ARCHIVE_STORAGE_ENGINE=1
+			-DWITH_BLACKHOLE_STORAGE_ENGINE=1
+			-DWITH_CSV_STORAGE_ENGINE=1
+			-DWITH_FEDERATED_STORAGE_ENGINE=1
+			-DWITH_HEAP_STORAGE_ENGINE=1
+			-DWITH_INNOBASE_STORAGE_ENGINE=1
+			-DWITH_INNODB_MEMCACHED=0
+			-DWITH_MYISAMMRG_STORAGE_ENGINE=1
+			-DWITH_MYISAM_STORAGE_ENGINE=1
+		)
+	else
+		mycmakeargs+=(
+			-DWITHOUT_SERVER=1
+			-DWITH_SYSTEMD=no
+		)
+	fi
+
+	cmake_src_configure
+}
+
+# Official test instructions:
+# ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' \
+# ebuild mysql-X.X.XX.ebuild digest clean test install
+src_test() {
+	_disable_test() {
+		local rawtestname bug reason
+		rawtestname="${1}" ; shift
+		bug="${1}" ; shift
+		reason="${@}"
+
+		ewarn "test '${rawtestname}' disabled: '${reason}' (BUG#${bug})"
+		echo "${rawtestname} : BUG#${bug} ${reason}" >> "${T}/disabled.def"
+	}
+
+	local TESTDIR="${BUILD_DIR}/mysql-test"
+	local retstatus_tests
+
+	einfo "Official test instructions:"
+	einfo "ulimit -n 16500 && USE='perl server' FEATURES='test userpriv' ebuild ..."
+
+	if ! use server ; then
+		ewarn "Skipping server tests due to minimal build!"
+		return 0
+	fi
+
+	# Ensure that parallel runs don't die
+	local -x MTR_BUILD_THREAD="$((${RANDOM} % 100))"
+
+	local -x MTR_PARALLEL=${MTR_PARALLEL:-$(makeopts_jobs)}
+	einfo "MTR_PARALLEL is set to '${MTR_PARALLEL}'"
+
+	# Disable unit tests, run them separately with eclass defaults
+	local -x MTR_UNIT_TESTS=0
+
+	# Increase test timeouts
+	# bug #923649
+	# https://github.com/gentoo/gentoo/pull/35002#issuecomment-1926101030
+	local -x MTR_SUITE_TIMEOUT=$(( 60 * 40 )) # minutes
+	local -x MTR_TESTCASE_TIMEOUT=60 # minutes
+
+	# Include config for tests, this is for scenarios where mysql wasn't installed previously or if the
+	# configuration was from an older version.
+	sed \
+		-e "s/@GENTOO_PORTAGE_EPREFIX@/${EPREFIX}/" \
+		-e "s/@DATADIR@/${MY_DATADIR}/" \
+		"${FILESDIR}"/my.cnf-8.0.distro-client \
+		"${FILESDIR}"/my.cnf-8.0.distro-server \
+			> "${T}"/my.cnf || die
+	local -X PATH_CONFIG_FILE="${T}/my.cnf"
+
+	# Create directories because mysqladmin might run out of order
+	mkdir -p "${T}"/var-tests{,/log} || die
+
+	# Run mysql tests
+	pushd "${TESTDIR}" &>/dev/null || die
+
+	touch "${T}/disabled.def" || die
+
+	local -a disabled_tests=(
+		"auth_sec.atomic_rename_user;103512;Depends on user running test"
+		"auth_sec.keyring_file_data_qa;0;Won't work with user privileges"
+		"auth_sec.openssl_without_fips;94718;Known test failure"
+
+		"gis.geometry_class_attri_prop;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.geometry_property_function_issimple;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.gis_bugs_crashes;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_analysis_functions_buffer;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_analysis_functions_centroid;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_analysis_functions_distance;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_op_testingfunc_mix;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_operators_intersection;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_utility_function_distance_sphere;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.spatial_utility_function_simplify;5452;Known rounding error with latest AMD processors (PS)"
+		"gis.st_symdifference;5452;Known rounding error with latest AMD processors (PS)"
+
+		"innodb.alter_kill;0;Known test failure -- no upstream bug yet"
+
+		"main.derived_limit;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.explain_tree;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.gis-precise;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.mysql_load_data_local_dir;0;Known test failure -- no upstream bug yet"
+		"main.select_icp_mrr;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_bugs;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_dupsweed;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_dupsweed_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_dupsweed_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_firstmatch;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_firstmatch_bka;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_firstmatch_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_mat_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.subquery_sj_all_bka_nobnl;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.window_std_var;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.window_std_var_optimized;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"main.with_recursive;0;Known rounding error with latest AMD processors -- no upstream bug yet"
+		"perfschema.statement_digest_query_sample;0;Test will fail on slow hardware"
+
+		"rpl.rpl_innodb_info_tbl_slave_tmp_tbl_mismatch;0;Unstable test"
+		"rpl_gtid.rpl_multi_source_mtr_includes;97844;Unstable test"
+		"main.partition_datatype;0;Unstable test"
+
+		"sys_vars.myisam_data_pointer_size_func;87935;Test will fail on slow hardware"
+
+		"x.connection;0;Known failure - no upstream bug yet"
+		"main.slow_log;0;Known failure - no upstream bug yet"
+
+		"sys_vars.build_id_basic;0;Requires -DWITH_BUILD_ID=ON"
+	)
+
+	if ! hash zip 1>/dev/null 2>&1 ; then
+		# No need to force dep app-arch/zip for one test
+		disabled_tests+=(
+			"innodb.discarded_partition_create;0;Requires app-arch/zip"
+			"innodb.partition_upgrade_create;0;Requires app-arch/zip"
+		)
+	fi
+
+	if has_version ">=dev-libs/openssl-3.2" ; then
+		# https://bugs.mysql.com/bug.php?id=113258
+		disabled_tests+=(
+			"rpl.rpl_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2"
+			"auth_sec.wl15800_ciphers_tlsv13;0;CCM8 ciphers have a lower security level with OpenSSL 3.2"
+		)
+	fi
+
+	if use debug; then
+		disabled_tests+=(
+			"innodb.dblwr_unencrypt;0;Known test failure -- no upstream bug yet"
+		)
+	fi
+
+	local test_infos_str test_infos_arr
+	for test_infos_str in "${disabled_tests[@]}" ; do
+		IFS=';' read -r -a test_infos_arr <<< "${test_infos_str}"
+
+		if [[ ${#test_infos_arr[@]} != 3 ]] ; then
+			die "Invalid test data set, not matching format: ${test_infos_str}"
+		fi
+
+		_disable_test "${test_infos_arr[0]}" "${test_infos_arr[1]}" "${test_infos_arr[2]}"
+	done
+	unset test_infos_str test_infos_arr
+
+	local -a CMAKE_SKIP_TESTS=(
+		# timing test, can be unreliable
+		"routertest_harness_net_ts_timer"
+
+		# Could not get local host address: Name or service not known(errno: -2)
+		"routertest_component_bootstrap"
+		"routertest_component_bootstrap_account"
+		"routertest_component_bootstrap_clusterset"
+		"routertest_component_config_overwrites"
+		"routertest_component_rest_api_enable"
+		"routertest_component_routing"
+		"routertest_component_sd_notify"
+		"routertest_component_state_file"
+		"routertest_integration_routing_direct"
+		"routertest_integration_routing_reuse"
+		"routertest_integration_routing_sharing"
+		"routertest_integration_routing_sharing_constrained_pools"
+		"routertest_integration_routing_sharing_restart"
+
+		# TODO: ???
+		"pfs_host-oom"
+		"pfs_user-oom"
+		"pfs"
+	)
+
+	if use debug; then
+		CMAKE_SKIP_TESTS+=(
+			# binary_log::transaction::compression::Payload_event_buffer_istream::~Payload_event_buffer_istream(): Assertion `!m_outstanding_error' failed.
+			"payload_event_buffer_istream"
+		)
+	fi
+
+	# Try to increase file limits to increase test coverage
+	if ! ulimit -n 16500 1>/dev/null 2>&1 ; then
+		# Upper limit comes from parts.partition_* tests
+		ewarn "For maximum test coverage, please raise open file limit to 16500 (ulimit -n 16500) before calling the package manager."
+
+		if ! ulimit -n 4162 1>/dev/null 2>&1 ; then
+			# Medium limit comes from '[Warning] Buffered warning: Could not increase number of max_open_files to more than 3000 (request: 4162)'
+			ewarn "For medium test coverage please raise open file limit to 4162 (ulimit -n 4162) before calling the package manager."
+
+			if ! ulimit -n 3000 1>/dev/null 2>&1 ; then
+				ewarn "For minimum test coverage, please raise open file limit to 3000 (ulimit -n 3000) before calling the package manager."
+			else
+				einfo "Will run test suite with open file limit set to 3000 (minimum test coverage)."
+			fi
+		else
+			einfo "Will run test suite with open file limit set to 4162 (medium test coverage)."
+		fi
+	else
+		einfo "Will run test suite with open file limit set to 16500 (best test coverage)."
+	fi
+
+	# run mysql-test tests
+	# Enable force restart to ensure success when tests don't cleanup sufficiently.
+	# Anything touching gtid_executed is negatively affected if you have unlucky ordering
+	nonfatal edo perl mysql-test-run.pl \
+		--force --force-restart \
+		--vardir="${T}/var-tests" --tmpdir="${T}/tmp-tests" \
+		--skip-test=tokudb --skip-test-list="${T}/disabled.def" \
+		--retry-failure=0 --max-test-fail=0
+	retstatus_tests=$?
+
+	popd &>/dev/null || die
+
+	# Cleanup is important for these testcases.
+	pkill -9 -f "${S}/ndb" 2>/dev/null
+	pkill -9 -f "${S}/sql" 2>/dev/null
+
+	local failures=""
+	[[ ${retstatus_tests} -eq 0 ]] || failures="${failures} tests"
+
+	cmake_src_test
+
+	[[ -z "${failures}" ]] || die "Test failures: ${failures}"
+	einfo "Tests successfully completed"
+}
+
+src_install() {
+	cmake_src_install
+
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Convenience links
+	einfo "Making Convenience links for mysqlcheck multi-call binary"
+	dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
+	dosym "mysqlcheck" "/usr/bin/mysqlrepair"
+	dosym "mysqlcheck" "/usr/bin/mysqloptimize"
+
+	# INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
+	if [[ -d "${ED}/usr/data" ]] ; then
+		rm -Rf "${ED}/usr/data" || die
+	fi
+
+	# Unless they explicitly specific USE=test, then do not install the
+	# testsuite. It DOES have a use to be installed, esp. when you want to do a
+	# validation of your database configuration after tuning it.
+	if ! use test ; then
+		rm -rf "${ED}/${MY_SHAREDSTATEDIR#${EPREFIX}}/mysql-test"
+	fi
+
+	# Configuration stuff
+	einfo "Building default configuration ..."
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}"
+	[[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
+	cp "${FILESDIR}/my.cnf-5.7" "${TMPDIR}/my.cnf" || die
+	eprefixify "${TMPDIR}/my.cnf"
+	doins "${TMPDIR}/my.cnf"
+	insinto "${MY_SYSCONFDIR#${EPREFIX}}/mysql.d"
+	cp "${FILESDIR}/my.cnf-8.0.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
+	eprefixify "${TMPDIR}/50-distro-client.cnf"
+	doins "${TMPDIR}/50-distro-client.cnf"
+
+	mycnf_src="my.cnf-8.0.distro-server"
+	sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
+		"${FILESDIR}/${mycnf_src}" \
+		> "${TMPDIR}/my.cnf.ok" || die
+
+	if use prefix ; then
+		sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
+			"${TMPDIR}/my.cnf.ok" || die
+	fi
+
+	if use latin1 ; then
+		sed -i \
+			-e "/character-set/s|utf8mb4|latin1|g" \
+			"${TMPDIR}/my.cnf.ok" || die
+	fi
+
+	eprefixify "${TMPDIR}/my.cnf.ok"
+
+	newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
+
+	#Remove mytop if perl is not selected
+	[[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
+
+	if use router ; then
+		rm -rf \
+			"${ED}/usr/LICENSE.router" \
+			"${ED}/usr/README.router" \
+			"${ED}/usr/run" \
+			"${ED}/usr/var" \
+			|| die
+	fi
+
+	# Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
+	find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
+}
+
+pkg_postinst() {
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Create log directory securely if it does not exist
+	# NOTE: $MY_LOGDIR contains $EPREFIX by default
+	[[ -d "${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${MY_LOGDIR}"
+
+	# Note about configuration change
+	einfo
+	elog "This version of ${PN} reorganizes the configuration from a single my.cnf"
+	elog "to several files in /etc/mysql/mysql.d."
+	elog "Please backup any changes you made to /etc/mysql/my.cnf"
+	elog "and add them as a new file under /etc/mysql/mysql.d with a .cnf extension."
+	elog "You may have as many files as needed and they are read alphabetically."
+	elog "Be sure the options have the appropriate section headers, i.e. [mysqld]."
+	einfo
+
+	if [[ -z "${REPLACING_VERSIONS}" ]] ; then
+		einfo
+		elog "You might want to run:"
+		elog "  \"emerge --config =${CATEGORY}/${PF}\""
+		elog "if this is a new install."
+		einfo
+	else
+		einfo
+		elog "Upgrade process for ${PN}-8.x has changed. Please read"
+		elog "https://dev.mysql.com/doc/refman/8.0/en/upgrade-binary-package.html"
+		einfo
+	fi
+}
+
+pkg_config() {
+	_getoptval() {
+		local section="$1"
+		local flag="--${2}="
+		local extra_options="${3}"
+		local cmd=(
+			"${my_print_defaults_binary}"
+			"${extra_options}"
+			"${section}"
+		)
+		local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") )
+
+		if [[ ${#results[@]} -gt 0 ]] ; then
+			# When option is set multiple times only return last value
+			echo "${results[-1]}"
+		fi
+	}
+
+	_mktemp_dry() {
+		# emktemp has no --dry-run option
+		local template="${1}"
+
+		if [[ -z "${template}" ]] ; then
+			if [[ -z "${T}" ]] ; then
+				template="/tmp/XXXXXXX"
+			else
+				template="${T}/XXXXXXX"
+			fi
+		fi
+
+		local template_wo_X=${template//X/}
+		local n_X
+		let n_X=${#template}-${#template_wo_X}
+		if [[ ${n_X} -lt 3 ]] ; then
+			echo "${FUNCNAME[0]}: too few X's in template ‘${template}’" >&2
+			return
+		fi
+
+		local attempts=0
+		local character tmpfile
+		while [[ true ]] ; do
+			let attempts=attempts+1
+
+			new_file=
+			while read -n1 character ; do
+				if [[ "${character}" == "X" ]] ; then
+					tmpfile+="${RANDOM:0:1}"
+				else
+					tmpfile+="${character}"
+				fi
+			done < <(echo -n "${template}")
+
+			if [[ ! -f "${tmpfile}" ]]
+			then
+				echo "${tmpfile}"
+				return
+			fi
+
+			if [[ ${attempts} -ge 100 ]] ; then
+				echo "${FUNCNAME[0]}: Cannot create temporary file after 100 attempts." >&2
+				return
+			fi
+		done
+	}
+
+	local mysqld_binary="${EROOT}/usr/sbin/mysqld"
+	if [[ ! -x "${mysqld_binary}" ]] ; then
+		die "'${mysqld_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+	fi
+
+	local mysql_binary="${EROOT}/usr/bin/mysql"
+	if [[ ! -x "${mysql_binary}" ]] ; then
+		die "'${mysql_binary}' not found! Please re-install ${CATEGORY}/${PN}!"
+	fi
+
+	local my_print_defaults_binary="${EROOT}/usr/bin/my_print_defaults"
+	if [[ ! -x "${my_print_defaults_binary}" ]] ; then
+		die "'${my_print_defaults_binary}' not found! Please re-install dev-db/mysql-connector-c!"
+	fi
+
+	if [[ -z "${MYSQL_USER}" ]] ; then
+		MYSQL_USER=mysql
+		if use prefix ; then
+			MYSQL_USER=$(id -u -n 2>/dev/null)
+			if [[ -z "${MYSQL_USER}" ]] ; then
+				die "Failed to determine current username!"
+			fi
+		fi
+	fi
+
+	if [[ -z "${MYSQL_GROUP}" ]] ; then
+		MYSQL_GROUP=mysql
+		if use prefix ; then
+			MYSQL_GROUP=$(id -g -n 2>/dev/null)
+			if [[ -z "${MYSQL_GROUP}" ]] ; then
+				die "Failed to determine current user groupname!"
+			fi
+		fi
+	fi
+
+	# my_print_defaults needs to read stuff in $HOME/.my.cnf
+	local -x HOME="${EROOT}/root"
+
+	# Make sure the vars are correctly initialized
+	mysql_init_vars
+
+	# Read currently set data directory
+	MY_DATADIR="$(_getoptval mysqld datadir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+
+	# Bug #213475 - MySQL _will_ object strenously if your machine is named
+	# localhost. Also causes weird failures.
+	[[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
+
+	if [[ -z "${MY_DATADIR}" ]] ; then
+		die "Sorry, unable to find MY_DATADIR!"
+	elif [[ -d "${MY_DATADIR}/mysql" ]] ; then
+		ewarn "Looks like your data directory '${MY_DATADIR}' is already initialized!"
+		ewarn "Please rename or delete its content if you wish to initialize a new data directory."
+		die "${PN} data directory at '${MY_DATADIR}' looks already initialized!"
+	fi
+
+	MYSQL_TMPDIR="$(_getoptval mysqld tmpdir "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+	MYSQL_TMPDIR=${MYSQL_TMPDIR%/}
+	# These are dir+prefix
+	MYSQL_LOG_BIN="$(_getoptval mysqld log-bin "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+	MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
+	MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log "--defaults-file='${MY_SYSCONFDIR}/my.cnf'")"
+	MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
+
+	# Create missing directories.
+	# Always check if mysql user can write to directory even if we just
+	# created directory because a parent directory might be not
+	# accessible for that user.
+	PID_DIR="${EROOT}/run/mysqld"
+	if [[ ! -d "${PID_DIR}" ]] ; then
+		einfo "Creating ${PN} PID directory '${PID_DIR}' ..."
+		install -d -m 755 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${PID_DIR}" \
+			|| die "Failed to create PID directory '${PID_DIR}'!"
+	fi
+
+	local _pid_dir_testfile="$(_mktemp_dry "${PID_DIR}/.pkg_config-access-test.XXXXXXXXX")"
+	[[ -z "${_pid_dir_testfile}" ]] \
+		&& die "_mktemp_dry() for '${PID_DIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+	if use prefix ; then
+		touch "${_pid_dir_testfile}" &>/dev/null
+	else
+		su -s /bin/sh -c "touch ${_pid_dir_testfile}" ${MYSQL_USER} &>/dev/null
+	fi
+
+	if [[ $? -ne 0 ]] ; then
+		die "${MYSQL_USER} user cannot write into PID dir '${PID_DIR}'!"
+	else
+		rm "${_pid_dir_testfile}" || die
+		unset _pid_dir_testfile
+	fi
+
+	if [[ ! -d "${MY_DATADIR}" ]] ; then
+		einfo "Creating ${PN} data directory '${MY_DATADIR}' ..."
+		install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MY_DATADIR}" \
+			|| die "Failed to create ${PN} data directory '${MY_DATADIR}'!"
+	fi
+
+	local _my_datadir_testfile="$(_mktemp_dry "${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX")"
+	[[ -z "${_my_datadir_testfile}" ]] \
+		&& die "_mktemp_dry() for '${MY_DATADIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+	if use prefix ; then
+		touch "${_my_datadir_testfile}" &>/dev/null
+	else
+		su -s /bin/sh -c "touch ${_my_datadir_testfile}" ${MYSQL_USER} &>/dev/null
+	fi
+
+	if [[ $? -ne 0 ]] ; then
+		die "${MYSQL_USER} user cannot write into data directory '${MY_DATADIR}'!"
+	else
+		rm "${_my_datadir_testfile}" || die
+		unset _my_datadir_testfile
+	fi
+
+	if [[ -n "${MYSQL_TMPDIR}" && ! -d "${MYSQL_TMPDIR}" ]] ; then
+		einfo "Creating ${PN} tmpdir '${MYSQL_TMPDIR}' ..."
+		install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_TMPDIR}" \
+			|| die "Failed to create ${PN} tmpdir '${MYSQL_TMPDIR}'!"
+	fi
+
+	if [[ -z "${MYSQL_TMPDIR}" ]] ; then
+		MYSQL_TMPDIR="$(_mktemp_dry "${EROOT}/tmp/mysqld-tmp.XXXXXXXXX")"
+		[[ -z "${MYSQL_TMPDIR}" ]] \
+			&& die "_mktemp_dry() for '${MYSQL_TMPDIR}' failed!"
+
+		mkdir "${MYSQL_TMPDIR}" || die
+		chown ${MYSQL_USER} "${MYSQL_TMPDIR}" || die
+	fi
+
+	# Now we need to test MYSQL_TMPDIR...
+	local _my_tmpdir_testfile="$(_mktemp_dry "${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX")"
+	[[ -z "${_my_tmpdir_testfile}" ]] \
+		&& die "_mktemp_dry() for '${MYSQL_TMPDIR}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+	if use prefix ; then
+		touch "${_my_tmpdir_testfile}" &>/dev/null
+	else
+		su -s /bin/sh -c "touch ${_my_tmpdir_testfile}" ${MYSQL_USER} &>/dev/null
+	fi
+
+	if [[ $? -ne 0 ]] ; then
+		die "${MYSQL_USER} user cannot write into tmpdir '${MYSQL_TMPDIR}'!"
+	else
+		rm "${_my_tmpdir_testfile}" || die
+		unset _my_tmpdir_testfile
+	fi
+
+	if [[ -n "${MYSQL_LOG_BIN}" && ! -d "${MYSQL_LOG_BIN}" ]] ; then
+		einfo "Creating ${PN} log-bin directory '${MYSQL_LOG_BIN}' ..."
+		install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_LOG_BIN}" \
+			|| die "Failed to create ${PN} log-bin directory '${MYSQL_LOG_BIN}'"
+	fi
+
+	if [[ -n "${MYSQL_LOG_BIN}" ]] ; then
+		local _my_logbin_testfile="$(_mktemp_dry "${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX")"
+		[[ -z "${_my_logbin_testfile}" ]] \
+			&& die "_mktemp_dry() for '${MYSQL_LOG_BIN}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+		if use prefix ; then
+			touch "${_my_logbin_testfile}" &>/dev/null
+		else
+			su -s /bin/sh -c "touch ${_my_logbin_testfile}" ${MYSQL_USER} &>/dev/null
+		fi
+
+		if [[ $? -ne 0 ]] ; then
+			die "${MYSQL_USER} user cannot write into log-bin directory '${MYSQL_LOG_BIN}'!"
+		else
+			rm "${_my_logbin_testfile}" || die
+			unset _my_logbin_testfile
+		fi
+	fi
+
+	if [[ -n "${MYSQL_RELAY_LOG}" && ! -d "${MYSQL_RELAY_LOG}" ]] ; then
+		einfo "Creating ${PN} relay-log directory '${MYSQL_RELAY_LOG}' ..."
+		install -d -m 770 -o ${MYSQL_USER} -g ${MYSQL_GROUP} "${MYSQL_RELAY_LOG}" \
+			|| die "Failed to create ${PN} relay-log directory '${MYSQL_RELAY_LOG}'!"
+	fi
+
+	if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
+		local _my_relaylog_testfile="$(_mktemp_dry "${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX")"
+		[[ -z "${_my_relaylog_testfile}" ]] \
+			&& die "_mktemp_dry() for '${MYSQL_RELAY_LOG}/.pkg_config-access-test.XXXXXXXXX' failed!"
+
+		if use prefix ; then
+			touch "${_my_relaylog_testfile}" &>/dev/null
+		else
+			su -s /bin/sh -c "touch ${_my_relaylog_testfile}" ${MYSQL_USER} &>/dev/null
+		fi
+
+		if [[ $? -ne 0 ]] ; then
+			die "${MYSQL_USER} user cannot write into relay-log directory '${MYSQL_RELAY_LOG}'!"
+		else
+			rm "${_my_relaylog_testfile}" || die
+			unset _my_relaylog_testfile
+		fi
+	fi
+
+	local mysql_install_log="$(_mktemp_dry "${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log")"
+	if [[ -z "${mysql_install_log}" ]] ; then
+		die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_db.XXXXXXXXX.log' failed!"
+	else
+		# make sure file is writable for MYSQL_USER...
+		touch "${mysql_install_log}" || die
+		chown ${MYSQL_USER} "${mysql_install_log}" || die
+	fi
+
+	local mysqld_logfile="$(_mktemp_dry "${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log")"
+	if [[ -z "${mysqld_logfile}" ]] ; then
+		die "_mktemp_dry() for '${MYSQL_TMPDIR}/install_mysqld.XXXXXXXXX.log' failed!"
+	else
+		# make sure file is writable for MYSQL_USER...
+		touch "${mysqld_logfile}" || die
+		chown ${MYSQL_USER} "${mysqld_logfile}" || die
+	fi
+
+	echo ""
+	einfo "Detected settings:"
+	einfo "=================="
+	einfo "MySQL User:\t\t\t\t${MYSQL_USER}"
+	einfo "MySQL Group:\t\t\t\t${MYSQL_GROUP}"
+	einfo "MySQL DATA directory:\t\t${MY_DATADIR}"
+	einfo "MySQL TMP directory:\t\t\t${MYSQL_TMPDIR}"
+
+	if [[ -n "${MYSQL_LOG_BIN}" ]] ; then
+		einfo "MySQL Binary Log File location:\t${MYSQL_LOG_BIN}"
+	fi
+
+	if [[ -n "${MYSQL_RELAY_LOG}" ]] ; then
+		einfo "MySQL Relay Log File location:\t${MYSQL_RELAY_LOG}"
+	fi
+
+	einfo "PID DIR:\t\t\t\t${PID_DIR}"
+	einfo "Install db log:\t\t\t${mysql_install_log}"
+	einfo "Install server log:\t\t\t${mysqld_logfile}"
+
+	local -a config_files
+
+	local config_file="${EROOT}/etc/mysql/mysql.d/50-distro-client.cnf"
+	if [[ -f "${config_file}" ]] ; then
+		config_files+=( "${config_file}" )
+	else
+		ewarn "Client configuration '${config_file}' not found; Skipping configuration of default authentication plugin for client ..."
+	fi
+
+	config_file="${EROOT}/etc/mysql/mysql.d/50-distro-server.cnf"
+	if [[ -f "${config_file}" ]] ; then
+		config_files+=( "${config_file}" )
+	else
+		ewarn "Server configuration '${config_file}' not found; Skipping configuration of default authentication plugin for mysqld ..."
+	fi
+
+	if [[ ${#config_files[@]} -gt 0 ]] ; then
+		if [[ -z "${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" ]] ; then
+			local user_answer
+
+			echo
+			einfo "Please select default authentication plugin (enter number or plugin name):"
+			einfo "1) caching_sha2_password [MySQL 8.0 default]"
+			einfo "2) mysql_native_password [MySQL 5.7 default]"
+			einfo
+			einfo "For details see:"
+			einfo "https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html#upgrade-caching-sha2-password"
+			read -p "    >" user_answer
+			echo
+
+			case "${user_answer}" in
+				1|caching_sha2_password)
+					MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=caching_sha2_password
+					;;
+				2|mysql_native_password)
+					MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password
+					;;
+				'')
+					die "No authentication plugin selected!"
+					;;
+				*)
+					die "Authentication plugin '${user_answer}' is unknown/unsupported!"
+					;;
+			esac
+
+			echo "Selected authentication plugin: ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" >> "${mysql_install_log}"
+
+			unset user_answer
+		fi
+
+		local cfg_option cfg_option_tabs cfg_section
+		for config_file in "${config_files[@]}" ; do
+			cfg_option="default-authentication-plugin"
+			cfg_section="mysqld"
+			cfg_option_tabs="\t\t"
+			if [[ "${config_file}" == *client.cnf ]] ; then
+				cfg_option="default-auth"
+				cfg_section="client"
+				cfg_option_tabs="\t\t\t\t"
+			fi
+
+			if grep -qE "^(loose-)?${cfg_option}\b.*=" "${config_file}" 2>/dev/null ; then
+				einfo "Ensuring that ${cfg_option} is set to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
+				sed -i \
+					-e "s/^\(loose-\)\?${cfg_option}\b.*=.*/loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}/" \
+					"${config_file}" || die "Failed to change ${cfg_option} in '${config_file}'!"
+			else
+				einfo "Setting ${cfg_option} to '${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}' in '${config_file}' ..."
+				sed -i \
+					-e "/^\[${cfg_section}\]$/a loose-${cfg_option}${cfg_option_tabs}= ${MYSQL_DEFAULT_AUTHENTICATION_PLUGIN}" \
+					"${config_file}" || die "Failed to add ${cfg_option} to '${config_file}'!"
+			fi
+		done
+		unset cfg_option cfg_option_tabs cfg_section
+	fi
+	unset config_files config_file
+
+	echo
+
+	if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+		local tmp_mysqld_password_source=
+
+		for tmp_mysqld_password_source in mysql client ; do
+			einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
+			if [[ -n "${MYSQL_ROOT_PASSWORD}" ]] ; then
+				if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]] ; then
+					ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
+					MYSQL_ROOT_PASSWORD=
+					continue
+				fi
+
+				einfo "Found password in '${tmp_mysqld_password_source}' section!"
+				break
+			fi
+		done
+
+		# Sometimes --show is required to display passwords in some implementations of my_print_defaults
+		if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]] ; then
+			MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
+		fi
+
+		unset tmp_mysqld_password_source
+	fi
+
+	if [[ -z "${MYSQL_ROOT_PASSWORD}" ]] ; then
+		local pwd1="a"
+		local pwd2="b"
+
+		echo
+		einfo "No password for mysql 'root' user was specified via environment"
+		einfo "variable MYSQL_ROOT_PASSWORD and no password was found in config"
+		einfo "file like '${HOME}/.my.cnf'."
+		einfo "To continue please provide a password for the mysql 'root' user"
+		einfo "now on console:"
+		ewarn "NOTE: Please avoid [\"'\\_%] characters in the password!"
+		read -rsp "    >" pwd1 ; echo
+
+		einfo "Retype the password"
+		read -rsp "    >" pwd2 ; echo
+
+		if [[ "x$pwd1" != "x$pwd2" ]] ; then
+			die "Passwords are not the same!"
+		fi
+
+		MYSQL_ROOT_PASSWORD="${pwd1}"
+		unset pwd1 pwd2
+
+		echo
+	fi
+
+	local -a mysqld_options
+
+	# Fix bug 446200. Don't reference host my.cnf, needs to come first,
+	# see http://bugs.mysql.com/bug.php?id=31312
+	use prefix && mysqld_options+=( "--defaults-file='${MY_SYSCONFDIR}/my.cnf'" )
+
+	# Figure out which options we need to disable to do the setup
+	local helpfile="${TMPDIR}/mysqld-help"
+	"${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
+
+	local opt optexp optfull
+	for opt in host-cache name-resolve networking slave-start \
+		federated ssl log-bin relay-log slow-query-log external-locking \
+		log-slave-updates \
+	; do
+		optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
+		grep -E -sq -- "${optexp}" "${helpfile}" && mysqld_options+=( "${optfull}" )
+	done
+
+	# Prepare timezones, see
+	# https://dev.mysql.com/doc/mysql/en/time-zone-support.html
+	local tz_sql="$(_mktemp_dry "${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql")"
+	[[ -z "${tz_sql}" ]] \
+		&& die "_mktemp_dry() for '${MYSQL_TMPDIR}/tz.XXXXXXXXX.sql' failed!"
+
+	echo "USE mysql;" >"${tz_sql}"
+	"${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" >> "${tz_sql}" 2>/dev/null
+	if [[ $? -ne 0 ]] ; then
+		die "mysql_tzinfo_to_sql failed!"
+	fi
+
+	# --initialize-insecure will not set root password
+	# --initialize would set a random one in the log which we don't need as we set it ourselves
+	local cmd=(
+		"${mysqld_binary}"
+		"${mysqld_options[@]}"
+		"--initialize-insecure"
+		"--init-file='${tz_sql}'"
+		"--basedir='${EROOT}/usr'"
+		"--datadir='${MY_DATADIR}'"
+		"--tmpdir='${MYSQL_TMPDIR}'"
+		"--log-error='${mysql_install_log}'"
+		"--user=${MYSQL_USER}"
+	)
+
+	einfo "Initializing ${PN} data directory: ${cmd[@]}"
+	eval "${cmd[@]}" >>"${mysql_install_log}" 2>&1
+
+	if [[ $? -ne 0 || ! -f "${MY_DATADIR}/mysql.ibd" ]] ; then
+		grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_install_log}" 1>&2
+		die "Failed to initialize ${PN} data directory. Please review '${mysql_install_log}'!"
+	fi
+
+	rm "${tz_sql}" || die
+
+	local x=${RANDOM}
+	local socket="${EROOT}${PID_DIR}/mysqld${x}.sock"
+	local pidfile="${EROOT}${PID_DIR}/mysqld${x}.pid"
+	unset x
+
+	cmd=(
+		"${mysqld_binary}"
+		"${mysqld_options[@]}"
+		"--basedir='${EROOT}/usr'"
+		"--datadir='${MY_DATADIR}'"
+		"--tmpdir='${MYSQL_TMPDIR}'"
+		--max_allowed_packet=8M
+		--net_buffer_length=16K
+		"--socket='${socket}'"
+		"--pid-file='${pidfile}'"
+		"--log-error='${mysqld_logfile}'"
+		"--user=${MYSQL_USER}"
+	)
+
+	einfo "Starting mysqld to finalize initialization: ${cmd[@]}"
+	eval "${cmd[@]}" >>"${mysqld_logfile}" 2>&1 &
+
+	echo -n "Waiting for mysqld to accept connections "
+	local maxtry=15
+	while [[ ! -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+		maxtry=$((${maxtry}-1))
+		echo -n "."
+		sleep 1
+	done
+
+	if [[ -S "${socket}" ]] ; then
+		# Even with a socket we don't know if mysqld will abort
+		# start due to an error so just wait a little bit more...
+		maxtry=5
+		while [[ -S "${socket}" && "${maxtry}" -gt 1 ]] ; do
+			maxtry=$((${maxtry}-1))
+			echo -n "."
+			sleep 1
+		done
+	fi
+
+	echo
+
+	if [[ ! -S "${socket}" ]] ; then
+		grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysqld_logfile}" 1>&2
+		die "mysqld was unable to start from initialized data directory. Please review '${mysqld_logfile}'!"
+	fi
+
+	local mysql_logfile="${TMPDIR}/set_root_pw.log"
+	touch "${mysql_logfile}" || die
+
+	ebegin "Setting root password"
+	# Do this from memory, as we don't want clear text passwords in temp files
+	local sql="ALTER USER 'root'@'localhost' IDENTIFIED BY '${MYSQL_ROOT_PASSWORD}'"
+	cmd=(
+		"${mysql_binary}"
+		--no-defaults
+		"--socket='${socket}'"
+		-hlocalhost
+		"-e \"${sql}\""
+	)
+	eval "${cmd[@]}" >"${mysql_logfile}" 2>&1
+	local rc=$?
+	eend ${rc}
+
+	if [[ ${rc} -ne 0 ]] ; then
+		# Poor man's solution which tries to avoid having password
+		# in log.  NOTE: sed can fail if user didn't follow advice
+		# and included character which will require escaping...
+		sed -i -e "s/${MYSQL_ROOT_PASSWORD}/*****/" "${mysql_logfile}" 2>/dev/null
+
+		grep -B5 -A999 -iE "(Aborting|ERROR|errno)" "${mysql_logfile}"
+		die "Failed to set ${PN} root password. Please review '${mysql_logfile}'!"
+	fi
+
+	# Stop the server
+	if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+		echo -n "Stopping the server "
+		pkill -F "${pidfile}" &>/dev/null
+
+		maxtry=10
+		while [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; do
+			maxtry=$((${maxtry}-1))
+			echo -n "."
+			sleep 1
+		done
+
+		echo
+
+		if [[ -f "${pidfile}" ]] && pgrep -F "${pidfile}" &>/dev/null ; then
+			# We somehow failed to stop server.
+			# However, not a fatal error. Just warn the user.
+			ewarn "WARNING: mysqld[$(cat "${pidfile}")] is still running!"
+		fi
+	fi
+
+	einfo "${PN} data directory at '${MY_DATADIR}' successfully initialized!"
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-24 18:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-17 22:50 [gentoo-commits] repo/gentoo:master commit in: dev-db/mysql/files/, dev-db/mysql/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-04-24 18:18 Sam James
2019-08-30 16:08 Brian Evans
2019-08-02 16:04 Thomas Deutschmann
2018-04-22  1:10 Brian Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox