Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@×××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/mysql:master commit in: eclass/
Date: Thu, 07 Nov 2013 19:44:16
Message-Id: 1383847114.132b9a5b9b01abffd15d12e3d57430a343425a8a.grknight.pub@gentoo
1 commit: 132b9a5b9b01abffd15d12e3d57430a343425a8a
2 Author: Brian Evans <grknight <AT> tuffmail <DOT> com>
3 AuthorDate: Thu Nov 7 17:58:34 2013 +0000
4 Commit: Brian Evans <grknight <AT> lavabit <DOT> com>
5 CommitDate: Thu Nov 7 17:58:34 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/mysql.git;a=commit;h=132b9a5b
7
8 [cmake-multilib] Refactor multilib eclass to remove duplication of code when possible
9
10 ---
11 eclass/mysql-cmake-multilib.eclass | 384 ++-----------------------------------
12 1 file changed, 17 insertions(+), 367 deletions(-)
13
14 diff --git a/eclass/mysql-cmake-multilib.eclass b/eclass/mysql-cmake-multilib.eclass
15 index 8834c37..fc4da63 100644
16 --- a/eclass/mysql-cmake-multilib.eclass
17 +++ b/eclass/mysql-cmake-multilib.eclass
18 @@ -12,10 +12,10 @@
19 # @DESCRIPTION:
20 # The mysql-cmake-multilib.eclass provides the support to build the mysql
21 # ebuilds using the cmake build system. This eclass provides
22 -# the src_unpack, src_prepare, src_configure, src_compile, scr_install,
23 -# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks.
24 +# the src_prepare, src_configure, src_compile and src_install
25 +# phase hooks.
26
27 -inherit cmake-multilib flag-o-matic multilib prefix
28 +inherit cmake-utils multilib-build flag-o-matic mysql-cmake
29
30 #
31 # HELPER FUNCTIONS:
32 @@ -25,224 +25,7 @@ inherit cmake-multilib flag-o-matic multilib prefix
33 # @DESCRIPTION:
34 # Helper function to disable specific tests.
35 mysql-cmake-multilib_disable_test() {
36 -
37 - local rawtestname testname testsuite reason mysql_disabled_file mysql_disabled_dir
38 - rawtestname="${1}" ; shift
39 - reason="${@}"
40 - ewarn "test '${rawtestname}' disabled: '${reason}'"
41 -
42 - testsuite="${rawtestname/.*}"
43 - testname="${rawtestname/*.}"
44 - for mysql_disabled_file in \
45 - ${S}/mysql-test/disabled.def \
46 - ${S}/mysql-test/t/disabled.def ; do
47 - [[ -f ${mysql_disabled_file} ]] && break
48 - done
49 - #mysql_disabled_file="${S}/mysql-test/t/disabled.def"
50 - #einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}"
51 - echo ${testname} : ${reason} >> "${mysql_disabled_file}"
52 -
53 - if [[ ( -n ${testsuite} ) && ( ${testsuite} != "main" ) ]]; then
54 - for mysql_disabled_file in \
55 - ${S}/mysql-test/suite/${testsuite}/disabled.def \
56 - ${S}/mysql-test/suite/${testsuite}/t/disabled.def \
57 - FAILED ; do
58 - [[ -f ${mysql_disabled_file} ]] && break
59 - done
60 - if [[ ${mysql_disabled_file} != "FAILED" ]]; then
61 - echo "${testname} : ${reason}" >> "${mysql_disabled_file}"
62 - else
63 - for mysql_disabled_dir in \
64 - ${S}/mysql-test/suite/${testsuite} \
65 - ${S}/mysql-test/suite/${testsuite}/t \
66 - FAILED ; do
67 - [[ -d ${mysql_disabled_dir} ]] && break
68 - done
69 - if [[ ${mysql_disabled_dir} != "FAILED" ]]; then
70 - echo "${testname} : ${reason}" >> "${mysql_disabled_dir}/disabled.def"
71 - else
72 - ewarn "Could not find testsuite disabled.def location for ${rawtestname}"
73 - fi
74 - fi
75 - fi
76 -}
77 -
78 -# @FUNCTION: mysql-cmake_use_plugin
79 -# @DESCRIPTION:
80 -# Helper function to enable/disable plugins by use flags
81 -# cmake-utils_use_with is not enough as some references check WITH_ (0|1)
82 -# and some check WITHOUT_. Also, this can easily extend to non-storage plugins.
83 -mysql-cmake_use_plugin() {
84 - [[ -z $2 ]] && die "mysql-cmake_use_plugin <USE flag> <flag name>"
85 - if use $1 ; then
86 - echo "-DWITH_$2=1"
87 - else
88 - echo "-DWITHOUT_$2=1 -DWITH_$2=0"
89 - fi
90 -}
91 -
92 -# @FUNCTION: configure_cmake_locale
93 -# @DESCRIPTION:
94 -# Helper function to configure locale cmake options
95 -configure_cmake_locale() {
96 -
97 - if ! use minimal && [[ ( -n ${MYSQL_DEFAULT_CHARSET} ) && ( -n ${MYSQL_DEFAULT_COLLATION} ) ]]; then
98 - ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}"
99 - ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}."
100 - ewarn "You MUST file bugs without these variables set."
101 -
102 - mycmakeargs+=(
103 - -DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET}
104 - -DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION}
105 - )
106 -
107 - elif ! use latin1 ; then
108 - mycmakeargs+=(
109 - -DDEFAULT_CHARSET=utf8
110 - -DDEFAULT_COLLATION=utf8_general_ci
111 - )
112 - else
113 - mycmakeargs+=(
114 - -DDEFAULT_CHARSET=latin1
115 - -DDEFAULT_COLLATION=latin1_swedish_ci
116 - )
117 - fi
118 -}
119 -
120 -# @FUNCTION: configure_cmake_minimal
121 -# @DESCRIPTION:
122 -# Helper function to configure minimal build
123 -configure_cmake_minimal() {
124 -
125 - mycmakeargs+=(
126 - -DWITHOUT_SERVER=1
127 - -DWITHOUT_EMBEDDED_SERVER=1
128 - -DENABLED_LOCAL_INFILE=1
129 - -DEXTRA_CHARSETS=none
130 - -DINSTALL_SQLBENCHDIR=
131 - -DWITH_SSL=system
132 - -DWITH_ZLIB=system
133 - -DWITHOUT_LIBWRAP=1
134 - -DWITH_READLINE=0
135 - -DWITH_LIBEDIT=0
136 - -DWITHOUT_ARCHIVE_STORAGE_ENGINE=1
137 - -DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1
138 - -DWITHOUT_CSV_STORAGE_ENGINE=1
139 - -DWITHOUT_FEDERATED_STORAGE_ENGINE=1
140 - -DWITHOUT_HEAP_STORAGE_ENGINE=1
141 - -DWITHOUT_INNOBASE_STORAGE_ENGINE=1
142 - -DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1
143 - -DWITHOUT_MYISAM_STORAGE_ENGINE=1
144 - -DWITHOUT_PARTITION_STORAGE_ENGINE=1
145 - -DWITHOUT_INNOBASE_STORAGE_ENGINE=1
146 - )
147 -}
148 -
149 -# @FUNCTION: configure_cmake_standard
150 -# @DESCRIPTION:
151 -# Helper function to configure standard build
152 -configure_cmake_standard() {
153 -
154 - mycmakeargs+=(
155 - -DENABLED_LOCAL_INFILE=1
156 - -DEXTRA_CHARSETS=all
157 - -DMYSQL_USER=mysql
158 - -DMYSQL_UNIX_ADDR=${EPREFIX}/var/run/mysqld/mysqld.sock
159 - -DWITH_READLINE=0
160 - -DWITH_LIBEDIT=0
161 - -DWITH_ZLIB=system
162 - -DWITHOUT_LIBWRAP=1
163 - )
164 -
165 - mycmakeargs+=(
166 - $(cmake-utils_use_disable !static SHARED)
167 - $(cmake-utils_use_with debug)
168 - $(cmake-utils_use_with embedded EMBEDDED_SERVER)
169 - $(cmake-utils_use_with profiling)
170 - $(cmake-utils_use_enable systemtap DTRACE)
171 - )
172 -
173 - if use static; then
174 - mycmakeargs+=( -DWITH_PIC=1 )
175 - fi
176 -
177 - if use ssl; then
178 - mycmakeargs+=( -DWITH_SSL=system )
179 - else
180 - mycmakeargs+=( -DWITH_SSL=bundled )
181 - fi
182 -
183 - if use jemalloc; then
184 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
185 - fi
186 -
187 - if use tcmalloc; then
188 - mycmakeargs+=( -DWITH_SAFEMALLOC=OFF )
189 - fi
190 -
191 - # Storage engines
192 - mycmakeargs+=(
193 - -DWITH_ARCHIVE_STORAGE_ENGINE=1
194 - -DWITH_BLACKHOLE_STORAGE_ENGINE=1
195 - -DWITH_CSV_STORAGE_ENGINE=1
196 - -DWITH_HEAP_STORAGE_ENGINE=1
197 - -DWITH_INNOBASE_STORAGE_ENGINE=1
198 - -DWITH_MYISAMMRG_STORAGE_ENGINE=1
199 - -DWITH_MYISAM_STORAGE_ENGINE=1
200 - -DWITH_PARTITION_STORAGE_ENGINE=1
201 - $(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE)
202 - )
203 -
204 - if pbxt_available ; then
205 - mycmakeargs+=( $(cmake-utils_use_with pbxt PBXT_STORAGE_ENGINE) )
206 - fi
207 -
208 - if [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]]; then
209 - mycmakeargs+=(
210 - $(mysql-cmake_use_plugin oqgraph OQGRAPH)
211 - $(mysql-cmake_use_plugin sphinx SPHINX)
212 - $(mysql-cmake_use_plugin extraengine FEDERATEDX)
213 - $(mysql-cmake_use_plugin tokudb TOKUDB)
214 - $(mysql-cmake_use_plugin pam AUTH_PAM)
215 - )
216 -
217 - if use jemalloc ; then
218 - mycmakeargs+=( -DWITH_JEMALLOC="system" )
219 - else
220 - mycmakeargs+=( -DWITH_JEMALLOC=no )
221 - fi
222 -
223 - if mysql_version_is_at_least 10.0.5 ; then
224 - # CassandraSE needs Apache Thrift which is not in portage
225 - # TODO: Add use and deps for Connect SE external deps
226 - mycmakeargs+= (
227 - -DWITHOUT_CASSANDRA=1 -DWITH_CASSANDRA=0
228 - $(mysql-cmake_use_plugin extraengine SEQUENCE)
229 - $(mysql-cmake_use_plugin extraengine SPIDER)
230 - $(mysql-cmake_use_plugin extraengine CONNECT)
231 - -DCONNECT_WITH_MYSQL=1
232 - -DCONNECT_WITH_LIBXML=0
233 - -DCONNECT_WITH_ODBC=0
234 - )
235 - fi
236 - fi
237 -
238 - if [[ ${PN} == "percona-server" ]]; then
239 - mycmakeargs+=(
240 - $(cmake-utils_use_with pam)
241 - )
242 - fi
243 -
244 - if [[ ${PN} == "mysql-cluster" ]]; then
245 - # TODO: This really should include the following options,
246 - # but the memcached package doesn't install the files it seeks.
247 - # -DWITH_BUNDLED_MEMCACHED=OFF
248 - # -DMEMCACHED_HOME=${EPREFIX}/usr
249 - mycmakeargs+=(
250 - -DWITH_BUNDLED_LIBEVENT=OFF
251 - $(cmake-utils_use_with java NDB_JAVA)
252 - )
253 - fi
254 + mysql-cmake_disable_test "$@"
255 }
256
257 #
258 @@ -256,44 +39,10 @@ mysql-cmake-multilib_src_prepare() {
259
260 debug-print-function ${FUNCNAME} "$@"
261
262 - cd "${S}"
263 -
264 - if [[ ${MY_EXTRAS_VER} != none ]]; then
265 -
266 - # Apply the patches for this MySQL version
267 - EPATCH_SUFFIX="patch"
268 - mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory"
269 - # Clean out old items
270 - rm -f "${EPATCH_SOURCE}"/*
271 - # Now link in right patches
272 - mysql_mv_patches
273 - # And apply
274 - epatch
275 - fi
276 -
277 - # last -fPIC fixup, per bug #305873
278 - i="${S}"/storage/innodb_plugin/plug.in
279 - [[ -f ${i} ]] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}"
280 -
281 - rm -f "scripts/mysqlbug"
282 - if use jemalloc && ! ( [[ ${PN} == "mariadb" ]] && mysql_version_is_at_least "5.5.33" ); then
283 - echo "TARGET_LINK_LIBRARIES(mysqld jemalloc)" >> "${S}/sql/CMakeLists.txt"
284 - fi
285 -
286 - if use tcmalloc; then
287 - echo "TARGET_LINK_LIBRARIES(mysqld tcmalloc)" >> "${S}/sql/CMakeLists.txt"
288 - fi
289 -
290 - if has tokudb ${IUSE} ; then
291 - # Don't build bundled xz-utils
292 - rm -f "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake"
293 - touch "${S}/storage/tokudb/ft-index/cmake_modules/TokuThirdParty.cmake"
294 - fi
295 -
296 - epatch_user
297 + mysql-cmake_src_prepare "$@"
298 }
299
300 -_cmake-multilib_src_configure() {
301 +_mysql-multilib_src_configure() {
302
303 debug-print-function ${FUNCNAME} "$@"
304
305 @@ -330,7 +79,7 @@ _cmake-multilib_src_configure() {
306 fi
307
308 configure_cmake_locale
309 -
310 +
311 if multilib_is_native_abi; then
312 if use minimal ; then
313 configure_cmake_minimal
314 @@ -362,14 +111,16 @@ _cmake-multilib_src_configure() {
315 cmake-utils_src_configure
316 }
317
318 +
319 # @FUNCTION: mysql-cmake-multilib_src_configure
320 # @DESCRIPTION:
321 # Configure mysql to build the code for Gentoo respecting the use flags.
322 mysql-cmake-multilib_src_configure() {
323 - multilib_parallel_foreach_abi _cmake-multilib_src_configure "${@}"
324 + multilib_parallel_foreach_abi _mysql-multilib_src_configure "${@}"
325 }
326
327 -_cmake-multilib_src_compile() {
328 +_mysql-multilib_src_compile() {
329 +
330 if ! multilib_is_native_abi; then
331 BUILD_DIR="${BUILD_DIR}/libmysql" cmake-utils_src_compile
332 else
333 @@ -384,123 +135,22 @@ mysql-cmake-multilib_src_compile() {
334
335 debug-print-function ${FUNCNAME} "$@"
336
337 - multilib_foreach_abi _cmake-multilib_src_compile "${@}"
338 + multilib_foreach_abi _mysql-multilib_src_compile "${@}"
339 }
340
341 -_mysql-cmake-multilib_src_install() {
342 -
343 +_mysql-multilib_src_install() {
344 debug-print-function ${FUNCNAME} "$@"
345
346 - # Make sure the vars are correctly initialized
347 - mysql_init_vars
348 -
349 - if ! multilib_is_native_abi; then
350 + if multilib_is_native_abi; then
351 + mysql-cmake_src_install
352 + else
353 BUILD_DIR="${BUILD_DIR}/libmysql" cmake-utils_src_install
354 - return
355 - fi
356 - cmake-utils_src_install
357 -
358 - # Convenience links
359 - einfo "Making Convenience links for mysqlcheck multi-call binary"
360 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze"
361 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair"
362 - dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize"
363 -
364 - # Create a mariadb_config symlink
365 - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && dosym "/usr/bin/mysql_config" "/usr/bin/mariadb_config"
366 -
367 - # INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir
368 - rm -Rf "${ED}/usr/data"
369 -
370 - # Various junk (my-*.cnf moved elsewhere)
371 - einfo "Removing duplicate /usr/share/mysql files"
372 -
373 - # Clean up stuff for a minimal build
374 -# if use minimal ; then
375 -# einfo "Remove all extra content for minimal build"
376 -# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench}
377 -# rm -f "${ED}"/usr/bin/{mysql{_install_db,manager*,_secure_installation,_fix_privilege_tables,hotcopy,_convert_table_format,d_multi,_fix_extensions,_zap,_explain_log,_tableinfo,d_safe,_install,_waitpid,binlog,test},myisam*,isam*,pack_isam}
378 -# rm -f "${ED}/usr/sbin/mysqld"
379 -# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a
380 -# fi
381 -
382 - # Unless they explicitly specific USE=test, then do not install the
383 - # testsuite. It DOES have a use to be installed, esp. when you want to do a
384 - # validation of your database configuration after tuning it.
385 - if ! use test ; then
386 - rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test
387 fi
388 -
389 - # Configuration stuff
390 - case ${MYSQL_PV_MAJOR} in
391 - 5.[1-4]*) mysql_mycnf_version="5.1" ;;
392 - 5.[5-9]|6*|7*|8*|9*|10*) mysql_mycnf_version="5.5" ;;
393 - esac
394 - einfo "Building default my.cnf (${mysql_mycnf_version})"
395 - insinto "${MY_SYSCONFDIR#${EPREFIX}}"
396 - doins scripts/mysqlaccess.conf
397 - mycnf_src="my.cnf-${mysql_mycnf_version}"
398 - sed -e "s!@DATADIR@!${MY_DATADIR}!g" \
399 - "${FILESDIR}/${mycnf_src}" \
400 - > "${TMPDIR}/my.cnf.ok"
401 - if use latin1 ; then
402 - sed -i \
403 - -e "/character-set/s|utf8|latin1|g" \
404 - "${TMPDIR}/my.cnf.ok"
405 - fi
406 - eprefixify "${TMPDIR}/my.cnf.ok"
407 - newins "${TMPDIR}/my.cnf.ok" my.cnf
408 -
409 - # Minimal builds don't have the MySQL server
410 - if ! use minimal ; then
411 - einfo "Creating initial directories"
412 - # Empty directories ...
413 - diropts "-m0750"
414 - if [[ ${PREVIOUS_DATADIR} != "yes" ]] ; then
415 - dodir "${MY_DATADIR#${EPREFIX}}"
416 - keepdir "${MY_DATADIR#${EPREFIX}}"
417 - chown -R mysql:mysql "${D}/${MY_DATADIR}"
418 - fi
419 -
420 - diropts "-m0755"
421 - for folder in "${MY_LOGDIR#${EPREFIX}}" ; do
422 - dodir "${folder}"
423 - keepdir "${folder}"
424 - chown -R mysql:mysql "${ED}/${folder}"
425 - done
426 - fi
427 -
428 - # Minimal builds don't have the MySQL server
429 - if ! use minimal ; then
430 - einfo "Including support files and sample configurations"
431 - docinto "support-files"
432 - for script in \
433 - "${S}"/support-files/my-*.cnf.sh \
434 - "${S}"/support-files/magic \
435 - "${S}"/support-files/ndb-config-2-node.ini.sh
436 - do
437 - [[ -f $script ]] && dodoc "${script}"
438 - done
439 -
440 - docinto "scripts"
441 - for script in "${S}"/scripts/mysql* ; do
442 - [[ ( -f $script ) && ( ${script%.sh} == ${script} ) ]] && dodoc "${script}"
443 - done
444 - fi
445 -
446 - cat <<-EOF > "${T}"/80mysql-libdir
447 - LDPATH="${EPREFIX}/usr/$(get_libdir)/mysql"
448 - EOF
449 - doenvd "${T}"/80mysql-libdir
450 -
451 - #Remove mytop if perl is not selected
452 - [[ ${PN} == "mariadb" || ${PN} == "mariadb-galera" ]] && ! use perl \
453 - && rm -f "${ED}/usr/bin/mytop"
454 }
455
456 # @FUNCTION: mysql-cmake-multilib_src_install
457 # @DESCRIPTION:
458 # Install mysql.
459 mysql-cmake-multilib_src_install() {
460 - multilib_foreach_abi _mysql-cmake-multilib_src_install "${@}"
461 + multilib_foreach_abi _mysql-multilib_src_install "${@}"
462 }