/[gentoo-x86]/eclass/mysql-autotools.eclass
Gentoo

Contents of /eclass/mysql-autotools.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (hide annotations) (download)
Mon Jan 28 02:13:05 2013 UTC (14 months, 2 weeks ago) by robbat2
Branch: MAIN
Changes since 1.13: +3 -1 lines
Sync mysql eclasses from gentoo-mysql tree. Fixes: PBXT nice (#374349), MariaDB desc (#453934), REQUIRED_USED (#441700).

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

  ViewVC Help
Powered by ViewVC 1.1.20