Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/mariadb/
Date: Sat, 23 May 2020 12:25:37
Message-Id: 1590236724.a95315e672bea822be863083102947a4ae4ca9e1.whissi@gentoo
1 commit: a95315e672bea822be863083102947a4ae4ca9e1
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 23 12:11:09 2020 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Sat May 23 12:25:24 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a95315e6
7
8 dev-db/mariadb: bump to v5.5.68
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
12
13 dev-db/mariadb/Manifest | 2 +
14 dev-db/mariadb/mariadb-5.5.68.ebuild | 835 +++++++++++++++++++++++++++++++++++
15 2 files changed, 837 insertions(+)
16
17 diff --git a/dev-db/mariadb/Manifest b/dev-db/mariadb/Manifest
18 index 8fa12eae91a..7e3ba5ea687 100644
19 --- a/dev-db/mariadb/Manifest
20 +++ b/dev-db/mariadb/Manifest
21 @@ -18,7 +18,9 @@ DIST mariadb-10.4.13-patches-01.tar.xz 5140 BLAKE2B 76bec85715d03cf17d54994205f0
22 DIST mariadb-10.4.13.tar.gz 80608459 BLAKE2B e9ada14da6ec7492311068549a5b6e5a66e1177312013b25472c084a21fbace543ec43b47f2e12190d45432648d508f311198521f42359561f8d75ea60f98205 SHA512 68919ceffb3d4afdd0d94daa77439a954c82ce4e08fbe06044fc397940eeb88a39ec75932cbd08ff26ef3cf7636fdb779947cda5b2764aa1fd888be19c44b566
23 DIST mariadb-5.5.66.tar.gz 45962591 BLAKE2B 41befba24abec2af876168a11fc205d328c137baa49e5e521787898e4b973d1dc548ef459228811caa99fa3c2b7a9fe96f3eb7a04bf62f0bb20966e4ffd2ea9b SHA512 403f3bc67018e01eb2277a88d3a7ac673d50df8f7a67607f9d14e3167d1bdd4ca202983df69c97688ff51edbd6d6b43af3541c75e968d1d01713a7b6495e4c8c
24 DIST mariadb-5.5.67.tar.gz 45971908 BLAKE2B 494fdc5d13c3560b074514f30a828e6689b820a1eefc0d0ec67f00a9dced6f4d3c305ed81ad39dddbb07659ccfbab418900f822baf502067d706ba84d2e7fd78 SHA512 494b2b0d863e2fed6f02f8d61134a645aa113bb0e17ba08b304350dfa974f6fce2a2fcc231fb413872156f70f08fbd2604f58d642fffe085f3b093176a3e68c9
25 +DIST mariadb-5.5.68.tar.gz 45969389 BLAKE2B 5b3a647649c614825adccbc83faa40ba330dae0a1f8005b2297cc6a44fbc00bf817f2d854af315f995e1065bd4d14a2f21a9cec44b5c78402524467d876d8157 SHA512 3419790aa88a7e2a5d80e56ca94683d22ca2d5d817dfe19904d11454f34cfc3b9d55e603295ea58580a3c9fe96a6c6f9b650e1058c4e8f2f2e82f09165436865
26 DIST mysql-extras-20180809-1700Z.tar.bz2 322999 BLAKE2B 8b5feb32085dc35b2f68dae985b2d266c4eaa0e956b490050a2df04bbff99bf8623b67e75af9326d84e3ad625c4d86b0d21d23c9a96df5a0c9cd5ed730958970 SHA512 fbd7af9284bbf09d55f128361e7cc52d94f24ac491aac800cd6d61f2e444aeca66a4d5e6ae94c2fb4044e00cec9b232bae9a76a229f87f19d90b7aecf70792ec
27 DIST mysql-extras-20190305-2052Z.tar.bz2 331304 BLAKE2B 1d2c35a961159fa5ce9ee6699fce943f5a5b5cf60b11c9bb4bcccee4943f4508a9eb6d01050c642353ac592ce1a6b421abf2a1bebc706c44c4c8a36aa698ec43 SHA512 ae63403320e010acbb92f8aec6da8ed4f267cef0bad37147d594076fd94571de7f98bfc2afbe94af5d716f58d57696fd958b1e13e20e87052f252ed4a188cd3c
28 DIST mysql-extras-20190731-2258Z.tar.bz2 332111 BLAKE2B cc144c9af852bfdd4149b96bdc22f8afb2d0aa92f95ebd272a244f0fb7743dc03f9244871d5c195260bac5d9ed20583093257ee2c95a5a4d0a4dae488d781adf SHA512 d4428a1128cd5aef62c463b659992b110090b1602cdcb6b8d922d570c6b946fde325bfcf5a9a955a8dcc61f3ccd3d612d8517ebf63e316f98ca9ff2cd8a807aa
29 DIST mysql-extras-20200203-1749Z.tar.bz2 344999 BLAKE2B 46441f3c210c87b8ce1df89e9480d0bd5be216b0a1380c3ca330294e787bf2fb2b7078438f032dd0381363e756312d7634350a0b02c00b3145d4787a9ad65cad SHA512 210d240efef4d7bb64d356cae240039d9bd65e2bd4af47e01131ab5bf48779f4c0519e50d212d50db998e6b9bf9d73f1a03b0bbf4f7d6dc6f978660c8ac8a21f
30 +DIST mysql-extras-20200523-1221Z.tar.bz2 345015 BLAKE2B 3ad0da663c31831d3b511b88df34b6a28bb781cfd88fd4479b43273aa15946e63c7ae43d5497207edc6cc53a72bd42b8ce2e2058dfb236afd940bd0282190e98 SHA512 8f7b39017efb08e1ae98c4c68728bc86f8427b88b2a22688abf6975c6706122086dc93289beb511bbaf17cd5a790c76406e81315a11830829efe9170ce4f6a42
31
32 diff --git a/dev-db/mariadb/mariadb-5.5.68.ebuild b/dev-db/mariadb/mariadb-5.5.68.ebuild
33 new file mode 100644
34 index 00000000000..87e9a50bd38
35 --- /dev/null
36 +++ b/dev-db/mariadb/mariadb-5.5.68.ebuild
37 @@ -0,0 +1,835 @@
38 +# Copyright 1999-2020 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI="6"
42 +MY_EXTRAS_VER="20200523-1221Z"
43 +SUBSLOT="18"
44 +
45 +# Keeping eutils in EAPI=6 for emktemp in pkg_config
46 +
47 +inherit eutils flag-o-matic prefix toolchain-funcs user cmake-utils multilib-build
48 +
49 +SRC_URI="https://downloads.mariadb.org/interstitial/${P}/source/${P}.tar.gz "
50 +
51 +# Gentoo patches to MySQL
52 +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
53 + SRC_URI="${SRC_URI}
54 + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
55 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
56 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
57 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
58 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
59 +fi
60 +
61 +HOMEPAGE="https://mariadb.org/"
62 +DESCRIPTION="An enhanced, drop-in replacement for MySQL"
63 +LICENSE="GPL-2"
64 +SLOT="0/${SUBSLOT:-0}"
65 +IUSE="bindist client-libs debug extraengine jemalloc latin1 libressl
66 + oqgraph pam +perl profiling selinux +server sphinx
67 + static static-libs systemtap tcmalloc
68 + test tokudb yassl"
69 +
70 +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
71 +RESTRICT="!bindist? ( bindist ) libressl? ( test ) !test? ( test )"
72 +
73 +REQUIRED_USE="server? ( tokudb? ( jemalloc !tcmalloc ) )
74 + ?? ( tcmalloc jemalloc )
75 + static? ( yassl !pam )"
76 +
77 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
78 +
79 +# Shorten the path because the socket path length must be shorter than 107 chars
80 +# and we will run a mysql server during test phase
81 +S="${WORKDIR}/mysql"
82 +
83 +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
84 + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras"
85 + inherit git-r3
86 + EGIT_REPO_URI="git://anongit.gentoo.org/proj/mysql-extras.git"
87 + EGIT_CHECKOUT_DIR="${WORKDIR%/}/mysql-extras"
88 + EGIT_CLONE_TYPE=shallow
89 +else
90 + MY_PATCH_DIR="${WORKDIR%/}/mysql-extras-${MY_EXTRAS_VER}"
91 +fi
92 +
93 +PATCHES=(
94 + "${MY_PATCH_DIR}/01050_all_mariadb_mysql_config_cleanup-5.5.41.patch"
95 + "${MY_PATCH_DIR}/20004_all_mariadb-filter-tokudb-flags-5.5.68.patch"
96 + "${MY_PATCH_DIR}/20006_all_cmake_elib-mariadb-5.5.50.patch"
97 + "${MY_PATCH_DIR}/20009_all_mariadb_myodbc_symbol_fix-5.5.38.patch"
98 + "${MY_PATCH_DIR}/20018_all_mariadb-5.5.60-without-clientlibs-tools.patch"
99 +)
100 +
101 +# Be warned, *DEPEND are version-dependant
102 +# These are used for both runtime and compiletime
103 +COMMON_DEPEND="
104 + kernel_linux? (
105 + sys-process/procps:0=
106 + dev-libs/libaio:0=
107 + )
108 + >=sys-apps/sed-4
109 + >=sys-apps/texinfo-4.7-r1
110 + jemalloc? ( dev-libs/jemalloc:0= )
111 + tcmalloc? ( dev-util/google-perftools:0= )
112 + systemtap? ( >=dev-util/systemtap-1.3:0= )
113 + !yassl? (
114 + !libressl? ( <dev-libs/openssl-1.1.0:0= )
115 + libressl? ( dev-libs/libressl:0= )
116 + )
117 + >=sys-libs/zlib-1.2.3:0=
118 + sys-libs/ncurses:0=
119 + !bindist? (
120 + >=sys-libs/readline-4.1:0=
121 + )
122 + server? (
123 + oqgraph? ( >=dev-libs/boost-1.40.0:0= dev-libs/judy:0= )
124 + pam? ( sys-libs/pam:0= )
125 + )
126 + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
127 +"
128 +DEPEND="virtual/yacc
129 + static? ( sys-libs/ncurses[static-libs] )
130 + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
131 + ${COMMON_DEPEND}"
132 +RDEPEND="selinux? ( sec-policy/selinux-mysql )
133 + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
134 + !dev-db/mysql !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql-cluster
135 + server? ( !prefix? ( dev-db/mysql-init-scripts ) )
136 + ${COMMON_DEPEND}
137 + perl? ( !dev-db/mytop
138 + virtual/perl-Getopt-Long
139 + dev-perl/TermReadKey
140 + virtual/perl-Term-ANSIColor
141 + virtual/perl-Time-HiRes )
142 +"
143 +# For other stuff to bring us in
144 +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
145 +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
146 +
147 +pkg_setup() {
148 + if [[ ${MERGE_TYPE} != binary ]] ; then
149 + local GCC_MAJOR_SET=$(gcc-major-version)
150 + local GCC_MINOR_SET=$(gcc-minor-version)
151 + if use tokudb && [[ ${GCC_MAJOR_SET} -lt 4 || \
152 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
153 + eerror "${PN} with tokudb needs to be built with gcc-4.7 or later."
154 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
155 + die
156 + fi
157 + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
158 + # non x86{,_64} arches
159 + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
160 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
161 + eerror "${PN} needs to be built with gcc-4.7 or later."
162 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
163 + die
164 + fi
165 + fi
166 + if has test ${FEATURES} && \
167 + use server && ! has userpriv ${FEATURES} ; then
168 + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
169 + fi
170 +
171 + # This should come after all of the die statements
172 + enewgroup mysql 60 || die "problem adding 'mysql' group"
173 + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
174 +}
175 +
176 +pkg_postinst() {
177 + # Make sure the vars are correctly initialized
178 + mysql_init_vars
179 +
180 + # Create log directory securely if it does not exist
181 + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
182 +
183 + if use server ; then
184 + if use pam; then
185 + einfo
186 + elog "This install includes the PAM authentication plugin."
187 + elog "To activate and configure the PAM plugin, please read:"
188 + elog "https://mariadb.com/kb/en/mariadb/pam-authentication-plugin/"
189 + einfo
190 + fi
191 +
192 + if [[ -z "${REPLACING_VERSIONS}" ]] ; then
193 + einfo
194 + elog "You might want to run:"
195 + elog "\"emerge --config =${CATEGORY}/${PF}\""
196 + elog "if this is a new install."
197 + elog
198 + elog "If you are switching server implentations, you should run the"
199 + elog "mysql_upgrade tool."
200 + einfo
201 + else
202 + einfo
203 + elog "If you are upgrading major versions, you should run the"
204 + elog "mysql_upgrade tool."
205 + einfo
206 + fi
207 +
208 + einfo
209 + elog "Be sure to edit the my.cnf file to activate your cluster settings."
210 + elog "This should be done after running \"emerge --config =${CATEGORY}/${PF}\""
211 + elog "The first time the cluster is activated, you should add"
212 + elog "--wsrep-new-cluster to the options in /etc/conf.d/mysql for one node."
213 + elog "This option should then be removed for subsequent starts."
214 + einfo
215 + fi
216 +}
217 +
218 +src_unpack() {
219 + unpack ${A}
220 + # Grab the patches
221 + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR%/}/mysql-extras" git-r3_src_unpack
222 +
223 + mv -f "${WORKDIR%/}/${P}" "${S}" || die
224 +}
225 +
226 +src_prepare() {
227 + _disable_engine() {
228 + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
229 + }
230 +
231 + _disable_plugin() {
232 + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
233 + }
234 +
235 + if use tcmalloc; then
236 + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S%/}/sql/CMakeLists.txt" || die
237 + fi
238 +
239 + # Don't build bundled xz-utils for tokudb
240 + echo > "${S%/}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake" || die
241 + sed -i -e 's/ build_lzma//' "${S%/}/storage/tokudb/ft-index/ft/CMakeLists.txt" || die
242 + sed -i -e 's/add_dependencies\(tokuportability_static_conv build_jemalloc\)//' "${S%/}/storage/tokudb/ft-index/portability/CMakeLists.txt" || die
243 +
244 + local plugin
245 + local server_plugins=( handler_socket auth_socket feedback qc_info server_audit semisync sql_errlog )
246 + local test_plugins=( audit_null auth_examples daemon_example fulltext )
247 + if ! use server; then # These plugins are for the server
248 + for plugin in "${server_plugins[@]}" ; do
249 + _disable_plugin "${plugin}"
250 + done
251 + fi
252 +
253 + if ! use test; then # These plugins are only used during testing
254 + for plugin in "${test_plugins[@]}" ; do
255 + _disable_plugin "${plugin}"
256 + done
257 + fi
258 +
259 + # Collides with mariadb-connector-c bug 655980
260 + _disable_plugin auth_dialog
261 +
262 + # Don't build example
263 + _disable_engine example
264 +
265 + if ! use oqgraph ; then # avoids extra library checks
266 + _disable_engine oqgraph
267 + fi
268 +
269 + # Don't clash with dev-db/mysql-connector-c
270 + sed -i -e 's/ my_print_defaults.1//' \
271 + -e 's/ perror.1//' \
272 + "${S}"/man/CMakeLists.txt || die
273 +
274 + cmake-utils_src_prepare
275 +}
276 +
277 +src_configure() {
278 + # bug 508724 mariadb cannot use ld.gold
279 + tc-ld-disable-gold
280 + # Bug #114895, bug #110149
281 + filter-flags "-O" "-O[01]"
282 +
283 + append-cxxflags -felide-constructors
284 +
285 + # bug #283926, with GCC4.4, this is required to get correct behavior.
286 + append-flags -fno-strict-aliasing
287 +
288 + CMAKE_BUILD_TYPE="RelWithDebInfo"
289 +
290 + # debug hack wrt #497532
291 + mycmakeargs=(
292 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
293 + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
294 + -DDEFAULT_SYSCONFDIR="${EPREFIX}/etc/mysql"
295 + -DINSTALL_BINDIR=bin
296 + -DINSTALL_DOCDIR=share/doc/${PF}
297 + -DINSTALL_DOCREADMEDIR=share/doc/${PF}
298 + -DINSTALL_INCLUDEDIR=include/mysql
299 + -DINSTALL_INFODIR=share/info
300 + -DINSTALL_LIBDIR=$(get_libdir)
301 + -DINSTALL_MANDIR=share/man
302 + -DINSTALL_MYSQLSHAREDIR=share/mariadb
303 + -DINSTALL_PLUGINDIR=$(get_libdir)/mariadb/plugin
304 + -DINSTALL_SCRIPTDIR=share/mariadb/scripts
305 + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
306 + -DINSTALL_SBINDIR=sbin
307 + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mariadb"
308 + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
309 + -DWITH_UNIT_TESTS=$(usex test ON OFF)
310 + -DWITH_ZLIB=system
311 + -DENABLED_LOCAL_INFILE=1
312 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
313 + -DINSTALL_UNIX_ADDRDIR="${EPREFIX}/var/run/mysqld/mysqld.sock"
314 + # The build forces this to be defined when cross-compiling. We pass it
315 + # all the time for simplicity and to make sure it is actually correct.
316 + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
317 + -DWITHOUT_CLIENTLIBS=YES
318 + -DWITH_READLINE=$(usex bindist 1 0)
319 + -DNOT_FOR_DISTRIBUTION=$(usex bindist 0 1)
320 + -DENABLE_DTRACE=$(usex systemtap)
321 + )
322 + if use test ; then
323 + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR=share/mariadb/mysql-test )
324 + else
325 + mycmakeargs+=( -DINSTALL_MYSQLTESTDIR='' )
326 + fi
327 +
328 + if ! use yassl ; then
329 + mycmakeargs+=( -DWITH_SSL=system )
330 + else
331 + mycmakeargs+=( -DWITH_SSL=bundled )
332 + fi
333 +
334 + if use server ; then
335 +
336 + # Federated{,X} must be treated special otherwise they will not be built as plugins
337 + if ! use extraengine ; then
338 + mycmakeargs+=(
339 + -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
340 + -DWITHOUT_FEDERATEDX_STORAGE_ENGINE=1 )
341 + fi
342 +
343 + mycmakeargs+=(
344 + -DWITH_JEMALLOC=$(usex jemalloc system)
345 + -D$(usex sphinx WITH WITHOUT)_SPHINX_STORAGE_ENGINE=1
346 + -D$(usex tokudb WITH WITHOUT)_TOKUDB_STORAGE_ENGINE=1
347 + -D$(usex oqgraph WITH WITHOUT)_AUTH_PAM=1
348 + -DINSTALL_SQLBENCHDIR=share/mariadb
349 + )
350 +
351 + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
352 + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
353 + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
354 + ewarn "You MUST file bugs without these variables set."
355 +
356 + mycmakeargs+=(
357 + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
358 + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
359 + )
360 +
361 + elif ! use latin1 ; then
362 + mycmakeargs+=(
363 + -DDEFAULT_CHARSET=utf8
364 + -DDEFAULT_COLLATION=utf8_general_ci
365 + )
366 + else
367 + mycmakeargs+=(
368 + -DDEFAULT_CHARSET=latin1
369 + -DDEFAULT_COLLATION=latin1_swedish_ci
370 + )
371 + fi
372 + mycmakeargs+=(
373 + -DEXTRA_CHARSETS=all
374 + -DDISABLE_SHARED=$(usex static YES NO)
375 + -DWITH_EMBEDDED_SERVER=OFF
376 + -DENABLED_PROFILING=$(usex profiling)
377 + )
378 +
379 + if use static; then
380 + mycmakeargs+=( -DWITH_PIC=1 )
381 + fi
382 +
383 + if use jemalloc || use tcmalloc ; then
384 + mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
385 + fi
386 +
387 + # Storage engines
388 + mycmakeargs+=(
389 + -DWITH_ARCHIVE_STORAGE_ENGINE=1
390 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1
391 + -DWITH_CSV_STORAGE_ENGINE=1
392 + -DWITH_HEAP_STORAGE_ENGINE=1
393 + -DWITH_INNOBASE_STORAGE_ENGINE=1
394 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1
395 + -DWITH_MYISAM_STORAGE_ENGINE=1
396 + -DWITH_PARTITION_STORAGE_ENGINE=1
397 + )
398 +
399 + else
400 + mycmakeargs+=(
401 + -DWITHOUT_SERVER=1
402 + -DEXTRA_CHARSETS=none
403 + -DINSTALL_SQLBENCHDIR=
404 + )
405 + fi
406 +
407 + cmake-utils_src_configure
408 +}
409 +
410 +src_compile() {
411 + cmake-utils_src_compile
412 +}
413 +
414 +src_install() {
415 + cmake-utils_src_install
416 +
417 + # Remove an unnecessary, private config header which will never match between ABIs and is not meant to be used
418 + if [[ -f "${ED%/}/usr/include/mysql/server/private/config.h" ]] ; then
419 + rm "${ED%/}/usr/include/mysql/server/private/config.h" || die
420 + fi
421 +
422 + # Make sure the vars are correctly initialized
423 + mysql_init_vars
424 +
425 + # Convenience links
426 + einfo "Making Convenience links for mysqlcheck multi-call binary"
427 + dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
428 + dosym "mysqlcheck" "/usr/bin/mysqlrepair"
429 + dosym "mysqlcheck" "/usr/bin/mysqloptimize"
430 +
431 + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
432 + if [[ -d "${ED%/}/usr/data" ]] ; then
433 + rm -Rf "${ED%/}/usr/data" || die
434 + fi
435 +
436 + # Unless they explicitly specific USE=test, then do not install the
437 + # testsuite. It DOES have a use to be installed, esp. when you want to do a
438 + # validation of your database configuration after tuning it.
439 + if ! use test ; then
440 + rm -rf "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test"
441 + fi
442 +
443 + # Configuration stuff
444 + einfo "Building default configuration ..."
445 + insinto "${MY_SYSCONFDIR#${EPREFIX}}"
446 + [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
447 + local mycnf_src="my.cnf-5.5"
448 + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
449 + "${FILESDIR%/}/${mycnf_src}" \
450 + > "${TMPDIR%/}/my.cnf.ok" || die
451 + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
452 + if use latin1 ; then
453 + sed -i \
454 + -e "/character-set/s|utf8|latin1|g" \
455 + "${TMPDIR%/}/my.cnf.ok" || die
456 + fi
457 + eprefixify "${TMPDIR%/}/my.cnf.ok"
458 + newins "${TMPDIR}/my.cnf.ok" my.cnf
459 +
460 + if use server ; then
461 + einfo "Including support files and sample configurations"
462 + docinto "support-files"
463 + local script
464 + for script in \
465 + "${S%/}"/support-files/magic
466 + do
467 + [[ -f "$script" ]] && dodoc "${script}"
468 + done
469 +
470 + docinto "scripts"
471 + for script in "${S%/}"/scripts/mysql* ; do
472 + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
473 + done
474 + # Manually install supporting files that conflict with other packages
475 + # but are needed for galera and initial installation
476 + exeinto /usr/libexec/mariadb
477 + doexe "${BUILD_DIR}/extra/my_print_defaults" "${BUILD_DIR}/extra/perror"
478 + fi
479 +
480 + #Remove mytop if perl is not selected
481 + [[ -e "${ED%/}/usr/bin/mytop" ]] && ! use perl && rm -f "${ED%/}/usr/bin/mytop"
482 +}
483 +
484 +# Official test instructions:
485 +# USE='extraengine perl server' \
486 +# FEATURES='test userpriv -usersandbox' \
487 +# ebuild mariadb-X.X.XX.ebuild \
488 +# digest clean package
489 +src_test() {
490 +
491 + _disable_test() {
492 + local rawtestname reason
493 + rawtestname="${1}" ; shift
494 + reason="${@}"
495 + ewarn "test '${rawtestname}' disabled: '${reason}'"
496 + echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
497 + }
498 +
499 + local TESTDIR="${BUILD_DIR}/mysql-test"
500 + local retstatus_unit
501 + local retstatus_tests
502 +
503 + if ! use server ; then
504 + einfo "Skipping server tests due to minimal build."
505 + return 0
506 + fi
507 +
508 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
509 + # localhost. Also causes weird failures.
510 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
511 +
512 + if [[ $UID -eq 0 ]]; then
513 + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
514 + fi
515 + has usersandbox $FEATURES && ewarn "Some tests may fail with FEATURES=usersandbox"
516 +
517 + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
518 +
519 + # Run CTest (test-units)
520 + cmake-utils_src_test
521 + retstatus_unit=$?
522 +
523 + # Ensure that parallel runs don't die
524 + export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
525 + # Enable parallel testing, auto will try to detect number of cores
526 + # You may set this by hand.
527 + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
528 + export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
529 +
530 + # create directories because mysqladmin might run out of order
531 + mkdir -p "${T}"/var-tests{,/log} || die
532 +
533 + # Run mysql tests
534 + pushd "${TESTDIR}" > /dev/null || die
535 +
536 + touch "${T}/disabled.def"
537 + # These are failing in MariaDB 5.5 for now and are believed to be
538 + # false positives:
539 + #
540 + # main.information_schema, binlog.binlog_statement_insert_delayed,
541 + # main.mysqld--help, funcs_1.is_triggers, funcs_1.is_tables_mysql,
542 + # funcs_1.is_columns_mysql
543 + # fails due to USE=-latin1 / utf8 default
544 + #
545 + # main.mysql_client_test, main.mysql_client_test_nonblock:
546 + # segfaults at random under Portage only, suspect resource limits.
547 + #
548 + # archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam
549 + # fails due to bad cleanup of previous tests when run in parallel
550 + # The tool is deprecated anyway
551 + # Bug 532288
552 +
553 + local t
554 + for t in main.mysql_client_test main.mysql_client_test_nonblock \
555 + binlog.binlog_statement_insert_delayed main.information_schema \
556 + main.mysqld--help \
557 + archive.mysqlhotcopy_archive main.mysqlhotcopy_myisam \
558 + funcs_1.is_triggers funcs_1.is_tables_mysql funcs_1.is_columns_mysql ; do
559 + _disable_test "$t" "False positives in Gentoo"
560 + done
561 +
562 + if ! use client-libs ; then
563 + _disable_test main.plugin_auth "Needs client libraries built"
564 + fi
565 +
566 + # run mysql-test tests
567 + perl mysql-test-run.pl --force --vardir="${T}/var-tests" --reorder --skip-test=tokudb --skip-test-list="${T}/disabled.def"
568 + retstatus_tests=$?
569 +
570 + popd > /dev/null || die
571 +
572 + # Cleanup is important for these testcases.
573 + pkill -9 -f "${S}/ndb" 2>/dev/null
574 + pkill -9 -f "${S}/sql" 2>/dev/null
575 +
576 + local failures=""
577 + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
578 + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
579 +
580 + [[ -z "$failures" ]] || die "Test failures: $failures"
581 + einfo "Tests successfully completed"
582 +}
583 +
584 +mysql_init_vars() {
585 + MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="${EPREFIX}/usr/share/mariadb"}
586 + MY_SYSCONFDIR=${MY_SYSCONFDIR="${EPREFIX}/etc/mysql"}
587 + MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="${EPREFIX}/var/lib/mysql"}
588 + MY_LOGDIR=${MY_LOGDIR="${EPREFIX}/var/log/mysql"}
589 +
590 + if [[ -z "${MY_DATADIR}" ]] ; then
591 + MY_DATADIR=""
592 + if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then
593 + MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
594 + | sed -ne '/datadir/s|^--datadir=||p' \
595 + | tail -n1`
596 + if [[ -z "${MY_DATADIR}" ]] ; then
597 + MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \
598 + | sed -e 's/.*=\s*//' \
599 + | tail -n1`
600 + fi
601 + fi
602 + if [[ -z "${MY_DATADIR}" ]] ; then
603 + MY_DATADIR="${MY_LOCALSTATEDIR}"
604 + einfo "Using default MY_DATADIR"
605 + fi
606 + elog "MySQL MY_DATADIR is ${MY_DATADIR}"
607 +
608 + if [[ -z "${PREVIOUS_DATADIR}" ]] ; then
609 + if [[ -e "${MY_DATADIR}" ]] ; then
610 + # If you get this and you're wondering about it, see bug #207636
611 + elog "MySQL datadir found in ${MY_DATADIR}"
612 + elog "A new one will not be created."
613 + PREVIOUS_DATADIR="yes"
614 + else
615 + PREVIOUS_DATADIR="no"
616 + fi
617 + export PREVIOUS_DATADIR
618 + fi
619 + else
620 + if [[ ${EBUILD_PHASE} == "config" ]]; then
621 + local new_MY_DATADIR
622 + new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \
623 + | sed -ne '/datadir/s|^--datadir=||p' \
624 + | tail -n1`
625 +
626 + if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then
627 + ewarn "MySQL MY_DATADIR has changed"
628 + ewarn "from ${MY_DATADIR}"
629 + ewarn "to ${new_MY_DATADIR}"
630 + MY_DATADIR="${new_MY_DATADIR}"
631 + fi
632 + fi
633 + fi
634 +
635 + export MY_SHAREDSTATEDIR MY_SYSCONFDIR
636 + export MY_LOCALSTATEDIR MY_LOGDIR
637 + export MY_DATADIR
638 +}
639 +
640 +pkg_config() {
641 + _getoptval() {
642 + local mypd="${EROOT}"usr/libexec/mariadb/my_print_defaults
643 + local section="$1"
644 + local flag="--${2}="
645 + local extra_options="${3}"
646 + "${mypd}" $extra_options $section | sed -n "/^${flag}/s,${flag},,gp"
647 + }
648 + local old_MY_DATADIR="${MY_DATADIR}"
649 + local old_HOME="${HOME}"
650 + # my_print_defaults needs to read stuff in $HOME/.my.cnf
651 + export HOME=${EPREFIX}/root
652 +
653 + # Make sure the vars are correctly initialized
654 + mysql_init_vars
655 +
656 + [[ -z "${MY_DATADIR}" ]] && die "Sorry, unable to find MY_DATADIR"
657 + if [[ ! -x "${EROOT}/usr/sbin/mysqld" ]] ; then
658 + die "Minimal builds do NOT include the MySQL server"
659 + fi
660 +
661 + if [[ ( -n "${MY_DATADIR}" ) && ( "${MY_DATADIR}" != "${old_MY_DATADIR}" ) ]]; then
662 + local MY_DATADIR_s="${ROOT}/${MY_DATADIR}"
663 + MY_DATADIR_s="${MY_DATADIR_s%%/}"
664 + local old_MY_DATADIR_s="${ROOT}/${old_MY_DATADIR}"
665 + old_MY_DATADIR_s="${old_MY_DATADIR_s%%/}"
666 +
667 + if [[ ( -d "${old_MY_DATADIR_s}" ) && ( "${old_MY_DATADIR_s}" != / ) ]]; then
668 + if [[ -d "${MY_DATADIR_s}" ]]; then
669 + ewarn "Both ${old_MY_DATADIR_s} and ${MY_DATADIR_s} exist"
670 + ewarn "Attempting to use ${MY_DATADIR_s} and preserving ${old_MY_DATADIR_s}"
671 + else
672 + elog "Moving MY_DATADIR from ${old_MY_DATADIR_s} to ${MY_DATADIR_s}"
673 + mv --strip-trailing-slashes -T "${old_MY_DATADIR_s}" "${MY_DATADIR_s}" \
674 + || die "Moving MY_DATADIR failed"
675 + fi
676 + else
677 + ewarn "Previous MY_DATADIR (${old_MY_DATADIR_s}) does not exist"
678 + if [[ -d "${MY_DATADIR_s}" ]]; then
679 + ewarn "Attempting to use ${MY_DATADIR_s}"
680 + else
681 + eerror "New MY_DATADIR (${MY_DATADIR_s}) does not exist"
682 + die "Configuration Failed! Please reinstall ${CATEGORY}/${PN}"
683 + fi
684 + fi
685 + fi
686 +
687 + local pwd1="a"
688 + local pwd2="b"
689 + local maxtry=15
690 +
691 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
692 + local tmp_mysqld_password_source=
693 +
694 + for tmp_mysqld_password_source in mysql client; do
695 + einfo "Trying to get password for mysql 'root' user from '${tmp_mysqld_password_source}' section ..."
696 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password)"
697 + if [[ -n "${MYSQL_ROOT_PASSWORD}" ]]; then
698 + if [[ ${MYSQL_ROOT_PASSWORD} == *$'\n'* ]]; then
699 + ewarn "Ignoring password from '${tmp_mysqld_password_source}' section due to newline character (do you have multiple password options set?)!"
700 + MYSQL_ROOT_PASSWORD=
701 + continue
702 + fi
703 +
704 + einfo "Found password in '${tmp_mysqld_password_source}' section!"
705 + break
706 + fi
707 + done
708 +
709 + # Sometimes --show is required to display passwords in some implementations of my_print_defaults
710 + if [[ "${MYSQL_ROOT_PASSWORD}" == '*****' ]]; then
711 + MYSQL_ROOT_PASSWORD="$(_getoptval "${tmp_mysqld_password_source}" password --show)"
712 + fi
713 +
714 + unset tmp_mysqld_password_source
715 + fi
716 + MYSQL_TMPDIR="$(_getoptval mysqld tmpdir | tail -n 1)"
717 + # These are dir+prefix
718 + MYSQL_RELAY_LOG="$(_getoptval mysqld relay-log | tail -n 1)"
719 + MYSQL_RELAY_LOG=${MYSQL_RELAY_LOG%/*}
720 + MYSQL_LOG_BIN="$(_getoptval mysqld log-bin | tail -n 1)"
721 + MYSQL_LOG_BIN=${MYSQL_LOG_BIN%/*}
722 +
723 + if [[ ! -d "${ROOT}/$MYSQL_TMPDIR" ]]; then
724 + einfo "Creating MySQL tmpdir $MYSQL_TMPDIR"
725 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_TMPDIR"
726 + fi
727 + if [[ ! -d "${ROOT}/$MYSQL_LOG_BIN" ]]; then
728 + einfo "Creating MySQL log-bin directory $MYSQL_LOG_BIN"
729 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_LOG_BIN"
730 + fi
731 + if [[ ! -d "${EROOT}/$MYSQL_RELAY_LOG" ]]; then
732 + einfo "Creating MySQL relay-log directory $MYSQL_RELAY_LOG"
733 + install -d -m 770 -o mysql -g mysql "${EROOT}/$MYSQL_RELAY_LOG"
734 + fi
735 +
736 + if [[ -d "${ROOT}/${MY_DATADIR}/mysql" ]] ; then
737 + ewarn "You have already a MySQL database in place."
738 + ewarn "(${ROOT}/${MY_DATADIR}/*)"
739 + ewarn "Please rename or delete it if you wish to replace it."
740 + die "MySQL database already exists!"
741 + fi
742 +
743 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
744 + # localhost. Also causes weird failures.
745 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
746 +
747 + if [ -z "${MYSQL_ROOT_PASSWORD}" ]; then
748 +
749 + einfo "Please provide a password for the mysql 'root' user now"
750 + einfo "or through the ${HOME}/.my.cnf file."
751 + ewarn "Avoid [\"'\\_%] characters in the password"
752 + read -rsp " >" pwd1 ; echo
753 +
754 + einfo "Retype the password"
755 + read -rsp " >" pwd2 ; echo
756 +
757 + if [[ "x$pwd1" != "x$pwd2" ]] ; then
758 + die "Passwords are not the same"
759 + fi
760 + MYSQL_ROOT_PASSWORD="${pwd1}"
761 + unset pwd1 pwd2
762 + fi
763 +
764 + local options
765 + local sqltmp="$(emktemp)"
766 +
767 + # Fix bug 446200. Don't reference host my.cnf, needs to come first,
768 + # see https://bugs.mysql.com/bug.php?id=31312
769 + use prefix && options="${options} '--defaults-file=${MY_SYSCONFDIR}/my.cnf'"
770 +
771 + # Figure out which options we need to disable to do the setup
772 + local helpfile="${TMPDIR}/mysqld-help"
773 + "${EROOT}/usr/sbin/mysqld" --verbose --help >"${helpfile}" 2>/dev/null
774 + for opt in grant-tables host-cache name-resolve networking slave-start \
775 + federated ssl log-bin relay-log slow-query-log external-locking \
776 + log-slave-updates \
777 + ; do
778 + optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}"
779 + egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}"
780 + done
781 +
782 + einfo "Creating the mysql database and setting proper permissions on it ..."
783 +
784 + # Now that /var/run is a tmpfs mount point, we need to ensure it exists before using it
785 + PID_DIR="${EROOT}/var/run/mysqld"
786 + if [[ ! -d "${PID_DIR}" ]]; then
787 + install -d -m 755 -o mysql -g mysql "${PID_DIR}" || die "Could not create pid directory"
788 + fi
789 +
790 + if [[ ! -d "${MY_DATADIR}" ]]; then
791 + install -d -m 750 -o mysql -g mysql "${MY_DATADIR}" || die "Could not create data directory"
792 + fi
793 +
794 + pushd "${TMPDIR}" &>/dev/null || die
795 +
796 + # Filling timezones, see
797 + # https://dev.mysql.com/doc/mysql/en/time-zone-support.html
798 + "${EROOT}/usr/bin/mysql_tzinfo_to_sql" "${EROOT}/usr/share/zoneinfo" > "${sqltmp}" 2>/dev/null
799 +
800 + local cmd=( "${EROOT}usr/share/mariadb/scripts/mysql_install_db" )
801 + [[ -f "${cmd}" ]] || cmd=( "${EROOT}usr/bin/mysql_install_db" )
802 + cmd+=( "--basedir=${EPREFIX}/usr" ${options} "--datadir=${ROOT}/${MY_DATADIR}" "--tmpdir=${ROOT}/${MYSQL_TMPDIR}" )
803 + einfo "Command: ${cmd[*]}"
804 + su -s /bin/sh -c "${cmd[*]}" mysql \
805 + >"${TMPDIR}"/mysql_install_db.log 2>&1
806 + if [ $? -ne 0 ]; then
807 + grep -B5 -A999 -i "ERROR" "${TMPDIR}"/mysql_install_db.log 1>&2
808 + die "Failed to initialize mysqld. Please review ${EPREFIX}/var/log/mysql/mysqld.err AND ${TMPDIR}/mysql_install_db.log"
809 + fi
810 + popd &>/dev/null || die
811 + [[ -f "${ROOT}/${MY_DATADIR}/mysql/user.frm" ]] \
812 + || die "MySQL databases not installed"
813 +
814 + use prefix || options="${options} --user=mysql"
815 +
816 + local socket="${EROOT}/var/run/mysqld/mysqld${RANDOM}.sock"
817 + local pidfile="${EROOT}/var/run/mysqld/mysqld${RANDOM}.pid"
818 + local mysqld="${EROOT}/usr/sbin/mysqld \
819 + ${options} \
820 + --log-warnings=0 \
821 + --basedir=${EROOT}/usr \
822 + --datadir=${ROOT}/${MY_DATADIR} \
823 + --max_allowed_packet=8M \
824 + --net_buffer_length=16K \
825 + --socket=${socket} \
826 + --pid-file=${pidfile} \
827 + --tmpdir=${ROOT}/${MYSQL_TMPDIR}"
828 + #einfo "About to start mysqld: ${mysqld}"
829 + ebegin "Starting mysqld"
830 + einfo "Command ${mysqld}"
831 + ${mysqld} &
832 + rc=$?
833 + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
834 + maxtry=$((${maxtry}-1))
835 + echo -n "."
836 + sleep 1
837 + done
838 + eend $rc
839 +
840 + if ! [[ -S "${socket}" ]]; then
841 + die "Completely failed to start up mysqld with: ${mysqld}"
842 + fi
843 +
844 + ebegin "Setting root password"
845 + # Do this from memory, as we don't want clear text passwords in temp files
846 + local sql="UPDATE mysql.user SET Password = PASSWORD('${MYSQL_ROOT_PASSWORD}') WHERE USER='root'; FLUSH PRIVILEGES"
847 + "${EROOT}/usr/bin/mysql" \
848 + "--socket=${socket}" \
849 + -hlocalhost \
850 + -e "${sql}"
851 + eend $?
852 +
853 + if [[ -n "${sqltmp}" ]] ; then
854 + ebegin "Loading \"zoneinfo\", this step may require a few seconds"
855 + "${EROOT}/usr/bin/mysql" \
856 + "--socket=${socket}" \
857 + -hlocalhost \
858 + -uroot \
859 + --password="${MYSQL_ROOT_PASSWORD}" \
860 + mysql < "${sqltmp}"
861 + rc=$?
862 + eend $?
863 + [[ $rc -ne 0 ]] && ewarn "Failed to load zoneinfo!"
864 + fi
865 +
866 + # Stop the server and cleanup
867 + einfo "Stopping the server ..."
868 + kill $(< "${pidfile}" )
869 + rm -f "${sqltmp}"
870 + wait %1
871 + einfo "Done"
872 +}