1 |
robbat2 11/07/13 07:07:15 |
2 |
|
3 |
Modified: mysql_fx.eclass |
4 |
Added: mysql-autotools.eclass mysql-cmake.eclass |
5 |
Log: |
6 |
Part 2 of MySQL eclass revamp: the split cmake/autotools support. |
7 |
|
8 |
Revision Changes Path |
9 |
1.23 eclass/mysql_fx.eclass |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql_fx.eclass?rev=1.23&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql_fx.eclass?rev=1.23&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql_fx.eclass?r1=1.22&r2=1.23 |
14 |
|
15 |
Index: mysql_fx.eclass |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v |
18 |
retrieving revision 1.22 |
19 |
retrieving revision 1.23 |
20 |
diff -p -w -b -B -u -u -r1.22 -r1.23 |
21 |
--- mysql_fx.eclass 12 Feb 2009 05:05:14 -0000 1.22 |
22 |
+++ mysql_fx.eclass 13 Jul 2011 07:07:15 -0000 1.23 |
23 |
@@ -1,9 +1,11 @@ |
24 |
# Copyright 1999-2007 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.22 2009/02/12 05:05:14 robbat2 Exp $ |
27 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/mysql_fx.eclass,v 1.23 2011/07/13 07:07:15 robbat2 Exp $ |
28 |
|
29 |
# Author: Francesco Riosa (Retired) <vivo@g.o> |
30 |
-# Maintainer: Luca Longinotti <chtekk@g.o> |
31 |
+# Maintainer: |
32 |
+# - MySQL Team <mysql-bugs@g.o> |
33 |
+# - Luca Longinotti <chtekk@g.o> |
34 |
|
35 |
inherit multilib |
36 |
|
37 |
@@ -182,10 +184,16 @@ mysql_version_is_at_least() { |
38 |
# library to the best version available. |
39 |
# |
40 |
mysql_lib_symlinks() { |
41 |
- einfo "Updating MySQL .so symlinks" |
42 |
- local d dirlist maxdots soname sonameln reldir |
43 |
+ |
44 |
+ local d dirlist maxdots libname libnameln libsuffix reldir |
45 |
+ libsuffix=$(get_libname) |
46 |
+ |
47 |
+ einfo "libsuffix = ${libsuffix}" |
48 |
+ einfo "Updating MySQL libraries symlinks" |
49 |
+ |
50 |
reldir="${1}" |
51 |
pushd "${reldir}/usr/$(get_libdir)" &> /dev/null |
52 |
+ |
53 |
# dirlist must contain the less significative directory left |
54 |
dirlist="mysql" |
55 |
|
56 |
@@ -191,21 +199,90 @@ mysql_lib_symlinks() { |
57 |
|
58 |
# waste some time in removing and recreating symlinks |
59 |
for d in $dirlist ; do |
60 |
- for soname in $( find "${d}" -name "*.so*" -and -not -type "l" 2>/dev/null ) ; do |
61 |
+ for libname in $( find "${d}" -name "*${libsuffix}*" -and -not -type "l" 2>/dev/null ) ; do |
62 |
# maxdot is a limit versus infinite loop |
63 |
maxdots=0 |
64 |
- sonameln=${soname##*/} |
65 |
+ libnameln=${libname##*/} |
66 |
# loop in version of the library to link it, similar to how |
67 |
# libtool works |
68 |
- while [[ ${sonameln:0-3} != '.so' ]] && [[ ${maxdots} -lt 6 ]] ; do |
69 |
- rm -f "${sonameln}" |
70 |
- ln -s "${soname}" "${sonameln}" |
71 |
+ while [[ ${libnameln:0-3} != '${libsuffix}' ]] && [[ ${maxdots} -lt 6 ]] ; do |
72 |
+ rm -f "${libnameln}" |
73 |
+ ln -s "${libname}" "${libnameln}" |
74 |
(( ++maxdots )) |
75 |
- sonameln="${sonameln%.*}" |
76 |
+ libnameln="${libnameln%.*}" |
77 |
done |
78 |
- rm -f "${sonameln}" |
79 |
- ln -s "${soname}" "${sonameln}" |
80 |
+ rm -f "${libnameln}" |
81 |
+ ln -s "${libname}" "${libnameln}" |
82 |
done |
83 |
done |
84 |
+ |
85 |
popd &> /dev/null |
86 |
} |
87 |
+ |
88 |
+# @FUNCTION: mysql_init_vars |
89 |
+# @DESCRIPTION: |
90 |
+# void mysql_init_vars() |
91 |
+# Initialize global variables |
92 |
+# 2005-11-19 <vivo@g.o> |
93 |
+mysql_init_vars() { |
94 |
+ MY_SHAREDSTATEDIR=${MY_SHAREDSTATEDIR="/usr/share/mysql"} |
95 |
+ MY_SYSCONFDIR=${MY_SYSCONFDIR="/etc/mysql"} |
96 |
+ MY_LIBDIR=${MY_LIBDIR="/usr/$(get_libdir)/mysql"} |
97 |
+ MY_LOCALSTATEDIR=${MY_LOCALSTATEDIR="/var/lib/mysql"} |
98 |
+ MY_LOGDIR=${MY_LOGDIR="/var/log/mysql"} |
99 |
+ MY_INCLUDEDIR=${MY_INCLUDEDIR="/usr/include/mysql"} |
100 |
+ |
101 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
102 |
+ MY_DATADIR="" |
103 |
+ if [[ -f "${MY_SYSCONFDIR}/my.cnf" ]] ; then |
104 |
+ MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
105 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
106 |
+ | tail -n1` |
107 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
108 |
+ MY_DATADIR=`grep ^datadir "${MY_SYSCONFDIR}/my.cnf" \ |
109 |
+ | sed -e 's/.*=\s*//' \ |
110 |
+ | tail -n1` |
111 |
+ fi |
112 |
+ fi |
113 |
+ if [[ -z "${MY_DATADIR}" ]] ; then |
114 |
+ MY_DATADIR="${MY_LOCALSTATEDIR}" |
115 |
+ einfo "Using default MY_DATADIR" |
116 |
+ fi |
117 |
+ elog "MySQL MY_DATADIR is ${MY_DATADIR}" |
118 |
+ |
119 |
+ if [[ -z "${PREVIOUS_DATADIR}" ]] ; then |
120 |
+ if [[ -e "${MY_DATADIR}" ]] ; then |
121 |
+ # If you get this and you're wondering about it, see bug #207636 |
122 |
+ elog "MySQL datadir found in ${MY_DATADIR}" |
123 |
+ elog "A new one will not be created." |
124 |
+ PREVIOUS_DATADIR="yes" |
125 |
+ else |
126 |
+ PREVIOUS_DATADIR="no" |
127 |
+ fi |
128 |
+ export PREVIOUS_DATADIR |
129 |
+ fi |
130 |
+ else |
131 |
+ if [[ ${EBUILD_PHASE} == "config" ]]; then |
132 |
+ local new_MY_DATADIR |
133 |
+ new_MY_DATADIR=`"my_print_defaults" mysqld 2>/dev/null \ |
134 |
+ | sed -ne '/datadir/s|^--datadir=||p' \ |
135 |
+ | tail -n1` |
136 |
+ |
137 |
+ if [[ ( -n "${new_MY_DATADIR}" ) && ( "${new_MY_DATADIR}" != "${MY_DATADIR}" ) ]]; then |
138 |
+ ewarn "MySQL MY_DATADIR has changed" |
139 |
+ ewarn "from ${MY_DATADIR}" |
140 |
+ ewarn "to ${new_MY_DATADIR}" |
141 |
+ MY_DATADIR="${new_MY_DATADIR}" |
142 |
+ fi |
143 |
+ fi |
144 |
+ fi |
145 |
+ |
146 |
+ if [ "${MY_SOURCEDIR:-unset}" == "unset" ]; then |
147 |
+ MY_SOURCEDIR=${SERVER_URI##*/} |
148 |
+ MY_SOURCEDIR=${MY_SOURCEDIR%.tar*} |
149 |
+ fi |
150 |
+ |
151 |
+ export MY_SHAREDSTATEDIR MY_SYSCONFDIR |
152 |
+ export MY_LIBDIR MY_LOCALSTATEDIR MY_LOGDIR |
153 |
+ export MY_INCLUDEDIR MY_DATADIR MY_SOURCEDIR |
154 |
+} |
155 |
|
156 |
|
157 |
|
158 |
1.1 eclass/mysql-autotools.eclass |
159 |
|
160 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql-autotools.eclass?rev=1.1&view=markup |
161 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql-autotools.eclass?rev=1.1&content-type=text/plain |
162 |
|
163 |
Index: mysql-autotools.eclass |
164 |
=================================================================== |
165 |
# Copyright 1999-2011 Gentoo Foundation |
166 |
# Distributed under the terms of the GNU General Public License v2 |
167 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-autotools.eclass,v 1.1 2011/07/13 07:07:15 robbat2 Exp $ |
168 |
|
169 |
# @ECLASS: mysql-autotools.eclass |
170 |
# @MAINTAINER: |
171 |
# Author: Francesco Riosa (Retired) <vivo@g.o> |
172 |
# Maintainers: |
173 |
# - MySQL Team <mysql-bugs@g.o> |
174 |
# - Robin H. Johnson <robbat2@g.o> |
175 |
# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o> |
176 |
# - Luca Longinotti <chtekk@g.o> |
177 |
# @BLURB: This eclass provides support for autotools based mysql releases |
178 |
# @DESCRIPTION: |
179 |
# The mysql-autotools.eclass provides the support to build the mysql |
180 |
# ebuilds using the autotools build system. This eclass provides |
181 |
# the src_unpack, src_prepare, src_configure, src_compile, scr_install, |
182 |
# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. |
183 |
|
184 |
inherit autotools |
185 |
|
186 |
# |
187 |
# HELPER FUNCTIONS: |
188 |
# |
189 |
|
190 |
# @FUNCTION: mysql-autotools_disable_test |
191 |
# @DESCRIPTION: |
192 |
# Helper function to disable specific tests. |
193 |
mysql-autotools_disable_test() { |
194 |
|
195 |
local rawtestname testname testsuite reason mysql_disable_file |
196 |
rawtestname="${1}" ; shift |
197 |
reason="${@}" |
198 |
ewarn "test '${rawtestname}' disabled: '${reason}'" |
199 |
|
200 |
testsuite="${rawtestname/.*}" |
201 |
testname="${rawtestname/*.}" |
202 |
mysql_disable_file="${S}/mysql-test/t/disabled.def" |
203 |
#einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" |
204 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
205 |
|
206 |
# ${S}/mysql-tests/t/disabled.def |
207 |
# |
208 |
# ${S}/mysql-tests/suite/federated/disabled.def |
209 |
# |
210 |
# ${S}/mysql-tests/suite/jp/t/disabled.def |
211 |
# ${S}/mysql-tests/suite/ndb/t/disabled.def |
212 |
# ${S}/mysql-tests/suite/rpl/t/disabled.def |
213 |
# ${S}/mysql-tests/suite/parts/t/disabled.def |
214 |
# ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def |
215 |
# ${S}/mysql-tests/suite/ndb_team/t/disabled.def |
216 |
# ${S}/mysql-tests/suite/binlog/t/disabled.def |
217 |
# ${S}/mysql-tests/suite/innodb/t/disabled.def |
218 |
if [ -n "${testsuite}" ]; then |
219 |
for mysql_disable_file in \ |
220 |
${S}/mysql-test/suite/${testsuite}/disabled.def \ |
221 |
${S}/mysql-test/suite/${testsuite}/t/disabled.def \ |
222 |
FAILED ; do |
223 |
[ -f "${mysql_disable_file}" ] && break |
224 |
done |
225 |
if [ "${mysql_disabled_file}" != "FAILED" ]; then |
226 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
227 |
else |
228 |
ewarn "Could not find testsuite disabled.def location for ${rawtestname}" |
229 |
fi |
230 |
fi |
231 |
} |
232 |
|
233 |
# @FUNCTION: mysql-autotools_configure_minimal |
234 |
# @DESCRIPTION: |
235 |
# Helper function to configure a minimal build |
236 |
mysql-autotools_configure_minimal() { |
237 |
|
238 |
# These are things we exclude from a minimal build, please |
239 |
# note that the server actually does get built and installed, |
240 |
# but we then delete it before packaging. |
241 |
local minimal_exclude_list="server embedded-server extra-tools innodb bench berkeley-db row-based-replication readline" |
242 |
|
243 |
for i in ${minimal_exclude_list} ; do |
244 |
myconf="${myconf} --without-${i}" |
245 |
done |
246 |
myconf="${myconf} --with-extra-charsets=none" |
247 |
myconf="${myconf} --enable-local-infile" |
248 |
|
249 |
if use static ; then |
250 |
myconf="${myconf} --with-client-ldflags=-all-static" |
251 |
myconf="${myconf} --disable-shared --with-pic" |
252 |
else |
253 |
myconf="${myconf} --enable-shared --enable-static" |
254 |
fi |
255 |
|
256 |
if ! use latin1 ; then |
257 |
myconf="${myconf} --with-charset=utf8" |
258 |
myconf="${myconf} --with-collation=utf8_general_ci" |
259 |
else |
260 |
myconf="${myconf} --with-charset=latin1" |
261 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
262 |
fi |
263 |
} |
264 |
|
265 |
# @FUNCTION: mysql-autotools_configure_common |
266 |
# @DESCRIPTION: |
267 |
# Helper function to configure the common builds |
268 |
mysql-autotools_configure_common() { |
269 |
|
270 |
myconf="${myconf} $(use_with big-tables)" |
271 |
myconf="${myconf} --enable-local-infile" |
272 |
myconf="${myconf} --with-extra-charsets=all" |
273 |
myconf="${myconf} --with-mysqld-user=mysql" |
274 |
myconf="${myconf} --with-server" |
275 |
myconf="${myconf} --with-unix-socket-path=/var/run/mysqld/mysqld.sock" |
276 |
myconf="${myconf} --without-libwrap" |
277 |
|
278 |
if use static ; then |
279 |
myconf="${myconf} --with-mysqld-ldflags=-all-static" |
280 |
myconf="${myconf} --with-client-ldflags=-all-static" |
281 |
myconf="${myconf} --disable-shared --with-pic" |
282 |
else |
283 |
myconf="${myconf} --enable-shared --enable-static" |
284 |
fi |
285 |
|
286 |
if use debug ; then |
287 |
myconf="${myconf} --with-debug=full" |
288 |
else |
289 |
myconf="${myconf} --without-debug" |
290 |
if ( use cluster || [[ "${PN}" == "mysql-cluster" ]] ); then |
291 |
myconf="${myconf} --without-ndb-debug" |
292 |
fi |
293 |
fi |
294 |
|
295 |
if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then |
296 |
ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
297 |
ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
298 |
ewarn "You MUST file bugs without these variables set." |
299 |
myconf="${myconf} --with-charset=${MYSQL_DEFAULT_CHARSET}" |
300 |
myconf="${myconf} --with-collation=${MYSQL_DEFAULT_COLLATION}" |
301 |
elif ! use latin1 ; then |
302 |
myconf="${myconf} --with-charset=utf8" |
303 |
myconf="${myconf} --with-collation=utf8_general_ci" |
304 |
else |
305 |
myconf="${myconf} --with-charset=latin1" |
306 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
307 |
fi |
308 |
|
309 |
if use embedded ; then |
310 |
myconf="${myconf} --with-embedded-privilege-control" |
311 |
myconf="${myconf} --with-embedded-server" |
312 |
else |
313 |
myconf="${myconf} --without-embedded-privilege-control" |
314 |
myconf="${myconf} --without-embedded-server" |
315 |
fi |
316 |
|
317 |
} |
318 |
|
319 |
# @FUNCTION: mysql-autotools_configure_51 |
320 |
# @DESCRIPTION: |
321 |
# Helper function to configure 5.1 and later builds |
322 |
mysql-autotools_configure_51() { |
323 |
|
324 |
# TODO: !!!! readd --without-readline |
325 |
# the failure depend upon config/ac-macros/readline.m4 checking into |
326 |
# readline.h instead of history.h |
327 |
myconf="${myconf} $(use_with ssl ssl /usr)" |
328 |
myconf="${myconf} --enable-assembler" |
329 |
myconf="${myconf} --with-geometry" |
330 |
myconf="${myconf} --with-readline" |
331 |
myconf="${myconf} --with-zlib-dir=/usr/" |
332 |
myconf="${myconf} --without-pstack" |
333 |
myconf="${myconf} --with-plugindir=/usr/$(get_libdir)/mysql/plugin" |
334 |
|
335 |
# This is an explict die here, because if we just forcibly disable it, then the |
336 |
# user's data is not accessible. |
337 |
use max-idx-128 && die "Bug #336027: upstream has a corruption issue with max-idx-128 presently" |
338 |
#use max-idx-128 && myconf="${myconf} --with-max-indexes=128" |
339 |
if [ "${MYSQL_COMMUNITY_FEATURES}" == "1" ]; then |
340 |
myconf="${myconf} $(use_enable community community-features)" |
341 |
if use community; then |
342 |
myconf="${myconf} $(use_enable profiling)" |
343 |
else |
344 |
myconf="${myconf} --disable-profiling" |
345 |
fi |
346 |
fi |
347 |
|
348 |
# Scan for all available plugins |
349 |
local plugins_avail="$( |
350 |
LANG=C \ |
351 |
find "${S}" \ |
352 |
\( \ |
353 |
-name 'plug.in' \ |
354 |
-o -iname 'configure.in' \ |
355 |
-o -iname 'configure.ac' \ |
356 |
\) \ |
357 |
-print0 \ |
358 |
| xargs -0 sed -r -n \ |
359 |
-e '/^MYSQL_STORAGE_ENGINE/{ |
360 |
s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ; |
361 |
s~^([^ ]+).*~\1~gp; |
362 |
}' \ |
363 |
| tr -s '\n' ' ' |
364 |
)" |
365 |
|
366 |
# 5.1 introduces a new way to manage storage engines (plugins) |
367 |
# like configuration=none |
368 |
# This base set are required, and will always be statically built. |
369 |
local plugins_sta="csv myisam myisammrg heap" |
370 |
local plugins_dyn="" |
371 |
local plugins_dis="example ibmdb2i" |
372 |
|
373 |
# These aren't actually required by the base set, but are really useful: |
374 |
plugins_sta="${plugins_sta} archive blackhole" |
375 |
|
376 |
# Now the extras |
377 |
if use extraengine ; then |
378 |
# like configuration=max-no-ndb, archive and example removed in 5.1.11 |
379 |
# not added yet: ibmdb2i |
380 |
# Not supporting as examples: example,daemon_example,ftexample |
381 |
plugins_sta="${plugins_sta} partition" |
382 |
|
383 |
if [[ "${PN}" != "mariadb" ]] ; then |
384 |
elog "Before using the Federated storage engine, please be sure to read" |
385 |
elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" |
386 |
plugins_dyn="${plugins_sta} federatedx" |
387 |
else |
388 |
elog "MariaDB includes the FederatedX engine. Be sure to read" |
389 |
elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine" |
390 |
plugins_dyn="${plugins_sta} federated" |
391 |
fi |
392 |
else |
393 |
plugins_dis="${plugins_dis} partition federated" |
394 |
fi |
395 |
|
396 |
# Upstream specifically requests that InnoDB always be built: |
397 |
# - innobase, innodb_plugin |
398 |
# Build falcon if available for 6.x series. |
399 |
for i in innobase falcon ; do |
400 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
401 |
done |
402 |
for i in innodb_plugin ; do |
403 |
[ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}" |
404 |
done |
405 |
|
406 |
# like configuration=max-no-ndb |
407 |
if ( use cluster || [[ "${PN}" == "mysql-cluster" ]] ) ; then |
408 |
plugins_sta="${plugins_sta} ndbcluster partition" |
409 |
plugins_dis="${plugins_dis//partition}" |
410 |
myconf="${myconf} --with-ndb-binlog" |
411 |
else |
412 |
plugins_dis="${plugins_dis} ndbcluster" |
413 |
fi |
414 |
|
415 |
if [[ "${PN}" == "mariadb" ]] ; then |
416 |
# In MariaDB, InnoDB is packaged in the xtradb directory, so it's not |
417 |
# caught above. |
418 |
# This is not optional, without it several upstream testcases fail. |
419 |
# Also strongly recommended by upstream. |
420 |
if [[ "${PV}" < "5.2.0" ]] ; then |
421 |
myconf="${myconf} --with-maria-tmp-tables" |
422 |
plugins_sta="${plugins_sta} maria" |
423 |
else |
424 |
myconf="${myconf} --with-aria-tmp-tables" |
425 |
plugins_sta="${plugins_sta} aria" |
426 |
fi |
427 |
|
428 |
[ -e "${S}"/storage/innobase ] || [ -e "${S}"/storage/xtradb ] || |
429 |
die "The ${P} package doesn't provide innobase nor xtradb" |
430 |
|
431 |
for i in innobase xtradb ; do |
432 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
433 |
done |
434 |
|
435 |
myconf="${myconf} $(use_with libevent)" |
436 |
|
437 |
if mysql_version_is_at_least "5.2" ; then |
438 |
for i in oqgraph ; do |
439 |
use ${i} \ |
440 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
441 |
|| plugins_dis="${plugins_dis} ${i}" |
442 |
done |
443 |
fi |
444 |
|
445 |
if mysql_version_is_at_least "5.2.5" ; then |
446 |
for i in sphinx ; do |
447 |
use ${i} \ |
448 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
449 |
|| plugins_dis="${plugins_dis} ${i}" |
450 |
done |
451 |
fi |
452 |
fi |
453 |
|
454 |
if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then |
455 |
use pbxt \ |
456 |
&& plugins_dyn="${plugins_dyn} pbxt" \ |
457 |
|| plugins_dis="${plugins_dis} pbxt" |
458 |
fi |
459 |
|
460 |
use static && \ |
461 |
plugins_sta="${plugins_sta} ${plugins_dyn}" && \ |
462 |
plugins_dyn="" |
463 |
|
464 |
einfo "Available plugins: ${plugins_avail}" |
465 |
einfo "Dynamic plugins: ${plugins_dyn}" |
466 |
einfo "Static plugins: ${plugins_sta}" |
467 |
einfo "Disabled plugins: ${plugins_dis}" |
468 |
|
469 |
# These are the static plugins |
470 |
myconf="${myconf} --with-plugins=${plugins_sta// /,}" |
471 |
# And the disabled ones |
472 |
for i in ${plugins_dis} ; do |
473 |
myconf="${myconf} --without-plugin-${i}" |
474 |
done |
475 |
} |
476 |
|
477 |
pbxt_src_configure() { |
478 |
|
479 |
mysql_init_vars |
480 |
|
481 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
482 |
|
483 |
einfo "Reconfiguring dir '${PWD}'" |
484 |
eautoreconf |
485 |
|
486 |
local myconf="" |
487 |
myconf="${myconf} --with-mysql=${S} --libdir=/usr/$(get_libdir)" |
488 |
use debug && myconf="${myconf} --with-debug=full" |
489 |
econf ${myconf} || die "Problem configuring PBXT storage engine" |
490 |
} |
491 |
|
492 |
pbxt_src_compile() { |
493 |
|
494 |
# TODO: is it safe/needed to use emake here ? |
495 |
make || die "Problem making PBXT storage engine (${myconf})" |
496 |
|
497 |
popd |
498 |
# TODO: modify test suite for PBXT |
499 |
} |
500 |
|
501 |
pbxt_src_install() { |
502 |
|
503 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
504 |
emake install DESTDIR="${D}" || die "Failed to install PBXT" |
505 |
popd |
506 |
} |
507 |
|
508 |
# |
509 |
# EBUILD FUNCTIONS |
510 |
# |
511 |
|
512 |
# @FUNCTION: mysql-autotools_src_prepare |
513 |
# @DESCRIPTION: |
514 |
# Apply patches to the source code and remove unneeded bundled libs. |
515 |
mysql-autotools_src_prepare() { |
516 |
|
517 |
cd "${S}" |
518 |
|
519 |
# Apply the patches for this MySQL version |
520 |
EPATCH_SUFFIX="patch" |
521 |
mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
522 |
# Clean out old items |
523 |
rm -f "${EPATCH_SOURCE}"/* |
524 |
# Now link in right patches |
525 |
mysql_mv_patches |
526 |
# And apply |
527 |
epatch |
528 |
|
529 |
# last -fPIC fixup, per bug #305873 |
530 |
i="${S}"/storage/innodb_plugin/plug.in |
531 |
[ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" |
532 |
|
533 |
# Additional checks, remove bundled zlib (Cluster needs this, for static |
534 |
# memory management in zlib, leave available for Cluster) |
535 |
if [[ "${PN}" != "mysql-cluster" ]] ; then |
536 |
rm -f "${S}/zlib/"*.[ch] |
537 |
sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" |
538 |
fi |
539 |
rm -f "scripts/mysqlbug" |
540 |
|
541 |
# Make charsets install in the right place |
542 |
find . -name 'Makefile.am' \ |
543 |
-exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
544 |
|
545 |
# Remove what needs to be recreated, so we're sure it's actually done |
546 |
einfo "Cleaning up old buildscript files" |
547 |
find . -name Makefile \ |
548 |
-o -name Makefile.in \ |
549 |
-o -name configure \ |
550 |
-exec rm -f {} \; |
551 |
rm -f "ltmain.sh" |
552 |
rm -f "scripts/mysqlbug" |
553 |
|
554 |
local rebuilddirlist d |
555 |
|
556 |
if xtradb_patch_available && use xtradb ; then |
557 |
einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)" |
558 |
pushd "${S}"/storage >/dev/null |
559 |
i="innobase" |
560 |
o="${WORKDIR}/storage-${i}.mysql-upstream" |
561 |
# Have we been here already? |
562 |
[ -d "${o}" ] && rm -f "${i}" |
563 |
# Or maybe we haven't |
564 |
[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" |
565 |
cp -ral "${WORKDIR}/${XTRADB_P}" "${i}" |
566 |
popd >/dev/null |
567 |
fi |
568 |
|
569 |
if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then |
570 |
einfo "Adding storage engine: PBXT" |
571 |
pushd "${S}"/storage >/dev/null |
572 |
i='pbxt' |
573 |
[ -d "${i}" ] && rm -rf "${i}" |
574 |
cp -ral "${WORKDIR}/${PBXT_P}" "${i}" |
575 |
popd >/dev/null |
576 |
fi |
577 |
|
578 |
rebuilddirlist="." |
579 |
# This does not seem to be needed presently. robbat2 2010/02/23 |
580 |
#einfo "Updating innobase cmake" |
581 |
## TODO: check this with a cmake expert |
582 |
#cmake \ |
583 |
# -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ |
584 |
# -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ |
585 |
# "storage/innobase" |
586 |
|
587 |
for d in ${rebuilddirlist} ; do |
588 |
einfo "Reconfiguring dir '${d}'" |
589 |
pushd "${d}" &>/dev/null |
590 |
eautoreconf |
591 |
popd &>/dev/null |
592 |
done |
593 |
} |
594 |
|
595 |
# @FUNCTION: mysql-autotools_src_configure |
596 |
# @DESCRIPTION: |
597 |
# Configure mysql to build the code for Gentoo respecting the use flags. |
598 |
mysql-autotools_src_configure() { |
599 |
|
600 |
# Make sure the vars are correctly initialized |
601 |
mysql_init_vars |
602 |
|
603 |
# $myconf is modified by the configure_* functions |
604 |
local myconf="" |
605 |
|
606 |
if use minimal ; then |
607 |
mysql-autotools_configure_minimal |
608 |
else |
609 |
mysql-autotools_configure_common |
610 |
mysql-autotools_configure_51 |
611 |
fi |
612 |
|
613 |
# Bug #114895, bug #110149 |
614 |
filter-flags "-O" "-O[01]" |
615 |
|
616 |
# glib-2.3.2_pre fix, bug #16496 |
617 |
append-flags "-DHAVE_ERRNO_AS_DEFINE=1" |
618 |
|
619 |
# As discovered by bug #246652, doing a double-level of SSP causes NDB to |
620 |
# fail badly during cluster startup. |
621 |
if [[ $(gcc-major-version) -lt 4 ]]; then |
622 |
filter-flags "-fstack-protector-all" |
623 |
fi |
624 |
|
625 |
CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" |
626 |
CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" |
627 |
mysql_version_is_at_least "5.0" \ |
628 |
&& CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" |
629 |
export CXXFLAGS |
630 |
|
631 |
# bug #283926, with GCC4.4, this is required to get correct behavior. |
632 |
append-flags -fno-strict-aliasing |
633 |
|
634 |
# bug #335185, #335995, with >= GCC4.3.3 on x86 only, omit-frame-pointer |
635 |
# causes a mis-compile. |
636 |
# Upstream bugs: |
637 |
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38562 |
638 |
# http://bugs.mysql.com/bug.php?id=45205 |
639 |
use x86 && version_is_at_least "4.3.3" "$(gcc-fullversion)" && \ |
640 |
append-flags -fno-omit-frame-pointer && \ |
641 |
filter-flags -fomit-frame-pointer |
642 |
|
643 |
econf \ |
644 |
--libexecdir="/usr/sbin" \ |
645 |
--sysconfdir="${MY_SYSCONFDIR}" \ |
646 |
--localstatedir="${MY_LOCALSTATEDIR}" \ |
647 |
--sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
648 |
--libdir="${MY_LIBDIR}" \ |
649 |
--includedir="${MY_INCLUDEDIR}" \ |
650 |
--with-low-memory \ |
651 |
--with-client-ldflags=-lstdc++ \ |
652 |
--enable-thread-safe-client \ |
653 |
--with-comment="Gentoo Linux ${PF}" \ |
654 |
--without-docs \ |
655 |
--with-LIBDIR="$(get_libdir)" \ |
656 |
${myconf} || die "econf failed" |
657 |
|
658 |
# TODO: Move this before autoreconf !!! |
659 |
find . -type f -name Makefile -print0 \ |
660 |
| xargs -0 -n100 sed -i \ |
661 |
-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' |
662 |
|
663 |
if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
664 |
pbxt_patch_available && use pbxt && pbxt_src_configure |
665 |
fi |
666 |
} |
667 |
|
668 |
# @FUNCTION: mysql-autotools_src_compile |
669 |
# @DESCRIPTION: |
670 |
# Compile the mysql code. |
671 |
mysql-autotools_src_compile() { |
672 |
|
673 |
emake || die "emake failed" |
674 |
|
675 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
676 |
pbxt_patch_available && use pbxt && pbxt_src_compile |
677 |
fi |
678 |
} |
679 |
|
680 |
# @FUNCTION: mysql-autotools_src_install |
681 |
# @DESCRIPTION: |
682 |
# Install mysql. |
683 |
mysql-autotools_src_install() { |
684 |
|
685 |
# Make sure the vars are correctly initialized |
686 |
mysql_init_vars |
687 |
|
688 |
emake install \ |
689 |
DESTDIR="${D}" \ |
690 |
benchdir_root="${MY_SHAREDSTATEDIR}" \ |
691 |
testroot="${MY_SHAREDSTATEDIR}" \ |
692 |
|| die "emake install failed" |
693 |
|
694 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
695 |
pbxt_patch_available && use pbxt && pbxt_src_install |
696 |
fi |
697 |
|
698 |
# Convenience links |
699 |
einfo "Making Convenience links for mysqlcheck multi-call binary" |
700 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" |
701 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" |
702 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" |
703 |
|
704 |
# Various junk (my-*.cnf moved elsewhere) |
705 |
einfo "Removing duplicate /usr/share/mysql files" |
706 |
rm -Rf "${D}/usr/share/info" |
707 |
for removeme in "mysql-log-rotate" mysql.server* \ |
708 |
binary-configure* my-*.cnf mi_test_all* |
709 |
do |
710 |
rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme} |
711 |
done |
712 |
|
713 |
# Clean up stuff for a minimal build |
714 |
if use minimal ; then |
715 |
einfo "Remove all extra content for minimal build" |
716 |
rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} |
717 |
rm -f "${D}"/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} |
718 |
rm -f "${D}/usr/sbin/mysqld" |
719 |
rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a |
720 |
fi |
721 |
|
722 |
# Unless they explicitly specific USE=test, then do not install the |
723 |
# testsuite. It DOES have a use to be installed, esp. when you want to do a |
724 |
# validation of your database configuration after tuning it. |
725 |
if use !test ; then |
726 |
rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test |
727 |
fi |
728 |
|
729 |
# Configuration stuff |
730 |
case ${MYSQL_PV_MAJOR} in |
731 |
5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;; |
732 |
esac |
733 |
einfo "Building default my.cnf (${mysql_mycnf_version})" |
734 |
insinto "${MY_SYSCONFDIR}" |
735 |
doins scripts/mysqlaccess.conf |
736 |
mycnf_src="my.cnf-${mysql_mycnf_version}" |
737 |
sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
738 |
"${FILESDIR}/${mycnf_src}" \ |
739 |
> "${TMPDIR}/my.cnf.ok" |
740 |
if use latin1 ; then |
741 |
sed -i \ |
742 |
-e "/character-set/s|utf8|latin1|g" \ |
743 |
"${TMPDIR}/my.cnf.ok" |
744 |
fi |
745 |
newins "${TMPDIR}/my.cnf.ok" my.cnf |
746 |
|
747 |
# Minimal builds don't have the MySQL server |
748 |
if ! use minimal ; then |
749 |
einfo "Creating initial directories" |
750 |
# Empty directories ... |
751 |
diropts "-m0750" |
752 |
if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
753 |
dodir "${MY_DATADIR}" |
754 |
keepdir "${MY_DATADIR}" |
755 |
chown -R mysql:mysql "${D}/${MY_DATADIR}" |
756 |
fi |
757 |
|
758 |
diropts "-m0755" |
759 |
for folder in "${MY_LOGDIR}" "/var/run/mysqld" ; do |
760 |
dodir "${folder}" |
761 |
keepdir "${folder}" |
762 |
chown -R mysql:mysql "${D}/${folder}" |
763 |
done |
764 |
fi |
765 |
|
766 |
# Docs |
767 |
einfo "Installing docs" |
768 |
for i in README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE ; do |
769 |
[[ -f "$i" ]] && dodoc "$i" |
770 |
done |
771 |
doinfo "${S}"/Docs/mysql.info |
772 |
|
773 |
# Minimal builds don't have the MySQL server |
774 |
if ! use minimal ; then |
775 |
einfo "Including support files and sample configurations" |
776 |
docinto "support-files" |
777 |
for script in \ |
778 |
"${S}"/support-files/my-*.cnf \ |
779 |
"${S}"/support-files/magic \ |
780 |
"${S}"/support-files/ndb-config-2-node.ini |
781 |
do |
782 |
[[ -f "$script" ]] && dodoc "${script}" |
783 |
done |
784 |
|
785 |
docinto "scripts" |
786 |
for script in "${S}"/scripts/mysql* ; do |
787 |
[[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" |
788 |
done |
789 |
|
790 |
fi |
791 |
|
792 |
mysql_lib_symlinks "${D}" |
793 |
} |
794 |
|
795 |
|
796 |
|
797 |
1.1 eclass/mysql-cmake.eclass |
798 |
|
799 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql-cmake.eclass?rev=1.1&view=markup |
800 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/mysql-cmake.eclass?rev=1.1&content-type=text/plain |
801 |
|
802 |
Index: mysql-cmake.eclass |
803 |
=================================================================== |
804 |
# Copyright 1999-2011 Gentoo Foundation |
805 |
# Distributed under the terms of the GNU General Public License v2 |
806 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-cmake.eclass,v 1.1 2011/07/13 07:07:15 robbat2 Exp $ |
807 |
|
808 |
# @ECLASS: mysql-cmake.eclass |
809 |
# @MAINTAINER: |
810 |
# Maintainers: |
811 |
# - MySQL Team <mysql-bugs@g.o> |
812 |
# - Robin H. Johnson <robbat2@g.o> |
813 |
# - Jorge Manuel B. S. Vicetto <jmbsvicetto@g.o> |
814 |
# @BLURB: This eclass provides the support for cmake based mysql releases |
815 |
# @DESCRIPTION: |
816 |
# The mysql-cmake.eclass provides the support to build the mysql |
817 |
# ebuilds using the cmake build system. This eclass provides |
818 |
# the src_unpack, src_prepare, src_configure, src_compile, scr_install, |
819 |
# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. |
820 |
|
821 |
inherit cmake-utils |
822 |
|
823 |
# |
824 |
# HELPER FUNCTIONS: |
825 |
# |
826 |
|
827 |
# @FUNCTION: mysql_cmake_disable_test |
828 |
# @DESCRIPTION: |
829 |
# Helper function to disable specific tests. |
830 |
mysql-cmake_disable_test() { |
831 |
|
832 |
local rawtestname testname testsuite reason mysql_disable_file |
833 |
rawtestname="${1}" ; shift |
834 |
reason="${@}" |
835 |
ewarn "test '${rawtestname}' disabled: '${reason}'" |
836 |
|
837 |
testsuite="${rawtestname/.*}" |
838 |
testname="${rawtestname/*.}" |
839 |
mysql_disable_file="${S}/mysql-test/t/disabled.def" |
840 |
#einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" |
841 |
echo ${testname} : ${reason} >> "${mysql_disable_file}" |
842 |
|
843 |
if [ -n "${testsuite}" ]; then |
844 |
for mysql_disable_file in \ |
845 |
${S}/mysql-test/suite/${testsuite}/disabled.def \ |
846 |
${S}/mysql-test/suite/${testsuite}/t/disabled.def \ |
847 |
FAILED ; do |
848 |
[ -f "${mysql_disable_file}" ] && break |
849 |
done |
850 |
if [ "${mysql_disabled_file}" != "FAILED" ]; then |
851 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
852 |
else |
853 |
ewarn "Could not find testsuite disabled.def location for ${rawtestname}" |
854 |
fi |
855 |
fi |
856 |
} |
857 |
|
858 |
# @FUNCTION: configure_cmake_locale |
859 |
# @DESCRIPTION: |
860 |
# Helper function to configure locale cmake options |
861 |
configure_cmake_locale() { |
862 |
|
863 |
if ! use minimal && [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then |
864 |
ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
865 |
ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
866 |
ewarn "You MUST file bugs without these variables set." |
867 |
|
868 |
mycmakeargs+=( |
869 |
-DDEFAULT_CHARSET=${MYSQL_DEFAULT_CHARSET} |
870 |
-DDEFAULT_COLLATION=${MYSQL_DEFAULT_COLLATION} |
871 |
) |
872 |
|
873 |
elif ! use latin1 ; then |
874 |
mycmakeargs+=( |
875 |
-DDEFAULT_CHARSET=utf8 |
876 |
-DDEFAULT_COLLATION=utf8_general_ci |
877 |
) |
878 |
else |
879 |
mycmakeargs+=( |
880 |
-DDEFAULT_CHARSET=latin1 |
881 |
-DDEFAULT_COLLATION=latin1_swedish_ci |
882 |
) |
883 |
fi |
884 |
} |
885 |
|
886 |
# @FUNCTION: configure_cmake_minimal |
887 |
# @DESCRIPTION: |
888 |
# Helper function to configure minimal build |
889 |
configure_cmake_minimal() { |
890 |
|
891 |
mycmakeargs+=( |
892 |
-DWITHOUT_SERVER=1 |
893 |
-DWITHOUT_EMBEDDED_SERVER=1 |
894 |
-DENABLED_LOCAL_INFILE=1 |
895 |
-DEXTRA_CHARSETS=none |
896 |
-DINSTALL_SQLBENCHDIR= |
897 |
-DWITH_SSL=system |
898 |
-DWITH_ZLIB=system |
899 |
-DWITHOUT_LIBWRAP=1 |
900 |
-DWITHOUT_READLINE=1 |
901 |
-DWITHOUT_ARCHIVE_STORAGE_ENGINE=1 |
902 |
-DWITHOUT_BLACKHOLE_STORAGE_ENGINE=1 |
903 |
-DWITHOUT_CSV_STORAGE_ENGINE=1 |
904 |
-DWITHOUT_FEDERATED_STORAGE_ENGINE=1 |
905 |
-DWITHOUT_HEAP_STORAGE_ENGINE=1 |
906 |
-DWITHOUT_INNOBASE_STORAGE_ENGINE=1 |
907 |
-DWITHOUT_MYISAMMRG_STORAGE_ENGINE=1 |
908 |
-DWITHOUT_MYISAM_STORAGE_ENGINE=1 |
909 |
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 |
910 |
-DWITHOUT_INNOBASE_STORAGE_ENGINE=1 |
911 |
) |
912 |
} |
913 |
|
914 |
# @FUNCTION: configure_cmake_standard |
915 |
# @DESCRIPTION: |
916 |
# Helper function to configure standard build |
917 |
configure_cmake_standard() { |
918 |
|
919 |
mycmakeargs+=( |
920 |
-DENABLED_LOCAL_INFILE=1 |
921 |
-DEXTRA_CHARSETS=all |
922 |
-DMYSQL_USER=mysql |
923 |
-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock |
924 |
-DWITHOUT_READLINE=1 |
925 |
-DWITH_ZLIB=system |
926 |
-DWITHOUT_LIBWRAP=1 |
927 |
) |
928 |
|
929 |
if use static ; then |
930 |
mycmakeargs+=( -DDISABLE_SHARED=1 ) |
931 |
else |
932 |
mycmakeargs+=( -DDISABLED_SHARED=0 ) |
933 |
fi |
934 |
|
935 |
mycmakeargs+=( |
936 |
$(cmake-utils_use_with debug) |
937 |
$(cmake-utils_use_with embedded EMBEDDED_SERVER) |
938 |
$(cmake-utils_use_with profiling) |
939 |
) |
940 |
|
941 |
if use ssl; then |
942 |
mycmakeargs+=( -DWITH_SSL=system ) |
943 |
else |
944 |
mycmakeargs+=( -DWITH_SSL=0 ) |
945 |
fi |
946 |
|
947 |
# Storage engines |
948 |
mycmakeargs+=( |
949 |
-DWITH_ARCHIVE_STORAGE_ENGINE=1 |
950 |
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 |
951 |
-DWITH_CSV_STORAGE_ENGINE=1 |
952 |
-DWITH_HEAP_STORAGE_ENGINE=1 |
953 |
-DWITH_INNOBASE_STORAGE_ENGINE=1 |
954 |
-DWITH_MYISAMMRG_STORAGE_ENGINE=1 |
955 |
-DWITH_MYISAM_STORAGE_ENGINE=1 |
956 |
-DWITH_PARTITION_STORAGE_ENGINE=1 |
957 |
$(cmake-utils_use_with extraengine FEDERATED_STORAGE_ENGINE) |
958 |
) |
959 |
} |
960 |
|
961 |
# |
962 |
# EBUILD FUNCTIONS |
963 |
# |
964 |
|
965 |
# @FUNCTION: mysql-cmake_src_prepare |
966 |
# @DESCRIPTION: |
967 |
# Apply patches to the source code and remove unneeded bundled libs. |
968 |
mysql-cmake_src_prepare() { |
969 |
|
970 |
debug-print-function ${FUNCNAME} "$@" |
971 |
|
972 |
cd "${S}" |
973 |
|
974 |
# Apply the patches for this MySQL version |
975 |
EPATCH_SUFFIX="patch" |
976 |
mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
977 |
# Clean out old items |
978 |
rm -f "${EPATCH_SOURCE}"/* |
979 |
# Now link in right patches |
980 |
mysql_mv_patches |
981 |
# And apply |
982 |
epatch |
983 |
|
984 |
# last -fPIC fixup, per bug #305873 |
985 |
i="${S}"/storage/innodb_plugin/plug.in |
986 |
[ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" |
987 |
|
988 |
rm -f "scripts/mysqlbug" |
989 |
} |
990 |
|
991 |
# @FUNCTION: mysql-cmake_src_configure |
992 |
# @DESCRIPTION: |
993 |
# Configure mysql to build the code for Gentoo respecting the use flags. |
994 |
mysql-cmake_src_configure() { |
995 |
|
996 |
debug-print-function ${FUNCNAME} "$@" |
997 |
|
998 |
mycmakeargs=( |
999 |
-DCMAKE_INSTALL_PREFIX=/usr |
1000 |
-DMYSQL_DATADIR=/var/lib/mysql |
1001 |
-DSYSCONFDIR=/etc/mysql |
1002 |
-DINSTALL_BINDIR=bin |
1003 |
-DINSTALL_DOCDIR=share/doc/${P} |
1004 |
-DINSTALL_DOCREADMEDIR=share/doc/${P} |
1005 |
-DINSTALL_INCLUDEDIR=include/mysql |
1006 |
-DINSTALL_INFODIR=share/info |
1007 |
-DINSTALL_LIBDIR=$(get_libdir)/mysql |
1008 |
-DINSTALL_MANDIR=share/man |
1009 |
-DINSTALL_MYSQLDATADIR=/var/lib/mysql |
1010 |
-DINSTALL_MYSQLSHAREDIR=share/mysql |
1011 |
-DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test |
1012 |
-DINSTALL_PLUGINDIR=$(get_libdir)/mysql/plugin |
1013 |
-DINSTALL_SBINDIR=sbin |
1014 |
-DINSTALL_SCRIPTDIR=share/mysql/scripts |
1015 |
-DINSTALL_SQLBENCHDIR=share/mysql |
1016 |
-DINSTALL_SUPPORTFILESDIR=/usr/share/mysql |
1017 |
-DWITH_COMMENT="Gentoo Linux ${PF}" |
1018 |
-DWITHOUT_UNIT_TESTS=1 |
1019 |
) |
1020 |
|
1021 |
configure_cmake_locale |
1022 |
|
1023 |
if use minimal ; then |
1024 |
configure_cmake_minimal |
1025 |
else |
1026 |
configure_cmake_standard |
1027 |
fi |
1028 |
|
1029 |
# Bug #114895, bug #110149 |
1030 |
filter-flags "-O" "-O[01]" |
1031 |
|
1032 |
CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" |
1033 |
CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" |
1034 |
CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" |
1035 |
export CXXFLAGS |
1036 |
|
1037 |
# bug #283926, with GCC4.4, this is required to get correct behavior. |
1038 |
append-flags -fno-strict-aliasing |
1039 |
|
1040 |
cmake-utils_src_configure |
1041 |
} |
1042 |
|
1043 |
# @FUNCTION: mysql-cmake_src_compile |
1044 |
# @DESCRIPTION: |
1045 |
# Compile the mysql code. |
1046 |
mysql-cmake_src_compile() { |
1047 |
|
1048 |
debug-print-function ${FUNCNAME} "$@" |
1049 |
|
1050 |
cmake-utils_src_compile |
1051 |
} |
1052 |
|
1053 |
# @FUNCTION: mysql-cmake_src_install |
1054 |
# @DESCRIPTION: |
1055 |
# Install mysql. |
1056 |
mysql-cmake_src_install() { |
1057 |
|
1058 |
debug-print-function ${FUNCNAME} "$@" |
1059 |
|
1060 |
# Make sure the vars are correctly initialized |
1061 |
mysql_init_vars |
1062 |
|
1063 |
cmake-utils_src_install |
1064 |
|
1065 |
# Convenience links |
1066 |
einfo "Making Convenience links for mysqlcheck multi-call binary" |
1067 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" |
1068 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" |
1069 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" |
1070 |
|
1071 |
# INSTALL_LAYOUT=STANDALONE causes cmake to create a /usr/data dir |
1072 |
rm -Rf "${D}/usr/data" |
1073 |
|
1074 |
# Various junk (my-*.cnf moved elsewhere) |
1075 |
einfo "Removing duplicate /usr/share/mysql files" |
1076 |
|
1077 |
# Clean up stuff for a minimal build |
1078 |
# if use minimal ; then |
1079 |
# einfo "Remove all extra content for minimal build" |
1080 |
# rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} |
1081 |
# rm -f "${D}"/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} |
1082 |
# rm -f "${D}/usr/sbin/mysqld" |
1083 |
# rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a |
1084 |
# fi |
1085 |
|
1086 |
# Unless they explicitly specific USE=test, then do not install the |
1087 |
# testsuite. It DOES have a use to be installed, esp. when you want to do a |
1088 |
# validation of your database configuration after tuning it. |
1089 |
if ! use test ; then |
1090 |
rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test |
1091 |
fi |
1092 |
|
1093 |
# Configuration stuff |
1094 |
case ${MYSQL_PV_MAJOR} in |
1095 |
5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;; |
1096 |
esac |
1097 |
einfo "Building default my.cnf (${mysql_mycnf_version})" |
1098 |
insinto "${MY_SYSCONFDIR}" |
1099 |
doins scripts/mysqlaccess.conf |
1100 |
mycnf_src="my.cnf-${mysql_mycnf_version}" |
1101 |
sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
1102 |
"${FILESDIR}/${mycnf_src}" \ |
1103 |
> "${TMPDIR}/my.cnf.ok" |
1104 |
if use latin1 ; then |
1105 |
sed -i \ |
1106 |
-e "/character-set/s|utf8|latin1|g" \ |
1107 |
"${TMPDIR}/my.cnf.ok" |
1108 |
fi |
1109 |
newins "${TMPDIR}/my.cnf.ok" my.cnf |
1110 |
|
1111 |
# Minimal builds don't have the MySQL server |
1112 |
if ! use minimal ; then |
1113 |
einfo "Creating initial directories" |
1114 |
# Empty directories ... |
1115 |
diropts "-m0750" |
1116 |
if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
1117 |
dodir "${MY_DATADIR}" |
1118 |
keepdir "${MY_DATADIR}" |
1119 |
chown -R mysql:mysql "${D}/${MY_DATADIR}" |
1120 |
fi |
1121 |
|
1122 |
diropts "-m0755" |
1123 |
for folder in "${MY_LOGDIR}" "/var/run/mysqld" ; do |
1124 |
dodir "${folder}" |
1125 |
keepdir "${folder}" |
1126 |
chown -R mysql:mysql "${D}/${folder}" |
1127 |
done |
1128 |
fi |
1129 |
|
1130 |
# Minimal builds don't have the MySQL server |
1131 |
if ! use minimal ; then |
1132 |
einfo "Including support files and sample configurations" |
1133 |
docinto "support-files" |
1134 |
for script in \ |
1135 |
"${S}"/support-files/my-*.cnf.sh \ |
1136 |
"${S}"/support-files/magic \ |
1137 |
"${S}"/support-files/ndb-config-2-node.ini.sh |
1138 |
do |
1139 |
[[ -f "$script" ]] && dodoc "${script}" |
1140 |
done |
1141 |
|
1142 |
docinto "scripts" |
1143 |
for script in "${S}"/scripts/mysql* ; do |
1144 |
[[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" |
1145 |
done |
1146 |
|
1147 |
fi |
1148 |
|
1149 |
mysql_lib_symlinks "${D}" |
1150 |
} |