Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Wed, 28 Feb 2018 16:24:42
Message-Id: 1519835068.17251d326c5c1dc501d74bc23134aa504d78ff68.grknight@gentoo
1 commit: 17251d326c5c1dc501d74bc23134aa504d78ff68
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 28 16:23:12 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 28 16:24:28 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17251d32
7
8 dev-db/mariadb: New version for 10.3.5 RC; dropped keywords
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6
11
12 dev-db/mariadb/Manifest | 2 +
13 dev-db/mariadb/mariadb-10.3.5_rc.ebuild | 1001 +++++++++++++++++++++++++++++++
14 dev-db/mariadb/metadata.xml | 1 +
15 3 files changed, 1004 insertions(+)
16
17 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
18 index 543b842b461..7d6cd5d9e46 100644
19 --- a/dev-db/mariadb/Manifest
20 +++ b/dev-db/mariadb/Manifest
21 @@ -10,6 +10,7 @@ DIST mariadb-10.1.31.tar.gz 67982786 BLAKE2B 1fabbea67345024157be4be34a50c4e9c73
22 DIST mariadb-10.2.10.tar.gz 72388999 BLAKE2B 8d9188672b9250d47859fb0c050eb22b31b99046cf70aac334e26bc34759a73f1f4ab60c5d0437e113e21b213492202d5b5950337ba09590308bbb2bb9179581 SHA512 39c198009f8b19f4a08226ef9842b50e24636580b67c1c92d59c61cce3aa1edbd466e253c281dfcdfc58ab573ae9a59aaacb0ce3e8b82222043ddd849fc3e239
23 DIST mariadb-10.2.11.tar.gz 72772830 BLAKE2B b3cd346ed1e032ed61e4499e1e6fb2adb0f0e959c296917fb55240922904872cb5d7836be8ee0ed744a753d1ae6310e537f4366209e0ce0627073b68076fe2d7 SHA512 4041ee1f1e266e8b30f85b19c5c95bcb626f965df9e0e20eb801598cc7fc5f5f37906e8a75cc86d373aa642adcccf3b75a0e67994e18908fb733cc6520d04a44
24 DIST mariadb-10.2.12.tar.gz 72818636 BLAKE2B 50a72b8096ae8bd5dc635352fc35d22322a0d7cf415e45883898307050ec547a79c66d51ab0ce311f1895eb178afeb49664fb434af77f9ff2b9aedef0aea85bc SHA512 8d3d3c84d4a01d6047e4f2b6802eb802e1f6a7b0e10e981c7ef9fdd27a5a25baab0af47a21b8637f4cbb9d21ef3bcc85097c5fdb8745c2a79040ab87fecb5a7b
25 +DIST mariadb-10.3.5.tar.gz 70945381 BLAKE2B 10f5f08a64b3d046f8255a5ea9bb1661b7a88d130b0a89b41c8f98abbe3c04cc13154e1ad6c012ef97a396f055ca5d748998f1e7d6dc89ca73a3b61f70749457 SHA512 e7f2ffd38da4e4dbd214bc97e30216682b6f8ca368bcbd5717fb408a6110f26da4472cd7ac0d288c817eb9c6426a063cff8d582e03fe8a1219c0d70508e5a004
26 DIST mariadb-5.5.58.tar.gz 45784323 BLAKE2B 57c51cf2e4574259acabb676c9aead1adfbaa0fe5cade08a41d6896089c27d401dab67598d58a00be44fe30f18d0c2252f3e4208c51508c7a20f0e5689cccf15 SHA512 c5c8b52c613a1a3f30de2cd1d8e390f8110b0891af78ee2a24ef2c4b7b8c5f2e140970ca89865e8277e7486dbfd0ad01c1fdbf8791c67a9793392247d68fec63
27 DIST mariadb-5.5.59.tar.gz 45804920 BLAKE2B e24792cb5427e2c3254e83cfa355b8cf4350bc488b2477daa4ef4ee41d3c33c7d0b124eb9a615ccbccec693313fd83e3f13f633cc08ea725b78b179cc813f809 SHA512 facebe62cb9b55518fe669b65f939974aa33c308983c4c3ab6897fb500ec10aa407489e936e56d1269ea5e533655c4be8d0b5d78b3eeb3882ce1b96113a66afe
28 DIST mysql-extras-20160721-1526Z.tar.bz2 301788 BLAKE2B 23ef75d0122e9e18382f708a86c61624e0437fad593b7f02ccb2b3939d710404e18e3b70617ed400e5f6947d3a92d2867a5f7d98bf61597442e99989f60ca4f7 SHA512 c7450039780e4e2684c932ba7c291c1de25dd1a64e4c6e88aa13b790768b4100955f36ae4a3bf983569ea23b43be02da6dad3d5985c1163ec9e8aa91f0efd85d
29 @@ -18,3 +19,4 @@ DIST mysql-extras-20170316-1355Z.tar.bz2 308933 BLAKE2B e515f5926a0cbba86fdaaa92
30 DIST mysql-extras-20170830-1210Z.tar.bz2 312079 BLAKE2B 821451c88ee812d6debed56f62102824370568999d16a469830c3ed84e9eb1aec7f823c8a422db60c9a74d20f19581178fc06ee0a483a6ea31ef408a882a8db6 SHA512 55553de3bb93b09c29ff411c135ff2762edad3498d9e8fb844df349ce8ab864969668f2bbc3ba99e2217cc20f1c9155443794c301ca064d09a1b45ddead567c8
31 DIST mysql-extras-20170926-1321Z.tar.bz2 312466 BLAKE2B 3e3e19a905961570cea9c1eb14dec3780da80409e996b1aeddb08625da875f5d08798a862cb1b80566b0d8be0d9ec2aab0a390ca90f991203c9871538b11f00a SHA512 556e782ccc40d8cffb2fde8c46038c90023440c07785ec667f898afdb8c802faeb4dbfe8b3918a1e563b46d1dc8c0de1172f7843ce08ee1ded435b344f8f0cf5
32 DIST mysql-extras-20180209-2142Z.tar.bz2 315130 BLAKE2B 4e3b1de9fdbb455f318962dabb4867e1f987fc5e921c9184171d0cca2176306c0153b17d600db809d5f25405edd52079873071ff5fda94fe1ea6f840c575f87e SHA512 d750020428bfff81a4275d92bb19a22804e6f4a3f60153d1fc8a31df40491f4b52d534c6123d2862737443e91d4b76741c7ec8c2aaac17eba481301243718107
33 +DIST mysql-extras-20180228-1611Z.tar.bz2 317225 BLAKE2B c13eefecbb5518b96390d18c1acdd5d0ee2c74d95952713d3efd047075a5164d45d4792bb4104043333278a93fddb1540443e252a82070d245972640ae7b1dd1 SHA512 cc2b940f3e7a3b988e38fdd8ae54206bf52a489d999a07e65413e042c2fc584f2901b5fca5668ed849eac3e1e70a271a0090efc463c0e99d902dff14aed0294f
34
35 diff --git a/dev-db/mariadb/mariadb-10.3.5_rc.ebuild b/dev-db/mariadb/mariadb-10.3.5_rc.ebuild
36 new file mode 100644
37 index 00000000000..40344139f09
38 --- /dev/null
39 +++ b/dev-db/mariadb/mariadb-10.3.5_rc.ebuild
40 @@ -0,0 +1,1001 @@
41 +# Copyright 1999-2018 Gentoo Foundation
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI="6"
45 +MY_EXTRAS_VER="20180228-1611Z"
46 +SUBSLOT="18"
47 +
48 +JAVA_PKG_OPT_USE="jdbc"
49 +
50 +# Keeping eutils in EAPI=6 for emktemp in pkg_config
51 +
52 +inherit eutils systemd flag-o-matic prefix toolchain-funcs \
53 + java-pkg-opt-2 user cmake-utils multilib-minimal
54 +
55 +SRC_URI="https://downloads.mariadb.org/interstitial/${P/_rc/}/source/${P/_rc/}.tar.gz "
56 +
57 +# Gentoo patches to MySQL
58 +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
59 + SRC_URI="${SRC_URI}
60 + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
61 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
62 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
63 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
64 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
65 +fi
66 +
67 +HOMEPAGE="http://mariadb.org/"
68 +DESCRIPTION="An enhanced, drop-in replacement for MySQL"
69 +LICENSE="GPL-2 LGPL-2.1+"
70 +SLOT="0/${SUBSLOT:-0}"
71 +IUSE="+backup bindist client-libs cracklib debug extraengine galera innodb-lz4
72 + innodb-lzo innodb-snappy jdbc jemalloc kerberos latin1 libressl mroonga
73 + numa odbc oqgraph pam +perl profiling rocksdb selinux +server sphinx
74 + sst-rsync sst-mariabackup sst-xtrabackup static static-libs systemd systemtap tcmalloc
75 + test tokudb xml yassl"
76 +
77 +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
78 +RESTRICT="!bindist? ( bindist ) libressl? ( test )"
79 +
80 +REQUIRED_USE="jdbc? ( extraengine server !static )
81 + server? ( tokudb? ( jemalloc !tcmalloc ) )
82 + !server? ( !extraengine )
83 + ?? ( tcmalloc jemalloc )
84 + static? ( yassl !pam )"
85 +
86 +# REMEMBER: also update eclass/mysql*.eclass before committing!
87 +KEYWORDS="~amd64 ~x86"
88 +
89 +# Shorten the path because the socket path length must be shorter than 107 chars
90 +# and we will run a mysql server during test phase
91 +S="${WORKDIR}/mysql"
92 +
93 +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
94 + MY_PATCH_DIR="${WORKDIR}/mysql-extras"
95 +else
96 + MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
97 +fi
98 +
99 +PATCHES=(
100 + "${MY_PATCH_DIR}"/20015_all_mariadb-pkgconfig-location.patch
101 + "${MY_PATCH_DIR}"/20018_all_mariadb-10.2.9-without-clientlibs-tools.patch
102 + "${MY_PATCH_DIR}"/20024_all_mariadb-10.2.6-mysql_st-regression.patch
103 + "${MY_PATCH_DIR}"/20025_all_mariadb-10.2.6-gssapi-detect.patch
104 +)
105 +
106 +# Be warned, *DEPEND are version-dependant
107 +# These are used for both runtime and compiletime
108 +# MULTILIB_USEDEP only set for libraries used by the client library
109 +COMMON_DEPEND="
110 + kernel_linux? (
111 + sys-process/procps:0=
112 + dev-libs/libaio:0=
113 + )
114 + >=sys-apps/sed-4
115 + >=sys-apps/texinfo-4.7-r1
116 + jemalloc? ( dev-libs/jemalloc:0= )
117 + tcmalloc? ( dev-util/google-perftools:0= )
118 + systemtap? ( >=dev-util/systemtap-1.3:0= )
119 + !yassl? (
120 + !libressl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
121 + libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
122 + )
123 + >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
124 + sys-libs/ncurses:0=
125 + mroonga? ( app-text/groonga-normalizer-mysql )
126 + kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
127 + !bindist? (
128 + sys-libs/binutils-libs:0=
129 + >=sys-libs/readline-4.1:0=
130 + )
131 + server? (
132 + backup? ( app-arch/libarchive:0= )
133 + cracklib? ( sys-libs/cracklib:0= )
134 + extraengine? (
135 + odbc? ( dev-db/unixODBC:0= )
136 + xml? ( dev-libs/libxml2:2= )
137 + )
138 + innodb-lz4? ( app-arch/lz4 )
139 + innodb-lzo? ( dev-libs/lzo )
140 + innodb-snappy? ( app-arch/snappy )
141 + numa? ( sys-process/numactl )
142 + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
143 + pam? ( virtual/pam:0= )
144 + systemd? ( sys-apps/systemd:= )
145 + tokudb? ( app-arch/snappy )
146 + )
147 + >=dev-libs/libpcre-8.41-r1:3=
148 +"
149 +DEPEND="virtual/yacc
150 + static? ( sys-libs/ncurses[static-libs] )
151 + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
152 + server? ( extraengine? ( jdbc? ( >=virtual/jdk-1.6 ) ) )
153 + ${COMMON_DEPEND}"
154 +RDEPEND="selinux? ( sec-policy/selinux-mysql )
155 + abi_x86_32? ( !app-emulation/emul-linux-x86-db[-abi_x86_32(-)] )
156 + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
157 + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
158 + server? ( !prefix? ( dev-db/mysql-init-scripts ) )
159 + !<virtual/mysql-5.6-r11
160 + ${COMMON_DEPEND}
161 + server? ( galera? (
162 + sys-apps/iproute2
163 + =sys-cluster/galera-25*
164 + sst-rsync? ( sys-process/lsof )
165 + sst-mariabackup? ( net-misc/socat[ssl] )
166 + sst-xtrabackup? ( net-misc/socat[ssl] )
167 + ) )
168 + perl? ( !dev-db/mytop
169 + virtual/perl-Getopt-Long
170 + dev-perl/TermReadKey
171 + virtual/perl-Term-ANSIColor
172 + virtual/perl-Time-HiRes )
173 + server? ( extraengine? ( jdbc? ( >=virtual/jre-1.6 ) ) )
174 +"
175 +# For other stuff to bring us in
176 +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
177 +# xtrabackup-bin causes a circular dependency if DBD-mysql is not already installed
178 +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )
179 + !client-libs? ( dev-db/mariadb-connector-c dev-db/mysql-connector-c )
180 + server? ( ~virtual/mysql-5.6[static=]
181 + galera? ( sst-xtrabackup? ( || ( >=dev-db/xtrabackup-bin-2.2.4 dev-db/percona-xtrabackup ) ) ) )"
182 +
183 +pkg_setup() {
184 + if [[ ${MERGE_TYPE} != binary ]] ; then
185 + local GCC_MAJOR_SET=$(gcc-major-version)
186 + local GCC_MINOR_SET=$(gcc-minor-version)
187 + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
188 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
189 + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
190 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
191 + die
192 + fi
193 + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
194 + # non x86{,_64} arches
195 + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
196 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
197 + eerror "${PN} needs to be built with gcc-4.7 or later."
198 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
199 + die
200 + fi
201 + fi
202 + java-pkg-opt-2_pkg_setup
203 + if has test ${FEATURES} && \
204 + use server && ! has userpriv ${FEATURES} ; then
205 + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
206 + fi
207 +
208 + # This should come after all of the die statements
209 + enewgroup mysql 60 || die "problem adding 'mysql' group"
210 + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
211 +}
212 +
213 +pkg_preinst() {
214 + java-pkg-opt-2_pkg_preinst
215 +
216 + # Here we need to see if the implementation switched client libraries
217 + # We check if this is a new instance of the package and a client library already exists
218 + local SHOW_ABI_MESSAGE libpath
219 + if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
220 + libpath=$(readlink "${EROOT}usr/$(get_libdir)/libmysqlclient.so")
221 + elog "Due to ABI changes when switching between different client libraries,"
222 + elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
223 + elog "Please run: revdep-rebuild --library ${libpath}"
224 + ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
225 + fi
226 +}
227 +
228 +pkg_postinst() {
229 + # Make sure the vars are correctly initialized
230 + mysql_init_vars
231 +
232 + # Create log directory securely if it does not exist
233 + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
234 +
235 + if use server ; then
236 + if use pam; then
237 + einfo
238 + elog "This install includes the PAM authentication plugin."
239 + elog "To activate and configure the PAM plugin, please read:"
240 + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
241 + einfo
242 + fi
243 +
244 + if [[ -z "${REPLACING_VERSIONS}" ]] ; then
245 + einfo
246 + elog "You might want to run:"
247 + elog "\"emerge --config =${CATEGORY}/${PF}\""
248 + elog "if this is a new install."
249 + elog
250 + elog "If you are switching server implentations, you should run the"
251 + elog "mysql_upgrade tool."
252 + einfo
253 + else
254 + einfo
255 + elog "If you are upgrading major versions, you should run the"
256 + elog "mysql_upgrade tool."
257 + einfo
258 + fi
259 +
260 + if use galera ; then
261 + einfo
262 + elog "Be sure to edit the my.cnf file to activate your cluster settings."
263 + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
264 + elog "The first time the cluster is activated, you should add"
265 + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
266 + elog "This option should then be removed for subsequent starts."
267 + einfo
268 + fi
269 + fi
270 +
271 + # Note about configuration change
272 + einfo
273 + elog "This version of mariadb reorganizes the configuration from a single my.cnf"
274 + elog "to several files in /etc/mysql/${PN}.d."
275 + elog "Please backup any changes you made to /etc/mysql/my.cnf"
276 + elog "and add them as a new file under /etc/mysql/${PN}.d with a .cnf extension."
277 + elog "You may have as many files as needed and they are read alphabetically."
278 + elog "Be sure the options have the appropitate section headers, i.e. [mysqld]."
279 + einfo
280 +}
281 +
282 +src_unpack() {
283 +
284 + # Initialize the proper variables first
285 + mysql_init_vars
286 +
287 + unpack ${A}
288 + # Grab the patches
289 + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
290 +
291 + mv -f "${WORKDIR}/${P/_rc/}" "${S}" || die
292 +}
293 +
294 +src_prepare() {
295 + java-pkg-opt-2_src_prepare
296 + if use tcmalloc; then
297 + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
298 + fi
299 +
300 + # Don't build bundled xz-utils for tokudb
301 + echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
302 + sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
303 + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
304 +
305 + # Remove the bundled groonga
306 + # There is no CMake flag, it simply checks for existance
307 + rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
308 +
309 + cmake-utils_src_prepare
310 +}
311 +
312 +src_configure(){
313 + # bug 508724 mariadb cannot use ld.gold
314 + tc-ld-disable-gold
315 + # Bug #114895, bug #110149
316 + filter-flags "-O" "-O[01]"
317 +
318 + append-cxxflags -felide-constructors
319 +
320 + # bug #283926, with GCC4.4, this is required to get correct behavior.
321 + append-flags -fno-strict-aliasing
322 +
323 + multilib-minimal_src_configure
324 +}
325 +
326 +multilib_src_configure() {
327 + debug-print-function ${FUNCNAME} "$@"
328 +
329 + if ! multilib_is_native_abi && ! use client-libs ; then
330 + return
331 + fi
332 +
333 + CMAKE_BUILD_TYPE="RelWithDebInfo"
334 +
335 + # debug hack wrt #497532
336 + mycmakeargs=(
337 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
338 + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
339 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
340 + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
341 + -DSYSCONFDIR="${EPREFIX}/etc/mysql"
342 + -DINSTALL_BINDIR=bin
343 + -DINSTALL_DOCDIR=share/doc/${PF}
344 + -DINSTALL_DOCREADMEDIR=share/doc/${PF}
345 + -DINSTALL_INCLUDEDIR=include/mysql
346 + -DINSTALL_INFODIR=share/info
347 + -DINSTALL_LIBDIR=$(get_libdir)
348 + -DINSTALL_MANDIR=share/man
349 + -DINSTALL_MYSQLSHAREDIR=share/mariadb
350 + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
351 + -DINSTALL_SCRIPTDIR=share/mariadb/scripts
352 + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
353 + -DINSTALL_SBINDIR=sbin
354 + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
355 + -DWITH_COMMENT="Gentoo Linux ${PF}"
356 + -DWITH_UNIT_TESTS=$(usex test ON OFF)
357 + -DWITH_LIBEDIT=0
358 + -DWITH_ZLIB=system
359 + -DWITHOUT_LIBWRAP=1
360 + -DENABLED_LOCAL_INFILE=1
361 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
362 + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
363 + -DWITH_DEFAULT_COMPILER_OPTIONS=0
364 + -DWITH_DEFAULT_FEATURE_SET=0
365 + -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
366 + -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
367 + # The build forces this to be defined when cross-compiling. We pass it
368 + # all the time for simplicity and to make sure it is actually correct.
369 + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
370 + -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
371 + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
372 + -DAUTH_GSSAPI_PLUGIN_TYPE=$(usex kerberos DYNAMIC OFF)
373 + -DCONC_WITH_EXTERNAL_ZLIB=YES
374 + -DWITH_EXTERNAL_ZLIB=YES
375 + -DSUFFIX_INSTALL_DIR=""
376 + -DWITH_UNITTEST=OFF
377 + )
378 + if use test ; then
379 + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
380 + else
381 + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
382 + fi
383 +
384 + if ! use yassl ; then
385 + mycmakeargs+=( -DWITH_SSL=system )
386 + else
387 + mycmakeargs+=( -DWITH_SSL=bundled )
388 + fi
389 +
390 + if ! use client-libs ; then
391 + mycmakeargs+=( -DWITHOUT_CLIENTLIBS=YES )
392 + fi
393 +
394 + # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
395 + # systemtap only works on native ABI bug 530132
396 + if multilib_is_native_abi; then
397 + mycmakeargs+=(
398 + -DWITH_READLINE=$(usex bindist 1 0)
399 + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
400 + -DENABLE_DTRACE=$(usex systemtap)
401 + )
402 + else
403 + mycmakeargs+=(
404 + -DWITHOUT_TOOLS=1
405 + -DWITH_READLINE=1
406 + -DNOT_FOR_DISTRIBUTION=0
407 + -DENABLE_DTRACE=0
408 + )
409 + fi
410 +
411 + if multilib_is_native_abi && use server ; then
412 +
413 + # Federated{,X} must be treated special otherwise they will not be built as plugins
414 + if ! use extraengine ; then
415 + mycmakeargs+=(
416 + -DPLUGIN_FEDERATED=NO
417 + -DPLUGIN_FEDERATEDX=NO )
418 + fi
419 +
420 + mycmakeargs+=(
421 + -DWITH_JEMALLOC=$(usex jemalloc system)
422 + -DWITH_PCRE=system
423 + -DPLUGIN_OQGRAPH=$(usex oqgraph DYNAMIC NO)
424 + -DPLUGIN_SPHINX=$(usex sphinx YES NO)
425 + -DPLUGIN_TOKUDB=$(usex tokudb YES NO)
426 + -DPLUGIN_AUTH_PAM=$(usex pam YES NO)
427 + -DPLUGIN_CRACKLIB_PASSWORD_CHECK=$(usex cracklib YES NO)
428 + -DPLUGIN_CASSANDRA=NO
429 + -DPLUGIN_SEQUENCE=$(usex extraengine YES NO)
430 + -DPLUGIN_SPIDER=$(usex extraengine YES NO)
431 + -DPLUGIN_CONNECT=$(usex extraengine YES NO)
432 + -DCONNECT_WITH_MYSQL=1
433 + -DCONNECT_WITH_LIBXML2=$(usex xml)
434 + -DCONNECT_WITH_ODBC=$(usex odbc)
435 + -DCONNECT_WITH_JDBC=$(usex jdbc)
436 + # Build failure and autodep wrt bug 639144
437 + -DCONNECT_WITH_MONGO=OFF
438 + -DWITH_WSREP=$(usex galera)
439 + -DWITH_INNODB_LZ4=$(usex innodb-lz4 ON OFF)
440 + -DWITH_INNODB_LZO=$(usex innodb-lzo ON OFF)
441 + -DWITH_INNODB_SNAPPY=$(usex innodb-snappy ON OFF)
442 + -DPLUGIN_MROONGA=$(usex mroonga DYNAMIC NO)
443 + -DPLUGIN_AUTH_GSSAPI=$(usex kerberos DYNAMIC NO)
444 + -DWITH_MARIABACKUP=$(usex backup ON OFF)
445 + -DWITH_LIBARCHIVE=$(usex backup ON OFF)
446 + -DINSTALL_SQLBENCHDIR=share/mariadb
447 + -DPLUGIN_ROCKSDB=$(usex rocksdb DYNAMIC NO)
448 + # systemd is only linked to for server notification
449 + -DWITH_SYSTEMD=$(usex systemd yes no)
450 + -DWITH_NUMA=$(usex numa ON OFF)
451 + )
452 +
453 + # Workaround for MDEV-14524
454 + use tokudb && mycmakeargs+=( -DTOKUDB_OK=1 )
455 +
456 + if use test ; then
457 + # This is needed for the new client lib which tests a real, open server
458 + mycmakeargs+=( -DSKIP_TESTS=ON )
459 + fi
460 +
461 + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
462 + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
463 + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
464 + ewarn "You MUST file bugs without these variables set."
465 +
466 + mycmakeargs+=(
467 + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
468 + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
469 + )
470 +
471 + elif ! use latin1 ; then
472 + mycmakeargs+=(
473 + -DDEFAULT_CHARSET=utf8
474 + -DDEFAULT_COLLATION=utf8_general_ci
475 + )
476 + else
477 + mycmakeargs+=(
478 + -DDEFAULT_CHARSET=latin1
479 + -DDEFAULT_COLLATION=latin1_swedish_ci
480 + )
481 + fi
482 + mycmakeargs+=(
483 + -DEXTRA_CHARSETS=all
484 + -DMYSQL_USER=mysql
485 + -DDISABLE_SHARED=$(usex static YES NO)
486 + -DWITH_DEBUG=$(usex debug)
487 + -DWITH_EMBEDDED_SERVER=OFF
488 + -DWITH_PROFILING=$(usex profiling)
489 + )
490 +
491 + if use static; then
492 + mycmakeargs+=( -DWITH_PIC=1 )
493 + fi
494 +
495 + if use jemalloc || use tcmalloc ; then
496 + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
497 + fi
498 +
499 + # Storage engines
500 + mycmakeargs+=(
501 + -DWITH_ARCHIVE_STORAGE_ENGINE=1
502 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1
503 + -DWITH_CSV_STORAGE_ENGINE=1
504 + -DWITH_HEAP_STORAGE_ENGINE=1
505 + -DWITH_INNOBASE_STORAGE_ENGINE=1
506 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1
507 + -DWITH_MYISAM_STORAGE_ENGINE=1
508 + -DWITH_PARTITION_STORAGE_ENGINE=1
509 + )
510 +
511 + else
512 + mycmakeargs+=(
513 + -DWITHOUT_SERVER=1
514 + -DWITH_EMBEDDED_SERVER=OFF
515 + -DEXTRA_CHARSETS=none
516 + -DINSTALL_SQLBENCHDIR=
517 + -DWITH_SYSTEMD=no
518 + )
519 + fi
520 +
521 + cmake-utils_src_configure
522 +}
523 +
524 +src_compile() {
525 + multilib-minimal_src_compile
526 +}
527 +
528 +multilib_src_compile() {
529 + if ! multilib_is_native_abi && ! use client-libs ; then
530 + return
531 + fi
532 +
533 + cmake-utils_src_compile
534 +}
535 +
536 +src_install() {
537 + local MULTILIB_WRAPPED_HEADERS
538 + local MULTILIB_CHOST_TOOLS
539 + if use client-libs ; then
540 + # headers with ABI specific data
541 + MULTILIB_WRAPPED_HEADERS=(
542 + /usr/include/mysql/server/my_config.h
543 + /usr/include/mysql/server/private/embedded_priv.h
544 + /usr/include/mysql/server/mysql_version.h
545 + /usr/include/mariadb/mariadb_version.h
546 + /usr/include/mysql/mariadb_version.h
547 + /usr/include/mysql/server/private/probes_mysql_nodtrace.h
548 + /usr/include/mysql/server/private/probes_mysql_dtrace.h )
549 +
550 + # wrap the config scripts
551 + MULTILIB_CHOST_TOOLS=( /usr/bin/mariadb_config /usr/bin/mysql_config )
552 + fi
553 + multilib-minimal_src_install
554 +}
555 +
556 +# Intentionally override eclass function
557 +multilib_src_install() {
558 + if ! multilib_is_native_abi && ! use client-libs ; then
559 + return
560 + fi
561 +
562 + cmake-utils_src_install
563 +
564 + if ! use client-libs ; then
565 + return
566 + fi
567 +
568 + # Make sure the vars are correctly initialized
569 + mysql_init_vars
570 +
571 + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
572 + if [[ -f "${D}/usr/include/mysql/server/private/config.h" ]] ; then
573 + rm "${D}/usr/include/mysql/server/private/config.h" || die
574 + fi
575 +
576 + if ! multilib_is_native_abi && use server ; then
577 + insinto /usr/include/mysql/server/private
578 + doins "${S}"/sql/*.h
579 + fi
580 +
581 + # Install compatible symlinks to libmysqlclient
582 +# use static-libs && dosym libmariadbclient.a "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.a"
583 +# dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so"
584 + dosym libmariadb.so.3 "${EPREFIX}/usr/$(get_libdir)/libmysqlclient.so.${SUBSLOT}"
585 +
586 + # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
587 + find "${D}" -name 'libmysqlclient_r.*' -type l -delete || die
588 +}
589 +
590 +multilib_src_install_all() {
591 + # Make sure the vars are correctly initialized
592 + mysql_init_vars
593 +
594 + # Convenience links
595 + einfo "Making Convenience links for mysqlcheck multi-call binary"
596 + dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
597 + dosym "mysqlcheck" "/usr/bin/mysqlrepair"
598 + dosym "mysqlcheck" "/usr/bin/mysqloptimize"
599 +
600 + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
601 + if [[ -d "${ED}/usr/data" ]] ; then
602 + rm -Rf "${ED}/usr/data" || die
603 + fi
604 +
605 + # Unless they explicitly specific USE=test, then do not install the
606 + # testsuite. It DOES have a use to be installed, esp. when you want to do a
607 + # validation of your database configuration after tuning it.
608 + if ! use test ; then
609 + rm -rf "${D}/${MY_SHAREDSTATEDIR}/mysql-test"
610 + fi
611 +
612 + # Configuration stuff
613 + einfo "Building default configuration ..."
614 + insinto "${MY_SYSCONFDIR#${EPREFIX}}"
615 + [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
616 + cp "${FILESDIR}/my.cnf-10.2" "${TMPDIR}/my.cnf" || die
617 + eprefixify "${TMPDIR}/my.cnf"
618 + doins "${TMPDIR}/my.cnf"
619 + insinto "${MY_SYSCONFDIR#${EPREFIX}}/mariadb.d"
620 + cp "${FILESDIR}/my.cnf.distro-client" "${TMPDIR}/50-distro-client.cnf" || die
621 + eprefixify "${TMPDIR}/50-distro-client.cnf"
622 + doins "${TMPDIR}/50-distro-client.cnf"
623 +
624 + if use server ; then
625 + mycnf_src="my.cnf.distro-server"
626 + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
627 + "${FILESDIR}/${mycnf_src}" \
628 + > "${TMPDIR}/my.cnf.ok" || die
629 + if use prefix ; then
630 + sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' \
631 + "${TMPDIR}/my.cnf.ok" || die
632 + fi
633 + if use latin1 ; then
634 + sed -i \
635 + -e "/character-set/s|utf8|latin1|g" \
636 + "${TMPDIR}/my.cnf.ok" || die
637 + fi
638 + eprefixify "${TMPDIR}/my.cnf.ok"
639 + newins "${TMPDIR}/my.cnf.ok" 50-distro-server.cnf
640 +
641 + einfo "Including support files and sample configurations"
642 + docinto "support-files"
643 + local script
644 + for script in \
645 + "${S}"/support-files/magic
646 + do
647 + [[ -f "$script" ]] && dodoc "${script}"
648 + done
649 +
650 + docinto "scripts"
651 + for script in "${S}"/scripts/mysql* ; do
652 + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
653 + done
654 + fi
655 +
656 + #Remove mytop if perl is not selected
657 + [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
658 +}
659 +
660 +# Official test instructions:
661 +# USE='extraengine perl server static-libs' \
662 +# FEATURES='test userpriv -usersandbox' \
663 +# ebuild mariadb-X.X.XX.ebuild \
664 +# digest clean package
665 +multilib_src_test() {
666 +
667 + if ! multilib_is_native_abi ; then
668 + einfo "Server tests not available on non-native abi".
669 + return 0;
670 + fi
671 +
672 + _disable_test() {
673 + local rawtestname reason
674 + rawtestname="${1}" ; shift
675 + reason="${@}"
676 + ewarn "test '${rawtestname}' disabled: '${reason}'"
677 + echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
678 + }
679 +
680 + local TESTDIR="${BUILD_DIR}/mysql-test"
681 + local retstatus_unit
682 + local retstatus_tests
683 +
684 + if ! use server ; then
685 + einfo "Skipping server tests due to minimal build."
686 + return 0
687 + fi
688 +
689 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
690 + # localhost. Also causes weird failures.
691 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
692 +
693 + if [[ $UID -eq 0 ]]; then
694 + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
695 + fi
696 + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
697 +
698 + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
699 +
700 + # Run CTest (test-units)
701 + cmake-utils_src_test
702 + retstatus_unit=$?
703 +
704 + # Ensure that parallel runs don't die
705 + export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
706 + # Enable parallel testing, auto will try to detect number of cores
707 + # You may set this by hand.
708 + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
709 + export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
710 +
711 + # create directories because mysqladmin might run out of order
712 + mkdir -p "${T}"/var-tests{,/log} || die
713 +
714 + # Run mysql tests
715 + pushd "${TESTDIR}" > /dev/null || die
716 +
717 + touch "${T}/disabled.def"
718 + # These are failing in MariaDB 10.0 for now and are believed to be
719 + # false positives:
720 + #
721 + # main.mysql_client_test, main.mysql_client_test_nonblock
722 + # main.mysql_client_test_comp:
723 + # segfaults at random under Portage only, suspect resource limits.
724 +
725 + local t
726 + for t in plugins.cracklib_password_check plugins.two_password_validations ; do
727 + _disable_test "$t" "False positive due to varying policies"
728 + done
729 +
730 + for t in main.mysql_client_test main.mysql_client_test_nonblock \
731 + main.mysql_client_test_comp rpl.rpl_extra_col_master_myisam ; do
732 + _disable_test "$t" "False positives in Gentoo"
733 + done
734 +
735 + # run mysql-test tests
736 + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
737 + retstatus_tests=$?
738 +
739 + popd > /dev/null || die
740 +
741 + # Cleanup is important for these testcases.
742 + pkill -9 -f "${S}/ndb" 2>/dev/null
743 + pkill -9 -f "${S}/sql" 2>/dev/null
744 +
745 + local failures=""
746 + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
747 + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
748 +
749 + [[ -z "$failures" ]] || die "Test failures: $failures"
750 + einfo "Tests successfully completed"
751 +}
752 +
753 +mysql_init_vars() {
754 + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
755 + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
756 + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
757 + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
758 +
759 + if [[ -z "${MY_DATADIR}" ]] ; then
760 + MY_DATADIR=""
761 + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
762 + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
763 + | sed -ne '/datadir/s|^--datadir=||p' \
764 + | tail -n1`
765 + if [[ -z "${MY_DATADIR}" ]] ; then
766 + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
767 + | sed -e 's/.*=\s*//' \
768 + | tail -n1`
769 + fi
770 + fi
771 + if [[ -z "${MY_DATADIR}" ]] ; then
772 + MY_DATADIR="${MY_LOCALSTATEDIR}"
773 + einfo "Using default MY_DATADIR"
774 + fi
775 + elog "MySQL MY_DATADIR is ${MY_DATADIR}"
776 +
777 + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
778 + if [[ -e "${MY_DATADIR}" ]] ; then
779 + # If you get this and you're wondering about it, see bug #207636
780 + elog "MySQL datadir found in ${MY_DATADIR}"
781 + elog "A new one will not be created."
782 + PREVIOUS_DATADIR="yes"
783 + else
784 + PREVIOUS_DATADIR="no"
785 + fi
786 + export PREVIOUS_DATADIR
787 + fi
788 + else
789 + if [[ ${EBUILD_PHASE} == "config" ]]; then
790 + local new_MY_DATADIR
791 + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
792 + | sed -ne '/datadir/s|^--datadir=||p' \
793 + | tail -n1`
794 +
795 + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
796 + ewarn "MySQL MY_DATADIR has changed"
797 + ewarn "from ${MY_DATADIR}"
798 + ewarn "to ${new_MY_DATADIR}"
799 + MY_DATADIR="${new_MY_DATADIR}"
800 + fi
801 + fi
802 + fi
803 +
804 + export MY_SHAREDSTATEDIR MY_SYSCONFDIR
805 + export MY_LOCALSTATEDIR MY_LOGDIR
806 + export MY_DATADIR
807 +}
808 +
809 +pkg_config() {
810 + _getoptval() {
811 + local mypd="${EROOT}"/usr/bin/my_print_defaults
812 + local section="$1"
813 + local flag="--${2}="
814 + local extra_options="${3}"
815 + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
816 + }
817 + local old_MY_DATADIR="${MY_DATADIR}"
818 + local old_HOME="${HOME}"
819 + # my_print_defaults needs to read stuff in $HOME/.my.cnf
820 + export HOME=${EPREFIX}/root
821 +
822 + # Make sure the vars are correctly initialized
823 + mysql_init_vars
824 +
825 + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
826 + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
827 + die "Minimal builds do NOT include the MySQL server"
828 + fi
829 +
830 + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
831 + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
832 + MY_DATADIR_s="${MY_DATADIR_s%%/}"
833 + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
834 + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
835 +
836 + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
837 + if [[ -d "${MY_DATADIR_s}" ]]; then
838 + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
839 + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
840 + else
841 + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
842 + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
843 + || die "Moving MY_DATADIR failed"
844 + fi
845 + else
846 + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
847 + if [[ -d "${MY_DATADIR_s}" ]]; then
848 + ewarn "Attempting to use ${MY_DATADIR_s}"
849 + else
850 + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
851 + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
852 + fi
853 + fi
854 + fi
855 +
856 + local pwd1="a"
857 + local pwd2="b"
858 + local maxtry=15
859 +
860 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
861 + local tmp_mysqld_password_source=
862 +
863 + for tmp_mysqld_password_source in mysql client; do
864 + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
865 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
866 + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
867 + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
868 + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
869 + MYSQL_ROOT_PASSWORD=
870 + continue
871 + fi
872 +
873 + einfo "Found password in '${tmp_mysqld_password_source}' section!"
874 + break
875 + fi
876 + done
877 +
878 + # Sometimes --show is required to display passwords in some implementations of my_print_defaults
879 + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
880 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
881 + fi
882 +
883 + unset tmp_mysqld_password_source
884 + fi
885 + MYSQL_TMPDIR="$(_getoptval '--mysqld' tmpdir)"
886 + # These are dir+prefix
887 + MYSQL_RELAY_LOG="$(_getoptval '--mysqld' relay-log)"
888 + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
889 + MYSQL_LOG_BIN="$(_getoptval '--mysqld' log-bin)"
890 + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
891 +
892 + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
893 + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
894 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
895 + fi
896 + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
897 + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
898 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
899 + fi
900 + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
901 + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
902 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
903 + fi
904 +
905 + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
906 + ewarn "You have already a MySQL database in place."
907 + ewarn "(${ROOT}/${MY_DATADIR}/*)"
908 + ewarn "Please rename or delete it if you wish to replace it."
909 + die "MySQL database already exists!"
910 + fi
911 +
912 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
913 + # localhost. Also causes weird failures.
914 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
915 +
916 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
917 +
918 + einfo "Please provide a password for the mysql 'root' user now"
919 + einfo "or through the ${HOME}/.my.cnf file."
920 + ewarn "Avoid [\"'\\_%] characters in the password"
921 + read -rsp " >" pwd1 ; echo
922 +
923 + einfo "Retype the password"
924 + read -rsp " >" pwd2 ; echo
925 +
926 + if [[ "x$pwd1" != "x$pwd2" ]] ; then
927 + die "Passwords are not the same"
928 + fi
929 + MYSQL_ROOT_PASSWORD="${pwd1}"
930 + unset pwd1 pwd2
931 + fi
932 +
933 + local options
934 + local sqltmp="$(emktemp)"
935 +
936 + # Fix bug 446200. Don't reference host my.cnf, needs to come first,
937 + # see http://bugs.mysql.com/bug.php?id=31312
938 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
939 +
940 + # Figure out which options we need to disable to do the setup
941 + local helpfile="${TMPDIR}/mysqld-help"
942 + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
943 + for opt in grant-tables host-cache name-resolve networking slave-start \
944 + federated ssl log-bin relay-log slow-query-log external-locking \
945 + log-slave-updates \
946 + ; do
947 + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
948 + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
949 + done
950 +
951 + einfo "Creating the mysql database and setting proper permissions on it ..."
952 +
953 + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
954 + PID_DIR="${EROOT}/var/run/mysqld"
955 + if [[ ! -d "${PID_DIR}" ]]; then
956 + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
957 + fi
958 +
959 + if [[ ! -d "${MY_DATADIR}" ]]; then
960 + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
961 + fi
962 +
963 + pushd "${TMPDIR}" &>/dev/null || die
964 +
965 + # Filling timezones, see
966 + # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
967 + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
968 +
969 + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
970 + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
971 + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
972 + einfo "Command: ${cmd[*]}"
973 + su -s /bin/sh -c "${cmd[*]}" mysql \
974 + >"${TMPDIR}"/mysql_install_db.log 2>&1
975 + if [ $? -ne 0 ]; then
976 + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
977 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
978 + fi
979 + popd &>/dev/null || die
980 + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
981 + || die "MySQL databases not installed"
982 +
983 + use prefix || options="${options} --user=mysql"
984 +
985 + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
986 + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
987 + local mysqld="${EROOT}/usr/sbin/mysqld \
988 + ${options} \
989 + --log-warnings=0 \
990 + --basedir=${EROOT}/usr \
991 + --datadir=${ROOT}/${MY_DATADIR} \
992 + --max_allowed_packet=8M \
993 + --net_buffer_length=16K \
994 + --socket=${socket} \
995 + --pid-file=${pidfile}
996 + --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
997 + #einfo "About to start mysqld: ${mysqld}"
998 + ebegin "Starting mysqld"
999 + einfo "Command ${mysqld}"
1000 + ${mysqld} &
1001 + rc=$?
1002 + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1003 + maxtry=$((${maxtry}-1))
1004 + echo -n "."
1005 + sleep 1
1006 + done
1007 + eend $rc
1008 +
1009 + if ! [[ -S "${socket}" ]]; then
1010 + die "Completely failed to start up mysqld with: ${mysqld}"
1011 + fi
1012 +
1013 + ebegin "Setting root password"
1014 + # Do this from memory, as we don't want clear text passwords in temp files
1015 + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
1016 + "${EROOT}/usr/bin/mysql" \
1017 + "--socket=${socket}" \
1018 + -hlocalhost \
1019 + -e "${sql}"
1020 + eend $?
1021 +
1022 + if [[ -n "${sqltmp}" ]] ; then
1023 + ebegin "Loading \"zoneinfo\", this step may require a few seconds"
1024 + "${EROOT}/usr/bin/mysql" \
1025 + "--socket=${socket}" \
1026 + -hlocalhost \
1027 + -uroot \
1028 + --password="${MYSQL_ROOT_PASSWORD}" \
1029 + mysql < "${sqltmp}"
1030 + rc=$?
1031 + eend $?
1032 + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1033 + fi
1034 +
1035 + # Stop the server and cleanup
1036 + einfo "Stopping the server ..."
1037 + kill $(< "${pidfile}" )
1038 + rm -f "${sqltmp}"
1039 + wait %1
1040 + einfo "Done"
1041 +}
1042
1043 diff --git a/dev-db/mariadb/metadata.xml b/dev-db/mariadb/metadata.xml
1044 index 7a863a5e517..dc1b8fcb633 100644
1045 --- a/dev-db/mariadb/metadata.xml
1046 +++ b/dev-db/mariadb/metadata.xml
1047 @@ -7,6 +7,7 @@
1048 </maintainer>
1049 <use>
1050 <flag name="backup">Build mariadb-backup which supports SST and hot backup of InnoDB, Aria and MyISAM including compression and encryption</flag>
1051 + <flag name="client-libs">Build the client libraries from the server package instead of the C Connector packages</flag>
1052 <flag name="cluster">Add support for NDB clustering (deprecated)</flag>
1053 <flag name="community">Enables the community features from upstream.</flag>
1054 <flag name="embedded">Build embedded server (libmysqld)</flag>