Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 09 Apr 2019 14:44:25
Message-Id: 1554820983.3bb2cffb5ada03f00b9e503d71953a42eda43b2a.grknight@gentoo
1 commit: 3bb2cffb5ada03f00b9e503d71953a42eda43b2a
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Tue Apr 9 14:43:03 2019 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 9 14:43:03 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bb2cffb
7
8 eclass: Remove deprecated mysql eclasses
9
10 These are no longer used as the forks have diverged, features changed and became
11 increasingly difficult to maintain
12
13 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
14
15 eclass/mysql-cmake.eclass | 541 -------------------
16 eclass/mysql-multilib-r1.eclass | 1142 ---------------------------------------
17 eclass/mysql-v2.eclass | 915 -------------------------------
18 eclass/mysql_fx.eclass | 321 -----------
19 4 files changed, 2919 deletions(-)
20
21 diff --git a/eclass/mysql-cmake.eclass b/eclass/mysql-cmake.eclass
22 deleted file mode 100644
23 index a3c05a5fa98..00000000000
24 --- a/eclass/mysql-cmake.eclass
25 +++ /dev/null
26 @@ -1,541 +0,0 @@
27 -# Copyright 1999-2019 Gentoo Authors
28 -# Distributed under the terms of the GNU General Public License v2
29 -
30 -# @DEAD
31 -# @ECLASS: mysql-cmake.eclass
32 -# @MAINTAINER:
33 -# Maintainers:
34 -# - MySQL Team <mysql-bugs@g.o>
35 -# - Robin H. Johnson <robbat2@g.o>
36 -# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>
37 -# - Brian Evans <grknight@g.o>
38 -# @BLURB: This eclass provides the support for cmake based mysql releases
39 -# @DESCRIPTION:
40 -# The mysql-cmake.eclass provides the support to build the mysql
41 -# ebuilds using the cmake build system. This eclass provides
42 -# the src_prepare, src_configure, src_compile, and src_install
43 -# phase hooks.
44 -
45 -inherit cmake-utils flag-o-matic multilib prefix eutils toolchain-funcs versionator
46 -
47 -#
48 -# HELPER FUNCTIONS:
49 -#
50 -
51 -# @FUNCTION: mysql_cmake_disable_test
52 -# @DESCRIPTION:
53 -# Helper function to disable specific tests.
54 -mysql-cmake_disable_test() {
55 -
56 - local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir
57 - rawtestname="${1}" ; shift
58 - reason="${@}"
59 - ewarn "test '${rawtestname}' disabled: '${reason}'"
60 -
61 - testsuite="${rawtestname/.*}"
62 - testname="${rawtestname/*.}"
63 - for mysql_disabled_file in \
64 - ${S}/mysql-test/disabled.def \
65 - ${S}/mysql-test/t/disabled.def ; do
66 - [[ -f ${mysql_disabled_file} ]] && break
67 - done
68 - #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
69 - #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
70 - echo ${testname} : ${reason} >> "${mysql_disabled_file}"
71 -
72 - if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then
73 - for mysql_disabled_file in \
74 - ${S}/mysql-test/suite/${testsuite}/disabled.def \
75 - ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
76 - FAILED ; do
77 - [[ -f ${mysql_disabled_file} ]] && break
78 - done
79 - if [[ ${mysql_disabled_file} != "FAILED" ]]; then
80 - echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
81 - else
82 - for mysql_disabled_dir in \
83 - ${S}/mysql-test/suite/${testsuite} \
84 - ${S}/mysql-test/suite/${testsuite}/t \
85 - FAILED ; do
86 - [[ -d ${mysql_disabled_dir} ]] && break
87 - done
88 - if [[ ${mysql_disabled_dir} != "FAILED" ]]; then
89 - echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
90 - else
91 - ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
92 - fi
93 - fi
94 - fi
95 -}
96 -
97 -# @FUNCTION: mysql-cmake_use_plugin
98 -# @DESCRIPTION:
99 -# Helper function to enable/disable plugins by use flags
100 -# cmake-utils_use_with is not enough as some references check WITH_ (0|1)
101 -# and some check WITHOUT_. Also, this can easily extend to non-storage plugins.
102 -mysql-cmake_use_plugin() {
103 - [[ -z $2 ]] && die "mysql-cmake_use_plugin <USE flag> <flag name>"
104 - if use_if_iuse $1 ; then
105 - echo "-DWITH_$2=1 -DPLUGIN_$2=YES"
106 - else
107 - echo "-DWITHOUT_$2=1 -DWITH_$2=0 -DPLUGIN_$2=NO"
108 - fi
109 -}
110 -
111 -# @FUNCTION: configure_cmake_locale
112 -# @DESCRIPTION:
113 -# Helper function to configure locale cmake options
114 -configure_cmake_locale() {
115 -
116 - if use_if_iuse minimal ; then
117 - :
118 - elif ! in_iuse server || use_if_iuse server ; then
119 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
120 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
121 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
122 - ewarn "You MUST file bugs without these variables set."
123 -
124 - mycmakeargs+=(
125 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
126 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
127 - )
128 -
129 - elif ! use latin1 ; then
130 - mycmakeargs+=(
131 - -DDEFAULT_CHARSET=utf8
132 - -DDEFAULT_COLLATION=utf8_general_ci
133 - )
134 - else
135 - mycmakeargs+=(
136 - -DDEFAULT_CHARSET=latin1
137 - -DDEFAULT_COLLATION=latin1_swedish_ci
138 - )
139 - fi
140 - fi
141 -}
142 -
143 -# @FUNCTION: configure_cmake_minimal
144 -# @DESCRIPTION:
145 -# Helper function to configure minimal build
146 -configure_cmake_minimal() {
147 -
148 - mycmakeargs+=(
149 - -DWITHOUT_SERVER=1
150 - -DWITHOUT_EMBEDDED_SERVER=1
151 - -DEXTRA_CHARSETS=none
152 - -DINSTALL_SQLBENCHDIR=
153 - -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
154 - -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
155 - -DWITHOUT_CSV_STORAGE_ENGINE=1
156 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
157 - -DWITHOUT_HEAP_STORAGE_ENGINE=1
158 - -DWITHOUT_INNOBASE_STORAGE_ENGINE=1
159 - -DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1
160 - -DWITHOUT_MYISAM_STORAGE_ENGINE=1
161 - -DWITHOUT_PARTITION_STORAGE_ENGINE=1
162 - -DPLUGIN_ARCHIVE=NO
163 - -DPLUGIN_BLACKHOLE=NO
164 - -DPLUGIN_CSV=NO
165 - -DPLUGIN_FEDERATED=NO
166 - -DPLUGIN_HEAP=NO
167 - -DPLUGIN_INNOBASE=NO
168 - -DPLUGIN_MYISAMMRG=NO
169 - -DPLUGIN_MYISAM=NO
170 - -DPLUGIN_PARTITION=NO
171 - )
172 -}
173 -
174 -# @FUNCTION: configure_cmake_standard
175 -# @DESCRIPTION:
176 -# Helper function to configure standard build
177 -configure_cmake_standard() {
178 -
179 - mycmakeargs+=(
180 - -DEXTRA_CHARSETS=all
181 - -DMYSQL_USER=mysql
182 - -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
183 - $(cmake-utils_use_disable !static SHARED)
184 - $(cmake-utils_use_with debug)
185 - $(cmake-utils_use_with embedded EMBEDDED_SERVER)
186 - $(cmake-utils_use_with profiling)
187 - $(cmake-utils_use_enable systemtap DTRACE)
188 - )
189 -
190 - if use static; then
191 - mycmakeargs+=( -DWITH_PIC=1 )
192 - fi
193 -
194 - if use jemalloc; then
195 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
196 - fi
197 -
198 - if use tcmalloc; then
199 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
200 - fi
201 -
202 - # Storage engines
203 - mycmakeargs+=(
204 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
205 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
206 - -DWITH_CSV_STORAGE_ENGINE=1
207 - -DWITH_HEAP_STORAGE_ENGINE=1
208 - -DWITH_INNOBASE_STORAGE_ENGINE=1
209 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
210 - -DWITH_MYISAM_STORAGE_ENGINE=1
211 - -DWITH_PARTITION_STORAGE_ENGINE=1
212 - )
213 -
214 - if in_iuse pbxt ; then
215 - mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) )
216 - fi
217 -
218 - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
219 -
220 - # Federated{,X} must be treated special otherwise they will not be built as plugins
221 - if ! use extraengine ; then
222 - mycmakeargs+=(
223 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
224 - -DPLUGIN_FEDERATED=NO
225 - -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1
226 - -DPLUGIN_FEDERATEDX=NO )
227 - fi
228 -
229 - mycmakeargs+=(
230 - $(mysql-cmake_use_plugin oqgraph OQGRAPH)
231 - $(mysql-cmake_use_plugin sphinx SPHINX)
232 - $(mysql-cmake_use_plugin tokudb TOKUDB)
233 - $(mysql-cmake_use_plugin pam AUTH_PAM)
234 - )
235 -
236 - if mysql_version_is_at_least 10.0.5 ; then
237 - # CassandraSE needs Apache Thrift which is not in portage
238 - mycmakeargs+=(
239 - -DWITHOUT_CASSANDRA=1 -DWITH_CASSANDRA=0
240 - -DPLUGIN_CASSANDRA=NO
241 - $(mysql-cmake_use_plugin extraengine SEQUENCE)
242 - $(mysql-cmake_use_plugin extraengine SPIDER)
243 - $(mysql-cmake_use_plugin extraengine CONNECT)
244 - -DCONNECT_WITH_MYSQL=1
245 - $(cmake-utils_use xml CONNECT_WITH_LIBXML2)
246 - $(cmake-utils_use odbc CONNECT_WITH_ODBC)
247 - )
248 - fi
249 -
250 - if in_iuse mroonga ; then
251 - use mroonga || mycmakeargs+=( -DWITHOUT_MROONGA=1 )
252 - else
253 - mycmakeargs+=( -DWITHOUT_MROONGA=1 )
254 - fi
255 -
256 - if in_iuse galera ; then
257 - mycmakeargs+=( $(cmake-utils_use_with galera WSREP) )
258 - fi
259 -
260 - if mysql_version_is_at_least "10.1.1" ; then
261 - mycmakeargs+=( $(cmake-utils_use_with innodb-lz4 INNODB_LZ4)
262 - $(cmake-utils_use_with innodb-lzo INNODB_LZO) )
263 - fi
264 -
265 - if in_iuse innodb-snappy ; then
266 - mycmakeargs+=( $(cmake-utils_use_with innodb-snappy INNODB_SNAPPY) )
267 - fi
268 -
269 - if mysql_version_is_at_least "10.1.2" ; then
270 - mycmakeargs+=( $(mysql-cmake_use_plugin cracklib CRACKLIB_PASSWORD_CHECK ) )
271 - fi
272 -
273 - # The build forces this to be defined when cross-compiling. We pass it
274 - # all the time for simplicity and to make sure it is actually correct.
275 - mycmakeargs+=( -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1) )
276 - else
277 - mycmakeargs+=( $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE) )
278 - fi
279 -
280 - if [[ ${PN} == "percona-server" ]]; then
281 - mycmakeargs+=(
282 - $(cmake-utils_use_with pam PAM)
283 - )
284 - if in_iuse tokudb ; then
285 - # TokuDB Backup plugin requires valgrind unconditionally
286 - mycmakeargs+=(
287 - $(mysql-cmake_use_plugin tokudb TOKUDB)
288 - $(usex tokudb-backup-plugin "" -DTOKUDB_BACKUP_DISABLED=1)
289 - )
290 - fi
291 - fi
292 -
293 - if [[ ${PN} == "mysql-cluster" ]]; then
294 - # TODO: This really should include the following options,
295 - # but the memcached package doesn't install the files it seeks.
296 - # -DWITH_BUNDLED_MEMCACHED=OFF
297 - # -DMEMCACHED_HOME=${EPREFIX}/usr
298 - mycmakeargs+=(
299 - -DWITH_BUNDLED_LIBEVENT=OFF
300 - $(cmake-utils_use_with java NDB_JAVA)
301 - )
302 - fi
303 -}
304 -
305 -#
306 -# EBUILD FUNCTIONS
307 -#
308 -
309 -# @FUNCTION: mysql-cmake_src_prepare
310 -# @DESCRIPTION:
311 -# Apply patches to the source code and remove unneeded bundled libs.
312 -mysql-cmake_src_prepare() {
313 -
314 - debug-print-function ${FUNCNAME} "$@"
315 -
316 - cd "${S}"
317 -
318 - if [[ ${MY_EXTRAS_VER} != none ]]; then
319 -
320 - # Apply the patches for this MySQL version
321 - EPATCH_SUFFIX="patch"
322 - mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
323 - # Clean out old items
324 - rm -f "${EPATCH_SOURCE}"/*
325 - # Now link in right patches
326 - mysql_mv_patches
327 - # And apply
328 - epatch
329 - fi
330 -
331 - # last -fPIC fixup, per bug #305873
332 - i="${S}"/storage/innodb_plugin/plug.in
333 - [[ -f ${i} ]] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
334 -
335 - rm -f "scripts/mysqlbug"
336 - if use jemalloc && ! ( [[ ${PN} == "mariadb" ]] && mysql_version_is_at_least "5.5.33" ); then
337 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
338 - fi
339 -
340 - if use tcmalloc; then
341 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
342 - fi
343 -
344 - if in_iuse tokudb ; then
345 - # Don't build bundled xz-utils
346 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
347 - rm -f "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
348 - touch "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
349 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
350 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
351 - rm "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
352 - touch "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
353 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
354 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
355 - fi
356 -
357 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
358 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
359 - fi
360 - fi
361 -
362 - # Remove the bundled groonga if it exists
363 - # There is no CMake flag, it simply checks for existance
364 - if [[ -d "${S}"/storage/mroonga/vendor/groonga ]] ; then
365 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
366 - fi
367 -
368 - cmake-utils_src_prepare
369 -}
370 -
371 -# @FUNCTION: mysql-cmake_src_configure
372 -# @DESCRIPTION:
373 -# Configure mysql to build the code for Gentoo respecting the use flags.
374 -mysql-cmake_src_configure() {
375 -
376 - debug-print-function ${FUNCNAME} "$@"
377 -
378 - CMAKE_BUILD_TYPE="RelWithDebInfo"
379 -
380 - # debug hack wrt #497532
381 - mycmakeargs=(
382 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
383 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug "" "-DNDEBUG")"
384 - -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
385 - -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
386 - -DSYSCONFDIR=${EPREFIX}/etc/mysql
387 - -DINSTALL_BINDIR=bin
388 - -DINSTALL_DOCDIR=share/doc/${P}
389 - -DINSTALL_DOCREADMEDIR=share/doc/${P}
390 - -DINSTALL_INCLUDEDIR=include/mysql
391 - -DINSTALL_INFODIR=share/info
392 - -DINSTALL_LIBDIR=$(get_libdir)
393 - -DINSTALL_ELIBDIR=$(get_libdir)/mysql
394 - -DINSTALL_MANDIR=share/man
395 - -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql
396 - -DINSTALL_MYSQLSHAREDIR=share/mysql
397 - -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test
398 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
399 - -DINSTALL_SBINDIR=sbin
400 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
401 - -DINSTALL_SQLBENCHDIR=share/mysql
402 - -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql
403 - -DWITH_COMMENT="Gentoo Linux ${PF}"
404 - $(cmake-utils_use_with test UNIT_TESTS)
405 - -DWITH_LIBEDIT=0
406 - -DWITH_ZLIB=system
407 - -DWITHOUT_LIBWRAP=1
408 - -DENABLED_LOCAL_INFILE=1
409 - $(cmake-utils_use_enable static-libs STATIC_LIBS)
410 - -DWITH_SSL=$(usex ssl system bundled)
411 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
412 - -DWITH_DEFAULT_FEATURE_SET=0
413 - )
414 -
415 - if in_iuse bindist ; then
416 - mycmakeargs+=(
417 - -DWITH_READLINE=$(usex bindist 1 0)
418 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
419 - $(usex bindist -DHAVE_BFD_H=0 '')
420 - )
421 - fi
422 -
423 - mycmakeargs+=( -DWITH_EDITLINE=system )
424 -
425 - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
426 - mycmakeargs+=(
427 - -DWITH_JEMALLOC=$(usex jemalloc system)
428 - )
429 - mysql_version_is_at_least "10.0.9" && mycmakeargs+=( -DWITH_PCRE=system )
430 - fi
431 -
432 - configure_cmake_locale
433 -
434 - if use_if_iuse minimal ; then
435 - configure_cmake_minimal
436 - else
437 - configure_cmake_standard
438 - fi
439 -
440 - # Bug #114895, bug #110149
441 - filter-flags "-O" "-O[01]"
442 -
443 - CXXFLAGS="${CXXFLAGS} -fno-strict-aliasing"
444 - CXXFLAGS="${CXXFLAGS} -felide-constructors"
445 - # Causes linkage failures. Upstream bug #59607 removes it
446 - if ! mysql_version_is_at_least "5.6" ; then
447 - CXXFLAGS="${CXXFLAGS} -fno-implicit-templates"
448 - fi
449 - # As of 5.7, exceptions and rtti are used!
450 - if [[ ${PN} -eq 'percona-server' ]] && mysql_version_is_at_least "5.6.26" ; then
451 - CXXFLAGS="${CXXFLAGS} -fno-rtti"
452 - elif ! mysql_version_is_at_least "5.7" ; then
453 - CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-rtti"
454 - fi
455 - export CXXFLAGS
456 -
457 - # bug #283926, with GCC4.4, this is required to get correct behavior.
458 - append-flags -fno-strict-aliasing
459 -
460 - cmake-utils_src_configure
461 -}
462 -
463 -# @FUNCTION: mysql-cmake_src_compile
464 -# @DESCRIPTION:
465 -# Compile the mysql code.
466 -mysql-cmake_src_compile() {
467 -
468 - debug-print-function ${FUNCNAME} "$@"
469 -
470 - cmake-utils_src_compile
471 -}
472 -
473 -# @FUNCTION: mysql-cmake_src_install
474 -# @DESCRIPTION:
475 -# Install mysql.
476 -mysql-cmake_src_install() {
477 -
478 - debug-print-function ${FUNCNAME} "$@"
479 -
480 - # Make sure the vars are correctly initialized
481 - mysql_init_vars
482 -
483 - cmake-utils_src_install
484 -
485 - if ! in_iuse tools || use_if_iuse tools ; then
486 - # Convenience links
487 - einfo "Making Convenience links for mysqlcheck multi-call binary"
488 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
489 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
490 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
491 - fi
492 -
493 - # Create a mariadb_config symlink
494 - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && dosym "/usr/bin/mysql_config" "/usr/bin/mariadb_config"
495 -
496 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
497 - rm -Rf "${ED}/usr/data"
498 -
499 - # Various junk (my-*.cnf moved elsewhere)
500 - einfo "Removing duplicate /usr/share/mysql files"
501 -
502 - # Unless they explicitly specific USE=test, then do not install the
503 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
504 - # validation of your database configuration after tuning it.
505 - if ! use test ; then
506 - rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
507 - fi
508 -
509 - # Configuration stuff
510 - case ${MYSQL_PV_MAJOR} in
511 - 5.[1-4]*) mysql_mycnf_version="5.1" ;;
512 - 5.5) mysql_mycnf_version="5.5" ;;
513 - 5.[6-9]|6*|7*|8*|9*|10*) mysql_mycnf_version="5.6" ;;
514 - esac
515 - einfo "Building default my.cnf (${mysql_mycnf_version})"
516 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
517 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
518 - mycnf_src="my.cnf-${mysql_mycnf_version}"
519 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
520 - "${FILESDIR}/${mycnf_src}" \
521 - > "${TMPDIR}/my.cnf.ok" || die
522 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
523 - if use latin1 ; then
524 - sed -i \
525 - -e "/character-set/s|utf8|latin1|g" \
526 - "${TMPDIR}/my.cnf.ok" || die
527 - fi
528 - eprefixify "${TMPDIR}/my.cnf.ok"
529 - newins "${TMPDIR}/my.cnf.ok" my.cnf
530 -
531 - # Minimal builds don't have the MySQL server
532 - if use_if_iuse minimal ; then
533 - :
534 - elif ! in_iuse server || use_if_iuse server; then
535 - einfo "Including support files and sample configurations"
536 - docinto "support-files"
537 - for script in \
538 - "${S}"/support-files/my-*.cnf.sh \
539 - "${S}"/support-files/magic \
540 - "${S}"/support-files/ndb-config-2-node.ini.sh
541 - do
542 - [[ -f $script ]] && dodoc "${script}"
543 - done
544 -
545 - docinto "scripts"
546 - for script in "${S}"/scripts/mysql* ; do
547 - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
548 - done
549 - fi
550 -
551 - #Remove mytop if perl is not selected
552 - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && ! use perl \
553 - && rm -f "${ED}/usr/bin/mytop"
554 -
555 - in_iuse client-libs && ! use client-libs && return
556 -
557 - # Percona has decided to rename libmysqlclient to libperconaserverclient
558 - # Use a symlink to preserve linkages for those who don't use mysql_config
559 - if [[ ${PN} == "percona-server" ]] && mysql_version_is_at_least "5.5.36" ; then
560 - dosym libperconaserverclient.so /usr/$(get_libdir)/libmysqlclient.so
561 - dosym libperconaserverclient.so /usr/$(get_libdir)/libmysqlclient_r.so
562 - if use static-libs ; then
563 - dosym libperconaserverclient.a /usr/$(get_libdir)/libmysqlclient.a
564 - dosym libperconaserverclient.a /usr/$(get_libdir)/libmysqlclient_r.a
565 - fi
566 - fi
567 -}
568
569 diff --git a/eclass/mysql-multilib-r1.eclass b/eclass/mysql-multilib-r1.eclass
570 deleted file mode 100644
571 index 2a0aea6a5b0..00000000000
572 --- a/eclass/mysql-multilib-r1.eclass
573 +++ /dev/null
574 @@ -1,1142 +0,0 @@
575 -# Copyright 1999-2019 Gentoo Authors
576 -# Distributed under the terms of the GNU General Public License v2
577 -
578 -# @DEAD
579 -# @ECLASS: mysql-multilib-r1.eclass
580 -# @MAINTAINER:
581 -# Maintainers:
582 -# - MySQL Team <mysql-bugs@g.o>
583 -# - Robin H. Johnson <robbat2@g.o>
584 -# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>
585 -# - Brian Evans <grknight@g.o>
586 -# @SUPPORTED_EAPIS: 5 6
587 -# @BLURB: This eclass provides common functions for mysql ebuilds
588 -# @DESCRIPTION:
589 -# The mysql-multilib-r1.eclass is the base eclass to build the mysql and
590 -# alternative projects (mariadb and percona) ebuilds.
591 -# Provider and version specific settings will be included in each ebuild.
592 -# It provides the src_unpack, src_prepare, src_configure, src_compile,
593 -# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
594 -# phase hooks.
595 -
596 -MYSQL_EXTRAS=""
597 -
598 -# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER
599 -# @DEFAULT_UNSET
600 -# @DESCRIPTION:
601 -# The version of the MYSQL_EXTRAS repo to use to build mysql
602 -# Use "none" to disable it's use
603 -[[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-r3"
604 -
605 -# @ECLASS-VARIABLE: MYSQL_CMAKE_NATIVE_DEFINES
606 -# @DEFAULT_UNSET
607 -# @DESCRIPTION:
608 -# An array of extra CMake arguments for native multilib builds
609 -
610 -# @ECLASS-VARIABLE: MYSQL_CMAKE_NONNATIVE_DEFINES
611 -# @DEFAULT_UNSET
612 -# @DESCRIPTION:
613 -# An array of extra CMake arguments for non-native multilib builds
614 -
615 -# @ECLASS-VARIABLE: MYSQL_CMAKE_EXTRA_DEFINES
616 -# @DEFAULT_UNSET
617 -# @DESCRIPTION:
618 -# An array of CMake arguments added to native and non-native
619 -
620 -# Keeping eutils in EAPI=6 for emktemp in pkg_config
621 -
622 -inherit eutils systemd flag-o-matic ${MYSQL_EXTRAS} versionator \
623 - prefix toolchain-funcs user cmake-utils multilib-minimal
624 -
625 -if [[ "${EAPI}x" == "5x" ]]; then
626 - inherit multilib mysql_fx
627 -fi
628 -
629 -#
630 -# Supported EAPI versions and export functions
631 -#
632 -
633 -case "${EAPI:-0}" in
634 - 5|6) ;;
635 - *) die "Unsupported EAPI: ${EAPI}" ;;
636 -esac
637 -
638 -EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config
639 -
640 -#
641 -# VARIABLES:
642 -#
643 -
644 -# Shorten the path because the socket path length must be shorter than 107 chars
645 -# and we will run a mysql server during test phase
646 -S="${WORKDIR}/mysql"
647 -
648 -[[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
649 -if [[ ${MY_EXTRAS_VER} == "live" ]]; then
650 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
651 - EGIT_CHECKOUT_DIR=${WORKDIR}/mysql-extras
652 - EGIT_CLONE_TYPE=shallow
653 -fi
654 -
655 -# @ECLASS-VARIABLE: MYSQL_PV_MAJOR
656 -# @DESCRIPTION:
657 -# Upstream MySQL considers the first two parts of the version number to be the
658 -# major version. Upgrades that change major version should always run
659 -# mysql_upgrade.
660 -if [[ -z ${MYSQL_PV_MAJOR} ]] ; then MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})" ; fi
661 -
662 -# @ECLASS-VARIABLE: MYSQL_VERSION_ID
663 -# @DESCRIPTION:
664 -# MYSQL_VERSION_ID will be:
665 -# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
666 -# This is an important part, because many of the choices the MySQL ebuild will do
667 -# depend on this variable.
668 -# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803"
669 -# We also strip off upstream's trailing letter that they use to respin tarballs
670 -if [[ "${EAPI}x" == "5x" ]]; then
671 - MYSQL_VERSION_ID=""
672 - tpv="${PV%[a-z]}"
673 - tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}"
674 - for vatom in 0 1 2 3 ; do
675 - # pad to length 2
676 - tpv[${vatom}]="00${tpv[${vatom}]}"
677 - MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}"
678 - done
679 - # strip leading "0" (otherwise it's considered an octal number by BASH)
680 - MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"}
681 -fi
682 -
683 -# Work out the default SERVER_URI correctly
684 -if [[ -z ${SERVER_URI} ]]; then
685 - if [[ ${PN} == "mariadb" ]]; then
686 - # Beginning with 5.5, MariaDB stopped putting beta, alpha or rc on their tarball names
687 - MARIA_FULL_PV=$(get_version_component_range 1-3)
688 - MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
689 - SERVER_URI="https://downloads.mariadb.org/interstitial/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz"
690 - elif [[ ${PN} == "percona-server" ]]; then
691 - PERCONA_PN="Percona-Server"
692 - MIRROR_PV=$(get_version_component_range 1-2 ${PV})
693 - MY_PV=$(get_version_component_range 1-3 ${PV})
694 - PERCONA_RELEASE=$(get_version_component_range 4-5 ${PV})
695 - PERCONA_RC=$(get_version_component_range 6 ${PV})
696 - SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/${PERCONA_PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}/source/tarball/${PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}.tar.gz"
697 - else
698 - if [[ "${PN}" == "mysql-cluster" ]] ; then
699 - URI_DIR="MySQL-Cluster"
700 - URI_FILE="mysql-cluster-gpl"
701 - else
702 - URI_DIR="MySQL"
703 - URI_FILE="mysql"
704 - fi
705 - [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}"
706 - URI_A="${URI_FILE}-${MY_PV}.tar.gz"
707 - MIRROR_PV=$(get_version_component_range 1-2 ${PV})
708 - # Recently upstream switched to an archive site, and not on mirrors
709 - SERVER_URI="http://cdn.mysql.com/Downloads/${URI_DIR}-${MIRROR_PV}/${URI_A}
710 - http://downloads.mysql.com/archives/${URI_DIR}-${MIRROR_PV}/${URI_A}"
711 - fi
712 -fi
713 -
714 -# Define correct SRC_URIs
715 -SRC_URI="${SERVER_URI}"
716 -
717 -# Gentoo patches to MySQL
718 -if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then
719 - SRC_URI="${SRC_URI}
720 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
721 - https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
722 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
723 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
724 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
725 -fi
726 -
727 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
728 -HOMEPAGE="https://www.mysql.com/"
729 -LICENSE="GPL-2"
730 -SLOT="0/${SUBSLOT:-0}"
731 -
732 -IUSE="debug embedded extraengine jemalloc latin1 libressl +openssl
733 - +perl profiling selinux +server systemtap static static-libs tcmalloc test yassl"
734 -
735 -REQUIRED_USE="^^ ( yassl openssl libressl )"
736 -
737 -# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
738 -RESTRICT="libressl? ( test )"
739 -
740 -REQUIRED_USE="${REQUIRED_USE} !server? ( !extraengine !embedded )
741 - ?? ( tcmalloc jemalloc )
742 - static? ( !libressl !openssl yassl )"
743 -
744 -#
745 -# DEPENDENCIES:
746 -#
747 -
748 -# Be warned, *DEPEND are version-dependant
749 -# These are used for both runtime and compiletime
750 -# MULTILIB_USEDEP only set for libraries used by the client library
751 -DEPEND="
752 - kernel_linux? (
753 - sys-process/procps:0=
754 - dev-libs/libaio:0=
755 - )
756 - >=sys-apps/sed-4
757 - >=sys-apps/texinfo-4.7-r1
758 - !dev-db/mariadb-native-client[mysqlcompat]
759 - jemalloc? ( dev-libs/jemalloc:0= )
760 - tcmalloc? ( dev-util/google-perftools:0= )
761 - systemtap? ( >=dev-util/systemtap-1.3:0= )
762 - openssl? ( >=dev-libs/openssl-1.0.0:0=[${MULTILIB_USEDEP},static-libs?] )
763 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP},static-libs?] )
764 - >=sys-libs/zlib-1.2.3:0=[${MULTILIB_USEDEP},static-libs?]
765 - sys-libs/ncurses:0=
766 -"
767 -
768 -# prefix: first need to implement something for #196294
769 -RDEPEND="${DEPEND}
770 - selinux? ( sec-policy/selinux-mysql )
771 -"
772 -
773 -# Having different flavours at the same time is not a good idea
774 -for i in "mysql" "mariadb" "mariadb-galera" "percona-server" "mysql-cluster" ; do
775 - [[ ${i} == ${PN} ]] ||
776 - RDEPEND="${RDEPEND} !dev-db/${i}"
777 -done
778 -
779 -RDEPEND="${RDEPEND}
780 - server? ( !prefix? ( dev-db/mysql-init-scripts ) )
781 - !<virtual/mysql-5.6-r4"
782 -
783 -# compile-time-only
784 -# ncurses only needs multilib for compile time due to a binary that will be not installed
785 -DEPEND="${DEPEND}
786 - virtual/yacc
787 - static? ( sys-libs/ncurses[static-libs] )
788 -"
789 -
790 -# For other stuff to bring us in
791 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
792 -PDEPEND="${PDEPEND} perl? ( >=dev-perl/DBD-mysql-2.9004 )
793 - server? ( ~virtual/mysql-${MYSQL_PV_MAJOR}[embedded=,static=] )
794 - virtual/libmysqlclient:${SLOT}[${MULTILIB_USEDEP},static-libs=]"
795 -
796 -# my_config.h includes ABI specific data
797 -MULTILIB_WRAPPED_HEADERS=( /usr/include/mysql/my_config.h /usr/include/mysql/private/embedded_priv.h )
798 -
799 -#
800 -# EBUILD FUNCTIONS
801 -#
802 -
803 -# @FUNCTION: mysql-multilib-r1_pkg_pretend
804 -# @DESCRIPTION:
805 -# Perform some basic tests and tasks during pkg_pretend phase:
806 -mysql-multilib-r1_pkg_pretend() {
807 - if [[ ${MERGE_TYPE} != binary ]] ; then
808 - local GCC_MAJOR_SET=$(gcc-major-version)
809 - local GCC_MINOR_SET=$(gcc-minor-version)
810 - if in_iuse tokudb && use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
811 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
812 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
813 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
814 - die
815 - fi
816 - # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
817 - # non x86{,_64} arches
818 - if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
819 - ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
820 - eerror "${PN} needs to be built with gcc-4.7 or later."
821 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
822 - die
823 - fi
824 - fi
825 -}
826 -
827 -# @FUNCTION: mysql-multilib-r1_pkg_setup
828 -# @DESCRIPTION:
829 -# Perform some basic tests and tasks during pkg_setup phase:
830 -# die if FEATURES="test", USE="server" and not using FEATURES="userpriv"
831 -# create new user and group for mysql
832 -# warn about deprecated features
833 -mysql-multilib-r1_pkg_setup() {
834 -
835 - if has test ${FEATURES} && \
836 - use server && ! has userpriv ${FEATURES} ; then
837 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
838 - fi
839 -
840 - # This should come after all of the die statements
841 - enewgroup mysql 60 || die "problem adding 'mysql' group"
842 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
843 -}
844 -
845 -# @FUNCTION: mysql-multilib-r1_src_unpack
846 -# @DESCRIPTION:
847 -# Unpack the source code
848 -mysql-multilib-r1_src_unpack() {
849 -
850 - # Initialize the proper variables first
851 - mysql_init_vars
852 -
853 - unpack ${A}
854 - # Grab the patches
855 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
856 -
857 - mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}"
858 -}
859 -
860 -# @FUNCTION: mysql-multilib-r1_src_prepare
861 -# @DESCRIPTION:
862 -# Apply patches to the source code and remove unneeded bundled libs.
863 -mysql-multilib-r1_src_prepare() {
864 -
865 - debug-print-function ${FUNCNAME} "$@"
866 -
867 - cd "${S}"
868 -
869 - if [[ ${MY_EXTRAS_VER} != none ]]; then
870 -
871 - # Apply the patches for this MySQL version
872 - if [[ "${EAPI}x" == "5x" ]]; then
873 - EPATCH_SUFFIX="patch"
874 - mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
875 - # Clean out old items
876 - rm -f "${EPATCH_SOURCE}"/*
877 - # Now link in right patches
878 - mysql_mv_patches
879 - # And apply
880 - epatch
881 - fi
882 - fi
883 -
884 - # last -fPIC fixup, per bug #305873
885 - i="${S}"/storage/innodb_plugin/plug.in
886 - if [[ -f ${i} ]] ; then sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" || die ; fi
887 -
888 - rm -f "scripts/mysqlbug"
889 - if use jemalloc && [[ ${PN} != "mariadb" ]] ; then
890 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
891 - fi
892 -
893 - if use tcmalloc; then
894 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
895 - fi
896 -
897 - if in_iuse tokudb ; then
898 - # Don't build bundled xz-utils
899 - if [[ -d "${S}/storage/tokudb/ft-index" ]] ; then
900 - echo > "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
901 - sed -i 's/ build_lzma//' "${S}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
902 - elif [[ -d "${S}/storage/tokudb/PerconaFT" ]] ; then
903 - echo > "${S}/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake" || die
904 - sed -i -e 's/ build_lzma//' -e 's/ build_snappy//' "${S}/storage/tokudb/PerconaFT/ft/CMakeLists.txt" || die
905 - sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S}/storage/tokudb/PerconaFT/portability/CMakeLists.txt" || die
906 - fi
907 -
908 - if [[ -d "${S}/plugin/tokudb-backup-plugin" ]] && ! use tokudb-backup-plugin ; then
909 - rm -r "${S}/plugin/tokudb-backup-plugin/Percona-TokuBackup" || die
910 - fi
911 - fi
912 -
913 - # Remove the bundled groonga if it exists
914 - # There is no CMake flag, it simply checks for existance
915 - if [[ -d "${S}"/storage/mroonga/vendor/groonga ]] ; then
916 - rm -r "${S}"/storage/mroonga/vendor/groonga || die "could not remove packaged groonga"
917 - fi
918 -
919 - # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
920 - if [[ -d "${S}/support-files/SELinux" ]] ; then
921 - echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
922 - fi
923 -
924 - cmake-utils_src_prepare
925 -}
926 -
927 -# @FUNCTION: mysql-multilib-r1_src_configure
928 -# @DESCRIPTION:
929 -# Configure mysql to build the code for Gentoo respecting the use flags.
930 -mysql-multilib-r1_src_configure() {
931 - # Bug #114895, bug #110149
932 - filter-flags "-O" "-O[01]"
933 -
934 - append-cxxflags -felide-constructors
935 -
936 - # bug #283926, with GCC4.4, this is required to get correct behavior.
937 - append-flags -fno-strict-aliasing
938 -
939 - multilib-minimal_src_configure
940 -}
941 -
942 -multilib_src_configure() {
943 - debug-print-function ${FUNCNAME} "$@"
944 -
945 - CMAKE_BUILD_TYPE="RelWithDebInfo"
946 -
947 - # debug hack wrt #497532
948 - mycmakeargs=(
949 - -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
950 - -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
951 - -DCMAKE_INSTALL_PREFIX=${EPREFIX}/usr
952 - -DMYSQL_DATADIR=${EPREFIX}/var/lib/mysql
953 - -DSYSCONFDIR=${EPREFIX}/etc/mysql
954 - -DINSTALL_BINDIR=bin
955 - -DINSTALL_DOCDIR=share/doc/${PF}
956 - -DINSTALL_DOCREADMEDIR=share/doc/${PF}
957 - -DINSTALL_INCLUDEDIR=include/mysql
958 - -DINSTALL_INFODIR=share/info
959 - -DINSTALL_LIBDIR=$(get_libdir)
960 - -DINSTALL_ELIBDIR=$(get_libdir)/mysql
961 - -DINSTALL_MANDIR=share/man
962 - -DINSTALL_MYSQLDATADIR=${EPREFIX}/var/lib/mysql
963 - -DINSTALL_MYSQLSHAREDIR=share/mysql
964 - -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
965 - -DINSTALL_SBINDIR=sbin
966 - -DINSTALL_SCRIPTDIR=share/mysql/scripts
967 - -DINSTALL_SQLBENCHDIR=share/mysql
968 - -DINSTALL_SUPPORTFILESDIR=${EPREFIX}/usr/share/mysql
969 - -DWITH_COMMENT="Gentoo Linux ${PF}"
970 - -DWITH_UNIT_TESTS=$(usex test ON OFF)
971 - -DWITH_LIBEDIT=0
972 - -DWITH_ZLIB=system
973 - -DWITHOUT_LIBWRAP=1
974 - -DENABLED_LOCAL_INFILE=1
975 - -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
976 - -DINSTALL_UNIX_ADDRDIR=${EPREFIX}/var/run/mysqld/mysqld.sock
977 - -DWITH_DEFAULT_COMPILER_OPTIONS=0
978 - -DWITH_DEFAULT_FEATURE_SET=0
979 - -DINSTALL_SYSTEMD_UNITDIR="$(systemd_get_systemunitdir)"
980 - -DENABLE_STATIC_LIBS=$(usex static-libs ON OFF)
981 - # The build forces this to be defined when cross-compiling. We pass it
982 - # all the time for simplicity and to make sure it is actually correct.
983 - -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
984 - -DPKG_CONFIG_EXECUTABLE="${EPREFIX}/usr/bin/$(tc-getPKG_CONFIG)"
985 - )
986 -
987 - if use test ; then
988 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test )
989 - else
990 - mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
991 - fi
992 -
993 - if use openssl || use libressl ; then
994 - mycmakeargs+=( -DWITH_SSL=system )
995 - else
996 - mycmakeargs+=( -DWITH_SSL=bundled )
997 - fi
998 -
999 - if ! multilib_is_native_abi ; then
1000 - mycmakeargs+=( -DWITHOUT_TOOLS=1 )
1001 - fi
1002 -
1003 - if in_iuse bindist ; then
1004 - # bfd.h is only used starting with 10.1 and can be controlled by NOT_FOR_DISTRIBUTION
1005 - if multilib_is_native_abi; then
1006 - mycmakeargs+=(
1007 - -DWITH_READLINE=$(usex bindist 1 0)
1008 - -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
1009 - )
1010 - else
1011 - mycmakeargs+=(
1012 - -DWITH_READLINE=1
1013 - -DNOT_FOR_DISTRIBUTION=0
1014 - )
1015 - fi
1016 - fi
1017 -
1018 - ### TODO: make this system but issues with UTF-8 prevent it
1019 - mycmakeargs+=( -DWITH_EDITLINE=bundled )
1020 -
1021 - if multilib_is_native_abi && use server ; then
1022 -
1023 - # systemd is only linked to for server notification
1024 - if in_iuse systemd ; then
1025 - mycmakeargs+=( -DWITH_SYSTEMD=$(usex systemd yes no) )
1026 - fi
1027 -
1028 - if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
1029 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
1030 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
1031 - ewarn "You MUST file bugs without these variables set."
1032 -
1033 - mycmakeargs+=(
1034 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
1035 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
1036 - )
1037 -
1038 - elif ! use latin1 ; then
1039 - mycmakeargs+=(
1040 - -DDEFAULT_CHARSET=utf8
1041 - -DDEFAULT_COLLATION=utf8_general_ci
1042 - )
1043 - else
1044 - mycmakeargs+=(
1045 - -DDEFAULT_CHARSET=latin1
1046 - -DDEFAULT_COLLATION=latin1_swedish_ci
1047 - )
1048 - fi
1049 - mycmakeargs+=(
1050 - -DEXTRA_CHARSETS=all
1051 - -DMYSQL_USER=mysql
1052 - -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
1053 - -DDISABLE_SHARED=$(usex static YES NO)
1054 - -DWITH_DEBUG=$(usex debug)
1055 - -DWITH_EMBEDDED_SERVER=$(usex embedded)
1056 - -DWITH_PROFILING=$(usex profiling)
1057 - )
1058 -
1059 - if use static; then
1060 - mycmakeargs+=( -DWITH_PIC=1 )
1061 - fi
1062 -
1063 - if use jemalloc || use tcmalloc ; then
1064 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
1065 - fi
1066 -
1067 - # Storage engines
1068 - mycmakeargs+=(
1069 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
1070 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
1071 - -DWITH_CSV_STORAGE_ENGINE=1
1072 - -DWITH_HEAP_STORAGE_ENGINE=1
1073 - -DWITH_INNOBASE_STORAGE_ENGINE=1
1074 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
1075 - -DWITH_MYISAM_STORAGE_ENGINE=1
1076 - -DWITH_PARTITION_STORAGE_ENGINE=1
1077 - )
1078 -
1079 - mycmakeargs+=( -DWITH_FEDERATED_STORAGE_ENGINE=$(usex extraengine) )
1080 - else
1081 - mycmakeargs+=(
1082 - -DWITHOUT_SERVER=1
1083 - -DWITHOUT_EMBEDDED_SERVER=1
1084 - -DEXTRA_CHARSETS=none
1085 - -DINSTALL_SQLBENCHDIR=
1086 - -DWITH_SYSTEMD=no
1087 - )
1088 - fi
1089 -
1090 - # systemtap only works on native ABI bug 530132
1091 - if multilib_is_native_abi; then
1092 - mycmakeargs+=( -DENABLE_DTRACE=$(usex systemtap)
1093 - "${MYSQL_CMAKE_NATIVE_DEFINES[@]}" )
1094 - else
1095 - mycmakeargs+=( -DENABLE_DTRACE=0
1096 - "${MYSQL_CMAKE_NONNATIVE_DEFINES[@]}" )
1097 - fi
1098 -
1099 - mycmakeargs+=( "${MYSQL_CMAKE_EXTRA_DEFINES[@]}" )
1100 -
1101 - cmake-utils_src_configure
1102 -}
1103 -
1104 -mysql-multilib-r1_src_compile() {
1105 - local _cmake_args=( "${@}" )
1106 -
1107 - multilib-minimal_src_compile
1108 -}
1109 -
1110 -multilib_src_compile() {
1111 -
1112 - cmake-utils_src_compile "${_cmake_args[@]}"
1113 -}
1114 -
1115 -
1116 -# @FUNCTION: mysql-multilib-r1_src_install
1117 -# @DESCRIPTION:
1118 -# Install mysql.
1119 -mysql-multilib-r1_src_install() {
1120 - # wrap the config script
1121 - MULTILIB_CHOST_TOOLS=( /usr/bin/mysql_config )
1122 -
1123 - multilib-minimal_src_install
1124 -}
1125 -
1126 -multilib_src_install() {
1127 - debug-print-function ${FUNCNAME} "$@"
1128 -
1129 - cmake-utils_src_install
1130 - # Make sure the vars are correctly initialized
1131 - mysql_init_vars
1132 -
1133 - # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
1134 - if [[ -f "${D}${MY_INCLUDEDIR}/private/config.h" ]] ; then
1135 - rm "${D}${MY_INCLUDEDIR}/private/config.h" || die
1136 - fi
1137 -
1138 - if multilib_is_native_abi; then
1139 -
1140 - # Convenience links
1141 - einfo "Making Convenience links for mysqlcheck multi-call binary"
1142 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
1143 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
1144 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
1145 -
1146 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
1147 - if [[ -d "${ED}/usr/data" ]] ; then
1148 - rm -Rf "${ED}/usr/data" || die
1149 - fi
1150 -
1151 - # Unless they explicitly specific USE=test, then do not install the
1152 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
1153 - # validation of your database configuration after tuning it.
1154 - if ! use test ; then
1155 - rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
1156 - fi
1157 -
1158 - # Configuration stuff
1159 - case ${MYSQL_PV_MAJOR} in
1160 - 5.5) mysql_mycnf_version="5.5" ;;
1161 - 5.[6-9]|6*|7*|8*|9*|10*) mysql_mycnf_version="5.6" ;;
1162 - esac
1163 - einfo "Building default my.cnf (${mysql_mycnf_version})"
1164 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
1165 - [[ -f "${S}/scripts/mysqlaccess.conf" ]] && doins "${S}"/scripts/mysqlaccess.conf
1166 - mycnf_src="my.cnf-${mysql_mycnf_version}"
1167 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
1168 - "${FILESDIR}/${mycnf_src}" \
1169 - > "${TMPDIR}/my.cnf.ok" || die
1170 - use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR}/my.cnf.ok"
1171 - if use latin1 ; then
1172 - sed -i \
1173 - -e "/character-set/s|utf8|latin1|g" \
1174 - "${TMPDIR}/my.cnf.ok" || die
1175 - fi
1176 - eprefixify "${TMPDIR}/my.cnf.ok"
1177 - newins "${TMPDIR}/my.cnf.ok" my.cnf
1178 -
1179 - if use server ; then
1180 - einfo "Including support files and sample configurations"
1181 - docinto "support-files"
1182 - for script in \
1183 - "${S}"/support-files/my-*.cnf.sh \
1184 - "${S}"/support-files/magic \
1185 - "${S}"/support-files/ndb-config-2-node.ini.sh
1186 - do
1187 - [[ -f $script ]] && dodoc "${script}"
1188 - done
1189 -
1190 - docinto "scripts"
1191 - for script in "${S}"/scripts/mysql* ; do
1192 - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
1193 - done
1194 - fi
1195 -
1196 - #Remove mytop if perl is not selected
1197 - [[ -e "${ED}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED}/usr/bin/mytop"
1198 -
1199 - # Percona has decided to rename libmysqlclient to libperconaserverclient
1200 - # Use a symlink to preserve linkages for those who don't use mysql_config
1201 - local suffix
1202 - for suffix in ".so" "_r.so" ".a" "_r.a" ; do
1203 - if [[ -e "${ED}/usr/$(get_libdir)/libperconaserverclient${suffix}" ]] ; then
1204 - dosym libperconaserverclient${suffix} /usr/$(get_libdir)/libmysqlclient${suffix}
1205 - fi
1206 - done
1207 - else
1208 - if [[ "${PN}" == "mariadb" ]] && use server ; then
1209 - insinto /usr/include/mysql/private
1210 - doins "${S}"/sql/*.h
1211 - fi
1212 - fi
1213 -}
1214 -
1215 -# @FUNCTION: mysql-multilib-r1_pkg_preinst
1216 -# @DESCRIPTION:
1217 -# Warn about ABI changes when switching providers
1218 -mysql-multilib-r1_pkg_preinst() {
1219 - debug-print-function ${FUNCNAME} "$@"
1220 -
1221 - # Here we need to see if the implementation switched client libraries
1222 - # We check if this is a new instance of the package and a client library already exists
1223 - local SHOW_ABI_MESSAGE
1224 - if [[ -z ${REPLACING_VERSIONS} && -e "${EROOT}usr/$(get_libdir)/libmysqlclient.so" ]] ; then
1225 - elog "Due to ABI changes when switching between different client libraries,"
1226 - elog "revdep-rebuild must find and rebuild all packages linking to libmysqlclient."
1227 - elog "Please run: revdep-rebuild --library libmysqlclient.so.${SUBSLOT:-18}"
1228 - ewarn "Failure to run revdep-rebuild may cause issues with other programs or libraries"
1229 - fi
1230 -}
1231 -
1232 -# @FUNCTION: mysql-multilib-r1_pkg_postinst
1233 -# @DESCRIPTION:
1234 -# Run post-installation tasks:
1235 -# create the dir for logfiles if non-existant
1236 -# touch the logfiles and secure them
1237 -# install scripts
1238 -# issue required steps for optional features
1239 -# issue deprecation warnings
1240 -mysql-multilib-r1_pkg_postinst() {
1241 - debug-print-function ${FUNCNAME} "$@"
1242 -
1243 - # Make sure the vars are correctly initialized
1244 - mysql_init_vars
1245 -
1246 - # Create log directory securely if it does not exist
1247 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
1248 -
1249 - if use server ; then
1250 - docinto "support-files"
1251 - for script in \
1252 - support-files/my-*.cnf \
1253 - support-files/magic \
1254 - support-files/ndb-config-2-node.ini
1255 - do
1256 - [[ -f "${script}" ]] \
1257 - && dodoc "${script}"
1258 - done
1259 -
1260 - docinto "scripts"
1261 - for script in scripts/mysql* ; do
1262 - if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then
1263 - dodoc "${script}"
1264 - fi
1265 - done
1266 -
1267 - if in_iuse pam && use pam; then
1268 - einfo
1269 - elog "This install includes the PAM authentication plugin."
1270 - elog "To activate and configure the PAM plugin, please read:"
1271 - if [[ ${PN} == "mariadb" ]] ; then
1272 - elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
1273 - elif [[ ${PN} == "percona-server" ]] ; then
1274 - elog "https://www.percona.com/doc/percona-server/5.6/management/pam_plugin.html"
1275 - fi
1276 - einfo
1277 - fi
1278 -
1279 - if [[ -z "${REPLACING_VERSIONS}" ]] ; then
1280 - einfo
1281 - elog "You might want to run:"
1282 - elog "\"emerge --config =${CATEGORY}/${PF}\""
1283 - elog "if this is a new install."
1284 - elog
1285 - elog "If you are switching server implentations, you should run the"
1286 - elog "mysql_upgrade tool."
1287 - einfo
1288 - else
1289 - einfo
1290 - elog "If you are upgrading major versions, you should run the"
1291 - elog "mysql_upgrade tool."
1292 - einfo
1293 - fi
1294 -
1295 - if in_iuse galera && use galera ; then
1296 - einfo
1297 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
1298 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
1299 - elog "The first time the galera cluster is activated, the database daemon"
1300 - elog "should be run as \"/etc/init.d/mysql bootstrap_galera\" on the primary node."
1301 - einfo
1302 - fi
1303 - fi
1304 -}
1305 -
1306 -# @FUNCTION: mysql-multilib-r1_getopt
1307 -# @DESCRIPTION:
1308 -# Use my_print_defaults to extract specific config options
1309 -mysql-multilib-r1_getopt() {
1310 - local mypd="${EROOT}"/usr/bin/my_print_defaults
1311 - section="$1"
1312 - flag="--${2}="
1313 - "${mypd}" $section | sed -n "/^${flag}/p"
1314 -}
1315 -
1316 -# @FUNCTION: mysql-multilib-r1_getoptval
1317 -# @DESCRIPTION:
1318 -# Use my_print_defaults to extract specific config options
1319 -mysql-multilib-r1_getoptval() {
1320 - local mypd="${EROOT}"/usr/bin/my_print_defaults
1321 - local section="$1"
1322 - local flag="--${2}="
1323 - local extra_options="${3}"
1324 - "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
1325 -}
1326 -
1327 -# @FUNCTION: mysql-multilib-r1_pkg_config
1328 -# @DESCRIPTION:
1329 -# Configure mysql environment.
1330 -mysql-multilib-r1_pkg_config() {
1331 -
1332 - debug-print-function ${FUNCNAME} "$@"
1333 -
1334 - local old_MY_DATADIR="${MY_DATADIR}"
1335 - local old_HOME="${HOME}"
1336 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
1337 - export HOME=${EPREFIX}/root
1338 -
1339 - # Make sure the vars are correctly initialized
1340 - mysql_init_vars
1341 -
1342 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
1343 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
1344 - die "Minimal builds do NOT include the MySQL server"
1345 - fi
1346 -
1347 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
1348 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
1349 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
1350 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
1351 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
1352 -
1353 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
1354 - if [[ -d "${MY_DATADIR_s}" ]]; then
1355 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
1356 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
1357 - else
1358 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
1359 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
1360 - || die "Moving MY_DATADIR failed"
1361 - fi
1362 - else
1363 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
1364 - if [[ -d "${MY_DATADIR_s}" ]]; then
1365 - ewarn "Attempting to use ${MY_DATADIR_s}"
1366 - else
1367 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
1368 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
1369 - fi
1370 - fi
1371 - fi
1372 -
1373 - local pwd1="a"
1374 - local pwd2="b"
1375 - local maxtry=15
1376 -
1377 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1378 - local tmp_mysqld_password_source=
1379 -
1380 - for tmp_mysqld_password_source in mysql client; do
1381 - einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
1382 - MYSQL_ROOT_PASSWORD="$(mysql-multilib-r1_getoptval "${tmp_mysqld_password_source}" password)"
1383 - if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
1384 - if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
1385 - ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
1386 - MYSQL_ROOT_PASSWORD=
1387 - continue
1388 - fi
1389 -
1390 - einfo "Found password in '${tmp_mysqld_password_source}' section!"
1391 - break
1392 - fi
1393 - done
1394 -
1395 - # Sometimes --show is required to display passwords in some implementations of my_print_defaults
1396 - if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
1397 - MYSQL_ROOT_PASSWORD="$(mysql-multilib-r1_getoptval "${tmp_mysqld_password_source}" password --show)"
1398 - fi
1399 -
1400 - unset tmp_mysqld_password_source
1401 - fi
1402 - MYSQL_TMPDIR="$(mysql-multilib-r1_getoptval mysqld tmpdir)"
1403 - # These are dir+prefix
1404 - MYSQL_RELAY_LOG="$(mysql-multilib-r1_getoptval mysqld relay-log)"
1405 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
1406 - MYSQL_LOG_BIN="$(mysql-multilib-r1_getoptval mysqld log-bin)"
1407 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
1408 -
1409 - if [[ ! -d "${ROOT}"/$MYSQL_TMPDIR ]]; then
1410 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
1411 - install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_TMPDIR
1412 - fi
1413 - if [[ ! -d "${ROOT}"/$MYSQL_LOG_BIN ]]; then
1414 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
1415 - install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_LOG_BIN
1416 - fi
1417 - if [[ ! -d "${EROOT}"/$MYSQL_RELAY_LOG ]]; then
1418 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
1419 - install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_RELAY_LOG
1420 - fi
1421 -
1422 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
1423 - ewarn "You have already a MySQL database in place."
1424 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
1425 - ewarn "Please rename or delete it if you wish to replace it."
1426 - die "MySQL database already exists!"
1427 - fi
1428 -
1429 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
1430 - # localhost. Also causes weird failures.
1431 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
1432 -
1433 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
1434 -
1435 - einfo "Please provide a password for the mysql 'root' user now"
1436 - einfo "or through the ${HOME}/.my.cnf file."
1437 - ewarn "Avoid [\"'\\_%] characters in the password"
1438 - read -rsp " >" pwd1 ; echo
1439 -
1440 - einfo "Retype the password"
1441 - read -rsp " >" pwd2 ; echo
1442 -
1443 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
1444 - die "Passwords are not the same"
1445 - fi
1446 - MYSQL_ROOT_PASSWORD="${pwd1}"
1447 - unset pwd1 pwd2
1448 - fi
1449 -
1450 - local options
1451 - local sqltmp="$(emktemp)"
1452 -
1453 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
1454 - # see http://bugs.mysql.com/bug.php?id=31312
1455 - use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
1456 -
1457 - local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
1458 - [[ -r "${help_tables}" ]] \
1459 - && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
1460 - || touch "${TMPDIR}/fill_help_tables.sql"
1461 - help_tables="${TMPDIR}/fill_help_tables.sql"
1462 -
1463 - # Figure out which options we need to disable to do the setup
1464 - local helpfile="${TMPDIR}/mysqld-help"
1465 - ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
1466 - for opt in grant-tables host-cache name-resolve networking slave-start \
1467 - federated ssl log-bin relay-log slow-query-log external-locking \
1468 - ndbcluster log-slave-updates wsrep-on \
1469 - ; do
1470 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
1471 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
1472 - done
1473 - # But some options changed names
1474 - egrep -sq external-locking "${helpfile}" && \
1475 - options="${options/skip-locking/skip-external-locking}"
1476 -
1477 - einfo "Creating the mysql database and setting proper permissions on it ..."
1478 -
1479 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
1480 - PID_DIR="${EROOT}/var/run/mysqld"
1481 - if [[ ! -d "${PID_DIR}" ]]; then
1482 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
1483 - fi
1484 -
1485 - if [[ ! -d "${MY_DATADIR}" ]]; then
1486 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
1487 - fi
1488 -
1489 - pushd "${TMPDIR}" &>/dev/null || die
1490 -
1491 - # Filling timezones, see
1492 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
1493 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
1494 -
1495 - local cmd
1496 - local initialize_options
1497 - if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && version_is_at_least "5.7.6" ; then
1498 - # --initialize-insecure will not set root password
1499 - # --initialize would set a random one in the log which we don't need as we set it ourselves
1500 - cmd=( "${EROOT}usr/sbin/mysqld" )
1501 - initialize_options="--initialize-insecure --init-file='${sqltmp}'"
1502 - sqltmp="" # the initialize will take care of it
1503 - else
1504 - cmd=( "${EROOT}usr/share/mysql/scripts/mysql_install_db" )
1505 - [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
1506 - if [[ -r "${help_tables}" ]] ; then
1507 - cat "${help_tables}" >> "${sqltmp}"
1508 - fi
1509 - fi
1510 - cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" ${initialize_options} )
1511 - einfo "Command: ${cmd[*]}"
1512 - su -s /bin/sh -c "${cmd[*]}" mysql \
1513 - >"${TMPDIR}"/mysql_install_db.log 2>&1
1514 - if [ $? -ne 0 ]; then
1515 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
1516 - die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
1517 - fi
1518 - popd &>/dev/null || die
1519 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
1520 - || die "MySQL databases not installed"
1521 -
1522 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
1523 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
1524 - local mysqld="${EROOT}/usr/sbin/mysqld \
1525 - ${options} \
1526 - $(use prefix || echo --user=mysql) \
1527 - --log-warnings=0 \
1528 - --basedir=${EROOT}/usr \
1529 - --datadir=${ROOT}/${MY_DATADIR} \
1530 - --max_allowed_packet=8M \
1531 - --net_buffer_length=16K \
1532 - --default-storage-engine=MyISAM \
1533 - --socket=${socket} \
1534 - --pid-file=${pidfile}
1535 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
1536 - #einfo "About to start mysqld: ${mysqld}"
1537 - ebegin "Starting mysqld"
1538 - einfo "Command ${mysqld}"
1539 - ${mysqld} &
1540 - rc=$?
1541 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
1542 - maxtry=$((${maxtry}-1))
1543 - echo -n "."
1544 - sleep 1
1545 - done
1546 - eend $rc
1547 -
1548 - if ! [[ -S "${socket}" ]]; then
1549 - die "Completely failed to start up mysqld with: ${mysqld}"
1550 - fi
1551 -
1552 - ebegin "Setting root password"
1553 - # Do this from memory, as we don't want clear text passwords in temp files
1554 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
1555 - "${EROOT}/usr/bin/mysql" \
1556 - --socket=${socket} \
1557 - -hlocalhost \
1558 - -e "${sql}"
1559 - eend $?
1560 -
1561 - if [[ -n "${sqltmp}" ]] ; then
1562 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
1563 - "${EROOT}/usr/bin/mysql" \
1564 - --socket=${socket} \
1565 - -hlocalhost \
1566 - -uroot \
1567 - --password="${MYSQL_ROOT_PASSWORD}" \
1568 - mysql < "${sqltmp}"
1569 - rc=$?
1570 - eend $?
1571 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
1572 - fi
1573 -
1574 - # Stop the server and cleanup
1575 - einfo "Stopping the server ..."
1576 - kill $(< "${pidfile}" )
1577 - rm -f "${sqltmp}"
1578 - wait %1
1579 - einfo "Done"
1580 -}
1581 -
1582 -
1583 -#
1584 -# HELPER FUNCTIONS:
1585 -#
1586 -
1587 -# @FUNCTION: mysql-multilib-r1_disable_test
1588 -# @DESCRIPTION:
1589 -# Helper function to disable specific tests.
1590 -mysql-multilib-r1_disable_test() {
1591 -
1592 - local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir
1593 - rawtestname="${1}" ; shift
1594 - reason="${@}"
1595 - ewarn "test '${rawtestname}' disabled: '${reason}'"
1596 -
1597 - testsuite="${rawtestname/.*}"
1598 - testname="${rawtestname/*.}"
1599 - for mysql_disabled_file in \
1600 - ${S}/mysql-test/disabled.def \
1601 - ${S}/mysql-test/t/disabled.def ; do
1602 - [[ -f ${mysql_disabled_file} ]] && break
1603 - done
1604 - #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
1605 - #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
1606 - echo ${testname} : ${reason} >> "${mysql_disabled_file}"
1607 -
1608 - if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then
1609 - for mysql_disabled_file in \
1610 - ${S}/mysql-test/suite/${testsuite}/disabled.def \
1611 - ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
1612 - FAILED ; do
1613 - [[ -f ${mysql_disabled_file} ]] && break
1614 - done
1615 - if [[ ${mysql_disabled_file} != "FAILED" ]]; then
1616 - echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
1617 - else
1618 - for mysql_disabled_dir in \
1619 - ${S}/mysql-test/suite/${testsuite} \
1620 - ${S}/mysql-test/suite/${testsuite}/t \
1621 - FAILED ; do
1622 - [[ -d ${mysql_disabled_dir} ]] && break
1623 - done
1624 - if [[ ${mysql_disabled_dir} != "FAILED" ]]; then
1625 - echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
1626 - else
1627 - ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
1628 - fi
1629 - fi
1630 - fi
1631 -}
1632 -
1633 -# @FUNCTION: mysql-cmake_use_plugin
1634 -# @DESCRIPTION:
1635 -# Helper function to enable/disable plugins by use flags
1636 -# cmake-utils_use_with is not enough as some references check WITH_ (0|1)
1637 -# and some check WITHOUT_. Also, this can easily extend to non-storage plugins.
1638 -mysql-cmake_use_plugin() {
1639 - [[ -z $2 ]] && die "mysql-cmake_use_plugin <USE flag> <flag name>"
1640 - if in_iuse $1 && use $1 ; then
1641 - echo "-DWITH_$2=1 -DPLUGIN_$2=YES"
1642 - else
1643 - echo "-DWITHOUT_$2=1 -DWITH_$2=0 -DPLUGIN_$2=NO"
1644 - fi
1645 -}
1646 -
1647 -# @FUNCTION: mysql_init_vars
1648 -# @DESCRIPTION:
1649 -# void mysql_init_vars()
1650 -# Initialize global variables
1651 -# 2005-11-19 <vivo@g.o>
1652 -if [[ "${EAPI}x" != "5x" ]]; then
1653 -
1654 -mysql_init_vars() {
1655 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
1656 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
1657 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
1658 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
1659 - MY_INCLUDEDIR=${MY_INCLUDEDIR="${EPREFIX}/usr/include/mysql"}
1660 - MY_LIBDIR=${MY_LIBDIR="${EPREFIX}/usr/$(get_libdir)/mysql"}
1661 -
1662 - if [[ -z "${MY_DATADIR}" ]] ; then
1663 - MY_DATADIR=""
1664 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
1665 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1666 - | sed -ne '/datadir/s|^--datadir=||p' \
1667 - | tail -n1`
1668 - if [[ -z "${MY_DATADIR}" ]] ; then
1669 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
1670 - | sed -e 's/.*=\s*//' \
1671 - | tail -n1`
1672 - fi
1673 - fi
1674 - if [[ -z "${MY_DATADIR}" ]] ; then
1675 - MY_DATADIR="${MY_LOCALSTATEDIR}"
1676 - einfo "Using default MY_DATADIR"
1677 - fi
1678 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
1679 -
1680 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
1681 - if [[ -e "${MY_DATADIR}" ]] ; then
1682 - # If you get this and you're wondering about it, see bug #207636
1683 - elog "MySQL datadir found in ${MY_DATADIR}"
1684 - elog "A new one will not be created."
1685 - PREVIOUS_DATADIR="yes"
1686 - else
1687 - PREVIOUS_DATADIR="no"
1688 - fi
1689 - export PREVIOUS_DATADIR
1690 - fi
1691 - else
1692 - if [[ ${EBUILD_PHASE} == "config" ]]; then
1693 - local new_MY_DATADIR
1694 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
1695 - | sed -ne '/datadir/s|^--datadir=||p' \
1696 - | tail -n1`
1697 -
1698 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
1699 - ewarn "MySQL MY_DATADIR has changed"
1700 - ewarn "from ${MY_DATADIR}"
1701 - ewarn "to ${new_MY_DATADIR}"
1702 - MY_DATADIR="${new_MY_DATADIR}"
1703 - fi
1704 - fi
1705 - fi
1706 -
1707 - if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then
1708 - MY_SOURCEDIR=${SERVER_URI##*/}
1709 - MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
1710 - fi
1711 -
1712 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
1713 - export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
1714 - export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR
1715 -}
1716 -fi
1717
1718 diff --git a/eclass/mysql-v2.eclass b/eclass/mysql-v2.eclass
1719 deleted file mode 100644
1720 index 9b9d6087e11..00000000000
1721 --- a/eclass/mysql-v2.eclass
1722 +++ /dev/null
1723 @@ -1,915 +0,0 @@
1724 -# Copyright 1999-2019 Gentoo Authors
1725 -# Distributed under the terms of the GNU General Public License v2
1726 -
1727 -# @DEAD
1728 -# @ECLASS: mysql-v2.eclass
1729 -# @MAINTAINER:
1730 -# Maintainers:
1731 -# - MySQL Team <mysql-bugs@g.o>
1732 -# - Robin H. Johnson <robbat2@g.o>
1733 -# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o>
1734 -# - Brian Evans <grknight@g.o>
1735 -# @SUPPORTED_EAPIS: 4 5
1736 -# @BLURB: This eclass provides most of the functions for mysql ebuilds
1737 -# @DESCRIPTION:
1738 -# The mysql-v2.eclass is the base eclass to build the mysql and
1739 -# alternative projects (mariadb and percona) ebuilds.
1740 -# This eclass uses the mysql-autotools and mysql-cmake eclasses for the
1741 -# specific bits related to the build system.
1742 -# It provides the src_unpack, src_prepare, src_configure, src_compile,
1743 -# src_install, pkg_preinst, pkg_postinst, pkg_config and pkg_postrm
1744 -# phase hooks.
1745 -
1746 -# @ECLASS-VARIABLE: BUILD
1747 -# @DESCRIPTION:
1748 -# Build type of the mysql version
1749 -: ${BUILD:=autotools}
1750 -
1751 -case ${BUILD} in
1752 - "cmake")
1753 - BUILD_INHERIT="mysql-cmake"
1754 - ;;
1755 - "autotools")
1756 - BUILD_INHERIT="mysql-autotools"
1757 -
1758 - WANT_AUTOCONF="latest"
1759 - WANT_AUTOMAKE="latest"
1760 - ;;
1761 - *)
1762 - die "${BUILD} is not a valid build system for mysql"
1763 - ;;
1764 -esac
1765 -
1766 -MYSQL_EXTRAS=""
1767 -
1768 -# @ECLASS-VARIABLE: MYSQL_EXTRAS_VER
1769 -# @DEFAULT_UNSET
1770 -# @DESCRIPTION:
1771 -# The version of the MYSQL_EXTRAS repo to use to build mysql
1772 -# Use "none" to disable it's use
1773 -[[ ${MY_EXTRAS_VER} == "live" ]] && MYSQL_EXTRAS="git-r3"
1774 -
1775 -inherit eutils flag-o-matic ${MYSQL_EXTRAS} ${BUILD_INHERIT} mysql_fx versionator toolchain-funcs user
1776 -
1777 -#
1778 -# Supported EAPI versions and export functions
1779 -#
1780 -
1781 -case "${EAPI:-0}" in
1782 - 4|5) ;;
1783 - *) die "Unsupported EAPI: ${EAPI}" ;;
1784 -esac
1785 -
1786 -EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_config pkg_postrm
1787 -
1788 -#
1789 -# VARIABLES:
1790 -#
1791 -
1792 -# Shorten the path because the socket path length must be shorter than 107 chars
1793 -# and we will run a mysql server during test phase
1794 -S="${WORKDIR}/mysql"
1795 -
1796 -[[ ${MY_EXTRAS_VER} == "latest" ]] && MY_EXTRAS_VER="20090228-0714Z"
1797 -if [[ ${MY_EXTRAS_VER} == "live" ]]; then
1798 - EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
1799 - EGIT_CHECKOUT_DIR=${WORKDIR}/mysql-extras
1800 - EGIT_CLONE_TYPE=shallow
1801 -fi
1802 -
1803 -# @ECLASS-VARIABLE: MYSQL_PV_MAJOR
1804 -# @DESCRIPTION:
1805 -# Upstream MySQL considers the first two parts of the version number to be the
1806 -# major version. Upgrades that change major version should always run
1807 -# mysql_upgrade.
1808 -MYSQL_PV_MAJOR="$(get_version_component_range 1-2 ${PV})"
1809 -
1810 -# Cluster is a special case...
1811 -if [[ ${PN} == "mysql-cluster" ]]; then
1812 - case ${PV} in
1813 - 6.1*|7.0*|7.1*) MYSQL_PV_MAJOR=5.1 ;;
1814 - 7.2*) MYSQL_PV_MAJOR=5.5 ;;
1815 - 7.3*) MYSQL_PV_MAJOR=5.6 ;;
1816 - esac
1817 -fi
1818 -
1819 -# MariaDB has left the numbering schema but keeping compatibility
1820 -if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
1821 - case ${PV} in
1822 - 10.0*|10.1*) MYSQL_PV_MAJOR="5.6" ;;
1823 - esac
1824 -fi
1825 -
1826 -# @ECLASS-VARIABLE: MYSQL_VERSION_ID
1827 -# @DESCRIPTION:
1828 -# MYSQL_VERSION_ID will be:
1829 -# major * 10e6 + minor * 10e4 + micro * 10e2 + gentoo revision number, all [0..99]
1830 -# This is an important part, because many of the choices the MySQL ebuild will do
1831 -# depend on this variable.
1832 -# In particular, the code below transforms a $PVR like "5.0.18-r3" in "5001803"
1833 -# We also strip off upstream's trailing letter that they use to respin tarballs
1834 -MYSQL_VERSION_ID=""
1835 -tpv="${PV%[a-z]}"
1836 -tpv=( ${tpv//[-._]/ } ) ; tpv[3]="${PVR:${#PV}}" ; tpv[3]="${tpv[3]##*-r}"
1837 -for vatom in 0 1 2 3 ; do
1838 - # pad to length 2
1839 - tpv[${vatom}]="00${tpv[${vatom}]}"
1840 - MYSQL_VERSION_ID="${MYSQL_VERSION_ID}${tpv[${vatom}]:0-2}"
1841 -done
1842 -# strip leading "0" (otherwise it's considered an octal number by BASH)
1843 -MYSQL_VERSION_ID=${MYSQL_VERSION_ID##"0"}
1844 -
1845 -# This eclass should only be used with at least mysql-5.1.50
1846 -mysql_version_is_at_least "5.1.50" || die "This eclass should only be used with >=mysql-5.1.50"
1847 -
1848 -# @ECLASS-VARIABLE: XTRADB_VER
1849 -# @DEFAULT_UNSET
1850 -# @DESCRIPTION:
1851 -# Version of the XTRADB storage engine
1852 -
1853 -# @ECLASS-VARIABLE: PERCONA_VER
1854 -# @DEFAULT_UNSET
1855 -# @DESCRIPTION:
1856 -# Designation by PERCONA for a MySQL version to apply an XTRADB release
1857 -
1858 -# Work out the default SERVER_URI correctly
1859 -if [[ -z ${SERVER_URI} ]]; then
1860 - [[ -z ${MY_PV} ]] && MY_PV="${PV//_/-}"
1861 - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
1862 - # Beginning with 5.5, MariaDB stopped putting beta, alpha or rc on their tarball names
1863 - mysql_version_is_at_least "5.5" && MARIA_FULL_PV=$(get_version_component_range 1-3) || \
1864 - MARIA_FULL_PV=$(replace_version_separator 3 '-' ${MY_PV})
1865 - MARIA_FULL_P="${PN}-${MARIA_FULL_PV}"
1866 - SERVER_URI="
1867 - http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1868 - http://ftp.osuosl.org/pub/mariadb/${MARIA_FULL_P}/source/${MARIA_FULL_P}.tar.gz
1869 - http://mirror.jmu.edu/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1870 - http://mirrors.coreix.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1871 - http://mirrors.syringanetworks.net/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1872 - http://mirrors.fe.up.pt/pub/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1873 - http://mirror2.hs-esslingen.de/mariadb/${MARIA_FULL_P}/kvm-tarbake-jaunty-x86/${MARIA_FULL_P}.tar.gz
1874 - "
1875 - if [[ ${PN} == "mariadb-galera" ]]; then
1876 - MY_SOURCEDIR="${PN%%-galera}-${MARIA_FULL_PV}"
1877 - fi
1878 - elif [[ ${PN} == "percona-server" ]]; then
1879 - PERCONA_PN="Percona-Server"
1880 - MIRROR_PV=$(get_version_component_range 1-2 ${PV})
1881 - MY_PV=$(get_version_component_range 1-3 ${PV})
1882 - PERCONA_RELEASE=$(get_version_component_range 4-5 ${PV})
1883 - PERCONA_RC=$(get_version_component_range 6 ${PV})
1884 - SERVER_URI="http://www.percona.com/redir/downloads/${PERCONA_PN}-${MIRROR_PV}/${PERCONA_PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}/source/tarball/${PN}-${MY_PV}-${PERCONA_RC}${PERCONA_RELEASE}.tar.gz"
1885 -# http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/tarball/Percona-Server-5.5.30-30.2.tar.gz
1886 -# http://www.percona.com/redir/downloads/Percona-Server-5.6/Percona-Server-5.6.13-rc60.5/source/tarball/Percona-Server-5.6.13-rc60.5.tar.gz
1887 - else
1888 - if [[ "${PN}" == "mysql-cluster" ]] ; then
1889 - URI_DIR="MySQL-Cluster"
1890 - URI_FILE="mysql-cluster-gpl"
1891 - else
1892 - URI_DIR="MySQL"
1893 - URI_FILE="mysql"
1894 - fi
1895 - URI_A="${URI_FILE}-${MY_PV}.tar.gz"
1896 - MIRROR_PV=$(get_version_component_range 1-2 ${PV})
1897 - # Recently upstream switched to an archive site, and not on mirrors
1898 - SERVER_URI="http://downloads.mysql.com/archives/${URI_FILE}-${MIRROR_PV}/${URI_A}
1899 - https://downloads.skysql.com/files/${URI_FILE}-${MIRROR_PV}/${URI_A}
1900 - mirror://mysql/Downloads/${URI_DIR}-${PV%.*}/${URI_A}"
1901 - fi
1902 -fi
1903 -
1904 -# Define correct SRC_URIs
1905 -SRC_URI="${SERVER_URI}"
1906 -
1907 -# Gentoo patches to MySQL
1908 -if [[ ${MY_EXTRAS_VER} != "live" && ${MY_EXTRAS_VER} != "none" ]]; then
1909 - SRC_URI="${SRC_URI}
1910 - mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1911 - https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1912 - https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
1913 - https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
1914 -fi
1915 -
1916 -DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
1917 -HOMEPAGE="https://www.mysql.com/"
1918 -if [[ ${PN} == "mariadb" ]]; then
1919 - HOMEPAGE="https://mariadb.org/"
1920 - DESCRIPTION="An enhanced, drop-in replacement for MySQL"
1921 -fi
1922 -if [[ ${PN} == "mariadb-galera" ]]; then
1923 - HOMEPAGE="https://mariadb.org/"
1924 - DESCRIPTION="An enhanced, drop-in replacement for MySQL with Galera Replication"
1925 -fi
1926 -if [[ ${PN} == "percona-server" ]]; then
1927 - HOMEPAGE="https://www.percona.com/software/mysql-database/percona-server"
1928 - DESCRIPTION="An enhanced, drop-in replacement for MySQL from the Percona team"
1929 -fi
1930 -LICENSE="GPL-2"
1931 -SLOT="0"
1932 -
1933 -case "${BUILD}" in
1934 - "autotools")
1935 - IUSE="big-tables debug embedded minimal +perl selinux ssl static test"
1936 - ;;
1937 - "cmake")
1938 - IUSE="debug embedded minimal +perl selinux ssl static static-libs test"
1939 - ;;
1940 -esac
1941 -
1942 -# Common IUSE
1943 -IUSE="${IUSE} latin1 extraengine cluster max-idx-128 +community profiling"
1944 -
1945 -# This probably could be simplified, but the syntax would have to be just right
1946 -if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && \
1947 - mysql_version_is_at_least "5.5" ; then
1948 - IUSE="bindist ${IUSE}"
1949 - RESTRICT="${RESTRICT} !bindist? ( bindist )"
1950 -elif [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \
1951 - mysql_check_version_range "5.5.37 to 5.6.11.99" ; then
1952 - IUSE="bindist ${IUSE}"
1953 - RESTRICT="${RESTRICT} !bindist? ( bindist )"
1954 -elif [[ ${PN} == "mysql-cluster" ]] && \
1955 - mysql_check_version_range "7.2 to 7.2.99.99" ; then
1956 - IUSE="bindist ${IUSE}"
1957 - RESTRICT="${RESTRICT} !bindist? ( bindist )"
1958 -fi
1959 -
1960 -if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
1961 - mysql_check_version_range "5.1.38 to 5.3.99" && IUSE="${IUSE} libevent"
1962 - mysql_version_is_at_least "5.2" && IUSE="${IUSE} oqgraph" && \
1963 - REQUIRED_USE="${REQUIRED_USE} minimal? ( !oqgraph )"
1964 - mysql_version_is_at_least "5.2.5" && IUSE="${IUSE} sphinx" && \
1965 - REQUIRED_USE="${REQUIRED_USE} minimal? ( !sphinx )"
1966 - mysql_version_is_at_least "5.2.10" && IUSE="${IUSE} pam"
1967 - # 5.5.33 and 10.0.5 add TokuDB. Authors strongly recommend jemalloc or perfomance suffers
1968 - mysql_version_is_at_least "10.0.5" && IUSE="${IUSE} tokudb odbc xml" && \
1969 - REQUIRED_USE="${REQUIRED_USE} odbc? ( extraengine ) xml? ( extraengine ) tokudb? ( jemalloc !tcmalloc )"
1970 - mysql_check_version_range "5.5.33 to 5.5.99" && IUSE="${IUSE} tokudb" && \
1971 - REQUIRED_USE="${REQUIRED_USE} tokudb? ( jemalloc !tcmalloc )"
1972 -fi
1973 -
1974 -if mysql_version_is_at_least "5.5"; then
1975 - REQUIRED_USE="${REQUIRED_USE} tcmalloc? ( !jemalloc ) jemalloc? ( !tcmalloc )"
1976 - IUSE="${IUSE} jemalloc tcmalloc"
1977 -fi
1978 -
1979 -if mysql_version_is_at_least "5.5.7"; then
1980 - IUSE="${IUSE} systemtap"
1981 -fi
1982 -
1983 -if [[ ${PN} == "percona-server" ]]; then
1984 - mysql_version_is_at_least "5.5.10" && IUSE="${IUSE} pam"
1985 -fi
1986 -
1987 -REQUIRED_USE="${REQUIRED_USE} minimal? ( !cluster !extraengine !embedded ) static? ( !ssl )"
1988 -
1989 -#
1990 -# DEPENDENCIES:
1991 -#
1992 -
1993 -# Be warned, *DEPEND are version-dependant
1994 -# These are used for both runtime and compiletime
1995 -DEPEND="
1996 - ssl? ( >=dev-libs/openssl-0.9.6d:0 )
1997 - kernel_linux? ( sys-process/procps )
1998 - >=sys-apps/sed-4
1999 - >=sys-apps/texinfo-4.7-r1
2000 - >=sys-libs/zlib-1.2.3
2001 -"
2002 -# TODO: add this as a dep if it is moved from the overlay
2003 -# !dev-db/mariadb-native-client[mysqlcompat]
2004 -
2005 -# dev-db/mysql-5.6.12+ only works with dev-libs/libedit
2006 -# This probably could be simplified
2007 -if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] && \
2008 - mysql_version_is_at_least "5.6.12" ; then
2009 - DEPEND="${DEPEND} dev-libs/libedit"
2010 -elif [[ ${PN} == "mysql-cluster" ]] && mysql_version_is_at_least "7.3"; then
2011 - DEPEND="${DEPEND} dev-libs/libedit"
2012 -else
2013 - if mysql_version_is_at_least "5.5" ; then
2014 - DEPEND="${DEPEND} !bindist? ( >=sys-libs/readline-4.1:0 )"
2015 - else
2016 - DEPEND="${DEPEND} >=sys-libs/readline-4.1:0"
2017 - fi
2018 -fi
2019 -
2020 -if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
2021 - mysql_check_version_range "5.1.38 to 5.3.99" && DEPEND="${DEPEND} libevent? ( >=dev-libs/libevent-1.4 )"
2022 - mysql_version_is_at_least "5.2" && DEPEND="${DEPEND} oqgraph? ( >=dev-libs/boost-1.40.0 )"
2023 - mysql_version_is_at_least "5.2.10" && DEPEND="${DEPEND} !minimal? ( pam? ( virtual/pam ) )"
2024 - # Bug 441700 MariaDB >=5.3 include custom mytop
2025 - mysql_version_is_at_least "5.3" && DEPEND="${DEPEND} perl? ( !dev-db/mytop )"
2026 - if mysql_version_is_at_least "10.0.5" ; then
2027 - DEPEND="${DEPEND}
2028 - odbc? ( dev-db/unixODBC )
2029 - xml? ( dev-libs/libxml2 )
2030 - "
2031 - fi
2032 - mysql_version_is_at_least "10.0.7" && DEPEND="${DEPEND} oqgraph? ( dev-libs/judy )"
2033 - if mysql_version_is_at_least "10.0.9" ; then
2034 - DEPEND="${DEPEND} >=dev-libs/libpcre-8.35"
2035 - fi
2036 -fi
2037 -
2038 -# Having different flavours at the same time is not a good idea
2039 -for i in "mysql" "mariadb" "mariadb-galera" "percona-server" "mysql-cluster" ; do
2040 - [[ ${i} == ${PN} ]] ||
2041 - DEPEND="${DEPEND} !dev-db/${i}"
2042 -done
2043 -
2044 -if mysql_version_is_at_least "5.5.7" ; then
2045 - DEPEND="${DEPEND}
2046 - jemalloc? ( dev-libs/jemalloc[static-libs?] )
2047 - tcmalloc? ( dev-util/google-perftools )
2048 - >=sys-libs/zlib-1.2.3[static-libs?]
2049 - ssl? ( >=dev-libs/openssl-0.9.6d[static-libs?] )
2050 - systemtap? ( >=dev-util/systemtap-1.3 )
2051 - kernel_linux? ( dev-libs/libaio )
2052 - "
2053 -fi
2054 -
2055 -if [[ ${PN} == "mysql-cluster" ]] ; then
2056 - # TODO: This really should include net-misc/memcached
2057 - # but the package does not install the files it seeks.
2058 - mysql_version_is_at_least "7.2.3" && \
2059 - DEPEND="${DEPEND} dev-libs/libevent"
2060 -fi
2061 -
2062 -# prefix: first need to implement something for #196294
2063 -RDEPEND="${DEPEND}
2064 - !minimal? ( !prefix? ( dev-db/mysql-init-scripts ) )
2065 - selinux? ( sec-policy/selinux-mysql )
2066 -"
2067 -
2068 -if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
2069 - # Bug 455016 Add dependencies of mytop
2070 - if mysql_version_is_at_least "5.3" ; then
2071 - RDEPEND="${RDEPEND}
2072 - perl? (
2073 - virtual/perl-Getopt-Long
2074 - dev-perl/TermReadKey
2075 - virtual/perl-Term-ANSIColor
2076 - virtual/perl-Time-HiRes
2077 - )
2078 - "
2079 - fi
2080 -fi
2081 -
2082 -if [[ ${PN} == "mariadb-galera" ]] ; then
2083 - # The wsrep API version must match between the ebuild and sys-cluster/galera.
2084 - # This will be indicated by WSREP_REVISION in the ebuild and the first number
2085 - # in the version of sys-cluster/galera
2086 - RDEPEND="${RDEPEND}
2087 - =sys-cluster/galera-${WSREP_REVISION}*
2088 - "
2089 -fi
2090 -
2091 -if [[ ${PN} == "mysql-cluster" ]] ; then
2092 - mysql_version_is_at_least "7.2.9" && RDEPEND="${RDEPEND} java? ( >=virtual/jre-1.6 )" && \
2093 - DEPEND="${DEPEND} java? ( >=virtual/jdk-1.6 )"
2094 -fi
2095 -
2096 -DEPEND="${DEPEND}
2097 - virtual/yacc
2098 -"
2099 -
2100 -DEPEND="${DEPEND} static? ( sys-libs/ncurses[static-libs] )"
2101 -
2102 -# compile-time-only
2103 -DEPEND="${DEPEND} >=dev-util/cmake-2.4.3"
2104 -
2105 -# compile-time-only
2106 -if mysql_version_is_at_least "5.5.8" ; then
2107 - DEPEND="${DEPEND} >=dev-util/cmake-2.6.3"
2108 -fi
2109 -
2110 -# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
2111 -PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
2112 -
2113 -# For other stuff to bring us in
2114 -PDEPEND="${PDEPEND} ~virtual/mysql-${MYSQL_PV_MAJOR}"
2115 -
2116 -#
2117 -# External patches
2118 -#
2119 -
2120 -# MariaDB has integrated PBXT until it was dropped in version 5.5.33
2121 -# PBXT_VERSION means that we have a PBXT patch for this PV
2122 -# PBXT was only introduced after 5.1.12
2123 -pbxt_patch_available() {
2124 - [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera" && ( -n "${PBXT_VERSION}" ) ]]
2125 - return $?
2126 -}
2127 -
2128 -pbxt_available() {
2129 - pbxt_patch_available || [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && mysql_check_version_range "5.1 to 5.5.32"
2130 - return $?
2131 -}
2132 -
2133 -# Get the percona tarball if XTRADB_VER and PERCONA_VER are both set
2134 -# MariaDB has integrated XtraDB
2135 -# XTRADB_VERS means that we have a XTRADB patch for this PV
2136 -# XTRADB was only introduced after 5.1.26
2137 -xtradb_patch_available() {
2138 - [[ ${PN} != "mariadb" && ${PN} != "mariadb-galera"
2139 - && ( -n "${XTRADB_VER}" ) && ( -n "${PERCONA_VER}" ) ]]
2140 - return $?
2141 -}
2142 -
2143 -if pbxt_patch_available; then
2144 -
2145 - PBXT_P="pbxt-${PBXT_VERSION}"
2146 - PBXT_SRC_URI="http://www.primebase.org/download/${PBXT_P}.tar.gz mirror://sourceforge/pbxt/${PBXT_P}.tar.gz"
2147 - SRC_URI="${SRC_URI} pbxt? ( ${PBXT_SRC_URI} )"
2148 -fi
2149 -
2150 -# PBXT_NEWSTYLE means pbxt is in storage/ and gets enabled as other plugins
2151 -# vs. built outside the dir
2152 -if pbxt_available; then
2153 -
2154 - IUSE="${IUSE} pbxt"
2155 - PBXT_NEWSTYLE=1
2156 - REQUIRED_USE="${REQUIRED_USE} pbxt? ( !embedded ) "
2157 -fi
2158 -
2159 -if xtradb_patch_available; then
2160 - XTRADB_P="percona-xtradb-${XTRADB_VER}"
2161 - XTRADB_SRC_URI_COMMON="${PERCONA_VER}/source/${XTRADB_P}.tar.gz"
2162 - XTRADB_SRC_B1="http://www.percona.com/"
2163 - XTRADB_SRC_B2="${XTRADB_SRC_B1}/percona-builds/"
2164 - XTRADB_SRC_URI1="${XTRADB_SRC_B2}/Percona-Server/Percona-Server-${XTRADB_SRC_URI_COMMON}"
2165 - XTRADB_SRC_URI2="${XTRADB_SRC_B2}/xtradb/${XTRADB_SRC_URI_COMMON}"
2166 - XTRADB_SRC_URI3="${XTRADB_SRC_B1}/${PN}/xtradb/${XTRADB_SRC_URI_COMMON}"
2167 - SRC_URI="${SRC_URI} xtradb? ( ${XTRADB_SRC_URI1} ${XTRADB_SRC_URI2} ${XTRADB_SRC_URI3} )"
2168 - IUSE="${IUSE} xtradb"
2169 - REQUIRED_USE="${REQUIRED_USE} xtradb? ( !embedded ) "
2170 -fi
2171 -
2172 -#
2173 -# HELPER FUNCTIONS:
2174 -#
2175 -
2176 -# @FUNCTION: mysql-v2_disable_test
2177 -# @DESCRIPTION:
2178 -# Helper function to disable specific tests.
2179 -mysql-v2_disable_test() {
2180 - ${BUILD_INHERIT}_disable_test "$@"
2181 -}
2182 -
2183 -# @FUNCTION: mysql-v2_configure_minimal
2184 -# @DESCRIPTION:
2185 -# Helper function to configure minimal build
2186 -configure_minimal() {
2187 - ${BUILD_INHERIT}_configure_minimal "$@"
2188 -}
2189 -
2190 -# @FUNCTION: mysql-v2_configure_common
2191 -# @DESCRIPTION:
2192 -# Helper function to configure common builds
2193 -configure_common() {
2194 - ${BUILD_INHERIT}_configure_common "$@"
2195 -}
2196 -
2197 -#
2198 -# EBUILD FUNCTIONS
2199 -#
2200 -
2201 -# @FUNCTION: mysql-v2_pkg_setup
2202 -# @DESCRIPTION:
2203 -# Perform some basic tests and tasks during pkg_setup phase:
2204 -# die if FEATURES="test", USE="-minimal" and not using FEATURES="userpriv"
2205 -# check for conflicting use flags
2206 -# create new user and group for mysql
2207 -# warn about deprecated features
2208 -mysql-v2_pkg_setup() {
2209 -
2210 - if has test ${FEATURES} ; then
2211 - if ! use minimal ; then
2212 - if ! has userpriv ${FEATURES} ; then
2213 - eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
2214 - fi
2215 - fi
2216 - fi
2217 -
2218 - # Check for USE flag problems in pkg_setup
2219 - if ! mysql_version_is_at_least "5.2" && use debug ; then
2220 - # Also in package.use.mask
2221 - die "Bug #344885: Upstream has broken USE=debug for 5.1 series >=5.1.51"
2222 - fi
2223 -
2224 - # This should come after all of the die statements
2225 - enewgroup mysql 60 || die "problem adding 'mysql' group"
2226 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
2227 -
2228 - if use cluster && [[ "${PN}" != "mysql-cluster" ]]; then
2229 - ewarn "Upstream has noted that the NDB cluster support in the 5.0 and"
2230 - ewarn "5.1 series should NOT be put into production. In the near"
2231 - ewarn "future, it will be disabled from building."
2232 - fi
2233 -
2234 - if [[ ${PN} == "mysql-cluster" ]] ; then
2235 - mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_setup
2236 - fi
2237 -
2238 - if use_if_iuse tokudb && [[ $(gcc-major-version) -lt 4 || $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 7 ]] ; then
2239 - eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
2240 - eerror "Please use gcc-config to switch to gcc-4.7 or later version."
2241 - die
2242 - fi
2243 -
2244 -}
2245 -
2246 -# @FUNCTION: mysql-v2_src_unpack
2247 -# @DESCRIPTION:
2248 -# Unpack the source code
2249 -mysql-v2_src_unpack() {
2250 -
2251 - # Initialize the proper variables first
2252 - mysql_init_vars
2253 -
2254 - unpack ${A}
2255 - # Grab the patches
2256 - [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
2257 -
2258 - mv -f "${WORKDIR}/${MY_SOURCEDIR}" "${S}"
2259 -}
2260 -
2261 -# @FUNCTION: mysql-v2_src_prepare
2262 -# @DESCRIPTION:
2263 -# Apply patches to the source code and remove unneeded bundled libs.
2264 -mysql-v2_src_prepare() {
2265 - ${BUILD_INHERIT}_src_prepare "$@"
2266 - if [[ ${PN} == "mysql-cluster" ]] ; then
2267 - mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_src_prepare
2268 - fi
2269 -}
2270 -
2271 -# @FUNCTION: mysql-v2_src_configure
2272 -# @DESCRIPTION:
2273 -# Configure mysql to build the code for Gentoo respecting the use flags.
2274 -mysql-v2_src_configure() {
2275 - ${BUILD_INHERIT}_src_configure "$@"
2276 -}
2277 -
2278 -# @FUNCTION: mysql-v2_src_compile
2279 -# @DESCRIPTION:
2280 -# Compile the mysql code.
2281 -mysql-v2_src_compile() {
2282 - ${BUILD_INHERIT}_src_compile "$@"
2283 -}
2284 -
2285 -# @FUNCTION: mysql-v2_src_install
2286 -# @DESCRIPTION:
2287 -# Install mysql.
2288 -mysql-v2_src_install() {
2289 - ${BUILD_INHERIT}_src_install "$@"
2290 -}
2291 -
2292 -# @FUNCTION: mysql-v2_pkg_preinst
2293 -# @DESCRIPTION:
2294 -# Create the user and groups for mysql - die if that fails.
2295 -mysql-v2_pkg_preinst() {
2296 - if [[ ${PN} == "mysql-cluster" ]] ; then
2297 - mysql_version_is_at_least "7.2.9" && java-pkg-opt-2_pkg_preinst
2298 - fi
2299 - enewgroup mysql 60 || die "problem adding 'mysql' group"
2300 - enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
2301 -}
2302 -
2303 -# @FUNCTION: mysql-v2_pkg_postinst
2304 -# @DESCRIPTION:
2305 -# Run post-installation tasks:
2306 -# create the dir for logfiles if non-existant
2307 -# touch the logfiles and secure them
2308 -# install scripts
2309 -# issue required steps for optional features
2310 -# issue deprecation warnings
2311 -mysql-v2_pkg_postinst() {
2312 -
2313 - # Make sure the vars are correctly initialized
2314 - mysql_init_vars
2315 -
2316 - # Create log directory securely if it does not exist
2317 - [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
2318 -
2319 - # Minimal builds don't have the MySQL server
2320 - if ! use minimal ; then
2321 - docinto "support-files"
2322 - for script in \
2323 - support-files/my-*.cnf \
2324 - support-files/magic \
2325 - support-files/ndb-config-2-node.ini
2326 - do
2327 - [[ -f "${script}" ]] \
2328 - && dodoc "${script}"
2329 - done
2330 -
2331 - docinto "scripts"
2332 - for script in scripts/mysql* ; do
2333 - if [[ -f "${script}" && "${script%.sh}" == "${script}" ]]; then
2334 - dodoc "${script}"
2335 - fi
2336 - done
2337 -
2338 - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] ; then
2339 - if use_if_iuse pam ; then
2340 - einfo
2341 - elog "This install includes the PAM authentication plugin."
2342 - elog "To activate and configure the PAM plugin, please read:"
2343 - elog "https://kb.askmonty.org/en/pam-authentication-plugin/"
2344 - einfo
2345 - fi
2346 - fi
2347 -
2348 - einfo
2349 - elog "You might want to run:"
2350 - elog "\"emerge --config =${CATEGORY}/${PF}\""
2351 - elog "if this is a new install."
2352 - einfo
2353 -
2354 - einfo
2355 - elog "If you are upgrading major versions, you should run the"
2356 - elog "mysql_upgrade tool."
2357 - einfo
2358 -
2359 - if [[ ${PN} == "mariadb-galera" ]] ; then
2360 - einfo
2361 - elog "Be sure to edit the my.cnf file to activate your cluster settings."
2362 - elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
2363 - elog "The first time the cluster is activated, you should add"
2364 - elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
2365 - elog "This option should then be removed for subsequent starts."
2366 - einfo
2367 - fi
2368 - fi
2369 -
2370 - if use_if_iuse pbxt ; then
2371 - elog "Note: PBXT is now statically built when enabled."
2372 - elog ""
2373 - elog "If, you previously installed as a plugin and "
2374 - elog "you cannot start the MySQL server,"
2375 - elog "remove the ${MY_DATADIR}/mysql/plugin.* files, then"
2376 - elog "use the MySQL upgrade script to restore the table"
2377 - elog "or execute the following SQL command:"
2378 - elog " CREATE TABLE IF NOT EXISTS plugin ("
2379 - elog " name char(64) binary DEFAULT '' NOT NULL,"
2380 - elog " dl char(128) DEFAULT '' NOT NULL,"
2381 - elog " PRIMARY KEY (name)"
2382 - elog " ) CHARACTER SET utf8 COLLATE utf8_bin;"
2383 - fi
2384 -}
2385 -
2386 -# @FUNCTION: mysql-v2_getopt
2387 -# @DESCRIPTION:
2388 -# Use my_print_defaults to extract specific config options
2389 -mysql-v2_getopt() {
2390 - local mypd="${EROOT}"/usr/bin/my_print_defaults
2391 - section="$1"
2392 - flag="--${2}="
2393 - "${mypd}" $section | sed -n "/^${flag}/p"
2394 -}
2395 -
2396 -# @FUNCTION: mysql-v2_getoptval
2397 -# @DESCRIPTION:
2398 -# Use my_print_defaults to extract specific config options
2399 -mysql-v2_getoptval() {
2400 - local mypd="${EROOT}"/usr/bin/my_print_defaults
2401 - section="$1"
2402 - flag="--${2}="
2403 - "${mypd}" $section | sed -n "/^${flag}/s,${flag},,gp"
2404 -}
2405 -
2406 -# @FUNCTION: mysql-v2_pkg_config
2407 -# @DESCRIPTION:
2408 -# Configure mysql environment.
2409 -mysql-v2_pkg_config() {
2410 -
2411 - local old_MY_DATADIR="${MY_DATADIR}"
2412 - local old_HOME="${HOME}"
2413 - # my_print_defaults needs to read stuff in $HOME/.my.cnf
2414 - export HOME=${EPREFIX}/root
2415 -
2416 - # Make sure the vars are correctly initialized
2417 - mysql_init_vars
2418 -
2419 - [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
2420 -
2421 - if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
2422 - die "Minimal builds do NOT include the MySQL server"
2423 - fi
2424 -
2425 - if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
2426 - local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
2427 - MY_DATADIR_s="${MY_DATADIR_s%%/}"
2428 - local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
2429 - old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
2430 -
2431 - if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
2432 - if [[ -d "${MY_DATADIR_s}" ]]; then
2433 - ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
2434 - ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
2435 - else
2436 - elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
2437 - mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
2438 - || die "Moving MY_DATADIR failed"
2439 - fi
2440 - else
2441 - ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
2442 - if [[ -d "${MY_DATADIR_s}" ]]; then
2443 - ewarn "Attempting to use ${MY_DATADIR_s}"
2444 - else
2445 - eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
2446 - die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
2447 - fi
2448 - fi
2449 - fi
2450 -
2451 - local pwd1="a"
2452 - local pwd2="b"
2453 - local maxtry=15
2454 -
2455 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2456 - MYSQL_ROOT_PASSWORD="$(mysql-v2_getoptval 'client mysql' password)"
2457 - fi
2458 - MYSQL_TMPDIR="$(mysql-v2_getoptval mysqld tmpdir)"
2459 - # These are dir+prefix
2460 - MYSQL_RELAY_LOG="$(mysql-v2_getoptval mysqld relay-log)"
2461 - MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
2462 - MYSQL_LOG_BIN="$(mysql-v2_getoptval mysqld log-bin)"
2463 - MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
2464 -
2465 - if [[ ! -d "${ROOT}"/$MYSQL_TMPDIR ]]; then
2466 - einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
2467 - install -d -m 770 -o mysql -g mysql "${ROOT}"/$MYSQL_TMPDIR
2468 - fi
2469 - if [[ ! -d "${ROOT}"/$MYSQL_LOG_BIN ]]; then
2470 - einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
2471 - install -d -m 770 -o mysql -g mysql "${ROOT}"/$MYSQL_LOG_BIN
2472 - fi
2473 - if [[ ! -d "${EROOT}"/$MYSQL_RELAY_LOG ]]; then
2474 - einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
2475 - install -d -m 770 -o mysql -g mysql "${EROOT}"/$MYSQL_RELAY_LOG
2476 - fi
2477 -
2478 - if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
2479 - ewarn "You have already a MySQL database in place."
2480 - ewarn "(${ROOT}/${MY_DATADIR}/*)"
2481 - ewarn "Please rename or delete it if you wish to replace it."
2482 - die "MySQL database already exists!"
2483 - fi
2484 -
2485 - # Bug #213475 - MySQL _will_ object strenously if your machine is named
2486 - # localhost. Also causes weird failures.
2487 - [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
2488 -
2489 - if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
2490 -
2491 - einfo "Please provide a password for the mysql 'root' user now, in the"
2492 - einfo "MYSQL_ROOT_PASSWORD env var or through the ${HOME}/.my.cnf file."
2493 - ewarn "Avoid [\"'\\_%] characters in the password"
2494 - read -rsp " >" pwd1 ; echo
2495 -
2496 - einfo "Retype the password"
2497 - read -rsp " >" pwd2 ; echo
2498 -
2499 - if [[ "x$pwd1" != "x$pwd2" ]] ; then
2500 - die "Passwords are not the same"
2501 - fi
2502 - MYSQL_ROOT_PASSWORD="${pwd1}"
2503 - unset pwd1 pwd2
2504 - fi
2505 -
2506 - local options
2507 - local sqltmp="$(emktemp)"
2508 -
2509 - # Fix bug 446200. Don't reference host my.cnf, needs to come first,
2510 - # see http://bugs.mysql.com/bug.php?id=31312
2511 - use prefix && options="${options} --defaults-file=${MY_SYSCONFDIR}/my.cnf"
2512 -
2513 - local help_tables="${ROOT}${MY_SHAREDSTATEDIR}/fill_help_tables.sql"
2514 - [[ -r "${help_tables}" ]] \
2515 - && cp "${help_tables}" "${TMPDIR}/fill_help_tables.sql" \
2516 - || touch "${TMPDIR}/fill_help_tables.sql"
2517 - help_tables="${TMPDIR}/fill_help_tables.sql"
2518 -
2519 - # Figure out which options we need to disable to do the setup
2520 - helpfile="${TMPDIR}/mysqld-help"
2521 - ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null
2522 - for opt in grant-tables host-cache name-resolve networking slave-start \
2523 - federated ssl log-bin relay-log slow-query-log external-locking \
2524 - ndbcluster log-slave-updates wsrep-on \
2525 - ; do
2526 - optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
2527 - egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
2528 - done
2529 - # But some options changed names
2530 - egrep -sq external-locking "${helpfile}" && \
2531 - options="${options/skip-locking/skip-external-locking}"
2532 -
2533 - # MySQL 5.6+ needs InnoDB
2534 - if [[ ${PN} == "mysql" || ${PN} == "percona-server" ]] ; then
2535 - mysql_version_is_at_least "5.6" || options="${options} --loose-skip-innodb"
2536 - fi
2537 -
2538 - einfo "Creating the mysql database and setting proper permissions on it ..."
2539 -
2540 - # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
2541 - PID_DIR="${EROOT}/var/run/mysqld"
2542 - if [[ ! -d "${PID_DIR}" ]]; then
2543 - install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
2544 - fi
2545 -
2546 - if [[ ! -d "${MY_DATADIR}" ]]; then
2547 - install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
2548 - fi
2549 -
2550 - pushd "${TMPDIR}" &>/dev/null || die
2551 - #cmd="'${EROOT}/usr/share/mysql/scripts/mysql_install_db' '--basedir=${EPREFIX}/usr' ${options}"
2552 - cmd=${EROOT}usr/share/mysql/scripts/mysql_install_db
2553 - [[ -f ${cmd} ]] || cmd=${EROOT}usr/bin/mysql_install_db
2554 - cmd="'$cmd' '--basedir=${EPREFIX}/usr' ${options} '--datadir=${ROOT}/${MY_DATADIR}' '--tmpdir=${ROOT}/${MYSQL_TMPDIR}'"
2555 - einfo "Command: $cmd"
2556 - su -s /bin/sh -c "${cmd}" mysql \
2557 - >"${TMPDIR}"/mysql_install_db.log 2>&1
2558 - if [ $? -ne 0 ]; then
2559 - grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
2560 - die "Failed to run mysql_install_db. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
2561 - fi
2562 - popd &>/dev/null || die
2563 - [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
2564 - || die "MySQL databases not installed"
2565 -
2566 - # Filling timezones, see
2567 - # http://dev.mysql.com/doc/mysql/en/time-zone-support.html
2568 - "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
2569 -
2570 - if [[ -r "${help_tables}" ]] ; then
2571 - cat "${help_tables}" >> "${sqltmp}"
2572 - fi
2573 -
2574 - local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
2575 - local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
2576 - local mysqld="${EROOT}/usr/sbin/mysqld \
2577 - ${options} \
2578 - $(use prefix || echo --user=mysql) \
2579 - --log-warnings=0 \
2580 - --basedir=${EROOT}/usr \
2581 - --datadir=${ROOT}/${MY_DATADIR} \
2582 - --max_allowed_packet=8M \
2583 - --net_buffer_length=16K \
2584 - --default-storage-engine=MyISAM \
2585 - --socket=${socket} \
2586 - --pid-file=${pidfile}
2587 - --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
2588 - #einfo "About to start mysqld: ${mysqld}"
2589 - ebegin "Starting mysqld"
2590 - einfo "Command ${mysqld}"
2591 - ${mysqld} &
2592 - rc=$?
2593 - while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
2594 - maxtry=$((${maxtry}-1))
2595 - echo -n "."
2596 - sleep 1
2597 - done
2598 - eend $rc
2599 -
2600 - if ! [[ -S "${socket}" ]]; then
2601 - die "Completely failed to start up mysqld with: ${mysqld}"
2602 - fi
2603 -
2604 - ebegin "Setting root password"
2605 - # Do this from memory, as we don't want clear text passwords in temp files
2606 - local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
2607 - "${EROOT}/usr/bin/mysql" \
2608 - --socket=${socket} \
2609 - -hlocalhost \
2610 - -e "${sql}"
2611 - eend $?
2612 -
2613 - ebegin "Loading \"zoneinfo\", this step may require a few seconds"
2614 - "${EROOT}/usr/bin/mysql" \
2615 - --socket=${socket} \
2616 - -hlocalhost \
2617 - -uroot \
2618 - --password="${MYSQL_ROOT_PASSWORD}" \
2619 - mysql < "${sqltmp}"
2620 - rc=$?
2621 - eend $?
2622 - [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
2623 -
2624 - # Stop the server and cleanup
2625 - einfo "Stopping the server ..."
2626 - kill $(< "${pidfile}" )
2627 - rm -f "${sqltmp}"
2628 - wait %1
2629 - einfo "Done"
2630 -}
2631 -
2632 -# @FUNCTION: mysql-v2_pkg_postrm
2633 -# @DESCRIPTION:
2634 -# Remove mysql symlinks.
2635 -mysql-v2_pkg_postrm() {
2636 -
2637 - : # mysql_lib_symlinks "${ED}"
2638 -}
2639
2640 diff --git a/eclass/mysql_fx.eclass b/eclass/mysql_fx.eclass
2641 deleted file mode 100644
2642 index 6ecf4d1a4ff..00000000000
2643 --- a/eclass/mysql_fx.eclass
2644 +++ /dev/null
2645 @@ -1,321 +0,0 @@
2646 -# Copyright 1999-2019 Gentoo Authors
2647 -# Distributed under the terms of the GNU General Public License v2
2648 -
2649 -# DEPRECATED
2650 -# Recent versions have begun deprecating this eclass.
2651 -# Do not use it in new series.
2652 -
2653 -# @DEAD
2654 -# @ECLASS: mysql_fx.eclass
2655 -# @MAINTAINER:
2656 -# - MySQL Team <mysql-bugs@g.o>
2657 -# - Luca Longinotti <chtekk@g.o>
2658 -# @AUTHOR: Francesco Riosa (Retired) <vivo@g.o>
2659 -# @BLURB: This eclass provides some helper functions for mysql ebuilds
2660 -# @DESCRIPTION:
2661 -# This eclass providers helpers to build mysql servers including patching
2662 -# from an index and initializing certain variables as part of the build.
2663 -
2664 -inherit multilib
2665 -
2666 -# @FUNCTION: stripdots
2667 -# @DESCRIPTION:
2668 -# Helper function, version (integer) may have sections separated by dots
2669 -# for readability.
2670 -stripdots() {
2671 - local dotver=${1:-"0"}
2672 - local v=""
2673 - local ret=0
2674 - if [[ "${dotver/./}" != "${dotver}" ]] ; then
2675 - # dotted version number
2676 - for i in 1000000 10000 100 1 ; do
2677 - v=${dotver%%\.*}
2678 - # remove leading zeroes
2679 - while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
2680 - # increment integer version number
2681 - ret=$(( ${v} * ${i} + ${ret} ))
2682 - if [[ "${dotver}" == "${dotver/\.}" ]] ; then
2683 - dotver=0
2684 - else
2685 - dotver=${dotver#*\.}
2686 - fi
2687 - done
2688 - echo "${ret}"
2689 - else
2690 - # already an integer
2691 - v=${dotver}
2692 - while [[ ${#v} -gt 1 ]] && [[ ${v:0:1} == "0" ]] ; do v=${v#0} ; done
2693 - echo "${v}"
2694 - fi
2695 -}
2696 -
2697 -# @FUNCTION: mysql_check_version_range
2698 -# @DESCRIPTION:
2699 -# Check if a version number falls inside a given range.
2700 -# The range includes the extremes and must be specified as
2701 -# "low_version to high_version" i.e. "4.1.2 to 5.1.99.99".
2702 -# Returns true if inside the range.
2703 -mysql_check_version_range() {
2704 - local lbound="${1%% to *}" ; lbound=$(stripdots "${lbound}")
2705 - local rbound="${1#* to }" ; rbound=$(stripdots "${rbound}")
2706 - local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
2707 - [[ ${lbound} -le ${my_ver} ]] && [[ ${my_ver} -le ${rbound} ]] && return 0
2708 - return 1
2709 -}
2710 -
2711 -# @FUNCTION: _mysql_test_patch_ver_pn
2712 -# @INTERNAL
2713 -# @DESCRIPTION:
2714 -# True if at least one applicable range is found for the patch.
2715 -_mysql_test_patch_ver_pn() {
2716 - local allelements=", version, package name"
2717 - # So that it fails the directory test if none of them exist
2718 - local filesdir="/dev/null"
2719 - for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
2720 - "${WORKDIR}/mysql-extras" ; do
2721 - if [ -d "${d}" ]; then
2722 - filesdir="${d}"
2723 - break
2724 - fi
2725 - done
2726 -
2727 - [[ -d "${filesdir}" ]] || die "Source dir must be a directory"
2728 - local flags=$1 pname=$2
2729 - if [[ $(( $flags & $(( 1 + 4 + 16 )) )) -eq 21 ]] ; then
2730 - einfo "using '${pname}'"
2731 - ln -sf "${filesdir}/${pname}" "${EPATCH_SOURCE}" || die "Couldn't move ${pname}"
2732 - return 0
2733 - fi
2734 -
2735 - [[ $(( $flags & $(( 2 + 4 )) )) -gt 0 ]] \
2736 - && allelements="${allelements//", version"}"
2737 -
2738 - [[ $(( $flags & $(( 8 + 16 )) )) -gt 0 ]] \
2739 - && allelements="${allelements//", package name"}"
2740 -
2741 - [[ -n "${allelements}" ]] && [[ "${flags}" -gt 0 ]] \
2742 - && ewarn "QA notice: ${allelements} missing in ${pname} patch"
2743 -
2744 - return 1
2745 -}
2746 -
2747 -# @FUNCTION: mysql_mv_patches
2748 -# @DESCRIPTION:
2749 -# Parse a "index_file" looking for patches to apply to the
2750 -# current MySQL version.
2751 -# If the patch applies, print its description.
2752 -#
2753 -mysql_mv_patches() {
2754 - # So that it fails the directory test if none of them exist
2755 - local filesdir="/dev/null"
2756 - if [[ -z "${1}" ]]; then
2757 - for d in "${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}" \
2758 - "${WORKDIR}/mysql-extras" ; do
2759 - if [ -d "${d}" ]; then
2760 - filesdir="${d}"
2761 - break
2762 - fi
2763 - done
2764 - [[ -d "${filesdir}" ]] || die "No patches directory found!"
2765 - fi
2766 -
2767 - for i in "$1" "${filesdir}/0000_index.txt" "${filesdir}/000_index.txt" ; do
2768 - if [ -n "$i" -a -f "$i" ]; then
2769 - local index_file="$i"
2770 - break
2771 - fi
2772 - done
2773 -
2774 - local my_ver="${2:-"${MYSQL_VERSION_ID}"}"
2775 - local my_test_fx=${3:-"_mysql_test_patch_ver_pn"}
2776 - _mysql_mv_patches "${index_file}" "${my_ver}" "${my_test_fx}"
2777 -}
2778 -
2779 -# @FUNCTION: _mysql_mv_patches
2780 -# @INTERNAL
2781 -_mysql_mv_patches() {
2782 - local index_file="${1}"
2783 - local my_ver="${2}"
2784 - local my_test_fx="${3}"
2785 - local dsc ndsc=0 i
2786 - dsc=( )
2787 -
2788 - # Values for flags are (2^x):
2789 - # 1 - one patch found
2790 - # 2 - at least one version range is wrong
2791 - # 4 - at least one version range is ok
2792 - # 8 - at least one ${PN} did not match
2793 - # 16 - at least one ${PN} has been matched
2794 - local flags=0 pname=""
2795 - while read row ; do
2796 - case "${row}" in
2797 - @patch\ *)
2798 - [[ -n "${pname}" ]] \
2799 - && ${my_test_fx} ${flags} "${pname}" \
2800 - && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
2801 - flags=1 ; ndsc=0 ; dsc=( )
2802 - pname=${row#"@patch "}
2803 - ;;
2804 - @ver\ *)
2805 - if mysql_check_version_range "${row#"@ver "}" "${my_ver}" ; then
2806 - flags=$(( ${flags} | 4 ))
2807 - else
2808 - flags=$(( ${flags} | 2 ))
2809 - fi
2810 - ;;
2811 - @pn\ *)
2812 - if [[ ${row#"@pn "} == "${PN}" ]] ; then
2813 - flags=$(( ${flags} | 16 ))
2814 - else
2815 - flags=$(( ${flags} | 8 ))
2816 - fi
2817 - ;;
2818 - # @use\ *) ;;
2819 - @@\ *)
2820 - dsc[$ndsc]="${row#"@@ "}"
2821 - (( ++ndsc ))
2822 - ;;
2823 - esac
2824 - done < "${index_file}"
2825 -
2826 - ${my_test_fx} ${flags} "${pname}" \
2827 - && for (( i=0 ; $i < $ndsc ; i++ )) ; do einfo "> ${dsc[$i]}" ; done
2828 -}
2829 -
2830 -# @FUNCTION: mysql_version_is_at_least
2831 -# @DESCRIPTION:
2832 -# Is $2 (defaults to $MYSQL_VERSION_ID) at least version $1?
2833 -# (nice) idea from versionator.eclass
2834 -#
2835 -mysql_version_is_at_least() {
2836 - local want_s=$(stripdots "$1") have_s=$(stripdots "${2:-${MYSQL_VERSION_ID}}")
2837 - [[ -z "${want_s}" ]] && die "mysql_version_is_at_least missing value to check"
2838 - [[ ${want_s} -le ${have_s} ]] && return 0 || return 1
2839 -}
2840 -
2841 -# @FUNCTION: mysql_lib_symlinks
2842 -# @DESCRIPTION:
2843 -# To be called on the live filesystem, reassigning symlinks of each MySQL
2844 -# library to the best version available. (Obsolete)
2845 -#
2846 -mysql_lib_symlinks() {
2847 -
2848 - local d dirlist maxdots libname libnameln libsuffix reldir
2849 - libsuffix=$(get_libname)
2850 -
2851 - einfo "libsuffix = ${libsuffix}"
2852 - einfo "Updating MySQL libraries symlinks"
2853 -
2854 - reldir="${1}"
2855 - pushd "${reldir}/usr/$(get_libdir)" &> /dev/null
2856 -
2857 - # dirlist must contain the less significative directory left
2858 - dirlist="mysql"
2859 -
2860 - # waste some time in removing and recreating symlinks
2861 - for d in $dirlist ; do
2862 - for libname in $( find "${d}" -mindepth 1 -maxdepth 1 -name "*${libsuffix}*" -and -not -type "l" 2>/dev/null ) ; do
2863 - # maxdot is a limit versus infinite loop
2864 - maxdots=0
2865 - libnameln=${libname##*/}
2866 - # loop in version of the library to link it, similar to how
2867 - # libtool works
2868 - if [[ ${CHOST} == *-darwin* ]] ; then
2869 - # macho: libname.x.y.z.dylib
2870 - local libbasename=${libnameln%%.*} # libname
2871 - local libver=${libnameln#${libbasename}} # .x.y.z.dylib
2872 - libver=${libver%${libsuffix}} # .x.y.z
2873 - while [[ -n ${libver} ]] && [[ ${maxdots} -lt 6 ]] ; do
2874 - libnameln="${libbasename}${libver}${libsuffix}"
2875 - rm -f "${libnameln}"
2876 - ln -s "${libname}" "${libnameln}"
2877 - (( ++maxdots ))
2878 - libver=${libver%.*}
2879 - done
2880 - libnameln="${libbasename}${libsuffix}"
2881 - rm -f "${libnameln}"
2882 - ln -s "${libname}" "${libnameln}"
2883 - else
2884 - # elf: libname.so.x.y.z
2885 - while [[ ${libnameln:0-3} != '${libsuffix}' ]] && [[ ${maxdots} -lt 6 ]] ; do
2886 - rm -f "${libnameln}"
2887 - ln -s "${libname}" "${libnameln}"
2888 - (( ++maxdots ))
2889 - libnameln="${libnameln%.*}"
2890 - done
2891 - rm -f "${libnameln}"
2892 - ln -s "${libname}" "${libnameln}"
2893 - fi
2894 - done
2895 - done
2896 -
2897 - popd &> /dev/null
2898 -}
2899 -
2900 -# @FUNCTION: mysql_init_vars
2901 -# @DESCRIPTION:
2902 -# void mysql_init_vars()
2903 -# Initialize global variables
2904 -# 2005-11-19 <vivo@g.o>
2905 -mysql_init_vars() {
2906 - MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mysql"}
2907 - MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
2908 - MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
2909 - MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
2910 - MY_INCLUDEDIR=${MY_INCLUDEDIR="${EPREFIX}/usr/include/mysql"}
2911 - MY_LIBDIR=${MY_LIBDIR="${EPREFIX}/usr/$(get_libdir)/mysql"}
2912 -
2913 - if [[ -z "${MY_DATADIR}" ]] ; then
2914 - MY_DATADIR=""
2915 - if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
2916 - MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2917 - | sed -ne '/datadir/s|^--datadir=||p' \
2918 - | tail -n1`
2919 - if [[ -z "${MY_DATADIR}" ]] ; then
2920 - MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
2921 - | sed -e 's/.*=\s*//' \
2922 - | tail -n1`
2923 - fi
2924 - fi
2925 - if [[ -z "${MY_DATADIR}" ]] ; then
2926 - MY_DATADIR="${MY_LOCALSTATEDIR}"
2927 - einfo "Using default MY_DATADIR"
2928 - fi
2929 - elog "MySQL MY_DATADIR is ${MY_DATADIR}"
2930 -
2931 - if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
2932 - if [[ -e "${MY_DATADIR}" ]] ; then
2933 - # If you get this and you're wondering about it, see bug #207636
2934 - elog "MySQL datadir found in ${MY_DATADIR}"
2935 - elog "A new one will not be created."
2936 - PREVIOUS_DATADIR="yes"
2937 - else
2938 - PREVIOUS_DATADIR="no"
2939 - fi
2940 - export PREVIOUS_DATADIR
2941 - fi
2942 - else
2943 - if [[ ${EBUILD_PHASE} == "config" ]]; then
2944 - local new_MY_DATADIR
2945 - new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
2946 - | sed -ne '/datadir/s|^--datadir=||p' \
2947 - | tail -n1`
2948 -
2949 - if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
2950 - ewarn "MySQL MY_DATADIR has changed"
2951 - ewarn "from ${MY_DATADIR}"
2952 - ewarn "to ${new_MY_DATADIR}"
2953 - MY_DATADIR="${new_MY_DATADIR}"
2954 - fi
2955 - fi
2956 - fi
2957 -
2958 - if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then
2959 - MY_SOURCEDIR=${SERVER_URI##*/}
2960 - MY_SOURCEDIR=${MY_SOURCEDIR%.tar*}
2961 - fi
2962 -
2963 - export MY_SHAREDSTATEDIR MY_SYSCONFDIR
2964 - export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR
2965 - export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR
2966 -}