1 |
# Copyright 1999-2012 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/mysql-autotools.eclass,v 1.6 2012/04/18 02:08:34 robbat2 Exp $ |
4 |
|
5 |
# @ECLASS: mysql-autotools.eclass |
6 |
# @MAINTAINER: |
7 |
# MySQL Team <mysql-bugs@gentoo.org> |
8 |
# Robin H. Johnson <robbat2@gentoo.org> |
9 |
# Jorge Manuel B. S. Vicetto <jmbsvicetto@gentoo.org> |
10 |
# Luca Longinotti <chtekk@gentoo.org> |
11 |
# @AUTHOR: |
12 |
# Francesco Riosa <vivo@gentoo.org> (retired) |
13 |
# @BLURB: This eclass provides support for autotools based mysql releases |
14 |
# @DESCRIPTION: |
15 |
# The mysql-autotools.eclass provides the support to build the mysql |
16 |
# ebuilds using the autotools build system. This eclass provides |
17 |
# the src_unpack, src_prepare, src_configure, src_compile, scr_install, |
18 |
# pkg_preinst, pkg_postinst, pkg_config and pkg_postrm phase hooks. |
19 |
|
20 |
inherit autotools |
21 |
|
22 |
# |
23 |
# HELPER FUNCTIONS: |
24 |
# |
25 |
|
26 |
# @FUNCTION: mysql-autotools_disable_test |
27 |
# @DESCRIPTION: |
28 |
# Helper function to disable specific tests. |
29 |
mysql-autotools_disable_test() { |
30 |
|
31 |
local rawtestname testname testsuite reason mysql_disable_file |
32 |
rawtestname="${1}" ; shift |
33 |
reason="${@}" |
34 |
ewarn "test '${rawtestname}' disabled: '${reason}'" |
35 |
|
36 |
testsuite="${rawtestname/.*}" |
37 |
testname="${rawtestname/*.}" |
38 |
mysql_disable_file="${S}/mysql-test/t/disabled.def" |
39 |
#einfo "rawtestname=${rawtestname} testname=${testname} testsuite=${testsuite}" |
40 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
41 |
|
42 |
# ${S}/mysql-tests/t/disabled.def |
43 |
# |
44 |
# ${S}/mysql-tests/suite/federated/disabled.def |
45 |
# |
46 |
# ${S}/mysql-tests/suite/jp/t/disabled.def |
47 |
# ${S}/mysql-tests/suite/ndb/t/disabled.def |
48 |
# ${S}/mysql-tests/suite/rpl/t/disabled.def |
49 |
# ${S}/mysql-tests/suite/parts/t/disabled.def |
50 |
# ${S}/mysql-tests/suite/rpl_ndb/t/disabled.def |
51 |
# ${S}/mysql-tests/suite/ndb_team/t/disabled.def |
52 |
# ${S}/mysql-tests/suite/binlog/t/disabled.def |
53 |
# ${S}/mysql-tests/suite/innodb/t/disabled.def |
54 |
if [ -n "${testsuite}" ]; then |
55 |
for mysql_disable_file in \ |
56 |
${S}/mysql-test/suite/${testsuite}/disabled.def \ |
57 |
${S}/mysql-test/suite/${testsuite}/t/disabled.def \ |
58 |
FAILED ; do |
59 |
[ -f "${mysql_disable_file}" ] && break |
60 |
done |
61 |
if [ "${mysql_disabled_file}" != "FAILED" ]; then |
62 |
echo "${testname} : ${reason}" >> "${mysql_disable_file}" |
63 |
else |
64 |
ewarn "Could not find testsuite disabled.def location for ${rawtestname}" |
65 |
fi |
66 |
fi |
67 |
} |
68 |
|
69 |
# @FUNCTION: mysql-autotools_configure_minimal |
70 |
# @DESCRIPTION: |
71 |
# Helper function to configure a minimal build |
72 |
mysql-autotools_configure_minimal() { |
73 |
|
74 |
# These are things we exclude from a minimal build, please |
75 |
# note that the server actually does get built and installed, |
76 |
# but we then delete it before packaging. |
77 |
local minimal_exclude_list="server embedded-server extra-tools innodb bench berkeley-db row-based-replication readline" |
78 |
|
79 |
for i in ${minimal_exclude_list} ; do |
80 |
myconf="${myconf} --without-${i}" |
81 |
done |
82 |
myconf="${myconf} --with-extra-charsets=none" |
83 |
myconf="${myconf} --enable-local-infile" |
84 |
|
85 |
if use static ; then |
86 |
myconf="${myconf} --with-client-ldflags=-all-static" |
87 |
myconf="${myconf} --disable-shared --with-pic" |
88 |
else |
89 |
myconf="${myconf} --enable-shared --enable-static" |
90 |
fi |
91 |
|
92 |
if ! use latin1 ; then |
93 |
myconf="${myconf} --with-charset=utf8" |
94 |
myconf="${myconf} --with-collation=utf8_general_ci" |
95 |
else |
96 |
myconf="${myconf} --with-charset=latin1" |
97 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
98 |
fi |
99 |
} |
100 |
|
101 |
# @FUNCTION: mysql-autotools_configure_common |
102 |
# @DESCRIPTION: |
103 |
# Helper function to configure the common builds |
104 |
mysql-autotools_configure_common() { |
105 |
|
106 |
myconf="${myconf} $(use_with big-tables)" |
107 |
myconf="${myconf} --enable-local-infile" |
108 |
myconf="${myconf} --with-extra-charsets=all" |
109 |
myconf="${myconf} --with-mysqld-user=mysql" |
110 |
myconf="${myconf} --with-server" |
111 |
myconf="${myconf} --with-unix-socket-path=${EPREFIX}/var/run/mysqld/mysqld.sock" |
112 |
myconf="${myconf} --without-libwrap" |
113 |
|
114 |
if use static ; then |
115 |
myconf="${myconf} --with-mysqld-ldflags=-all-static" |
116 |
myconf="${myconf} --with-client-ldflags=-all-static" |
117 |
myconf="${myconf} --disable-shared --with-pic" |
118 |
else |
119 |
myconf="${myconf} --enable-shared --enable-static" |
120 |
fi |
121 |
|
122 |
if use debug ; then |
123 |
myconf="${myconf} --with-debug=full" |
124 |
else |
125 |
myconf="${myconf} --without-debug" |
126 |
if ( use cluster ); then |
127 |
myconf="${myconf} --without-ndb-debug" |
128 |
fi |
129 |
fi |
130 |
|
131 |
if [ -n "${MYSQL_DEFAULT_CHARSET}" -a -n "${MYSQL_DEFAULT_COLLATION}" ]; then |
132 |
ewarn "You are using a custom charset of ${MYSQL_DEFAULT_CHARSET}" |
133 |
ewarn "and a collation of ${MYSQL_DEFAULT_COLLATION}." |
134 |
ewarn "You MUST file bugs without these variables set." |
135 |
myconf="${myconf} --with-charset=${MYSQL_DEFAULT_CHARSET}" |
136 |
myconf="${myconf} --with-collation=${MYSQL_DEFAULT_COLLATION}" |
137 |
elif ! use latin1 ; then |
138 |
myconf="${myconf} --with-charset=utf8" |
139 |
myconf="${myconf} --with-collation=utf8_general_ci" |
140 |
else |
141 |
myconf="${myconf} --with-charset=latin1" |
142 |
myconf="${myconf} --with-collation=latin1_swedish_ci" |
143 |
fi |
144 |
|
145 |
if use embedded ; then |
146 |
myconf="${myconf} --with-embedded-privilege-control" |
147 |
myconf="${myconf} --with-embedded-server" |
148 |
else |
149 |
myconf="${myconf} --without-embedded-privilege-control" |
150 |
myconf="${myconf} --without-embedded-server" |
151 |
fi |
152 |
|
153 |
} |
154 |
|
155 |
# @FUNCTION: mysql-autotools_configure_51 |
156 |
# @DESCRIPTION: |
157 |
# Helper function to configure 5.1 and later builds |
158 |
mysql-autotools_configure_51() { |
159 |
|
160 |
# TODO: !!!! readd --without-readline |
161 |
# the failure depend upon config/ac-macros/readline.m4 checking into |
162 |
# readline.h instead of history.h |
163 |
myconf="${myconf} $(use_with ssl ssl "${EPREFIX}"/usr)" |
164 |
myconf="${myconf} --enable-assembler" |
165 |
myconf="${myconf} --with-geometry" |
166 |
myconf="${myconf} --with-readline" |
167 |
myconf="${myconf} --with-zlib-dir=${EPREFIX}/usr/" |
168 |
myconf="${myconf} --without-pstack" |
169 |
myconf="${myconf} --with-plugindir=${EPREFIX}/usr/$(get_libdir)/mysql/plugin" |
170 |
|
171 |
# This is an explict die here, because if we just forcibly disable it, then the |
172 |
# user's data is not accessible. |
173 |
use max-idx-128 && die "Bug #336027: upstream has a corruption issue with max-idx-128 presently" |
174 |
#use max-idx-128 && myconf="${myconf} --with-max-indexes=128" |
175 |
myconf="${myconf} $(use_enable community community-features)" |
176 |
if use community; then |
177 |
myconf="${myconf} $(use_enable profiling)" |
178 |
else |
179 |
myconf="${myconf} --disable-profiling" |
180 |
fi |
181 |
|
182 |
# Scan for all available plugins |
183 |
local plugins_avail="$( |
184 |
LANG=C \ |
185 |
find "${S}" \ |
186 |
\( \ |
187 |
-name 'plug.in' \ |
188 |
-o -iname 'configure.in' \ |
189 |
-o -iname 'configure.ac' \ |
190 |
\) \ |
191 |
-print0 \ |
192 |
| xargs -0 sed -r -n \ |
193 |
-e '/^MYSQL_STORAGE_ENGINE/{ |
194 |
s~MYSQL_STORAGE_ENGINE\([[:space:]]*\[?([-_a-z0-9]+)\]?.*,~\1 ~g ; |
195 |
s~^([^ ]+).*~\1~gp; |
196 |
}' \ |
197 |
| tr -s '\n' ' ' |
198 |
)" |
199 |
|
200 |
# 5.1 introduces a new way to manage storage engines (plugins) |
201 |
# like configuration=none |
202 |
# This base set are required, and will always be statically built. |
203 |
local plugins_sta="csv myisam myisammrg heap" |
204 |
local plugins_dyn="" |
205 |
local plugins_dis="example ibmdb2i" |
206 |
|
207 |
# These aren't actually required by the base set, but are really useful: |
208 |
plugins_sta="${plugins_sta} archive blackhole" |
209 |
|
210 |
# Now the extras |
211 |
if use extraengine ; then |
212 |
# like configuration=max-no-ndb, archive and example removed in 5.1.11 |
213 |
# not added yet: ibmdb2i |
214 |
# Not supporting as examples: example,daemon_example,ftexample |
215 |
plugins_sta="${plugins_sta} partition" |
216 |
|
217 |
if [[ "${PN}" != "mariadb" ]] ; then |
218 |
elog "Before using the Federated storage engine, please be sure to read" |
219 |
elog "http://dev.mysql.com/doc/refman/5.1/en/federated-limitations.html" |
220 |
plugins_dyn="${plugins_dyn} federated" |
221 |
else |
222 |
elog "MariaDB includes the FederatedX engine. Be sure to read" |
223 |
elog "http://askmonty.org/wiki/index.php/Manual:FederatedX_storage_engine" |
224 |
plugins_dyn="${plugins_dyn} federatedx" |
225 |
fi |
226 |
else |
227 |
plugins_dis="${plugins_dis} partition federated" |
228 |
fi |
229 |
|
230 |
# Upstream specifically requests that InnoDB always be built: |
231 |
# - innobase, innodb_plugin |
232 |
# Build falcon if available for 6.x series. |
233 |
for i in innobase falcon ; do |
234 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
235 |
done |
236 |
for i in innodb_plugin ; do |
237 |
[ -e "${S}"/storage/${i} ] && plugins_dyn="${plugins_dyn} ${i}" |
238 |
done |
239 |
|
240 |
# like configuration=max-no-ndb |
241 |
if ( use cluster ) ; then |
242 |
plugins_sta="${plugins_sta} ndbcluster partition" |
243 |
plugins_dis="${plugins_dis//partition}" |
244 |
myconf="${myconf} --with-ndb-binlog" |
245 |
else |
246 |
plugins_dis="${plugins_dis} ndbcluster" |
247 |
fi |
248 |
|
249 |
if [[ "${PN}" == "mariadb" ]] ; then |
250 |
# In MariaDB, InnoDB is packaged in the xtradb directory, so it's not |
251 |
# caught above. |
252 |
# This is not optional, without it several upstream testcases fail. |
253 |
# Also strongly recommended by upstream. |
254 |
if [[ "${PV}" < "5.2.0" ]] ; then |
255 |
myconf="${myconf} --with-maria-tmp-tables" |
256 |
plugins_sta="${plugins_sta} maria" |
257 |
else |
258 |
myconf="${myconf} --with-aria-tmp-tables" |
259 |
plugins_sta="${plugins_sta} aria" |
260 |
fi |
261 |
|
262 |
[ -e "${S}"/storage/innobase ] || [ -e "${S}"/storage/xtradb ] || |
263 |
die "The ${P} package doesn't provide innobase nor xtradb" |
264 |
|
265 |
for i in innobase xtradb ; do |
266 |
[ -e "${S}"/storage/${i} ] && plugins_sta="${plugins_sta} ${i}" |
267 |
done |
268 |
|
269 |
myconf="${myconf} $(use_with libevent)" |
270 |
|
271 |
if mysql_version_is_at_least "5.2" ; then |
272 |
for i in oqgraph ; do |
273 |
use ${i} \ |
274 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
275 |
|| plugins_dis="${plugins_dis} ${i}" |
276 |
done |
277 |
fi |
278 |
|
279 |
if mysql_version_is_at_least "5.2.5" ; then |
280 |
for i in sphinx ; do |
281 |
use ${i} \ |
282 |
&& plugins_dyn="${plugins_dyn} ${i}" \ |
283 |
|| plugins_dis="${plugins_dis} ${i}" |
284 |
done |
285 |
fi |
286 |
fi |
287 |
|
288 |
if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]]; then |
289 |
use pbxt \ |
290 |
&& plugins_sta="${plugins_sta} pbxt" \ |
291 |
|| plugins_dis="${plugins_dis} pbxt" |
292 |
fi |
293 |
|
294 |
use static && \ |
295 |
plugins_sta="${plugins_sta} ${plugins_dyn}" && \ |
296 |
plugins_dyn="" |
297 |
|
298 |
einfo "Available plugins: ${plugins_avail}" |
299 |
einfo "Dynamic plugins: ${plugins_dyn}" |
300 |
einfo "Static plugins: ${plugins_sta}" |
301 |
einfo "Disabled plugins: ${plugins_dis}" |
302 |
|
303 |
# These are the static plugins |
304 |
myconf="${myconf} --with-plugins=${plugins_sta// /,}" |
305 |
# And the disabled ones |
306 |
for i in ${plugins_dis} ; do |
307 |
myconf="${myconf} --without-plugin-${i}" |
308 |
done |
309 |
} |
310 |
|
311 |
pbxt_src_configure() { |
312 |
|
313 |
mysql_init_vars |
314 |
|
315 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
316 |
|
317 |
einfo "Reconfiguring dir '${PWD}'" |
318 |
eautoreconf |
319 |
|
320 |
local myconf="" |
321 |
myconf="${myconf} --with-mysql=${S} --libdir=${EPREFIX}/usr/$(get_libdir)" |
322 |
use debug && myconf="${myconf} --with-debug=full" |
323 |
econf ${myconf} || die "Problem configuring PBXT storage engine" |
324 |
} |
325 |
|
326 |
pbxt_src_compile() { |
327 |
|
328 |
# TODO: is it safe/needed to use emake here ? |
329 |
make || die "Problem making PBXT storage engine (${myconf})" |
330 |
|
331 |
popd |
332 |
# TODO: modify test suite for PBXT |
333 |
} |
334 |
|
335 |
pbxt_src_install() { |
336 |
|
337 |
pushd "${WORKDIR}/pbxt-${PBXT_VERSION}" &>/dev/null |
338 |
emake install DESTDIR="${D}" || die "Failed to install PBXT" |
339 |
popd |
340 |
} |
341 |
|
342 |
# |
343 |
# EBUILD FUNCTIONS |
344 |
# |
345 |
|
346 |
# @FUNCTION: mysql-autotools_src_prepare |
347 |
# @DESCRIPTION: |
348 |
# Apply patches to the source code and remove unneeded bundled libs. |
349 |
mysql-autotools_src_prepare() { |
350 |
|
351 |
cd "${S}" |
352 |
|
353 |
# Apply the patches for this MySQL version |
354 |
EPATCH_SUFFIX="patch" |
355 |
mkdir -p "${EPATCH_SOURCE}" || die "Unable to create epatch directory" |
356 |
# Clean out old items |
357 |
rm -f "${EPATCH_SOURCE}"/* |
358 |
# Now link in right patches |
359 |
mysql_mv_patches |
360 |
# And apply |
361 |
epatch |
362 |
|
363 |
# last -fPIC fixup, per bug #305873 |
364 |
i="${S}"/storage/innodb_plugin/plug.in |
365 |
[ -f "${i}" ] && sed -i -e '/CFLAGS/s,-prefer-non-pic,,g' "${i}" |
366 |
|
367 |
# Additional checks, remove bundled zlib |
368 |
rm -f "${S}/zlib/"*.[ch] |
369 |
sed -i -e "s/zlib\/Makefile dnl/dnl zlib\/Makefile/" "${S}/configure.in" |
370 |
rm -f "scripts/mysqlbug" |
371 |
|
372 |
# Make charsets install in the right place |
373 |
find . -name 'Makefile.am' \ |
374 |
-exec sed --in-place -e 's!$(pkgdatadir)!'${MY_SHAREDSTATEDIR}'!g' {} \; |
375 |
|
376 |
# Remove what needs to be recreated, so we're sure it's actually done |
377 |
einfo "Cleaning up old buildscript files" |
378 |
find . -name Makefile \ |
379 |
-o -name Makefile.in \ |
380 |
-o -name configure \ |
381 |
-exec rm -f {} \; |
382 |
rm -f "ltmain.sh" |
383 |
rm -f "scripts/mysqlbug" |
384 |
|
385 |
local rebuilddirlist d |
386 |
|
387 |
if xtradb_patch_available && use xtradb ; then |
388 |
einfo "Adding storage engine: Percona XtraDB (replacing InnoDB)" |
389 |
pushd "${S}"/storage >/dev/null |
390 |
i="innobase" |
391 |
o="${WORKDIR}/storage-${i}.mysql-upstream" |
392 |
# Have we been here already? |
393 |
[ -d "${o}" ] && rm -f "${i}" |
394 |
# Or maybe we haven't |
395 |
[ -d "${i}" -a ! -d "${o}" ] && mv "${i}" "${o}" |
396 |
cp -ral "${WORKDIR}/${XTRADB_P}" "${i}" |
397 |
popd >/dev/null |
398 |
fi |
399 |
|
400 |
if pbxt_available && [[ "${PBXT_NEWSTYLE}" == "1" ]] && use pbxt ; then |
401 |
einfo "Adding storage engine: PBXT" |
402 |
pushd "${S}"/storage >/dev/null |
403 |
i='pbxt' |
404 |
[ -d "${i}" ] && rm -rf "${i}" |
405 |
cp -ral "${WORKDIR}/${PBXT_P}" "${i}" |
406 |
popd >/dev/null |
407 |
fi |
408 |
|
409 |
rebuilddirlist="." |
410 |
# This does not seem to be needed presently. robbat2 2010/02/23 |
411 |
#einfo "Updating innobase cmake" |
412 |
## TODO: check this with a cmake expert |
413 |
#cmake \ |
414 |
# -DCMAKE_C_COMPILER=$(type -P $(tc-getCC)) \ |
415 |
# -DCMAKE_CXX_COMPILER=$(type -P $(tc-getCXX)) \ |
416 |
# "storage/innobase" |
417 |
|
418 |
for d in ${rebuilddirlist} ; do |
419 |
einfo "Reconfiguring dir '${d}'" |
420 |
pushd "${d}" &>/dev/null |
421 |
eautoreconf |
422 |
popd &>/dev/null |
423 |
done |
424 |
} |
425 |
|
426 |
# @FUNCTION: mysql-autotools_src_configure |
427 |
# @DESCRIPTION: |
428 |
# Configure mysql to build the code for Gentoo respecting the use flags. |
429 |
mysql-autotools_src_configure() { |
430 |
|
431 |
# Make sure the vars are correctly initialized |
432 |
mysql_init_vars |
433 |
|
434 |
# $myconf is modified by the configure_* functions |
435 |
local myconf="" |
436 |
|
437 |
if use minimal ; then |
438 |
mysql-autotools_configure_minimal |
439 |
else |
440 |
mysql-autotools_configure_common |
441 |
mysql-autotools_configure_51 |
442 |
fi |
443 |
|
444 |
# Bug #114895, bug #110149 |
445 |
filter-flags "-O" "-O[01]" |
446 |
|
447 |
# glib-2.3.2_pre fix, bug #16496 |
448 |
append-flags "-DHAVE_ERRNO_AS_DEFINE=1" |
449 |
|
450 |
# As discovered by bug #246652, doing a double-level of SSP causes NDB to |
451 |
# fail badly during cluster startup. |
452 |
if [[ $(gcc-major-version) -lt 4 ]]; then |
453 |
filter-flags "-fstack-protector-all" |
454 |
fi |
455 |
|
456 |
CXXFLAGS="${CXXFLAGS} -fno-exceptions -fno-strict-aliasing" |
457 |
CXXFLAGS="${CXXFLAGS} -felide-constructors -fno-rtti" |
458 |
mysql_version_is_at_least "5.0" \ |
459 |
&& CXXFLAGS="${CXXFLAGS} -fno-implicit-templates" |
460 |
export CXXFLAGS |
461 |
|
462 |
# bug #283926, with GCC4.4, this is required to get correct behavior. |
463 |
append-flags -fno-strict-aliasing |
464 |
|
465 |
# bug #335185, #335995, with >= GCC4.3.3 on x86 only, omit-frame-pointer |
466 |
# causes a mis-compile. |
467 |
# Upstream bugs: |
468 |
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38562 |
469 |
# http://bugs.mysql.com/bug.php?id=45205 |
470 |
use x86 && version_is_at_least "4.3.3" "$(gcc-fullversion)" && \ |
471 |
append-flags -fno-omit-frame-pointer && \ |
472 |
filter-flags -fomit-frame-pointer |
473 |
|
474 |
econf \ |
475 |
--libexecdir="${EPREFIX}/usr/sbin" \ |
476 |
--sysconfdir="${MY_SYSCONFDIR}" \ |
477 |
--localstatedir="${MY_LOCALSTATEDIR}" \ |
478 |
--sharedstatedir="${MY_SHAREDSTATEDIR}" \ |
479 |
--libdir="${MY_LIBDIR}" \ |
480 |
--includedir="${MY_INCLUDEDIR}" \ |
481 |
--with-low-memory \ |
482 |
--with-client-ldflags=-lstdc++ \ |
483 |
--enable-thread-safe-client \ |
484 |
--with-comment="Gentoo Linux ${PF}" \ |
485 |
--without-docs \ |
486 |
--with-LIBDIR="$(get_libdir)" \ |
487 |
${myconf} || die "econf failed" |
488 |
|
489 |
# TODO: Move this before autoreconf !!! |
490 |
find . -type f -name Makefile -print0 \ |
491 |
| xargs -0 -n100 sed -i \ |
492 |
-e 's|^pkglibdir *= *$(libdir)/mysql|pkglibdir = $(libdir)|;s|^pkgincludedir *= *$(includedir)/mysql|pkgincludedir = $(includedir)|' |
493 |
|
494 |
if [[ $EAPI == 2 ]] && [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
495 |
pbxt_patch_available && use pbxt && pbxt_src_configure |
496 |
fi |
497 |
} |
498 |
|
499 |
# @FUNCTION: mysql-autotools_src_compile |
500 |
# @DESCRIPTION: |
501 |
# Compile the mysql code. |
502 |
mysql-autotools_src_compile() { |
503 |
|
504 |
emake || die "emake failed" |
505 |
|
506 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
507 |
pbxt_patch_available && use pbxt && pbxt_src_compile |
508 |
fi |
509 |
} |
510 |
|
511 |
# @FUNCTION: mysql-autotools_src_install |
512 |
# @DESCRIPTION: |
513 |
# Install mysql. |
514 |
mysql-autotools_src_install() { |
515 |
|
516 |
# Make sure the vars are correctly initialized |
517 |
mysql_init_vars |
518 |
|
519 |
emake install \ |
520 |
DESTDIR="${D}" \ |
521 |
benchdir_root="${MY_SHAREDSTATEDIR}" \ |
522 |
testroot="${MY_SHAREDSTATEDIR}" \ |
523 |
|| die "emake install failed" |
524 |
|
525 |
if [[ "${PBXT_NEWSTYLE}" != "1" ]]; then |
526 |
pbxt_patch_available && use pbxt && pbxt_src_install |
527 |
fi |
528 |
|
529 |
# Convenience links |
530 |
einfo "Making Convenience links for mysqlcheck multi-call binary" |
531 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlanalyze" |
532 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqlrepair" |
533 |
dosym "/usr/bin/mysqlcheck" "/usr/bin/mysqloptimize" |
534 |
|
535 |
# Various junk (my-*.cnf moved elsewhere) |
536 |
einfo "Removing duplicate /usr/share/mysql files" |
537 |
rm -Rf "${ED}/usr/share/info" |
538 |
for removeme in "mysql-log-rotate" mysql.server* \ |
539 |
binary-configure* my-*.cnf mi_test_all* |
540 |
do |
541 |
rm -f "${D}"/${MY_SHAREDSTATEDIR}/${removeme} |
542 |
done |
543 |
|
544 |
# Clean up stuff for a minimal build |
545 |
if use minimal ; then |
546 |
einfo "Remove all extra content for minimal build" |
547 |
rm -Rf "${D}${MY_SHAREDSTATEDIR}"/{mysql-test,sql-bench} |
548 |
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} |
549 |
rm -f "${ED}/usr/sbin/mysqld" |
550 |
rm -f "${D}${MY_LIBDIR}"/lib{heap,merge,nisam,my{sys,strings,sqld,isammrg,isam},vio,dbug}.a |
551 |
fi |
552 |
|
553 |
# Unless they explicitly specific USE=test, then do not install the |
554 |
# testsuite. It DOES have a use to be installed, esp. when you want to do a |
555 |
# validation of your database configuration after tuning it. |
556 |
if use !test ; then |
557 |
rm -rf "${D}"/${MY_SHAREDSTATEDIR}/mysql-test |
558 |
fi |
559 |
|
560 |
# Configuration stuff |
561 |
case ${MYSQL_PV_MAJOR} in |
562 |
5.[1-9]|6*|7*) mysql_mycnf_version="5.1" ;; |
563 |
esac |
564 |
einfo "Building default my.cnf (${mysql_mycnf_version})" |
565 |
insinto "${MY_SYSCONFDIR#${EPREFIX}}" |
566 |
doins scripts/mysqlaccess.conf |
567 |
mycnf_src="my.cnf-${mysql_mycnf_version}" |
568 |
sed -e "s!@DATADIR@!${MY_DATADIR}!g" \ |
569 |
-e "s!/tmp!${EPREFIX}/tmp!" \ |
570 |
-e "s!/usr!${EPREFIX}/usr!" \ |
571 |
-e "s!= /var!= ${EPREFIX}/var!" \ |
572 |
"${FILESDIR}/${mycnf_src}" \ |
573 |
> "${TMPDIR}/my.cnf.ok" |
574 |
if use latin1 ; then |
575 |
sed -i \ |
576 |
-e "/character-set/s|utf8|latin1|g" \ |
577 |
"${TMPDIR}/my.cnf.ok" |
578 |
fi |
579 |
newins "${TMPDIR}/my.cnf.ok" my.cnf |
580 |
|
581 |
# Minimal builds don't have the MySQL server |
582 |
if ! use minimal ; then |
583 |
einfo "Creating initial directories" |
584 |
# Empty directories ... |
585 |
diropts "-m0750" |
586 |
if [[ "${PREVIOUS_DATADIR}" != "yes" ]] ; then |
587 |
dodir "${MY_DATADIR#${EPREFIX}}" |
588 |
keepdir "${MY_DATADIR#${EPREFIX}}" |
589 |
chown -R mysql:mysql "${D}/${MY_DATADIR}" |
590 |
fi |
591 |
|
592 |
diropts "-m0755" |
593 |
for folder in "${MY_LOGDIR#${EPREFIX}}" "/var/run/mysqld" ; do |
594 |
dodir "${folder}" |
595 |
keepdir "${folder}" |
596 |
chown -R mysql:mysql "${ED}/${folder}" |
597 |
done |
598 |
fi |
599 |
|
600 |
# Docs |
601 |
einfo "Installing docs" |
602 |
for i in README ChangeLog EXCEPTIONS-CLIENT INSTALL-SOURCE ; do |
603 |
[[ -f "$i" ]] && dodoc "$i" |
604 |
done |
605 |
doinfo "${S}"/Docs/mysql.info |
606 |
|
607 |
# Minimal builds don't have the MySQL server |
608 |
if ! use minimal ; then |
609 |
einfo "Including support files and sample configurations" |
610 |
docinto "support-files" |
611 |
for script in \ |
612 |
"${S}"/support-files/my-*.cnf \ |
613 |
"${S}"/support-files/magic \ |
614 |
"${S}"/support-files/ndb-config-2-node.ini |
615 |
do |
616 |
[[ -f "$script" ]] && dodoc "${script}" |
617 |
done |
618 |
|
619 |
docinto "scripts" |
620 |
for script in "${S}"/scripts/mysql* ; do |
621 |
[[ -f "$script" ]] && [[ "${script%.sh}" == "${script}" ]] && dodoc "${script}" |
622 |
done |
623 |
|
624 |
fi |
625 |
|
626 |
mysql_lib_symlinks "${ED}" |
627 |
} |