Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mysql:master commit in: dev-db/mysql-cluster/
Date: Thu, 28 Jun 2018 18:13:55
Message-Id: 1530209589.4229f739d92db62d68143fd69deba1989b004daf.grknight@gentoo
1 commit: 4229f739d92db62d68143fd69deba1989b004daf
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 28 18:13:09 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 28 18:13:09 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/mysql.git/commit/?id=4229f739
7
8 dev-db/mysql-cluster: New 7.4.20 with client-libs FIXME!
9
10 This currently has a build issue. Find it and squash
11
12 Package-Manager: Portage-2.3.41, Repoman-2.3.9
13 Manifest-Sign-Key: D1F781EFF9F4A3B6
14
15 dev-db/mysql-cluster/Manifest | 34 +-
16 dev-db/mysql-cluster/metadata.xml | 8 +-
17 dev-db/mysql-cluster/mysql-cluster-7.4.20.ebuild | 514 +++++++++++++++++++++++
18 3 files changed, 535 insertions(+), 21 deletions(-)
19
20 diff --git a/dev-db/mysql-cluster/Manifest b/dev-db/mysql-cluster/Manifest
21 index e0d2a84..2eafe55 100644
22 --- a/dev-db/mysql-cluster/Manifest
23 +++ b/dev-db/mysql-cluster/Manifest
24 @@ -3,23 +3,25 @@ Hash: SHA256
25
26 DIST mysql-cluster-gpl-7.2.22.tar.gz 26075142 SHA256 404b80192c488791cedf6251e64bb01310b20f13fcdb28721e108e92985ae999 SHA512 b3370725f17a5b6577c9822097b6c39e4375bdabca2a403bd45dfeb9fd5920c0e213c894eed33dadba69d9c066427ab5065c587869d82bf2e3438d3bdeb1aa8e WHIRLPOOL 1275fc2a181011c5ea2ac392c94027f399a5ce4fd499ff23790bfad142b1c7d67bc421e7c6a4e64e6bb409f04016196417535d5704d21165c1120bf46ab68544
27 DIST mysql-cluster-gpl-7.3.11.tar.gz 42806929 SHA256 6c8cfc99ccbf47cd4304996559de6fb330e9cdf754bec37ff7347be72e50c646 SHA512 89e5b6e845b71ed6945529b7f515d3af96ec6daf79c0085f1d0ea6e4426f61eb3626b688e5edda668be4615df1b8cec4e71acdf0d21150fa2775c79ea09563e5 WHIRLPOOL f03d3b62da793becd6aab775293e5963697f9b4147bf6d662274f689b1a48692b1f4de0ad196e74cb02a07ce2a69b608a4d420ad5dc153b20888ba69dc361dc4
28 +DIST mysql-cluster-gpl-7.4.20.tar.gz 41675568 SHA256 4a9efbf3a2506654605daac7ec51f06e18b316786d745b975896cfee395cc5b4 SHA512 fb6b8d027f873423b64b0898386126e85881605357650821ed6cd30c0fabb8edf1765bf2c87e11533d944fd33b07aaf01c045da9e10f8e24e864e9c1a3d8c984 WHIRLPOOL 669471b83fe47550c0ad3dae58a37dfc62e1b71e0f3e0023e8b78f1b2693408eab7b02b7c0cd4ab113691d3f29e09568f2687cfddf7a2e9a8de6fec8c9f06e00
29 DIST mysql-extras-20151117-2040Z.tar.bz2 294183 SHA256 2ca16597e869fb0fac4f6e48b779892569698ce83c898df3afaee63131f71833 SHA512 8edbc6a3812d17a2f1a827459867c0747387ff72be86b12fe0e790afca5e4b70e4f23c4098bdb61afa20ef292e2c3b154f16577d5c11999a3e2eec9e43b8d09a WHIRLPOOL f0df653216857527ffa3d31f07ab1c470614b53350f5dbd965ba3bdc398f36f37b506537f1070b03a54203a3847f6557a2ae6757327ce852833fa026de7b518d
30 +DIST mysql-extras-20180628-0201Z.tar.bz2 322141 SHA256 8317028fa98cc4abd819d11191fb82026eb9c4d23490b7c1d42590731fbc834d SHA512 71a3800ec091b41e41d25536199149eb714c0bbfc0f6fc478e8e4dcaf4cf87a7e4d49c513da3c9badc0de810d7d78c05ad91dd898e45005b42136346237de42a WHIRLPOOL 71a5d8d09ede40a2d7adad6d57e1b546fabb34610c92ede6e0b472c0d84ad016e39ec7fcb038c708723535542dfd9caace22f2b8dd822951ba8c0ee2778c462b
31 -----BEGIN PGP SIGNATURE-----
32 -Version: GnuPG v2.1
33 +Version: GnuPG v2
34
35 -iQJ8BAEBCABmBQJWTIuvXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
36 -ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NkMyRTQ0RUQ5MEUzMjc1OEU3RDU1QzBE
37 -MUY3ODFFRkY5RjRBM0I2AAoJENH3ge/59KO2pREP/iDluPWnygK42a/B+2xy4Imc
38 -5xJ29aAPYW3dX0YXqsH2WXvwRjDX2Khj5dIIf4WhqGiVG/HiPr56ukrVGLVXJuAW
39 -EJE7XO/ksuqsyJLPlyjGR3CBiRo3zZZlDykmSu6Z1WvCG4dvppSVFkO6aHrIAunL
40 -ZG12Ht5W6NOKEE2V8YkkciGNPsalggikIycgujJtOixDBhiCVc4lXG5F9Mo6uSe3
41 -7Nv/VrQwpuhuj21DH/KxQfIN6vE91WY7ZZ1NHgLOcYqVBId/cDCsR536ji8L5uuC
42 -kMuAvoOEsqTnWV0UinW2Q/BdlnIAYChU1+7Av9FHE9hBSETGkceFpg3kYIiy8iiP
43 -gddiPVruZQCfw/jqzK8Wzip6Ce42VNq7f/RlnpBaqInvoO8Orf3sq2JUEN/Kp3Hf
44 -F6/H/1F1c3iglJ/NsHU1fB083edgvI07M4iCWRQyOJHEKSeiCH6x0vraXApWVDT5
45 -sRZwEcsUQojIWH7QoyP+0DGiuDybDDttcKliPaaUOlFcp9iqJaEmllQIo0t/88MO
46 -D9f1E5N9e+Cuh8DbuqS36FYTLYtVuorwhqEsfDC9sLepMzlyBd0KisDX36uKlWDD
47 -Z1A1J2CW89fiiWXZLCZ0BAut2gWKjWkkrmOfZPiDmApzM9yjzeftARWdbWGBLJIu
48 -MY9CE99Dy32sF3dAFwtB
49 -=DZXo
50 +iQKTBAEBCAB9FiEEZsLkTtkOMnWOfVXA0feB7/n0o7YFAls1JTVfFIAAAAAALgAo
51 +aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDY2
52 +QzJFNDRFRDkwRTMyNzU4RTdENTVDMEQxRjc4MUVGRjlGNEEzQjYACgkQ0feB7/n0
53 +o7bVWRAAvmeaQBrNqYDFN31LWTWNRhlydqsRyl/uqBJIx74JgGKfuT4M5OMEqzL6
54 +VUSX3bM/ecZyIbYvqwZtgGotZ7S+J2Ac/J3crAKnVeTDIpbyU4MQ+nvmKt/kATsy
55 +77m5UrxQXja7ARZ5nUwV3wV0t1VW1/ukips/8KM3yPEdaEXzygo/SSdQUB6QPFaI
56 +nphtETJ84tf9MOWo1HJrS147j9PeDefs3EJONnl7d8mhlzCWNHOI718K8zQhxwS2
57 +o1va2F+UM0fWHEJoa/trrCKquvv6wra/oaIAlRhthSmLtQYTckAlLNu5n8WtCbpQ
58 +jm1KFR9s3gOY2Lco/xwDkvt23vQk5934hG0wkgyHSTCRuFiJdJD+fXut/eGdTEuu
59 +kpGseCZUFQ/XcFF5FKqJwXYIXd6ILqkzs3YU2dUcdO0XCMgVIytAwEReIgMeryKV
60 +8qCFJY58lJIDsp5Gp/6gb/732WJ9Dmpwpav/M6yS6cBIyC5oKyRLHWeoM4/bnsQW
61 +XFhj6bT1TdHJp+fMpfjb8vWAyA88wutu3lSQ3R90+5bEz3eXssaVZS1CGNnNNCmg
62 +oXsgNAMgUN+z62na+qlQKAaFtMJ4exhepnnpwB1Bwx59/Vt7KJCJga34wanMwuFJ
63 +H/ooLxuNb8KUh5V1pGP/SUiNw29JedsJ1nEbe28gGo/iZv5kZqc=
64 +=skuK
65 -----END PGP SIGNATURE-----
66
67 diff --git a/dev-db/mysql-cluster/metadata.xml b/dev-db/mysql-cluster/metadata.xml
68 index 4ac64b5..9836872 100644
69 --- a/dev-db/mysql-cluster/metadata.xml
70 +++ b/dev-db/mysql-cluster/metadata.xml
71 @@ -5,11 +5,8 @@
72 <email>mysql-bugs@g.o</email>
73 <name>MySQL</name>
74 </maintainer>
75 - <maintainer type="person">
76 - <email>hasufell@g.o</email>
77 - <description>Libressl issues. Only assign if it's a direct Libressl issue. Do not directly assign for anything else.</description>
78 - </maintainer>
79 <use>
80 + <flag name="client-libs">Build the client libraries from the server package instead of the C Connector packages</flag>
81 <flag name="cluster">Add support for NDB clustering</flag>
82 <flag name="community">Enables the community features from upstream.</flag>
83 <flag name="embedded">Build embedded server (libmysqld)</flag>
84 @@ -20,8 +17,9 @@
85 <flag name="openssl">Enable SSL connections and crypto functions using <pkg>dev-libs/openssl</pkg></flag>
86 <flag name="max-idx-128">Raise the max index per table limit from 64 to 128</flag>
87 <flag name="minimal">Install client programs only, no server</flag>
88 + <flag name="numa">Enable NUMA support using sys-process/numactl (NUMA kernel support is also required)</flag>
89 <flag name="profiling">Add support for statement profiling (requires USE=community).</flag>
90 -<!-- <flag name="server">Install server daemon</flag> -->
91 + <flag name="server">Build the server program</flag>
92 <flag name="systemtap">Build support for profiling and tracing using <pkg>dev-util/systemtap</pkg></flag>
93 <flag name="test">Install upstream testsuites for end use.</flag>
94 <flag name="yassl">Enable SSL connections and crypto functions using the bundled yaSSL</flag>
95
96 diff --git a/dev-db/mysql-cluster/mysql-cluster-7.4.20.ebuild b/dev-db/mysql-cluster/mysql-cluster-7.4.20.ebuild
97 new file mode 100644
98 index 0000000..7121a97
99 --- /dev/null
100 +++ b/dev-db/mysql-cluster/mysql-cluster-7.4.20.ebuild
101 @@ -0,0 +1,514 @@
102 +# Copyright 1999-2018 Gentoo Foundation
103 +# Distributed under the terms of the GNU General Public License v2
104 +
105 +EAPI="6"
106 +MY_EXTRAS_VER="20180628-0201Z"
107 +
108 +CMAKE_MAKEFILE_GENERATOR=emake
109 +
110 +# Keeping eutils in EAPI=6 for emktemp in pkg_config
111 +
112 +inherit eutils flag-o-matic prefix toolchain-funcs \
113 + java-pkg-opt-2 user cmake-utils multilib-build
114 +
115 +SRC_URI="http://cdn.mysql.com/Downloads/MySQL-Cluster-7.4/${PN}-gpl-${PV}.tar.gz
116 + https://cdn.mysql.com/archives/mysql-cluster-7.4/${PN}-gpl-${PV}.tar.gz
117 + http://downloads.mysql.com/archives/MySQL-Cluster-7.4/${PN}-gpl-${PV}.tar.gz"
118 +
119 +# Gentoo patches to MySQL
120 +if [[ "${MY_EXTRAS_VER}" != "live" && "${MY_EXTRAS_VER}" != "none" ]]; then
121 + SRC_URI="${SRC_URI}
122 + mirror://gentoo/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
123 + https://gitweb.gentoo.org/proj/mysql-extras.git/snapshot/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
124 + https://dev.gentoo.org/~grknight/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
125 + https://dev.gentoo.org/~robbat2/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2
126 + https://dev.gentoo.org/~jmbsvicetto/distfiles/mysql-extras-${MY_EXTRAS_VER}.tar.bz2"
127 +fi
128 +
129 +HOMEPAGE="https://www.mysql.com/"
130 +DESCRIPTION="A fast, multi-threaded, multi-user SQL database server"
131 +LICENSE="GPL-2"
132 +SLOT="0/18"
133 +IUSE="client-libs cracklib debug jemalloc latin1 libressl numa +perl profiling selinux
134 + +server static static-libs systemtap tcmalloc test yassl"
135 +
136 +# Tests always fail when libressl is enabled due to hard-coded ciphers in the tests
137 +RESTRICT="libressl? ( test )"
138 +
139 +REQUIRED_USE="?? ( tcmalloc jemalloc ) static? ( yassl )"
140 +
141 +KEYWORDS="~amd64 ~x86"
142 +# Shorten the path because the socket path length must be shorter than 107 chars
143 +# and we will run a mysql server during test phase
144 +S="${WORKDIR}/mysql"
145 +
146 +if [[ "${MY_EXTRAS_VER}" == "live" ]] ; then
147 + inherit git-r3
148 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/mysql-extras.git"
149 + EGIT_CHECKOUT_DIR="${WORKDIR}/mysql-extras"
150 + EGIT_CLONE_TYPE=shallow
151 + MY_PATCH_DIR="${WORKDIR}/mysql-extras"
152 +else
153 + MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
154 +fi
155 +
156 +MY_PATCH_DIR="${WORKDIR}/mysql-extras-${MY_EXTRAS_VER}"
157 +
158 +PATCHES=(
159 + "${MY_PATCH_DIR}"/01050_all_mysql_config_cleanup-5.6.patch
160 + "${MY_PATCH_DIR}"/02040_all_embedded-library-shared-5.5.10.patch
161 + "${MY_PATCH_DIR}"/20006_all_cmake_elib-mysql-5.6.35.patch
162 + "${MY_PATCH_DIR}"/20007_all_cmake-debug-werror-5.6.22.patch
163 + "${MY_PATCH_DIR}"/20009_all_mysql_myodbc_symbol_fix-5.6.patch
164 + "${MY_PATCH_DIR}"/20018_all_mysql-5.6.25-without-clientlibs-tools.patch
165 + "${MY_PATCH_DIR}"/20027_all_mysql-5.5-perl5.26-includes.patch
166 + "${MY_PATCH_DIR}"/20028_all_mysql-5.6-gcc7.patch
167 + "${MY_PATCH_DIR}"/30000_all_mysql-cluster-multilib-property.patch
168 +)
169 +
170 +# Be warned, *DEPEND are version-dependant
171 +# These are used for both runtime and compiletime
172 +COMMON_DEPEND="
173 + kernel_linux? (
174 + sys-process/procps:0=
175 + dev-libs/libaio:0=
176 + )
177 + net-misc/curl
178 + >=sys-apps/sed-4
179 + >=sys-apps/texinfo-4.7-r1
180 + jemalloc? ( dev-libs/jemalloc:0= )
181 + tcmalloc? ( dev-util/google-perftools:0= )
182 + systemtap? ( >=dev-util/systemtap-1.3:0= )
183 + !yassl? (
184 + !libressl? ( >=dev-libs/openssl-1.0.0:0= )
185 + libressl? ( dev-libs/libressl:0= )
186 + )
187 + >=sys-libs/zlib-1.2.3:0=
188 + sys-libs/ncurses:0=
189 + server? (
190 + numa? ( sys-process/numactl )
191 + dev-libs/libevent:0=
192 + )
193 + !client-libs? ( dev-db/mysql-connector-c[${MULTILIB_USEDEP},static-libs?] )
194 + ${JAVA_PKG_E_DEPEND}
195 +"
196 +DEPEND="virtual/yacc
197 + static? ( sys-libs/ncurses[static-libs] )
198 + || ( >=sys-devel/gcc-3.4.6 >=sys-devel/gcc-apple-4.0 )
199 + >=virtual/jdk-1.6
200 + test? ( dev-perl/JSON )
201 + ${COMMON_DEPEND}"
202 +RDEPEND="selinux? ( sec-policy/selinux-mysql )
203 + client-libs? ( !dev-db/mariadb-connector-c[mysqlcompat] !dev-db/mysql-connector-c )
204 + !dev-db/mariadb !dev-db/mariadb-galera !dev-db/percona-server !dev-db/mysql
205 + server? ( !prefix? ( dev-db/mysql-init-scripts ) )
206 + >=virtual/jre-1.6
207 + ${COMMON_DEPEND}
208 +"
209 +# For other stuff to bring us in
210 +# dev-perl/DBD-mysql is needed by some scripts installed by MySQL
211 +PDEPEND="perl? ( >=dev-perl/DBD-mysql-2.9004 )"
212 +
213 +pkg_setup() {
214 + if [[ ${MERGE_TYPE} != binary ]] ; then
215 + local GCC_MAJOR_SET=$(gcc-major-version)
216 + local GCC_MINOR_SET=$(gcc-minor-version)
217 + # Bug 565584. InnoDB now requires atomic functions introduced with gcc-4.7 on
218 + # non x86{,_64} arches
219 + if ! use amd64 && ! use x86 && [[ ${GCC_MAJOR_SET} -lt 4 || \
220 + ${GCC_MAJOR_SET} -eq 4 && ${GCC_MINOR_SET} -lt 7 ]] ; then
221 + eerror "${PN} needs to be built with gcc-4.7 or later."
222 + eerror "Please use gcc-config to switch to gcc-4.7 or later version."
223 + die
224 + fi
225 + fi
226 + if has test ${FEATURES} && \
227 + use server && ! has userpriv ${FEATURES} ; then
228 + eerror "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
229 + fi
230 +
231 + # This should come after all of the die statements
232 + enewgroup mysql 60 || die "problem adding 'mysql' group"
233 + enewuser mysql 60 -1 /dev/null mysql || die "problem adding 'mysql' user"
234 + java-pkg_init
235 +}
236 +
237 +src_unpack() {
238 + unpack ${A}
239 + # Grab the patches
240 + [[ "${MY_EXTRAS_VER}" == "live" ]] && S="${WORKDIR}/mysql-extras" git-r3_src_unpack
241 +
242 + mv -f "${WORKDIR}/${PN}-gpl-${PV}" "${S}" || die
243 +}
244 +
245 +src_prepare() {
246 + java-utils-2_src_prepare
247 + _disable_engine() {
248 + echo > "${S%/}/storage/${1}/CMakeLists.txt" || die
249 + }
250 +
251 + _disable_plugin() {
252 + echo > "${S%/}/plugin/${1}/CMakeLists.txt" || die
253 + }
254 +
255 + if use jemalloc ; then
256 + echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt" || die
257 + fi
258 + if use tcmalloc; then
259 + echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt" || die
260 + fi
261 + # Remove the centos and rhel selinux policies to support mysqld_safe under SELinux
262 + if [[ -d "${S}/support-files/SELinux" ]] ; then
263 + echo > "${S}/support-files/SELinux/CMakeLists.txt" || die
264 + fi
265 +
266 + if use libressl ; then
267 + sed -i 's/OPENSSL_MAJOR_VERSION STREQUAL "1"/OPENSSL_MAJOR_VERSION STREQUAL "2"/' \
268 + "${S}/cmake/ssl.cmake" || die
269 + fi
270 + local plugin
271 + local server_plugins=( semisync )
272 + local test_plugins=( audit_null daemon_example fulltext )
273 + if ! use server; then # These plugins are for the server
274 + for plugin in "${server_plugins[@]}" ; do
275 + _disable_plugin "${plugin}"
276 + done
277 + fi
278 +
279 + if ! use test; then # These plugins are only used during testing
280 + for plugin in "${test_plugins[@]}" ; do
281 + _disable_plugin "${plugin}"
282 + done
283 + fi
284 +
285 + # Don't build example
286 + _disable_engine example
287 + _disable_plugin innodb_memcached
288 +
289 + cmake-utils_src_prepare
290 +}
291 +
292 +src_configure() {
293 + # Bug #114895, bug #110149
294 + filter-flags "-O" "-O[01]"
295 +
296 + append-cxxflags -felide-constructors
297 +
298 + # bug #283926, with GCC4.4, this is required to get correct behavior.
299 + append-flags -fno-strict-aliasing
300 +
301 + CMAKE_BUILD_TYPE="RelWithDebInfo"
302 +
303 + # debug hack wrt #497532
304 + mycmakeargs=(
305 + -DCMAKE_C_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
306 + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(usex debug '' '-DNDEBUG')"
307 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
308 + -DMYSQL_DATADIR="${EPREFIX}/var/lib/mysql"
309 + -DSYSCONFDIR="${EPREFIX}/etc/mysql"
310 + -DINSTALL_BINDIR=bin
311 + -DINSTALL_DOCDIR=share/doc/${PF}
312 + -DINSTALL_DOCREADMEDIR=share/doc/${PF}
313 + -DINSTALL_INCLUDEDIR=include/mysql
314 + -DINSTALL_INFODIR=share/info
315 + -DINSTALL_LIBDIR=$(get_libdir)
316 + -DINSTALL_MANDIR=share/man
317 + -DINSTALL_MYSQLSHAREDIR=share/mysql
318 + -DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin
319 + -DINSTALL_SCRIPTDIR=share/mysql/scripts
320 + -DINSTALL_MYSQLDATADIR="${EPREFIX}/var/lib/mysql"
321 + -DINSTALL_SBINDIR=sbin
322 + -DINSTALL_SUPPORTFILESDIR="${EPREFIX}/usr/share/mysql"
323 + -DCOMPILATION_COMMENT="Gentoo Linux ${PF}"
324 + -DWITH_UNIT_TESTS=$(usex test ON OFF)
325 + ### TODO: make this system but issues with UTF-8 prevent it
326 + -DWITH_EDITLINE=bundled
327 + -DWITH_ZLIB=system
328 + -DWITH_LIBWRAP=0
329 + -DENABLED_LOCAL_INFILE=1
330 + -DMYSQL_UNIX_ADDR="${EPREFIX}/var/run/mysqld/mysqld.sock"
331 + -DWITH_DEFAULT_COMPILER_OPTIONS=0
332 + -DWITH_DEFAULT_FEATURE_SET=0
333 + # The build forces this to be defined when cross-compiling. We pass it
334 + # all the time for simplicity and to make sure it is actually correct.
335 + -DSTACK_DIRECTION=$(tc-stack-grows-down && echo -1 || echo 1)
336 + -DWITH_LIBEVENT=NO
337 + -DWITHOUT_CLIENTLIBS=YES
338 + -DENABLE_DTRACE=$(usex systemtap)
339 + -DWITH_SSL=$(usex yassl bundled system)
340 + -DINSTALL_MYSQLTESTDIR=$(usex test 'share/mysql/mysql-test' '')
341 + -DWITHOUT_VALIDATE_PASSWORD=1
342 + )
343 +
344 + if use server ; then
345 +
346 + if [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
347 + ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
348 + ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
349 + ewarn "You MUST file bugs without these variables set."
350 +
351 + mycmakeargs+=(
352 + -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
353 + -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
354 + )
355 +
356 + elif ! use latin1 ; then
357 + mycmakeargs+=(
358 + -DDEFAULT_CHARSET=utf8
359 + -DDEFAULT_COLLATION=utf8_general_ci
360 + )
361 + else
362 + mycmakeargs+=(
363 + -DDEFAULT_CHARSET=latin1
364 + -DDEFAULT_COLLATION=latin1_swedish_ci
365 + )
366 + fi
367 + mycmakeargs+=(
368 + -DWITH_NUMA=$(usex numa ON OFF)
369 + -DEXTRA_CHARSETS=all
370 + -DDISABLE_SHARED=$(usex static YES NO)
371 + -DWITH_DEBUG=$(usex debug)
372 + -DWITH_EMBEDDED_SERVER=OFF
373 + -DENABLED_PROFILING=$(usex profiling)
374 + )
375 +
376 + if use static; then
377 + mycmakeargs+=( -DWITH_PIC=1 )
378 + fi
379 +
380 + # Storage engines
381 + mycmakeargs+=(
382 + -DWITH_ARCHIVE_STORAGE_ENGINE=1
383 + -DWITH_BLACKHOLE_STORAGE_ENGINE=1
384 + -DWITH_CSV_STORAGE_ENGINE=1
385 + -DWITH_HEAP_STORAGE_ENGINE=1
386 + -DWITH_INNOBASE_STORAGE_ENGINE=1
387 + -DWITH_MYISAMMRG_STORAGE_ENGINE=1
388 + -DWITH_MYISAM_STORAGE_ENGINE=1
389 + -DWITH_PARTITION_STORAGE_ENGINE=1
390 + -DWITH_INNODB_MEMCACHED=0
391 + -DWITH_NDBCLUSTER=1
392 + -DWITHOUT_PARTITION_STORAGE_ENGINE=0
393 + )
394 +
395 + else
396 + mycmakeargs+=(
397 + -DWITHOUT_SERVER=1
398 + -DWITH_EMBEDDED_SERVER=OFF
399 + -DEXTRA_CHARSETS=none
400 + )
401 + fi
402 +
403 + cmake-utils_src_configure
404 +}
405 +
406 +src_compile() {
407 + cmake-utils_src_compile
408 +}
409 +
410 +src_install() {
411 + cmake-utils_src_install
412 +
413 + # Kill old libmysqclient_r symlinks if they exist. Time to fix what depends on them.
414 + find "${D%/}" -name 'libmysqlclient_r.*' -type l -delete || die
415 + # Make sure the vars are correctly initialized
416 + mysql_init_vars
417 +
418 + # Convenience links
419 + einfo "Making Convenience links for mysqlcheck multi-call binary"
420 + dosym "mysqlcheck" "/usr/bin/mysqlanalyze"
421 + dosym "mysqlcheck" "/usr/bin/mysqlrepair"
422 + dosym "mysqlcheck" "/usr/bin/mysqloptimize"
423 +
424 + # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
425 + if [[ -d "${ED%/}/usr/data" ]] ; then
426 + find "${ED%/}/usr/data" -delete || die
427 + fi
428 +
429 + # Unless they explicitly specific USE=test, then do not install the
430 + # testsuite. It DOES have a use to be installed, esp. when you want to do a
431 + # validation of your database configuration after tuning it.
432 + if ! use test ; then
433 + find "${D%/}/${MY_SHAREDSTATEDIR}/mysql-test" -delete || die
434 + fi
435 +
436 + # Configuration stuff
437 + einfo "Building default configuration ..."
438 + insinto "${MY_SYSCONFDIR#${EPREFIX}}"
439 + [[ -f "${S%/}/scripts/mysqlaccess.conf" ]] && doins "${S%/}"/scripts/mysqlaccess.conf
440 + local mycnf_src="my.cnf-5.6"
441 + sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
442 + "${FILESDIR%/}/${mycnf_src}" \
443 + > "${TMPDIR%/}/my.cnf.ok" || die
444 + use prefix && sed -i -r -e '/^user[[:space:]]*=[[:space:]]*mysql$/d' "${TMPDIR%/}/my.cnf.ok"
445 + if use latin1 ; then
446 + sed -i \
447 + -e "/character-set/s|utf8|latin1|g" \
448 + "${TMPDIR%/}/my.cnf.ok" || die
449 + fi
450 + eprefixify "${TMPDIR%/}/my.cnf.ok"
451 + newins "${TMPDIR}/my.cnf.ok" my.cnf
452 +
453 + if use server ; then
454 + einfo "Including support files and sample configurations"
455 + docinto "support-files"
456 + local script
457 + for script in \
458 + "${S}"/support-files/magic
459 + do
460 + [[ -f "$script" ]] && dodoc "${script}"
461 + done
462 +
463 + docinto "scripts"
464 + for script in "${S}"/scripts/mysql* ; do
465 + [[ ( -f "$script" ) && ( "${script%.sh}" == "${script}" ) ]] && dodoc "${script}"
466 + done
467 + fi
468 +}
469 +
470 +pkg_preinst() {
471 + java-utils-2_pkg_preinst
472 +}
473 +
474 +pkg_postinst() {
475 + # Make sure the vars are correctly initialized
476 + mysql_init_vars
477 +
478 + # Create log directory securely if it does not exist
479 + [[ -d "${ROOT}${MY_LOGDIR}" ]] || install -d -m0750 -o mysql -g mysql "${ROOT}${MY_LOGDIR}"
480 +
481 + if use server ; then
482 + if [[ -z "${REPLACING_VERSIONS}" ]] ; then
483 + einfo
484 + elog "You might want to run:"
485 + elog "\"emerge --config =${CATEGORY}/${PF}\""
486 + elog "if this is a new install."
487 + elog
488 + elog "If you are switching server implentations, you should run the"
489 + elog "mysql_upgrade tool."
490 + einfo
491 + else
492 + einfo
493 + elog "If you are upgrading major versions, you should run the"
494 + elog "mysql_upgrade tool."
495 + einfo
496 + fi
497 + fi
498 +}
499 +
500 +# Official test instructions:
501 +# USE='extraengine perl openssl' \
502 +# FEATURES='test userpriv -usersandbox' \
503 +# ebuild mysql-cluster-X.X.XX.ebuild \
504 +# digest clean package
505 +src_test() {
506 +
507 + _disable_test() {
508 + local rawtestname reason
509 + rawtestname="${1}" ; shift
510 + reason="${@}"
511 + ewarn "test '${rawtestname}' disabled: '${reason}'"
512 + echo ${rawtestname} : ${reason} >> "${T}/disabled.def"
513 + }
514 +
515 + local TESTDIR="${CMAKE_BUILD_DIR}/mysql-test"
516 + local retstatus_unit
517 + local retstatus_tests
518 +
519 + # Bug #213475 - MySQL _will_ object strenously if your machine is named
520 + # localhost. Also causes weird failures.
521 + [[ "${HOSTNAME}" == "localhost" ]] && die "Your machine must NOT be named localhost"
522 +
523 + if use server ; then
524 +
525 + if [[ $UID -eq 0 ]]; then
526 + die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
527 + fi
528 + has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox"
529 +
530 + einfo ">>> Test phase [test]: ${CATEGORY}/${PF}"
531 +
532 + # Ensure that parallel runs don't die
533 + export MTR_BUILD_THREAD="$((${RANDOM} % 100))"
534 + # Enable parallel testing, auto will try to detect number of cores
535 + # You may set this by hand.
536 + # The default maximum is 8 unless MTR_MAX_PARALLEL is increased
537 + export MTR_PARALLEL="${MTR_PARALLEL:-auto}"
538 +
539 + # create directories because mysqladmin might right out of order
540 + mkdir -p "${T}"/var-tests{,/log}
541 +
542 + # create symlink for the tests to find mysql_tzinfo_to_sql
543 + ln -s "${BUILD_DIR}/sql/mysql_tzinfo_to_sql" "${S}/sql/"
544 +
545 + touch "${T}/disabled.def"
546 + # These are failing in MySQL 5.5/5.6 for now and are believed to be
547 + # false positives:
548 + #
549 + # main.information_schema, binlog.binlog_statement_insert_delayed,
550 + # main.mysqld--help-notwin, funcs_1.is_triggers funcs_1.is_tables_mysql,
551 + # funcs_1.is_columns_mysql, binlog.binlog_mysqlbinlog_filter,
552 + # perfschema.binlog_edge_mix, perfschema.binlog_edge_stmt,
553 + # mysqld--help-notwin, funcs_1.is_triggers, funcs_1.is_tables_mysql, funcs_1.is_columns_mysql
554 + # perfschema.binlog_edge_stmt, perfschema.binlog_edge_mix, binlog.binlog_mysqlbinlog_filter
555 + # fails due to USE=-latin1 / utf8 default
556 + #
557 + # main.mysql_client_test:
558 + # segfaults at random under Portage only, suspect resource limits.
559 + #
560 + for t in \
561 + binlog.binlog_mysqlbinlog_filter \
562 + binlog.binlog_statement_insert_delayed \
563 + funcs_1.is_columns_mysql \
564 + funcs_1.is_tables_mysql \
565 + funcs_1.is_triggers \
566 + main.information_schema \
567 + main.mysqld--help-notwinfuncs_1.is_triggers \
568 + main.mysql_client_test \
569 + mysqld--help-notwin \
570 + main.mysqlhotcopy_archive main.mysqlhotcopy_myisam \
571 + perfschema.binlog_edge_mix \
572 + perfschema.binlog_edge_stmt \
573 + rpl.rpl_plugin_load main.mysql \
574 + main.mysql_upgrade \
575 + ; do
576 + _disable_test "$t" "False positives in Gentoo"
577 + done
578 + # ndb.ndbinfo, ndb_binlog.ndb_binlog_index: latin1/utf8
579 + for t in \
580 + ndb.ndbinfo ndb.ndb_tools_connect \
581 + ndb_binlog.ndb_binlog_index ; do
582 + _disable_test "$t" "False positives in Gentoo (NDB) (Latin1/UTF8)"
583 + done
584 +
585 + # Set file limits higher so tests run
586 + ulimit -n 3000
587 +
588 + # Run mysql tests
589 + pushd "${TESTDIR}" > /dev/null || die
590 +
591 + # run mysql-test tests
592 + perl mysql-test-run.pl --force --vardir="${T}/var-tests" \
593 + --suite-timeout=5000 --reorder --skip-test-list="${T}/disabled.def" \
594 + --nounit-tests
595 + retstatus_tests=$?
596 +
597 + popd > /dev/null || die
598 +
599 + # Cleanup is important for these testcases.
600 + pkill -9 -f "${S}/ndb" 2>/dev/null
601 + pkill -9 -f "${S}/sql" 2>/dev/null
602 +
603 + failures=""
604 + [[ $retstatus_unit -eq 0 ]] || failures="${failures} test-unit"
605 + [[ $retstatus_tests -eq 0 ]] || failures="${failures} tests"
606 + has usersandbox $FEATURES && eerror "Some tests may fail with FEATURES=usersandbox"
607 +
608 + [[ -z "$failures" ]] || die "Test failures: $failures"
609 + einfo "Tests successfully completed"
610 +
611 + else
612 +
613 + einfo "Skipping server tests due to minimal build."
614 + fi
615 +}